Compare commits

..

5 Commits

Author SHA1 Message Date
paoloricciuti
230b77027e fix: ignore changeset in prettier 2025-10-24 10:32:45 +02:00
paoloricciuti
2715b36f64 fix: ignore changeset 2025-10-24 10:31:04 +02:00
Paolo Ricciuti
73fea39550 Update changeset for support of $state.eager 2025-10-24 10:26:52 +02:00
baseballyama
88b462e366 feat: support: .eager 2025-10-24 17:19:15 +09:00
Tee Ming
e56159dda6 chore: add FUNDING.yml (#89) 2025-10-24 16:37:32 +09:00
16 changed files with 19 additions and 88 deletions

View File

@@ -0,0 +1,5 @@
---
"@sveltejs/mcp": patch
---
feat: support: `$state.eager`

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
open_collective: svelte

View File

@@ -11,4 +11,5 @@ bun.lockb
/**/.svelte-kit/*
# Claude Code
.claude/
.claude/
.changeset/

View File

@@ -65,7 +65,6 @@
"@sveltejs/mcp-schema": "workspace:^",
"@sveltejs/mcp-server": "workspace:^",
"@tmcp/transport-http": "^0.7.1",
"@vercel/analytics": "^1.5.0",
"tmcp": "^1.15.3"
}
}

View File

@@ -1,8 +1,6 @@
import { dev } from '$app/environment';
import { http_transport } from '$lib/mcp/index.js';
import { db } from '$lib/server/db/index.js';
import { redirect } from '@sveltejs/kit';
import { track } from '@vercel/analytics/server';
export async function handle({ event, resolve }) {
if (event.request.method === 'POST') {
@@ -21,12 +19,6 @@ export async function handle({ event, resolve }) {
}
const mcp_response = await http_transport.respond(event.request, {
db,
// only add analytics in production
track: dev
? undefined
: async (session_id, event, slug) => {
await track(event, { session_id, ...(slug ? { slug } : {}) });
},
});
// we are deploying on vercel the SSE connection will timeout after 5 minutes...for
// the moment we are not sending back any notifications (logs, or list changed notifications)

View File

@@ -1,6 +1,8 @@
import { createClient } from '@libsql/client';
import { drizzle } from 'drizzle-orm/libsql';
import * as schema from './schema.js';
// let's disable it for the moment...i can't figure out a way to make it wotk with eslint
// eslint-disable-next-line import/extensions
import { DATABASE_TOKEN, DATABASE_URL } from '$env/static/private';
if (!DATABASE_URL) throw new Error('DATABASE_URL is not set');
if (!DATABASE_TOKEN) throw new Error('DATABASE_TOKEN is not set');

View File

@@ -13,7 +13,7 @@ const gitignore_path = fileURLToPath(new URL('./.gitignore', import.meta.url));
export default /** @type {import("eslint").Linter.Config} */ ([
includeIgnoreFile(gitignore_path),
{
ignores: ['.claude/**/*'],
ignores: ['.claude/**/*', '.changeset/*'],
},
js.configs.recommended,
...ts.configs.recommended,
@@ -48,17 +48,13 @@ export default /** @type {import("eslint").Linter.Config} */ ([
'import/no-unresolved': 'off', // this doesn't work well with typescript path mapping
'import/extensions': [
'error',
'ignorePackages',
{
ignorePackages: true,
pattern: {
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
svg: 'always',
json: 'always',
},
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
},
],
},

View File

@@ -11,6 +11,7 @@ export const base_runes = [
export const nested_runes = [
'$state.raw',
'$state.snapshot',
'$state.eager',
'$effect.pre',
'$effect.tracking',
'$effect.pending',

View File

@@ -68,9 +68,6 @@ export function setup_svelte_task(server: SvelteMcp) {
icons,
},
async ({ task }) => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'svelte-task');
}
const available_docs = await format_sections_list();
return {

View File

@@ -46,13 +46,6 @@ export async function list_sections(server: SvelteMcp) {
icons,
},
async (uri, { slug }) => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(
server.ctx.sessionId,
'svelte-doc-section',
Array.isArray(slug) ? slug.join(',') : slug,
);
}
const section = sections.find((section) => {
return slug === section.slug;
});

View File

@@ -21,9 +21,6 @@ export function get_documentation(server: SvelteMcp) {
icons,
},
async ({ section }) => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'get-documentation');
}
let sections: string[];
if (Array.isArray(section)) {

View File

@@ -12,9 +12,6 @@ export function list_sections(server: SvelteMcp) {
icons,
},
async () => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'list-sections');
}
const formatted_sections = await format_sections_list();
return {

View File

@@ -59,9 +59,6 @@ export function playground_link(server: SvelteMcp) {
icons,
},
async ({ files, name, tailwind }) => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'playground-link');
}
const playground_base = new URL('https://svelte.dev/playground');
const playground_files: File[] = [];
@@ -79,9 +76,6 @@ export function playground_link(server: SvelteMcp) {
}
if (!has_app_svelte) {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'playground-link-no-app-svelte');
}
return {
isError: true,
content: [

View File

@@ -46,18 +46,12 @@ export function svelte_autofixer(server: SvelteMcp) {
filename: filename_or_path,
desired_svelte_version: desired_svelte_version_unchecked,
}) => {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'svelte-autofixer');
}
// we validate manually because some clients don't support union in the input schema (looking at you cursor)
const parsed_version = v.safeParse(
v.union([v.literal(4), v.literal(5), v.literal('4'), v.literal('5')]),
desired_svelte_version_unchecked,
);
if (parsed_version.success === false) {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'svelte-autofixer-wrong-version');
}
return {
isError: true,
content: [

View File

@@ -24,10 +24,7 @@ export const server = new McpServer(
instructions:
'This is the official Svelte MCP server. It MUST be used whenever svelte development is involved. It can provide official documentation, code examples and correct your code. After you correct the component call this tool again to confirm all the issues are fixed.',
},
).withContext<{
db: LibSQLDatabase<Schema>;
track?: (sessionId: string, event: string, slug?: string) => Promise<void>;
}>();
).withContext<{ db: LibSQLDatabase<Schema> }>();
export type SvelteMcp = typeof server;

