Compare commits

..

27 Commits

Author SHA1 Message Date
paoloricciuti
239f9613a2 docs: update prompts documentation 2025-12-17 17:27:39 +00:00
Paolo Ricciuti
b01ae9069b fix: typo again 2025-12-17 18:27:20 +01:00
Paolo Ricciuti
b6db495242 fix: changesets 2025-12-17 18:19:08 +01:00
Paolo Ricciuti
3926310107 fix: typo in documentation tool name in svelte_task 2025-12-17 18:17:30 +01:00
Paolo Ricciuti
848627549f fix: improve prompt to reduce token usage (#124)
Co-authored-by: Stanislav Khromov <stanislav.khromov+github@gmail.com>
2025-12-17 18:13:07 +01:00
renovate[bot]
283164ca7e chore(deps): update peter-evans/create-pull-request action to v8 (#121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 16:48:55 +01:00
renovate[bot]
c6ee414f62 chore(deps): update all non-major dependencies (#119)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 16:48:38 +01:00
Matheus Ferraz
ea5bdf66dc chore(docs): fix tool name typo (#120) 2025-12-13 01:32:19 +01:00
paoloricciuti
7d707202d1 fix: update tmcp 2025-12-06 10:44:04 +01:00
renovate[bot]
f0daadfbd0 chore(deps): update all non-major dependencies (#117)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-05 23:52:14 +01:00
github-actions[bot]
15a7774da7 Version Packages (#118)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-05 22:34:53 +01:00
paoloricciuti
98efa1e09e fix: revert name change and add title 2025-12-05 22:26:33 +01:00
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
34 changed files with 1082 additions and 729 deletions

View File

@@ -0,0 +1,5 @@
---
"@sveltejs/mcp-stdio": patch
---
fix: improve prompt to reduce token usage

View File

@@ -1,5 +0,0 @@
---
'@sveltejs/mcp': patch
---
chore: update tmcp

View File

@@ -13,12 +13,12 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
version: 10.26.0
- name: Setup Node.js
uses: actions/setup-node@v6

View File

@@ -13,12 +13,12 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
version: 10.26.0
- name: Setup Node.js
uses: actions/setup-node@v6

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,12 +13,12 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
version: 10.26.0
- name: Setup Node.js
uses: actions/setup-node@v6

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
@@ -55,7 +55,7 @@ jobs:
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: update prompts documentation'

View File

@@ -37,35 +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": "catalog:mcp",
"@vercel/analytics": "^1.5.0",
"tmcp": "catalog:mcp"
"@tmcp/transport-http": "catalog:tmcp",
"@vercel/analytics": "catalog:tooling",
"tmcp": "catalog:tmcp"
}
}

View File

@@ -5,9 +5,6 @@ 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) {
@@ -24,8 +21,8 @@ export async function handle({ event, resolve }) {
// only add analytics in production
track: dev
? undefined
: async (session_id, event, slug) => {
await track(event, { session_id, ...(slug ? { slug } : {}) });
: 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

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

@@ -12,7 +12,7 @@ This prompt should be used whenever you are asking the model to work on a Svelte
<summary>Copy the prompt</summary>
```md
You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool `get_documentation` with one of the following paths:
You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool `get-documentation` with one of the following paths. However: before invoking the `get-documentation` tool, try to answer the users query using your own knowledge and the `svelte-autofixer` tool. Be mindful of how many section you request, since it is token-intensive!
<available-docs>
- title: Overview, use_cases: project setup, creating new svelte apps, scaffolding, cli tools, initializing projects, path: cli/overview
@@ -153,6 +153,7 @@ You are a Svelte expert tasked to build components and utilities for Svelte deve
- title: Context, use_cases: shared state, avoiding prop drilling, component communication, theme providers, user context, authentication state, configuration sharing, deeply nested components, path: svelte/context
- title: Lifecycle hooks, use_cases: component initialization, cleanup tasks, timers, subscriptions, dom measurements, chat windows, autoscroll features, migration from svelte 4, path: svelte/lifecycle-hooks
- title: Imperative component API, use_cases: project setup, client-side rendering, server-side rendering, ssr, hydration, testing, programmatic component creation, tooltips, dynamic mounting, path: svelte/imperative-component-api
- title: Hydratable data, use_cases: use title and path to estimate use case, path: svelte/hydratable
- title: Testing, use_cases: testing, quality assurance, unit tests, integration tests, component tests, e2e tests, vitest setup, playwright setup, test automation, path: svelte/testing
- title: TypeScript, use_cases: typescript setup, type safety, component props typing, generic components, wrapper components, dom type augmentation, project configuration, path: svelte/typescript
- title: Custom elements, use_cases: web components, custom elements, component library, design system, framework-agnostic components, embedding svelte in non-svelte apps, shadow dom, path: svelte/custom-elements
@@ -192,6 +193,8 @@ You are a Svelte expert tasked to build components and utilities for Svelte deve
</available-docs>
These are the available documentation sections that `list-sections` will return, you do not need to call it again.
Every time you write a Svelte component or a Svelte module you MUST invoke the `svelte-autofixer` tool providing the code. The tool will return a list of issues or suggestions. If there are any issues or suggestions you MUST fix them and call the tool again with the updated code. You MUST keep doing this until the tool returns no issues or suggestions. Only then you can return the code to the user.
This is the task you will work on:

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,
@@ -74,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.20.0",
"packageManager": "pnpm@10.26.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

@@ -17,30 +17,31 @@
".": "./src/index.ts"
},
"peerDependencies": {
"drizzle-orm": "^0.44.0"
"drizzle-orm": "^0.45.0"
},
"dependencies": {
"@mcp-ui/server": "^5.12.0",
"@mcp-ui/server": "catalog:ai",
"@sveltejs/mcp-schema": "workspace:^",
"@tmcp/adapter-valibot": "catalog:mcp",
"@typescript-eslint/parser": "^8.44.0",
"eslint": "^9.36.0",
"eslint-plugin-svelte": "^3.12.5",
"svelte": "^5.39.2",
"svelte-eslint-parser": "^1.4.0",
"tmcp": "catalog:mcp",
"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",
"@tmcp/transport-in-memory": "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.68.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

@@ -2,19 +2,22 @@ import type { SvelteMcp } from '../../index.js';
import * as v from 'valibot';
import { format_sections_list } from '../../utils.js';
import { icons } from '../../icons/index.js';
import { prompt } from 'tmcp/utils';
/**
* Function that actually generates the prompt string. You can use this in the MCP server handler to generate the prompt, it can accept arguments
* if needed (it will always be invoked manually so it's up to you to provide the arguments).
*/
function svelte_task(available_docs: string, task: string) {
return `You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool \`get_documentation\` with one of the following paths:
return `You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool \`get-documentation\` with one of the following paths. However: before invoking the \`get-documentation\` tool, try to answer the users query using your own knowledge and the \`svelte-autofixer\` tool. Be mindful of how many section you request, since it is token-intensive!
<available-docs>
${available_docs}
</available-docs>
These are the available documentation sections that \`list-sections\` will return, you do not need to call it again.
Every time you write a Svelte component or a Svelte module you MUST invoke the \`svelte-autofixer\` tool providing the code. The tool will return a list of issues or suggestions. If there are any issues or suggestions you MUST fix them and call the tool again with the updated code. You MUST keep doing this until the tool returns no issues or suggestions. Only then you can return the code to the user.
This is the task you will work on:
@@ -73,17 +76,7 @@ export function setup_svelte_task(server: SvelteMcp) {
}
const available_docs = await format_sections_list();
return {
messages: [
{
role: 'user',
content: {
type: 'text',
text: svelte_task(available_docs, task),
},
},
],
};
return prompt.text(svelte_task(available_docs, task));
},
);
}

View File

@@ -1,6 +1,7 @@
import type { SvelteMcp } from '../../index.js';
import { get_sections, fetch_with_timeout } from '../../utils.js';
import { icons } from '../../icons/index.js';
import { resource } from 'tmcp/utils';
export async function list_sections(server: SvelteMcp) {
const sections = await get_sections();
@@ -59,15 +60,7 @@ export async function list_sections(server: SvelteMcp) {
if (!section) throw new Error(`Section not found: ${slug}`);
const response = await fetch_with_timeout(section.url);
const content = await response.text();
return {
contents: [
{
uri,
type: 'text',
text: content,
},
],
};
return resource.text(uri, content);
},
);
}

View File

@@ -3,13 +3,14 @@ import * as v from 'valibot';
import { get_sections, fetch_with_timeout, format_sections_list } from '../../utils.js';
import { SECTIONS_LIST_INTRO, SECTIONS_LIST_OUTRO } from './prompts.js';
import { icons } from '../../icons/index.js';
import { tool } from 'tmcp/utils';
export function get_documentation(server: SvelteMcp) {
server.tool(
{
name: 'get-documentation',
description:
'Retrieves full documentation content for Svelte 5 or SvelteKit sections. Supports flexible search by title (e.g., "$state", "routing") or file path (e.g., "cli/overview"). Can accept a single section name or an array of sections. Before running this, make sure to analyze the users query, as well as the output from list-sections (which should be called first). Then ask for ALL relevant sections the user might require. For example, if the user asks to build anything interactive, you will need to fetch all relevant runes, and so on.',
'Retrieves full documentation content for Svelte 5 or SvelteKit sections. Supports flexible search by title (e.g., "$state", "routing") or file path (e.g., "cli/overview"). Can accept a single section name or an array of sections. Before running this, make sure to analyze the users query, as well as the output from list-sections (which should be called first). Then ask for ALL relevant sections the user might require. For example, if the user asks to build anything interactive, you will need to fetch all relevant runes, and so on. Before calling this tool, try to implement Svelte components using your own knowledge and the `svelte-autofixer` tool, since calling this tool is token intensive.',
schema: v.object({
section: v.pipe(
v.union([v.string(), v.array(v.string())]),
@@ -107,14 +108,7 @@ export function get_documentation(server: SvelteMcp) {
final_text += `\n\n---\n\n${SECTIONS_LIST_INTRO}\n\n${formatted_sections}\n\n${SECTIONS_LIST_OUTRO}`;
}
return {
content: [
{
type: 'text',
text: final_text,
},
],
};
return tool.text(final_text);
},
);
}

View File

@@ -2,6 +2,7 @@ import type { SvelteMcp } from '../../index.js';
import { format_sections_list } from '../../utils.js';
import { SECTIONS_LIST_INTRO, SECTIONS_LIST_OUTRO } from './prompts.js';
import { icons } from '../../icons/index.js';
import { tool } from 'tmcp/utils';
export function list_sections(server: SvelteMcp) {
server.tool(
@@ -17,14 +18,7 @@ export function list_sections(server: SvelteMcp) {
}
const formatted_sections = await format_sections_list();
return {
content: [
{
type: 'text',
text: `${SECTIONS_LIST_INTRO}\n\n${formatted_sections}\n\n${SECTIONS_LIST_OUTRO}`,
},
],
};
return tool.text(`${SECTIONS_LIST_INTRO}\n\n${formatted_sections}\n\n${SECTIONS_LIST_OUTRO}`);
},
);
}

View File

@@ -0,0 +1,84 @@
import { InMemoryTransport } from '@tmcp/transport-in-memory';
import { beforeEach, describe, expect, it } from 'vitest';
import { server } from '../../index.js';
const transport = new InMemoryTransport(server);
let session: ReturnType<typeof transport.session>;
describe('playground-link tool', () => {
beforeEach(async () => {
session = transport.session();
await session.initialize(
'2025-06-18',
{},
{
name: 'test-client',
version: '1.0.0',
},
);
});
it('should create a playground link if App.svelte is present', async () => {
const result = await session.callTool<{ url: string }>('playground-link', {
name: 'My Playground',
tailwind: false,
files: {
'App.svelte': `Hi there!`,
},
});
expect(result.structuredContent).toBeDefined();
expect(result.structuredContent?.url).toBeDefined();
// Verify URL structure rather than exact match (gzip compression can vary by platform)
expect(result.structuredContent?.url).toMatch(/^https:\/\/svelte\.dev\/playground#H4sIA/);
expect(result.structuredContent?.url).toContain('svelte.dev/playground');
});
it('should have a content with the stringified version of structured content and an ui resource', async () => {
const result = await session.callTool<{ url: string }>('playground-link', {
name: 'My Playground',
tailwind: false,
files: {
'App.svelte': `Hi there!`,
},
});
expect(result.structuredContent).toBeDefined();
expect(result.content).toStrictEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'text',
text: JSON.stringify(result.structuredContent),
}),
]),
);
// Verify resource structure without exact URL match (gzip compression can vary by platform)
expect(result.content).toStrictEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'resource',
resource: expect.objectContaining({
uri: 'ui://svelte/playground-link',
mimeType: 'text/uri-list',
_meta: { 'mcpui.dev/ui-preferred-frame-size': ['100%', '1200px'] },
text: expect.stringMatching(/^https:\/\/svelte\.dev\/playground\/embed#H4sIA/),
}),
}),
]),
);
});
it('should not create a playground link if App.svelte is missing', async () => {
const result = await session.callTool<{ url: string }>('playground-link', {
name: 'My Playground',
tailwind: false,
files: {
'Something.svelte': `Hi there!`,
},
});
expect(result.isError).toBe(true);
expect(result.content?.[0]).toStrictEqual({
type: 'text',
text: 'The files must contain an App.svelte file as the entry point',
});
});
});

View File

@@ -2,6 +2,7 @@ import type { SvelteMcp } from '../../index.js';
import * as v from 'valibot';
import { icons } from '../../icons/index.js';
import { createUIResource } from '@mcp-ui/server';
import { tool } from 'tmcp/utils';
async function compress_and_encode_text(input: string) {
const reader = new Blob([input]).stream().pipeThrough(new CompressionStream('gzip')).getReader();
@@ -82,17 +83,8 @@ export function playground_link(server: SvelteMcp) {
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: [
{
type: 'text',
text: JSON.stringify({
error: 'The files must contain an App.svelte file as the entry point',
}),
},
],
};
return tool.error('The files must contain an App.svelte file as the entry point');
}
const playground_config = {

View File

@@ -1,12 +1,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { InMemoryTransport } from '@tmcp/transport-in-memory';
import { beforeEach, describe, expect, it } from 'vitest';
import { server } from '../../index.js';
/**
* Small utility to create a JSON-RPC request without having to always specify as const
*/
function request<const T>(request: T) {
return request;
}
const transport = new InMemoryTransport(server);
let session: ReturnType<typeof transport.session>;
async function autofixer_tool_call(
code: string,
@@ -14,51 +13,34 @@ async function autofixer_tool_call(
desired_svelte_version = 5,
async = false,
) {
const result = await server.receive({
jsonrpc: '2.0',
id: 2,
method: 'tools/call',
params: {
name: 'svelte-autofixer',
arguments: {
code,
desired_svelte_version,
filename: 'App.svelte',
async,
},
},
const result = await session.callTool('svelte-autofixer', {
code,
desired_svelte_version,
filename: 'App.svelte',
async,
});
expect(result).toBeDefined();
expect(result.result).toBeDefined();
if (is_error) {
return result.result;
return result as any;
}
expect(result.result.structuredContent).toBeDefined();
return result.result.structuredContent;
expect(result.structuredContent).toBeDefined();
return result.structuredContent as any;
}
describe('svelte-autofixer tool', () => {
beforeEach(async () => {
const initialize_request = request({
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2025-06-18',
capabilities: {
roots: { listChanged: true },
},
clientInfo: {
name: 'test-client',
version: '1.0.0',
},
},
});
session = transport.session();
await server.receive(initialize_request, {
sessionId: 'svelte-autofixer-session',
});
session = transport.session();
await session.initialize(
'2025-06-18',
{},
{
name: 'test-client',
version: '1.0.0',
},
);
});
it('should add suggestions for js parse errors', async () => {

View File

@@ -5,6 +5,7 @@ import { add_compile_issues } from '../../autofixers/add-compile-issues.js';
import { add_eslint_issues } from '../../autofixers/add-eslint-issues.js';
import { add_autofixers_issues } from '../../autofixers/add-autofixers-issues.js';
import { icons } from '../../icons/index.js';
import { tool } from 'tmcp/utils';
export function svelte_autofixer(server: SvelteMcp) {
server.tool(
@@ -65,29 +66,15 @@ export function svelte_autofixer(server: SvelteMcp) {
if (server.ctx.sessionId && server.ctx.custom?.track) {
await server.ctx.custom?.track?.(server.ctx.sessionId, 'svelte-autofixer-wrong-version');
}
return {
isError: true,
content: [
{
type: 'text',
text: `The desired_svelte_version MUST be either 4 or 5 but received "${desired_svelte_version_unchecked}"`,
},
],
};
return tool.error(
`The desired_svelte_version MUST be either 4 or 5 but received "${desired_svelte_version_unchecked}"`,
);
}
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.`,
},
],
};
return tool.error('The async option can only be used with Svelte version 5 or higher.');
}
const content: {
@@ -126,15 +113,7 @@ export function svelte_autofixer(server: SvelteMcp) {
content.require_another_tool_call_after_fixing = true;
}
return {
content: [
{
type: 'text',
text: JSON.stringify(content),
},
],
structuredContent: content,
};
return tool.structured(content);
},
);
}

