Compare commits

..

23 Commits

Author SHA1 Message Date
github-actions[bot]
e20cf2974d Version Packages (#100)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-03 10:37:26 +01:00
paoloricciuti
b2ee968a3f chore: update publisher 2025-12-03 10:36:46 +01:00
paoloricciuti
60297b3c49 fix: update server name on mcp registry 2025-12-03 10:34:39 +01:00
renovate[bot]
39076da8ce chore(deps): update dependency @eslint/compat to v2 (#111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-03 10:34:15 +01:00
renovate[bot]
fba733646a chore(deps): update all non-major dependencies (#112)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 10:02:16 +01:00
renovate[bot]
7fcd4705a5 chore(deps): update actions/checkout action to v6 (#114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 10:02:00 +01:00
renovate[bot]
af7d341ba5 chore(deps): update pnpm to v10.22.0 (#107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-13 15:29:04 +01:00
Lucas Terracino
52546551ff Update valid scope options in remote setup documentation for Gemini CLI (#108) 2025-11-12 23:01:54 +01:00
renovate[bot]
1f0a5f1519 chore(deps): update all non-major dependencies (#98)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
2025-11-11 12:39:11 +01:00
Scott Wu
0bf04bad2e docs: add reference to GEMINI.md and CLI change (#106) 2025-11-11 12:19:12 +01:00
Paolo Ricciuti
f001918925 chore: add initialize analytics event (#104) 2025-11-04 11:21:49 +01:00
paoloricciuti
67487c324a fix: remove log 2025-11-04 11:03:23 +01:00
jyc.dev
5beeef5543 moving to pnpm catalogs (#101) 2025-11-01 00:10:54 +01:00
Willow (GHOST)
e1a03fdb85 docs: update zed docs to use svelte-mcp extension (#102) 2025-10-31 17:11:46 +01:00
Paolo Ricciuti
384c1fd209 chore: update tmcp (#99) 2025-10-30 09:34:03 +01:00
renovate[bot]
b3027fd815 chore(deps): update dependency @anthropic-ai/sdk to ^0.68.0 (#97)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-29 08:27:08 +01:00
renovate[bot]
849bf2ad49 chore(deps): update dependency node to v24 (#95)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 19:11:08 +01:00
renovate[bot]
314538c8e7 chore(deps): update pnpm to v10.20.0 (#96)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 19:05:19 +01:00
github-actions[bot]
a9994310c0 Version Packages (#92)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-25 17:07:07 +02:00
Paolo Ricciuti
9fb1a403b7 fix: add async parameter to svelte-autofixer (#94) 2025-10-25 17:04:15 +02:00
github-actions[bot]
3c7b5033a4 docs: update prompt documentation (#93)
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2025-10-24 23:12:06 +02:00
Paolo Ricciuti
b911a00bb7 feat: analytics (#88) 2025-10-24 23:06:58 +02:00
paoloricciuti
f6ce89ff34 fix: install latest eslint svelte packages to support $state.eager 2025-10-24 21:02:25 +02:00
36 changed files with 970 additions and 514 deletions

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.19.0
version: 10.24.0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.19.0
version: 10.24.0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Publish to MCP Registry
working-directory: packages/mcp-stdio
@@ -21,11 +21,11 @@ jobs:
MCP_KEY: ${{ secrets.MCP_KEY }}
run: |
NAME=mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz
# Download MCP Publisher pinned to v1.3.3 using latest https for security and save it to a file named mcp-publisher.tar.gz
curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fL "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/$NAME" -O
# Download MCP Publisher pinned to v1.3.10 using latest https for security and save it to a file named mcp-publisher.tar.gz
curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fL "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.10/$NAME" -O
# Verify the SHA256 checksum of the downloaded file
sha256sum --ignore-missing -c ./checksums/registry_1.3.3_checksums.txt
sha256sum --ignore-missing -c ./checksums/registry_1.3.10_checksums.txt
# Extract the tarball
mkdir tmp

View File

@@ -25,7 +25,7 @@ jobs:
os: [ubuntu-latest]
steps:
- name: checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.19.0
version: 10.24.0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0

View File

@@ -37,34 +37,35 @@
],
"private": true,
"devDependencies": {
"@eslint/compat": "^1.3.2",
"@eslint/js": "^9.36.0",
"@libsql/client": "^0.15.0",
"@modelcontextprotocol/inspector": "^0.17.0",
"@sveltejs/adapter-vercel": "^6.0.0",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@types/node": "^24.3.1",
"@typescript-eslint/parser": "^8.44.0",
"drizzle-kit": "^0.31.0",
"drizzle-orm": "^0.44.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.12.3",
"globals": "^16.0.0",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"svelte-eslint-parser": "^1.3.2",
"typescript": "^5.0.0",
"vite": "^7.0.4",
"vite-plugin-devtools-json": "^1.0.0",
"vitest": "^4.0.0"
"@eslint/compat": "catalog:lint",
"@eslint/js": "catalog:lint",
"@libsql/client": "catalog:orm",
"@modelcontextprotocol/inspector": "catalog:ai",
"@sveltejs/adapter-vercel": "catalog:svelte",
"@sveltejs/kit": "catalog:svelte",
"@sveltejs/vite-plugin-svelte": "catalog:svelte",
"@types/node": "catalog:tooling",
"@typescript-eslint/parser": "catalog:lint",
"drizzle-kit": "catalog:orm",
"drizzle-orm": "catalog:orm",
"eslint-config-prettier": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"globals": "catalog:lint",
"prettier": "catalog:lint",
"prettier-plugin-svelte": "catalog:lint",
"svelte": "catalog:svelte",
"svelte-check": "catalog:svelte",
"svelte-eslint-parser": "catalog:lint",
"typescript": "catalog:tooling",
"vite": "catalog:tooling",
"vite-plugin-devtools-json": "catalog:tooling",
"vitest": "catalog:tooling"
},
"dependencies": {
"@sveltejs/mcp-schema": "workspace:^",
"@sveltejs/mcp-server": "workspace:^",
"@tmcp/transport-http": "^0.7.1",
"tmcp": "^1.15.3"
"@tmcp/transport-http": "catalog:tmcp",
"@vercel/analytics": "catalog:tooling",
"tmcp": "catalog:tmcp"
}
}

View File

@@ -1,11 +1,10 @@
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') {
console.log(await event.request.clone().text());
}
if (event.request.method === 'GET') {
const accept = event.request.headers.get('accept');
if (accept) {
@@ -19,6 +18,12 @@ 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, extra) => {
await track(event, { session_id, ...(extra ? { extra } : {}) });
},
});
// 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,8 +1,6 @@
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,9 @@ The setup varies based on the version of the MCP you prefer — remote or local
## Usage
To get the most out of the MCP server we recommend including the following prompt in your [`AGENTS.md`](https://agents.md) (or [`CLAUDE.md`](https://docs.claude.com/en/docs/claude-code/memory#claude-md-imports), if using Claude Code). This will tell the LLM which tools are available and when it's appropriate to use them.
To get the most out of the MCP server we recommend including the following prompt in your [`AGENTS.md`](https://agents.md) (or [`CLAUDE.md`](https://docs.claude.com/en/docs/claude-code/memory#claude-md-imports), if using Claude Code. Or [`GEMINI.md`](https://geminicli.com/docs/cli/gemini-md/), if using GEMINI). This will tell the LLM which tools are available and when it's appropriate to use them.
> [!NOTE] This is already setup for you when using `npx sv add mcp`
```md
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:

View File

@@ -110,6 +110,12 @@ It will open a file with your MCP servers where you can add the following config
## Zed
Install the [Svelte MCP Server extension](https://zed.dev/extensions/svelte-mcp).
<details>
<summary>Configure Manually</summary>
- Open the command palette
- Search and select "agent:open settings"
- In settings panel look for `Model Context Protocol (MCP) Servers`
@@ -127,6 +133,8 @@ It will open a popup with MCP server config where you can add the following conf
}
```
</details>
## Other clients
If we didn't include the MCP client you are using, refer to their documentation for `stdio` servers and use `npx` as the command and `-y @sveltejs/mcp` as the arguments.

View File

@@ -42,7 +42,7 @@ To use the remote MCP server with Gemini CLI, simply run the following command:
gemini mcp add -t http -s [scope] svelte https://mcp.svelte.dev/mcp
```
The `[scope]` must be `user`, `project` or `local`.
The `[scope]` must be `user` or `project`.
## OpenCode

View File

@@ -25,6 +25,7 @@ You are a Svelte expert tasked to build components and utilities for Svelte deve
- title: drizzle, use_cases: database setup, sql queries, orm integration, data modeling, postgresql, mysql, sqlite, server-side data access, database migrations, type-safe queries, path: cli/drizzle
- title: eslint, use_cases: code quality, linting, error detection, project setup, code standards, team collaboration, typescript projects, path: cli/eslint
- title: lucia, use_cases: authentication, login systems, user management, registration pages, session handling, auth setup, path: cli/lucia
- title: mcp, use_cases: use title and path to estimate use case, path: cli/mcp
- title: mdsvex, use_cases: blog, content sites, markdown rendering, documentation sites, technical writing, cms integration, article pages, path: cli/mdsvex
- title: paraglide, use_cases: internationalization, multi-language sites, i18n, translation, localization, language switching, global apps, multilingual content, path: cli/paraglide
- title: playwright, use_cases: browser testing, e2e testing, integration testing, test automation, quality assurance, ci/cd pipelines, testing user flows, path: cli/playwright

View File

@@ -7,13 +7,20 @@ import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './apps/mcp-remote/svelte.config.js';
import eslint_plugin_import from 'eslint-plugin-import';
import { configs as pnpm } from 'eslint-plugin-pnpm';
const gitignore_path = fileURLToPath(new URL('./.gitignore', import.meta.url));
export default /** @type {import("eslint").Linter.Config} */ ([
includeIgnoreFile(gitignore_path),
{
ignores: ['.claude/**/*', '.changeset/*'],
ignores: [
'.claude/**/*',
'.changeset/*',
'.github/**/*.yml',
'.github/**/*.yaml',
'**/pnpm-lock.yaml',
],
},
js.configs.recommended,
...ts.configs.recommended,
@@ -48,13 +55,17 @@ export default /** @type {import("eslint").Linter.Config} */ ([
'import/no-unresolved': 'off', // this doesn't work well with typescript path mapping
'import/extensions': [
'error',
'ignorePackages',
{
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
ignorePackages: true,
pattern: {
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
svg: 'always',
json: 'always',
},
},
],
},
@@ -70,4 +81,16 @@ export default /** @type {import("eslint").Linter.Config} */ ([
},
},
},
{
name: 'pnpm/exclude-some-rules',
files: ['**/*.json', '**/*.yaml', '**/*.yml', 'pnpm-workspace.yaml'],
rules: {
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'func-style': 'off',
},
},
...pnpm.json,
...pnpm.yaml,
]);

View File

@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"packageManager": "pnpm@10.19.0",
"packageManager": "pnpm@10.24.0",
"scripts": {
"build": "pnpm -r run build",
"dev": "pnpm --filter @sveltejs/mcp-remote run dev",
@@ -12,6 +12,8 @@
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "prettier --write . && eslint . --fix",
"lint:inspect": "pnpm dlx @eslint/config-inspector",
"node:inspect": "pnpm dlx node-modules-inspector",
"test:unit": "vitest",
"test": "npm run test:unit -- --run",
"test:watch": "npm run test:unit -- --watch",
@@ -30,27 +32,24 @@
],
"private": true,
"devDependencies": {
"@changesets/cli": "^2.29.7",
"@eslint/compat": "^1.3.2",
"@eslint/js": "^9.36.0",
"@modelcontextprotocol/inspector": "^0.17.0",
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-svelte": "^3.12.3",
"globals": "^16.0.0",
"node-resolve-ts": "^1.0.2",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"publint": "^0.3.13",
"typescript": "^5.0.0",
"typescript-eslint": "^8.44.1",
"vitest": "^4.0.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
"@changesets/cli": "catalog:tooling",
"@eslint/compat": "catalog:lint",
"@eslint/js": "catalog:lint",
"@modelcontextprotocol/inspector": "catalog:ai",
"@sveltejs/adapter-vercel": "catalog:svelte",
"@svitejs/changesets-changelog-github-compact": "catalog:tooling",
"eslint": "catalog:lint",
"eslint-config-prettier": "catalog:lint",
"eslint-plugin-import": "catalog:lint",
"eslint-plugin-pnpm": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"globals": "catalog:lint",
"node-resolve-ts": "catalog:tooling",
"prettier": "catalog:lint",
"prettier-plugin-svelte": "catalog:lint",
"publint": "catalog:tooling",
"typescript": "catalog:tooling",
"typescript-eslint": "catalog:lint",
"vitest": "catalog:tooling"
}
}

View File

@@ -14,6 +14,6 @@
"license": "ISC",
"type": "module",
"dependencies": {
"drizzle-orm": "^0.44.0"
"drizzle-orm": "catalog:orm"
}
}

View File

@@ -20,27 +20,27 @@
"drizzle-orm": "^0.44.0"
},
"dependencies": {
"@mcp-ui/server": "^5.12.0",
"@mcp-ui/server": "catalog:ai",
"@sveltejs/mcp-schema": "workspace:^",
"@tmcp/adapter-valibot": "^0.1.4",
"@typescript-eslint/parser": "^8.44.0",
"eslint": "^9.36.0",
"eslint-plugin-svelte": "^3.12.3",
"svelte": "^5.39.2",
"svelte-eslint-parser": "^1.3.2",
"tmcp": "^1.15.3",
"ts-blank-space": "^0.6.2",
"typescript-eslint": "^8.44.0",
"valibot": "^1.1.0",
"vitest": "^4.0.0",
"zimmerframe": "^1.1.4"
"@tmcp/adapter-valibot": "catalog:tmcp",
"@typescript-eslint/parser": "catalog:lint",
"eslint": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"svelte": "catalog:svelte",
"svelte-eslint-parser": "catalog:lint",
"tmcp": "catalog:tmcp",
"ts-blank-space": "catalog:tooling",
"typescript-eslint": "catalog:lint",
"valibot": "catalog:tooling",
"vitest": "catalog:tooling",
"zimmerframe": "catalog:tooling"
},
"devDependencies": {
"@anthropic-ai/sdk": "^0.67.0",
"@sveltejs/kit": "^2.42.2",
"@types/eslint-scope": "^8.3.2",
"@types/estree": "^1.0.8",
"@typescript-eslint/types": "^8.44.0",
"dotenv": "^17.2.3"
"@anthropic-ai/sdk": "catalog:ai",
"@sveltejs/kit": "catalog:svelte",
"@types/eslint-scope": "catalog:lint",
"@types/estree": "catalog:tooling",
"@typescript-eslint/types": "catalog:lint",
"dotenv": "catalog:tooling"
}
}

View File

@@ -8,6 +8,7 @@ export function add_autofixers_issues(
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
const parsed = parse(code, filename);
@@ -15,7 +16,7 @@ export function add_autofixers_issues(
for (const autofixer of Object.values(autofixers)) {
walk(
parsed.ast as unknown as Node,
{ output: content, parsed, desired_svelte_version },
{ output: content, parsed, desired_svelte_version, async },
autofixer,
);
}

View File

@@ -7,6 +7,7 @@ export function add_compile_issues(
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
let compile = compile_component;
const extension = extname(filename);
@@ -27,6 +28,7 @@ export function add_compile_issues(
filename: filename || 'Component.svelte',
generate: false,
runes: desired_svelte_version >= 5,
experimental: { async },
});
for (const warning of compilation_result.warnings) {

View File

@@ -51,7 +51,7 @@ function base_config(svelte_config: Config): ESLint.Options['baseConfig'] {
];
}
function get_linter(version: number) {
function get_linter(version: number, async = false) {
if (version < 5) {
return (svelte_4_linter ??= new ESLint({
overrideConfigFile: true,
@@ -67,6 +67,7 @@ function get_linter(version: number) {
baseConfig: base_config({
compilerOptions: {
runes: true,
experimental: { async },
},
}),
}));
@@ -77,8 +78,9 @@ export async function add_eslint_issues(
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
const eslint = get_linter(desired_svelte_version);
const eslint = get_linter(desired_svelte_version, async);
const results = await eslint.lintText(code, { filePath: filename || './Component.svelte' });
for (const message of results[0]?.messages ?? []) {

View File

@@ -7,6 +7,7 @@ export type AutofixerState = {
output: { issues: string[]; suggestions: string[] };
parsed: ParseResult;
desired_svelte_version: number;
async?: boolean;
};
export type Autofixer = Visitors<Node | AST.SvelteNode, AutofixerState>;

View File

@@ -68,6 +68,9 @@ 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,6 +46,13 @@ 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,6 +21,9 @@ 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,6 +12,9 @@ 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,6 +59,9 @@ 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[] = [];
@@ -76,6 +79,9 @@ 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

@@ -8,7 +8,12 @@ function request<const T>(request: T) {
return request;
}
async function autofixer_tool_call(code: string, is_error = false, desired_svelte_version = 5) {
async function autofixer_tool_call(
code: string,
is_error = false,
desired_svelte_version = 5,
async = false,
) {
const result = await server.receive({
jsonrpc: '2.0',
id: 2,
@@ -19,6 +24,7 @@ async function autofixer_tool_call(code: string, is_error = false, desired_svelt
code,
desired_svelte_version,
filename: 'App.svelte',
async,
},
},
});
@@ -65,6 +71,61 @@ describe('svelte-autofixer tool', () => {
);
});
it('should error out if async is true with a version less than 5', async () => {
const content = await autofixer_tool_call(
`<script>
$state count = 0;
</script>`,
true,
4,
true,
);
expect(content.isError).toBeTruthy();
expect(content.content[0]).toBeDefined();
expect(content.content[0].text).toBe(
'The async option can only be used with Svelte version 5 or higher.',
);
});
it('should not add suggestion/issues if async is true and await is used in the template/derived', async () => {
const content = await autofixer_tool_call(
`<script>
import { slow_double } from './utils.js';
let count = $state(0);
let double = $derived(await slow_double(count));
</script>
{double}
{await slow_double(count)}`,
false,
5,
true,
);
expect(content.issues).toHaveLength(0);
expect(content.suggestions).toHaveLength(0);
expect(content.require_another_tool_call_after_fixing).toBeFalsy();
});
it('should add suggestion/issues if async is false and await is used in the template/derived', async () => {
const content = await autofixer_tool_call(
`<script>
import { slow_double } from './utils.js';
let count = $state(0);
let double = $derived(await slow_double(count));
</script>
{double}
{await slow_double(count)}`,
false,
5,
);
expect(content.issues.length).toBeGreaterThanOrEqual(1);
expect(content.issues).toEqual(
expect.arrayContaining([expect.stringContaining('experimental_async')]),
);
expect(content.require_another_tool_call_after_fixing).toBeTruthy();
});
it('should add suggestions for css invalid identifier', async () => {
const content = await autofixer_tool_call(`<script>
let my_color = $state('red');

View File

@@ -21,6 +21,12 @@ export function svelte_autofixer(server: SvelteMcp) {
'The desired svelte version...if possible read this from the package.json of the user project, otherwise use some hint from the wording (if the user asks for runes it wants version 5). Default to 5 in case of doubt.',
),
),
async: v.pipe(
v.optional(v.boolean()),
v.description(
'If true the code is an async component/module and might use await in the markup or top-level awaits in the script tag. If possible check the svelte.config.js/svelte.config.ts to check if the option is enabled otherwise asks the user if they prefer using it or not. You can only use this option if the version is 5.',
),
),
filename: v.pipe(
v.optional(v.string()),
v.description(
@@ -45,13 +51,20 @@ export function svelte_autofixer(server: SvelteMcp) {
code,
filename: filename_or_path,
desired_svelte_version: desired_svelte_version_unchecked,
async,
}) => {
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: [
@@ -65,6 +78,18 @@ export function svelte_autofixer(server: SvelteMcp) {
const desired_svelte_version = parsed_version.output;
if (async && +desired_svelte_version < 5) {
return {
isError: true,
content: [
{
type: 'text',
text: `The async option can only be used with Svelte version 5 or higher.`,
},
],
};
}
const content: {
issues: string[];
suggestions: string[];
@@ -76,11 +101,11 @@ export function svelte_autofixer(server: SvelteMcp) {
const filename = filename_or_path ? basename(filename_or_path) : 'Component.svelte';
add_compile_issues(content, code, +desired_svelte_version, filename);
add_compile_issues(content, code, +desired_svelte_version, filename, async);
add_autofixers_issues(content, code, +desired_svelte_version, filename);
add_autofixers_issues(content, code, +desired_svelte_version, filename, async);
await add_eslint_issues(content, code, +desired_svelte_version, filename);
await add_eslint_issues(content, code, +desired_svelte_version, filename, async);
} catch (e: unknown) {
const error = e as Error & { start?: { line: number; column: number } };
content.issues.push(

View File

@@ -24,10 +24,18 @@ 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> }>();
).withContext<{
db: LibSQLDatabase<Schema>;
track?: (sessionId: string, event: string, extra?: string) => Promise<void>;
}>();
export type SvelteMcp = typeof server;
setup_tools(server);
setup_resources(server);
setup_prompts(server);
server.on('initialize', async ({ clientInfo: client_info }) => {
if (!server.ctx.custom?.track || !server.ctx.sessionId) return;
server.ctx.custom.track(server.ctx.sessionId, 'initialize', client_info.name);
});

View File

@@ -1,5 +1,21 @@
# @sveltejs/mcp
## 0.1.12
### Patch Changes
- fix: update server name on mcp registry ([`60297b3`](https://github.com/sveltejs/mcp/commit/60297b3c49bf110b48908e61b5d5d902ea1bdf39))
- chore: update tmcp ([#99](https://github.com/sveltejs/mcp/pull/99))
## 0.1.11
### Patch Changes
- fix: add `async` parameter to `svelte-autofixer` ([#94](https://github.com/sveltejs/mcp/pull/94))
- fix: install latest eslint svelte packages to support `$state.eager` ([`f6ce89f`](https://github.com/sveltejs/mcp/commit/f6ce89ff34faabc3d746a350ea347298ecfed2ec))
## 0.1.10
### Patch Changes

View File

@@ -0,0 +1,25 @@
aada17479e04faa55e380ae1ee0de3c5a5d86b4c0ad5dd4b64f68426f87c84e0 mcp-publisher_darwin_amd64.tar.gz
d426c953218a61699bb47d1dae6f0b89807313f082d650f243b8a91bc7f448f3 mcp-publisher_darwin_amd64.tar.gz.sbom.json
75a14ff2570bca0eba656dee1d4ad4b2955de67e97aacc5884bcab1793d8dd2d mcp-publisher_darwin_arm64.tar.gz
988adc169f9ce4cded2b08ab0df7c1738f8ea77dccb581a234f7e036ad7b478e mcp-publisher_darwin_arm64.tar.gz.sbom.json
dc97c003df75d40134b9bf003077ac9057187d64f8d601c4f2457980712dbb62 mcp-publisher_linux_amd64.tar.gz
49e63cd1c1ade8988f6c6f679b3172ab28b5ae6ef92243a4f8a78c58150853c7 mcp-publisher_linux_amd64.tar.gz.sbom.json
094e70c73ff671da69b138b448c68336f582e9245355d469c8372a48639bbc6c mcp-publisher_linux_arm64.tar.gz
3888ef7db7a77efeb3cfb711527a00ed93188ff3fce05468a6308ae75e2bb913 mcp-publisher_linux_arm64.tar.gz.sbom.json
43a1f3ca680350dd898697c93e4e0a1489c2b638dc946c4ef496a815c0e46d53 mcp-publisher_windows_amd64.tar.gz
512ac8c24275845bcc9c4c4faf4f08d950de3585e13d283e1aa48c567735ad73 mcp-publisher_windows_amd64.tar.gz.sbom.json
739347d69d4979faf06365843c49ede92e16975cd1afe3ef627e9511459fa30b mcp-publisher_windows_arm64.tar.gz
b8ecb1cf98caef446447a1ad89f7259699632f09bd19d600c89fd800aa3c7698 mcp-publisher_windows_arm64.tar.gz.sbom.json
5b4d676da2a574ee0d3cfd752d9d3a663e675d48d928706dda0084271ded1cb5 registry-1.3.10.tar.gz
d5140c2730991dfc236305d3e6eddb6c05da9325d9803b1eaee50c06953d5991 registry_darwin_amd64.tar.gz
fd1380e0d308a1702d040427603d203a9407603e1156cd23743a3074e1313b06 registry_darwin_amd64.tar.gz.sbom.json
db22e6b0f518b1ccaf44f749babc28d70d2573ba5641b06ff085430826eac688 registry_darwin_arm64.tar.gz
4415141c7b490b1c7d9643e799df5a2885f3292b4c1c3e4c71f2841aae52fdeb registry_darwin_arm64.tar.gz.sbom.json
8fbb607254b412513eeec45c89fb3051fe9ce623196f6361ded1d335a5348566 registry_linux_amd64.tar.gz
c256554e7060cbfc92494f9b22c4e857b0606ca57479a29fa61649917c63c974 registry_linux_amd64.tar.gz.sbom.json
86ff45f0c5afc674e9b30ec47815ab54401d716b12d70f27bd73f72d5b5ad2f8 registry_linux_arm64.tar.gz
0ccb7a3d856a7951bea5d5e63314459b365199577f573c2fbcd11e7e98b9b94c registry_linux_arm64.tar.gz.sbom.json
f56d75a2569e6e37f44d8f7bede0bd01f8056130f8eab58b1211d55d43fa08fe registry_windows_amd64.tar.gz
d941a82dd69937edff791b4f84b61006d78802280fb0c06d15c07a5d90d6e0a0 registry_windows_amd64.tar.gz.sbom.json
b2e6fff3cd9bab76d4431294b2844e1e9a399d45728e5459492b21367da62453 registry_windows_arm64.tar.gz
1954a54f47048e1ac25c92196440f0c2b1ba2357e01720d5b14e6faf43be46b2 registry_windows_arm64.tar.gz.sbom.json

View File

@@ -1,25 +0,0 @@
704f15b3ccba80990fbaaeb858e2e893120dea3ebb9340e04a36065987e089c5 mcp-publisher_darwin_amd64.tar.gz
9eadadeb80998cd5b29e009dd3959634730d3754b9e201c0a3bb39dd6ae85933 mcp-publisher_darwin_amd64.tar.gz.sbom.json
f80265eadc6b052d2885a7dfa47a1ecc7ca95926c143197ced747317793dcc11 mcp-publisher_darwin_arm64.tar.gz
f063c462512eed8f2ce9610a6a125534cb552060ddb5364d8d49b32196416fbe mcp-publisher_darwin_arm64.tar.gz.sbom.json
1113b9d6bf59b000966c4f17752cf87b51db03dcc5482721421fd843ce3bf048 mcp-publisher_linux_amd64.tar.gz
d3e46855b3b906aa84571b0d16384ad6074fd08709108a47d724908e91947b9d mcp-publisher_linux_amd64.tar.gz.sbom.json
34be13ec07490ab1250194d56820af222b49b85db6062ff848d33f9cf6eb41ce mcp-publisher_linux_arm64.tar.gz
a1ff3c26d53007c98301b747f97e5e241bfdb860b6a761db8627c9ba9ba71d88 mcp-publisher_linux_arm64.tar.gz.sbom.json
9ba8b538744652c4837d08b7b83ae85d2dbea98c897cfcf4d90835df4fe075b3 mcp-publisher_windows_amd64.tar.gz
924a0adcebd9360aed4ee5959e664e4e99b8259ed871ac91be5ace5657afba7d mcp-publisher_windows_amd64.tar.gz.sbom.json
a3eeab18ee6fd1d76d7ec153779ebe1bb404d7ea561f117781174e4396d90565 mcp-publisher_windows_arm64.tar.gz
9351f3acc39f89402ce5f72be1b45f3bf1b16f8441c97496195188f276e6c227 mcp-publisher_windows_arm64.tar.gz.sbom.json
9767b6f2afe1b60c597d4c66468d491be3466b25de8b4d4e7a21e61950856ef7 registry-1.3.3.tar.gz
a7867ff2c15905a765dc77636d86241ea04a17d0a90f086913a3cea4fe899213 registry_darwin_amd64.tar.gz
f0ed44b6ebdfcba40daefe7ca556f385de0cbae95dca3077c406f75cdb6abb9b registry_darwin_amd64.tar.gz.sbom.json
b4d93d6fc2d831d287cde79953822b434cb8406eea4f38f180628df227f6569e registry_darwin_arm64.tar.gz
dde0ed7f350eda98eb6f474d19aa0e4c717dd9f120609949acf05d7986cf6fcc registry_darwin_arm64.tar.gz.sbom.json
6772a573828f3482a192c88dac4223ee71ff4f521c8819480a194757e46a8272 registry_linux_amd64.tar.gz
ac177354d5f43f86bdf7f36738837a2792ba136198209eb61d4d4dd9ab408853 registry_linux_amd64.tar.gz.sbom.json
61c1fb9126977e0694d5aad8990a9d4c2d0e933e6aa469789559fad3865e8b7f registry_linux_arm64.tar.gz
9b81dfe2c81c49f7731072b8c217f05d609f7094ea94aaf9491f33880f2dec7f registry_linux_arm64.tar.gz.sbom.json
7fb5752de50a841614c6990f20807820bda33a72eaf7be51ae6cbd4e9acb2b87 registry_windows_amd64.tar.gz
fd44139231d4725c75b2a5a96fb670d3137f628db91c8281f6348e842792d514 registry_windows_amd64.tar.gz.sbom.json
a85ba7eb1a06a9e668b8a2097e00ab010e454a2afeb4e29ebeb7b702a31cccd3 registry_windows_arm64.tar.gz
93503683d32a2971b741e87f2879cb2a3f41acd184c618e04d17a98926915f2d registry_windows_arm64.tar.gz.sbom.json

View File

@@ -1,15 +1,15 @@
{
"name": "@sveltejs/mcp",
"version": "0.1.10",
"version": "0.1.12",
"type": "module",
"license": "MIT",
"mcpName": "dev.svelte/mcp",
"mcpName": "dev.svelte/svelte",
"homepage": "https://github.com/sveltejs/mcp#readme",
"bugs": {
"url": "https://github.com/sveltejs/mcp/issues"
},
"bin": {
"svelte-mcp": "./dist/index.js"
"svelte-mcp": "./dist/index.mjs"
},
"repository": {
"type": "git",
@@ -32,15 +32,15 @@
},
"devDependencies": {
"@sveltejs/mcp-server": "workspace:^",
"@tmcp/transport-stdio": "^0.3.1",
"@types/node": "^22.15.17",
"publint": "^0.3.13",
"tsdown": "^0.15.0",
"typescript": "^5.8.3",
"vitest": "^4.0.0"
"@tmcp/transport-stdio": "catalog:tmcp",
"@types/node": "catalog:tooling",
"publint": "catalog:tooling",
"tsdown": "catalog:tooling",
"typescript": "catalog:tooling",
"vitest": "catalog:tooling"
},
"dependencies": {
"eslint": "^9.36.0",
"tmcp": "^1.15.3"
"eslint": "catalog:lint",
"tmcp": "catalog:tmcp"
}
}

View File

@@ -1,6 +1,6 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
"name": "dev.svelte/mcp",
"name": "dev.svelte/svelte",
"description": "The official Svelte MCP server providing docs and autofixing tools for Svelte development",
"repository": {
"id": "1054419133",
@@ -8,7 +8,7 @@
"subfolder": "packages/mcp-stdio",
"source": "github"
},
"version": "0.1.10",
"version": "0.1.12",
"websiteUrl": "https://svelte.dev/docs/mcp/overview",
"icons": [
{
@@ -24,7 +24,7 @@
{
"registryType": "npm",
"identifier": "@sveltejs/mcp",
"version": "0.1.10",
"version": "0.1.12",
"runtimeHint": "npx",
"transport": {
"type": "stdio"

962
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,3 +3,62 @@ packages:
- './apps/*'
useNodeVersion: 22.19.0
catalogs:
tmcp:
tmcp: '^1.16.0'
'@tmcp/transport-http': '^0.8.0'
'@tmcp/transport-stdio': '^0.4.0'
'@tmcp/adapter-valibot': '^0.1.4'
ai:
'@anthropic-ai/sdk': ^0.71.0
'@mcp-ui/server': ^5.12.0
'@modelcontextprotocol/inspector': ^0.17.0
lint:
eslint: ^9.36.0
'@types/eslint-scope': ^8.3.2
'@eslint/compat': ^2.0.0
'@eslint/js': ^9.36.0
'@typescript-eslint/parser': ^8.44.0
'@typescript-eslint/types': ^8.44.0
eslint-config-prettier: ^10.0.1
eslint-plugin-import: ^2.32.0
eslint-plugin-svelte: ^3.12.5
svelte-eslint-parser: ^1.4.0
eslint-plugin-pnpm: ^1.3.0
typescript-eslint: ^8.44.0
globals: ^16.0.0
prettier: ^3.4.2
prettier-plugin-svelte: ^3.3.3
orm:
'@libsql/client': ^0.15.0
drizzle-kit: ^0.31.0
drizzle-orm: ^0.44.0
svelte:
'@sveltejs/adapter-vercel': ^6.0.0
'@sveltejs/kit': ^2.42.2
'@sveltejs/vite-plugin-svelte': ^6.0.0
svelte: ^5.39.2
svelte-check: ^4.0.0
tooling:
'@changesets/cli': ^2.29.7
'@svitejs/changesets-changelog-github-compact': ^1.2.0
'@types/estree': ^1.0.8
'@types/node': ^24.3.1
'@vercel/analytics': ^1.5.0
dotenv: ^17.2.3
node-resolve-ts: ^1.0.2
publint: ^0.3.13
ts-blank-space: ^0.6.2
tsdown: ^0.16.0
typescript: ^5.0.0
valibot: ^1.1.0
vite: ^7.0.4
vite-plugin-devtools-json: ^1.0.0
vitest: ^4.0.0
zimmerframe: ^1.1.4