35
pnpm-lock.yaml generated
View File

@@ -71,9 +71,6 @@ importers:
'@tmcp/transport-http':
specifier: ^0.7.1
version: 0.7.1(tmcp@1.15.3(typescript@5.9.2))
'@vercel/analytics':
specifier: ^1.5.0
version: 1.5.0(@sveltejs/kit@2.43.5(@sveltejs/vite-plugin-svelte@6.2.1(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)))(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)))(react@18.3.1)(svelte@5.39.6)
tmcp:
specifier: ^1.15.3
version: 1.15.3(typescript@5.9.2)
@@ -1688,32 +1685,6 @@ packages:
peerDependencies:
valibot: ^1.1.0
'@vercel/analytics@1.5.0':
resolution: {integrity: sha512-MYsBzfPki4gthY5HnYN7jgInhAZ7Ac1cYDoRWFomwGHWEX7odTEzbtg9kf/QSo7XEsEAqlQugA6gJ2WS2DEa3g==}
peerDependencies:
'@remix-run/react': ^2
'@sveltejs/kit': ^1 || ^2
next: '>= 13'
react: ^18 || ^19 || ^19.0.0-rc
svelte: '>= 4'
vue: ^3
vue-router: ^4
peerDependenciesMeta:
'@remix-run/react':
optional: true
'@sveltejs/kit':
optional: true
next:
optional: true
react:
optional: true
svelte:
optional: true
vue:
optional: true
vue-router:
optional: true
'@vercel/nft@0.30.1':
resolution: {integrity: sha512-2mgJZv4AYBFkD/nJ4QmiX5Ymxi+AisPLPcS/KPXVqniyQNqKXX+wjieAbDXQP3HcogfEbpHoRMs49Cd4pfkk8g==}
engines: {node: '>=18'}
@@ -5458,12 +5429,6 @@ snapshots:
dependencies:
valibot: 1.1.0(typescript@5.9.2)
'@vercel/analytics@1.5.0(@sveltejs/kit@2.43.5(@sveltejs/vite-plugin-svelte@6.2.1(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)))(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)))(react@18.3.1)(svelte@5.39.6)':
optionalDependencies:
'@sveltejs/kit': 2.43.5(@sveltejs/vite-plugin-svelte@6.2.1(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6)))(svelte@5.39.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6))
react: 18.3.1
svelte: 5.39.6
'@vercel/nft@0.30.1(rollup@4.52.2)':
dependencies:
'@mapbox/node-pre-gyp': 2.0.0