View File

@@ -26,7 +26,7 @@ export const server = new McpServer(
},
).withContext<{
db: LibSQLDatabase<Schema>;
track?: (sessionId: string, event: string, slug?: string) => Promise<void>;
track?: (sessionId: string, event: string, extra?: string) => Promise<void>;
}>();
export type SvelteMcp = typeof server;
@@ -34,3 +34,8 @@ 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,19 @@
# @sveltejs/mcp
## 0.1.13
### Patch Changes
- fix: revert name change and add title ([`98efa1e`](https://github.com/sveltejs/mcp/commit/98efa1e09ebcca7827b10dc6bc8e1699fc1e5171))
## 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

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,6 +1,6 @@
{
"name": "@sveltejs/mcp",
"version": "0.1.11",
"version": "0.1.13",
"type": "module",
"license": "MIT",
"mcpName": "dev.svelte/mcp",
@@ -9,7 +9,7 @@
"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": "catalog:mcp",
"@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": "catalog:mcp"
"eslint": "catalog:lint",
"tmcp": "catalog:tmcp"
}
}

View File

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

1181
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,60 @@
packages:
- './packages/*'
- './apps/*'
useNodeVersion: 22.19.0
- ./packages/*
- ./apps/*
catalogs:
mcp:
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.18.0
lint:
'@eslint/compat': ^2.0.0
'@eslint/js': ^9.36.0
'@types/eslint-scope': ^8.3.2
'@typescript-eslint/parser': ^8.44.0
'@typescript-eslint/types': ^8.44.0
eslint: ^9.36.0
eslint-config-prettier: ^10.0.1
eslint-plugin-import: ^2.32.0
eslint-plugin-pnpm: ^1.3.0
eslint-plugin-svelte: ^3.12.5
globals: ^16.0.0
prettier: ^3.4.2
prettier-plugin-svelte: ^3.3.3
svelte-eslint-parser: ^1.4.0
typescript-eslint: ^8.44.0
orm:
'@libsql/client': ^0.15.0
drizzle-kit: ^0.31.0
drizzle-orm: ^0.45.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
tmcp:
'@tmcp/adapter-valibot': ^0.1.4
'@tmcp/transport-http': ^0.8.3
'@tmcp/transport-in-memory': ^0.0.5
'@tmcp/transport-stdio': ^0.4.0
tmcp: ^1.19.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.18.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
useNodeVersion: 22.19.0