Compare commits

..

47 Commits

Author SHA1 Message Date
paoloricciuti
0360d00955 chore: remove changes to test action 2025-10-10 12:30:14 +02:00
paoloricciuti
65d403af1e feat: automatic prompt sync with docs 2025-10-10 10:38:41 +02:00
Paolo Ricciuti
ec9c5b3415 Merge pull request #61 from sveltejs/changeset-release/main 2025-10-09 22:43:36 +02:00
github-actions[bot]
b508a4ea49 Version Packages 2025-10-09 20:42:32 +00:00
paoloricciuti
044f0988b9 fix: pass secrets in action and update mcpName 2025-10-09 22:41:56 +02:00
Paolo Ricciuti
c5c6ba6580 Merge pull request #60 from sveltejs/changeset-release/main 2025-10-09 22:31:24 +02:00
github-actions[bot]
fb2240d60c Version Packages 2025-10-09 20:30:38 +00:00
Paolo Ricciuti
469b2071e7 Merge pull request #59 from sveltejs/use-dns-mcp-publish 2025-10-09 22:30:06 +02:00
paoloricciuti
fc39b44859 fix: use DNS to publish MCP 2025-10-09 21:53:39 +02:00
Paolo Ricciuti
e12a0c90ab Merge pull request #58 from sveltejs/changeset-release/main 2025-10-09 18:44:05 +02:00
github-actions[bot]
7234e64967 Version Packages 2025-10-09 16:43:04 +00:00
paoloricciuti
ef5241cbc2 fix: publish to MCP registry (I really hope this time for real) 2025-10-09 18:42:26 +02:00
Paolo Ricciuti
9a74df198d Merge pull request #57 from sveltejs/changeset-release/main 2025-10-09 18:34:54 +02:00
github-actions[bot]
f1280b9876 Version Packages 2025-10-09 16:33:34 +00:00
paoloricciuti
132943db3b feat: publish mcp to registry (maybe for real this time) 2025-10-09 18:30:21 +02:00
paoloricciuti
5ed1454e2c fix: use right curl param 2025-10-09 18:27:21 +02:00
Paolo Ricciuti
bd072bd324 Merge pull request #54 from sveltejs/changeset-release/main 2025-10-09 18:24:56 +02:00
github-actions[bot]
c35be898da Version Packages 2025-10-09 16:23:57 +00:00
paoloricciuti
b960301ced fix: add id-token: write permission to release.yml 2025-10-09 18:23:26 +02:00
Paolo Ricciuti
43408f5504 Merge pull request #45 from sveltejs/publish-to-registry 2025-10-09 18:18:26 +02:00
Paolo Ricciuti
bf4dcda7e1 Merge pull request #55 from mquandalle/fix-claude-code-command-docs
docs: fix CLI command syntax for Claude Code and Gemini CLI
2025-10-09 08:25:22 +02:00
Paolo Ricciuti
35691c464b docs: fix gemini 2025-10-09 08:10:38 +02:00
Paolo Ricciuti
a5decb4cf3 Merge pull request #56 from sveltejs/link-to-docs 2025-10-08 17:36:30 +02:00
paoloricciuti
cb9764c234 docs: add link to CLAUDE.md and AGENTS.md docs 2025-10-08 17:22:15 +02:00
paoloricciuti
3fbc786383 fix: verify checksum 2025-10-08 17:20:16 +02:00
Maxime Quandalle
3b680232a0 Fix CLI command syntax for Claude Code and Gemini CLI
Add missing `--` separator between CLI options and npx command.
Without this separator, the `-y` option is incorrectly parsed as a
CLI option instead of being passed to npx.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 10:22:01 +02:00
paoloricciuti
c5c08ccd13 fix: lint 2025-10-08 00:09:23 +02:00
paoloricciuti
4ac35bf258 chore: separate workflows 2025-10-08 00:06:12 +02:00
paoloricciuti
ecbbf70d98 fix: call changeset version in script 2025-10-07 23:50:10 +02:00
paoloricciuti
aaac49cdef chore: update version of server.json on release 2025-10-07 23:49:28 +02:00
paoloricciuti
558d964919 Merge branch 'main' into publish-to-registry 2025-10-07 23:35:45 +02:00
paoloricciuti
73d7625b3c chore: changesets 2025-10-07 21:34:19 +02:00
Paolo Ricciuti
c7060c8bdb Merge pull request #20 from sveltejs/attachments-autofixer 2025-10-07 21:31:50 +02:00
Paolo Ricciuti
ef2d569934 Merge pull request #26 from sveltejs/function-call-in-effect 2025-10-07 21:31:21 +02:00
Paolo Ricciuti
7ba57b45ae Merge pull request #52 from theetherGit/zed-config 2025-10-07 12:04:00 +02:00
Paolo Ricciuti
fe393bf480 docs: remove command shortcut 2025-10-07 11:59:21 +02:00
theetherGit
a63deba99d chore: Lint 2025-10-07 15:05:36 +05:30
Paolo Ricciuti
668a2e4481 Merge pull request #51 from sveltejs/renovate/all-minor-patch 2025-10-07 10:23:08 +02:00
Shivam Meena
04c82875f3 Add MCP to zed guide 2025-10-07 12:12:05 +05:30
renovate[bot]
84601f9ab0 chore(deps): update pnpm to v10.18.1 2025-10-06 14:34:35 +00:00
paoloricciuti
11cd2447fc feat: publish to registry 2025-10-05 12:13:34 +02:00
paoloricciuti
8483bd672d feat: add autofixer to tell the LLM to check if some function called in effect is assigning state 2025-09-26 13:04:11 +02:00
paoloricciuti
8414ffbcc8 fix: move attachments fixer 2025-09-23 23:05:53 +02:00
paoloricciuti
5798b50ceb Merge branch 'main' into attachments-autofixer 2025-09-23 23:04:38 +02:00
paoloricciuti
e560932211 Merge branch 'main' into attachments-autofixer 2025-09-23 23:03:13 +02:00
paoloricciuti
9504e6bac9 feat: autofixer action -> attachment 2025-09-23 00:49:09 +02:00
paoloricciuti
7086e8e55f feat: add bind:this -> attachment autofixer 2025-09-23 00:17:36 +02:00
25 changed files with 794 additions and 123 deletions

View File

@@ -0,0 +1,5 @@
---
'@sveltejs/mcp': patch
---
fix: minor tweaks to the prompt to allow for automatic sync

View File

@@ -18,7 +18,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.0
version: 10.18.1
- name: Setup Node.js
uses: actions/setup-node@v5

View File

@@ -18,7 +18,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.0
version: 10.18.1
- name: Setup Node.js
uses: actions/setup-node@v5

40
.github/workflows/publish-mcp.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Publish to MCP Registry
on:
workflow_call:
secrets:
MCP_KEY:
required: true
jobs:
publish-mcp:
name: Publish to MCP Registry
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
- name: Publish to MCP Registry
working-directory: packages/mcp-stdio
env:
MCP_KEY: ${{ secrets.MCP_KEY }}
run: |
NAME=mcp-publisher_1.2.3_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz
# Download MCP Publisher pinned to v1.2.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.2.3/$NAME" -O
# Verify the SHA256 checksum of the downloaded file
sha256sum --ignore-missing -c ./checksums/registry_1.2.3_checksums.txt
# Extract the tarball
mkdir tmp
tar -xzf $NAME --no-same-owner --no-same-permissions -C tmp
# Install the MCP Publisher binary
install -m 0755 tmp/mcp-publisher .
# Login using DNS
./mcp-publisher login dns --domain svelte.dev --private-key "${MCP_KEY}"
# Publish to MCP Registry
./mcp-publisher publish

View File

@@ -16,6 +16,8 @@ jobs:
if: github.repository == 'sveltejs/mcp'
name: Release
runs-on: ${{ matrix.os }}
outputs:
published: ${{ steps.changesets.outputs.published }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
@@ -51,8 +53,17 @@ jobs:
# pinned for security, always review third party action code before updating
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
# This expects you to have a script called changeset:version version that calls changeset version and updated what it needs to be updated
version: pnpm changeset:version
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
publish-mcp:
needs: release
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/publish-mcp.yml
secrets:
MCP_KEY: ${{ secrets.MCP_KEY }}

View File

@@ -18,7 +18,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.0
version: 10.18.1
- name: Setup Node.js
uses: actions/setup-node@v5

View File

@@ -0,0 +1,78 @@
name: Update Prompt Documentation
on:
push:
branches:
- main
paths:
- 'packages/mcp-server/src/mcp/handlers/prompts/**'
permissions:
contents: write
pull-requests: write
jobs:
update-docs:
# prevents this action from running on forks
if: github.repository == 'sveltejs/mcp'
name: Update Prompt Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Generate prompt documentation
run: pnpm generate-prompt-docs
- name: Check for changes
id: git-check
run: |
git diff --exit-code documentation/docs/30-capabilities/30-prompts.md || echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: update prompts documentation'
branch: docs/update-prompt-docs
delete-branch: true
title: 'docs: update prompt documentation'
body: |
## Summary
Automatically generated documentation update for MCP prompts.
This PR was triggered by changes to the prompts folder in `packages/mcp-server/src/mcp/handlers/prompts/`.
## Changes
- Updated `documentation/docs/30-capabilities/30-prompts.md` with latest prompt definitions
## Generated by
GitHub Action: Update Prompt Documentation
labels: |
documentation
automated

View File

@@ -30,4 +30,62 @@
],
"description": "Create a setup export for an autofixer",
},
"Prompt Generator": {
"scope": "javascript,typescript",
"prefix": "!prompt",
"body": [
"import type { SvelteMcp } from '../../index.js';",
"",
"/**",
" * 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 ${1:prompt_name}() {",
"\treturn `$0`;",
"}",
"",
"/**",
" * This function is used to generate the prompt to update the docs in the script `/scripts/update-docs-prompts.ts` it should use the default export",
" * function and pass in the arguments. Since it will be included in the documentation if it's an argument that the MCP will expose it should",
" * be in the format [NAME_OF_THE_ARGUMENT] to signal the user that it can substitute it.",
" * ",
" * The name NEEDS to be `generate_for_docs`.",
" */",
"export async function generate_for_docs() {",
"\treturn ${1:prompt_name}();",
"}",
"",
"/**",
" * Human readable description of what the prompt does. It will be included in the documentation.",
" * ",
" * The name NEEDS to be `docs_description`.",
" */",
"export const docs_description = '';",
"",
"export function setup_${1:prompt_name}(server: SvelteMcp) {",
"\tserver.prompt(",
"\t\t{",
"\t\t\tname: '${1:prompt_name}',",
"\t\t\ttitle: '${2:title}',",
"\t\t\tdescription:",
"\t\t\t\t'${3:llm_description}',",
"\t\t},",
"\t\tasync () => {",
"\t\t\treturn {",
"\t\t\t\tmessages: [",
"\t\t\t\t\t{",
"\t\t\t\t\t\trole: 'assistant',",
"\t\t\t\t\t\tcontent: {",
"\t\t\t\t\t\t\ttype: 'text',",
"\t\t\t\t\t\t\ttext: ${1:prompt_name}(),",
"\t\t\t\t\t\t},",
"\t\t\t\t\t},",
"\t\t\t\t],",
"\t\t\t};",
"\t\t},",
"\t);",
"}",
],
"description": "Create a setup export for a prompt generator",
},
}

View File

@@ -13,7 +13,7 @@ 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` (or `CLAUDE.md`, 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). This will tell the LLM which tools are available and when it's appropriate to use them.
```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

@@ -15,7 +15,7 @@ Here's how to set it up in some common MCP clients:
To include the local MCP version in Claude Code, simply run the following command:
```bash
claude mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp
claude mcp add -t stdio -s [scope] svelte -- npx -y @sveltejs/mcp
```
The `[scope]` must be `user`, `project` or `local`.
@@ -108,6 +108,25 @@ It will open a file with your MCP servers where you can add the following config
}
```
## Zed
- Open the command palette
- Search and select "agent:open settings"
- In settings panel look for `Model Context Protocol (MCP) Servers`
- Click on "Add Server"
- Select: "Add Custom Server"
It will open a popup with MCP server config where you can add the following configuration:
```json
{
"svelte": {
"command": "npx",
"args": ["-y", "@sveltejs/mcp"]
}
}
```
## 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

@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"packageManager": "pnpm@10.18.0",
"packageManager": "pnpm@10.18.1",
"scripts": {
"build": "pnpm -r run build",
"dev": "pnpm --filter @sveltejs/mcp-remote run dev",
@@ -17,8 +17,10 @@
"test:watch": "npm run test:unit -- --watch",
"inspect": "pnpm mcp-inspector",
"generate-summaries": "pnpm --filter @sveltejs/mcp-server run generate-summaries",
"generate-prompt-docs": "node --import node-resolve-ts/register scripts/update-docs-prompts.ts",
"debug:generate-summaries": "pnpm --filter @sveltejs/mcp-server run debug:generate-summaries",
"release": "pnpm --filter @sveltejs/mcp run build && changeset publish"
"release": "pnpm --filter @sveltejs/mcp run build && changeset publish",
"changeset:version": "changeset version && pnpm --filter @sveltejs/mcp run update:version && git add --all"
},
"keywords": [
"svelte",
@@ -38,6 +40,7 @@
"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",

View File

@@ -133,6 +133,36 @@ describe('add_autofixers_issues', () => {
);
});
});
it('should add a suggestion when calling a function inside an effect', () => {
const content = run_autofixers_on_code(`
<script>
import { fetch_data } from './data.js';
$effect(() => {
fetch_data();
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are calling the function \`fetch_data\` inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
it('should add a suggestion when calling a function inside an effect (with non identifier callee)', () => {
const content = run_autofixers_on_code(`
<script>
import { fetch_data } from './data.js';
$effect(() => {
fetch_data.fetch();
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are calling a function inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
});
with_possible_inits('($init)', ({ init }) => {
@@ -484,4 +514,177 @@ describe('add_autofixers_issues', () => {
);
});
});
describe('suggest_attachments', () => {
describe('bind:this', () => {
it('should add suggestions when using bind:this on an element', () => {
const content = run_autofixers_on_code(`
<script>
let a = $state();
</script>
<a bind:this={a} />`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should not add suggestions when using bind:this on a component', () => {
const content = run_autofixers_on_code(`
<script>
import Child from './Child.svelte';
let a = $state();
</script>
<Child bind:this={a} />`);
expect(content.suggestions).not.toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should not add suggestions when using bind:this on a component nested in an element', () => {
const content = run_autofixers_on_code(`
<script>
import Child from './Child.svelte';
let a = $state();
</script>
<div>
<Child bind:this={a} />
</div>`);
expect(content.suggestions).not.toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should add suggestions but not suggest attachments when using bind:this on an element and the desired svelte version is 4', () => {
const content = run_autofixers_on_code(
`
<script>
let a;
</script>
<a bind:this={a} />`,
4,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action`. Consider using the latter if possible.',
);
});
});
describe('use:', () => {
it('should add suggestions when using use: on an element and the action is declared as a function', () => {
const content = run_autofixers_on_code(
`<script>
function my_action(node) {
// do something with the node
}
</script>
<a use:my_action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should add suggestions when using use: on an element and the action is declared as a variable', () => {
const content = run_autofixers_on_code(
`<script>
const my_action = (node) => {
// do something with the node
}
</script>
<a use:my_action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should add suggestions when using use: on an element and the action is declared as an object', () => {
const content = run_autofixers_on_code(
`<script>
const my_action = {
action: (node) => {
// do something with the node
}
};
</script>
<a use:my_action.action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the desired svelte version is 4', () => {
const content = run_autofixers_on_code(
`<script>
function my_action(node) {
// do something with the node
}
</script>
<a use:my_action />`,
4,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from an import', () => {
const content = run_autofixers_on_code(
`<script>
import { my_action } from './actions.js';
</script>
<a use:my_action />`,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from the props', () => {
const content = run_autofixers_on_code(
`<script>
const { my_action } = $props();
</script>
<a use:my_action />`,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from a global variable', () => {
const content = run_autofixers_on_code(`<a use:my_action />`);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
});
});
});

View File

@@ -1,4 +1,10 @@
import type { AssignmentExpression, Identifier, Node, UpdateExpression } from 'estree';
import type {
AssignmentExpression,
CallExpression,
Identifier,
Node,
UpdateExpression,
} from 'estree';
import type { Autofixer, AutofixerState } from './index.js';
import { left_most_id } from '../ast/utils.js';
import type { AST } from 'svelte-eslint-parser';
@@ -19,9 +25,9 @@ function run_if_in_effect(
}
}
function visitor(
function assign_or_update_visitor(
node: UpdateExpression | AssignmentExpression,
{ state, path }: Context<Node | AST.SvelteNode, AutofixerState>,
{ state, path, next }: Context<Node | AST.SvelteNode, AutofixerState>,
) {
run_if_in_effect(path, state, () => {
function check_if_stateful_id(id: Identifier) {
@@ -50,9 +56,25 @@ function visitor(
}
}
});
next();
}
function call_expression_visitor(
node: CallExpression,
{ state, path, next }: Context<Node | AST.SvelteNode, AutofixerState>,
) {
run_if_in_effect(path, state, () => {
const function_name =
node.callee.type === 'Identifier' ? `the function \`${node.callee.name}\`` : 'a function';
state.output.suggestions.push(
`You are calling ${function_name} inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
next();
}
export const assign_in_effect: Autofixer = {
UpdateExpression: visitor,
AssignmentExpression: visitor,
UpdateExpression: assign_or_update_visitor,
AssignmentExpression: assign_or_update_visitor,
CallExpression: call_expression_visitor,
};

View File

@@ -16,3 +16,4 @@ export * from './wrong-property-access-state.js';
export * from './imported-runes.js';
export * from './derived-with-function.js';
export * from './use-runes-instead-of-store.js';
export * from './suggest-attachments.js';

View File

@@ -0,0 +1,47 @@
import type { Identifier } from 'estree';
import type { Autofixer } from './index.js';
import { left_most_id } from '../ast/utils.js';
export const suggest_attachments: Autofixer = {
SvelteDirective(node, { state, next, path }) {
if (node.kind === 'Binding' && node.key.name.name === 'this') {
const parent_element = path.findLast((p) => p.type === 'SvelteElement');
if (parent_element?.kind === 'html' && parent_element.startTag.attributes.includes(node)) {
let better_an_attachment = ` or even better an \`attachment\``;
if (state.desired_svelte_version === 4) {
better_an_attachment = ``;
}
state.output.suggestions.push(
`The usage of \`bind:this\` can often be replaced with an easier to read \`action\`${better_an_attachment}. Consider using the latter if possible.`,
);
}
} else if (node.kind === 'Action' && state.desired_svelte_version === 5) {
let id: Identifier | null = null;
if (node.key.name.type === 'Identifier') {
id = node.key.name;
} else if (node.key.name.type === 'MemberExpression') {
id = left_most_id(node.key.name);
}
if (id) {
const reference = state.parsed.find_reference_by_id(id);
const definition = reference?.resolved?.defs[0];
console.log(definition);
if (
definition &&
(definition.type === 'Variable' ||
!(definition.type === 'ImportBinding' || definition.type === 'Parameter')) &&
!(
definition.type === 'Variable' &&
definition.node.init?.type === 'CallExpression' &&
state.parsed.is_rune(definition.node.init, ['$props'])
)
) {
state.output.suggestions.push(
`Consider using an \`attachment\` instead of an \`action\` for "${id.name}".`,
);
}
}
}
next();
},
};

View File

@@ -1 +1 @@
export * from './svelte-task.js';
export { setup_svelte_task } from './svelte-task.js';

View File

@@ -2,29 +2,16 @@ import type { SvelteMcp } from '../../index.js';
import * as v from 'valibot';
import { format_sections_list } from '../../utils.js';
export function setup_svelte_task(server: SvelteMcp) {
server.prompt(
{
name: 'svelte-task-prompt',
title: 'Svelte-Task-Prompt',
description:
'Use this Prompt to ask for any svelte related task. It will automatically instruct the LLM on how to best use the autofixer and how to query for documentation pages.',
schema: v.object({
task: v.pipe(v.string(), v.description('The task to be performed')),
}),
},
async ({ task }) => {
const available_docs = await format_sections_list();
return {
messages: [
{
role: 'user',
content: {
type: 'text',
text: `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:
/**
* 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:
<available-docs>
${available_docs}
</available-docs>
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.
@@ -35,8 +22,59 @@ This is the task you will work on:
${task}
</task>
If you are not writing the code into a file, once you have the final version of the code ask the user if it wants to generate a playground link to quickly check the code in it and if it answer yes call the \`playground-link\` tool and return the url to the user nicely formatted. The playground link MUST be generated only once you have the final version of the code and you are ready to share it, it MUST include an entry point file called \`App.svelte\` where the main component should live. If you have multiple files to include in the playground link you can include them all at the root.
`,
If you are not writing the code into a file, once you have the final version of the code ask the user if it wants to generate a playground link to quickly check the code in it and if it answer yes call the \`playground-link\` tool and return the url to the user nicely formatted. The playground link MUST be generated only once you have the final version of the code and you are ready to share it, it MUST include an entry point file called \`App.svelte\` where the main component should live. If you have multiple files to include in the playground link you can include them all at the root.`;
}
/**
* This function is used to generate the prompt to update the docs in the script `/scripts/update-docs-prompts.ts` it should use the default export
* function and pass in the arguments. Since it will be included in the documentation if it's an argument that the MCP will expose it should
* be in the format [NAME_OF_THE_ARGUMENT] to signal the user that it can substitute it.
*
* The name NEEDS to be `generate_for_docs`.
*/
export async function generate_for_docs() {
const available_docs = await format_sections_list();
return svelte_task(available_docs, '[YOUR TASK HERE]');
}
/**
* Human readable description of what the prompt does. It will be included in the documentation.
*
* The name NEEDS to be `docs_description`.
*/
export const docs_description =
'This prompt should be used whenever you are asking the model to work on a Svelte-related task. It will instruct the LLM which documentation sections are available, which tools to invoke, when to invoke them, and how to interpret the results.';
export function setup_svelte_task(server: SvelteMcp) {
server.prompt(
{
name: 'svelte-task',
title: 'Svelte-Task-Prompt',
description:
'Use this Prompt to ask for any svelte related task. It will automatically instruct the LLM on how to best use the autofixer and how to query for documentation pages.',
schema: v.object({
task: v.pipe(v.string(), v.description('The task to be performed')),
}),
complete: {
task() {
return {
completion: {
values: [''],
},
};
},
},
},
async ({ task }) => {
const available_docs = await format_sections_list();
return {
messages: [
{
role: 'user',
content: {
type: 'text',
text: svelte_task(available_docs, task),
},
},
],

View File

@@ -51,6 +51,6 @@ export async function get_sections() {
export async function format_sections_list() {
const sections = await get_sections();
return sections
.map((s) => `* title: ${s.title}, use_cases: ${s.use_cases}, path: ${s.slug}`)
.map((s) => `- title: ${s.title}, use_cases: ${s.use_cases}, path: ${s.slug}`)
.join('\n');
}

View File

@@ -1,5 +1,41 @@
# @sveltejs/mcp
## 0.1.4
### Patch Changes
- fix: pass secrets in action and update `mcpName` ([`044f098`](https://github.com/sveltejs/mcp/commit/044f0988b935fff39911a861a648dfb276f5831a))
## 0.1.3
### Patch Changes
- fix: use DNS to publish MCP ([#59](https://github.com/sveltejs/mcp/pull/59))
## 0.1.2
### Patch Changes
- fix: publish to MCP registry (I really hope this time for real) ([`ef5241c`](https://github.com/sveltejs/mcp/commit/ef5241cbc204ad8bb84bde27db7c9d0a08280245))
## 0.1.1
### Patch Changes
- feat: publish mcp to registry (maybe for real this time) ([`132943d`](https://github.com/sveltejs/mcp/commit/132943db3b04dbbd322d08926c0880c990a61f5f))
## 0.1.0
### Minor Changes
- feat: publish to registry ([#45](https://github.com/sveltejs/mcp/pull/45))
### Patch Changes
- feat: add autofixer to tell the LLM to check if some function called in effect is assigning state #26 ([`73d7625`](https://github.com/sveltejs/mcp/commit/73d7625b3ca6a812ba91883ea668d80ff1e7c703))
- feat: add bind:this -> attachment and action -> attachment autofixer #20 ([`73d7625`](https://github.com/sveltejs/mcp/commit/73d7625b3ca6a812ba91883ea668d80ff1e7c703))
## 0.0.4
### Patch Changes

View File

@@ -0,0 +1,25 @@
4e7c92f289d903d4649c59f82df6e7b014caebb49d8b5c1d2466667fd6caf68c mcp-publisher_1.2.3_darwin_amd64.tar.gz
09637600871bec7cce25e098d6ce23b7c7577a8e537f618d24a5630d2d782afa mcp-publisher_1.2.3_darwin_amd64.tar.gz.sbom.json
9ac90d3182bae9af4b48fb3cd19c3cade3e52c8ea25d7aa14327326a209bcf71 mcp-publisher_1.2.3_darwin_arm64.tar.gz
0b2cedf3f42c5a7b33bdd3f72ce7f4c938ff4fe2aca5cabd60094dc4b855c1f6 mcp-publisher_1.2.3_darwin_arm64.tar.gz.sbom.json
868a54268f21580ec97ec9dfc4fc3442a7f69c241ee7c745c7032f2e43cdf47b mcp-publisher_1.2.3_linux_amd64.tar.gz
a7bce190ea1c1b5682d1b5069b20dd9c67f3688e02dbc93e7273e942097dac4d mcp-publisher_1.2.3_linux_amd64.tar.gz.sbom.json
319cdefb4c4f19fa35eeb0337e30be3169dbf3107a8c160651691a6342a6783b mcp-publisher_1.2.3_linux_arm64.tar.gz
bc9309ab843531e811990dcf637b9912c470fc38eddc13a5af0512fcef498944 mcp-publisher_1.2.3_linux_arm64.tar.gz.sbom.json
298026e0252547046f50dcb7817239d44107f5a3ae64f4e43b6a31d0c5b89f9b mcp-publisher_1.2.3_windows_amd64.tar.gz
971b835ce4df2b37ddcf8591d4400dc94d1e3f730b181b325c905261b75b9e6e mcp-publisher_1.2.3_windows_amd64.tar.gz.sbom.json
64da67b451d0fba12f15f7b0f6ab8d71c718bb2263f90f198ff1fe15a5ff2024 mcp-publisher_1.2.3_windows_arm64.tar.gz
f591b2153f1277cb67817763a23de9e77188fa94b893fac00e91d13160d696e3 mcp-publisher_1.2.3_windows_arm64.tar.gz.sbom.json
265377b343500898e3c3fea798926ff2695fe7500c1225c8a97f390a5892d849 registry-1.2.3.tar.gz
a9c03a84d2e30176d6ed7b493e7e3a8a05d446f1611a35bad6007fbe3ba80657 registry_1.2.3_darwin_amd64.tar.gz
4db4e8a0b1f3d0ca193e5356fef89b74c0666cdf56d6f3c8fc2d0aba1cac3b55 registry_1.2.3_darwin_amd64.tar.gz.sbom.json
2933a11990db16035e4896f394ada389166046911e6868f79b84636048dfe6fb registry_1.2.3_darwin_arm64.tar.gz
edd36e62f4b1c5b857da1862f20cbcf6dd3dfd9717888c08bd5c25740d8b11f6 registry_1.2.3_darwin_arm64.tar.gz.sbom.json
59bdd9977795891220e6fdb8f79dd7d14f48166362e94699bee59e745f7c7df6 registry_1.2.3_linux_amd64.tar.gz
7f7efb180aa312f674377e32a92ac3600e50c62e37d697d2d16acfe60227a2fd registry_1.2.3_linux_amd64.tar.gz.sbom.json
7fef1088a664850dd75e54a699fce6a5fb32e8ebbdc0d2869b6b34945727ba9c registry_1.2.3_linux_arm64.tar.gz
ca0488e5cbb04c8ee515e1b80e08b755a55d6af1784368a2f55e429137359a25 registry_1.2.3_linux_arm64.tar.gz.sbom.json
5bc29310aacc08437dcc973cfc1e1129f7065d2050396012f5ed98c4eb0ea75b registry_1.2.3_windows_amd64.tar.gz
e918c604f23e6d33f9952f18eddf0e50e50d7ce3e87ca5258bf78f4f1da243ab registry_1.2.3_windows_amd64.tar.gz.sbom.json
394cad1e6f5e37a583defdd522edbff854de5035d6e025a195664db31b58c0c0 registry_1.2.3_windows_arm64.tar.gz
c93df66f3257ba4b9c29f7bfded4cf04d712ec220b044ddfa019da3e4bd6475f registry_1.2.3_windows_arm64.tar.gz.sbom.json

View File

@@ -1,8 +1,9 @@
{
"name": "@sveltejs/mcp",
"version": "0.0.4",
"version": "0.1.4",
"type": "module",
"license": "MIT",
"mcpName": "dev.svelte/mcp",
"homepage": "https://github.com/sveltejs/mcp#readme",
"bugs": {
"url": "https://github.com/sveltejs/mcp/issues"
@@ -26,7 +27,8 @@
"dev": "tsdown --watch",
"test": "vitest",
"check": "tsc --noEmit",
"check:publint": "publint --strict"
"check:publint": "publint --strict",
"update:version": "node scripts/update-version.ts"
},
"devDependencies": {
"@sveltejs/mcp-server": "workspace:^",

View File

@@ -0,0 +1,14 @@
import { readFile, writeFile } from 'node:fs/promises';
import { resolve } from 'node:path';
const package_json_string = await readFile(resolve('./package.json'), 'utf-8');
const package_json = JSON.parse(package_json_string);
const server_json_path = resolve('./server.json');
const server_json_string = await readFile(server_json_path, 'utf-8');
const server_json = JSON.parse(server_json_string);
server_json.version = package_json.version;
server_json.packages[0].version = package_json.version;
await writeFile(server_json_path, JSON.stringify(server_json, null, '\t') + '\n', 'utf-8');

View File

@@ -0,0 +1,30 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
"name": "dev.svelte/mcp",
"description": "The official Svelte MCP server providing docs and autofixing tools for Svelte development",
"repository": {
"id": "1054419133",
"url": "https://github.com/sveltejs/mcp",
"subfolder": "packages/mcp-stdio",
"source": "github"
},
"version": "0.1.4",
"websiteUrl": "https://svelte.dev/docs/mcp/overview",
"packages": [
{
"registryType": "npm",
"identifier": "@sveltejs/mcp",
"version": "0.1.4",
"runtimeHint": "npx",
"transport": {
"type": "stdio"
}
}
],
"remotes": [
{
"url": "https://mcp.svelte.dev/mcp",
"type": "streamable-http"
}
]
}

171
pnpm-lock.yaml generated
View File

@@ -31,13 +31,16 @@ importers:
version: 10.1.8(eslint@9.36.0(jiti@2.6.0))
eslint-plugin-import:
specifier: ^2.32.0
version: 2.32.0(eslint@9.36.0(jiti@2.6.0))
version: 2.32.0(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint@9.36.0(jiti@2.6.0))
eslint-plugin-svelte:
specifier: ^3.12.3
version: 3.12.4(eslint@9.36.0(jiti@2.6.0))(svelte@5.39.6)(ts-node@10.9.2(@types/node@24.5.2)(typescript@5.9.2))
globals:
specifier: ^16.0.0
version: 16.4.0
node-resolve-ts:
specifier: ^1.0.2
version: 1.0.2
prettier:
specifier: ^3.4.2
version: 3.6.2
@@ -875,8 +878,8 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@oxc-project/types@0.93.0':
resolution: {integrity: sha512-yNtwmWZIBtJsMr5TEfoZFDxIWV6OdScOpza/f5YxbqUMJk+j6QX3Cf3jgZShGEFYWQJ5j9mJ6jM0tZHu2J9Yrg==}
'@oxc-project/types@0.94.0':
resolution: {integrity: sha512-+UgQT/4o59cZfH6Cp7G0hwmqEQ0wE+AdIwhikdwnhWI9Dp8CgSY081+Q3O67/wq3VJu8mgUEB93J9EHHn70fOw==}
'@petamoriken/float16@3.9.2':
resolution: {integrity: sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog==}
@@ -1282,91 +1285,91 @@ packages:
'@radix-ui/rect@1.1.1':
resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==}
'@rolldown/binding-android-arm64@1.0.0-beta.41':
resolution: {integrity: sha512-Edflndd9lU7JVhVIvJlZhdCj5DkhYDJPIRn4Dx0RUdfc8asP9xHOI5gMd8MesDDx+BJpdIT/uAmVTearteU/mQ==}
'@rolldown/binding-android-arm64@1.0.0-beta.42':
resolution: {integrity: sha512-W5ZKF3TP3bOWuBfotAGp+UGjxOkGV7jRmIRbBA7NFjggx7Oi6vOmGDqpHEIX7kDCiry1cnIsWQaxNvWbMdkvzQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [android]
'@rolldown/binding-darwin-arm64@1.0.0-beta.41':
resolution: {integrity: sha512-XGCzqfjdk7550PlyZRTBKbypXrB7ATtXhw/+bjtxnklLQs0mKP/XkQVOKyn9qGKSlvH8I56JLYryVxl0PCvSNw==}
'@rolldown/binding-darwin-arm64@1.0.0-beta.42':
resolution: {integrity: sha512-abw/wtgJA8OCgaTlL+xJxnN/Z01BwV1rfzIp5Hh9x+IIO6xOBfPsQ0nzi0+rWx3TyZ9FZXyC7bbC+5NpQ9EaXQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [darwin]
'@rolldown/binding-darwin-x64@1.0.0-beta.41':
resolution: {integrity: sha512-Ho6lIwGJed98zub7n0xcRKuEtnZgbxevAmO4x3zn3C3N4GVXZD5xvCvTVxSMoeBJwTcIYzkVDRTIhylQNsTgLQ==}
'@rolldown/binding-darwin-x64@1.0.0-beta.42':
resolution: {integrity: sha512-Y/UrZIRVr8CvXVEB88t6PeC46r1K9/QdPEo2ASE/b/KBEyXIx+QbM6kv9QfQVWU2Atly2+SVsQzxQsIvuk3lZQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [darwin]
'@rolldown/binding-freebsd-x64@1.0.0-beta.41':
resolution: {integrity: sha512-ijAZETywvL+gACjbT4zBnCp5ez1JhTRs6OxRN4J+D6AzDRbU2zb01Esl51RP5/8ZOlvB37xxsRQ3X4YRVyYb3g==}
'@rolldown/binding-freebsd-x64@1.0.0-beta.42':
resolution: {integrity: sha512-zRM0oOk7BZiy6DoWBvdV4hyEg+j6+WcBZIMHVirMEZRu8hd18kZdJkg+bjVMfCEhwpWeFUfBfZ1qcaZ5UdYzlQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [freebsd]
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.41':
resolution: {integrity: sha512-EgIOZt7UildXKFEFvaiLNBXm+4ggQyGe3E5Z1QP9uRcJJs9omihOnm897FwOBQdCuMvI49iBgjFrkhH+wMJ2MA==}
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.42':
resolution: {integrity: sha512-6RjFaC52QNwo7ilU8C5H7swbGlgfTkG9pudXwzr3VYyT18s0C9gLg3mvc7OMPIGqNxnQ0M5lU8j6aQCk2DTRVg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.41':
resolution: {integrity: sha512-F8bUwJq8v/JAU8HSwgF4dztoqJ+FjdyjuvX4//3+Fbe2we9UktFeZ27U4lRMXF1vxWtdV4ey6oCSqI7yUrSEeg==}
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.42':
resolution: {integrity: sha512-LMYHM5Sf6ROq+VUwHMDVX2IAuEsWTv4SnlFEedBnMGpvRuQ14lCmD4m5Q8sjyAQCgyha9oghdGoK8AEg1sXZKg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.41':
resolution: {integrity: sha512-MioXcCIX/wB1pBnBoJx8q4OGucUAfC1+/X1ilKFsjDK05VwbLZGRgOVD5OJJpUQPK86DhQciNBrfOKDiatxNmg==}
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.42':
resolution: {integrity: sha512-/bNTYb9aKNhzdbPn3O4MK2aLv55AlrkUKPE4KNfBYjkoZUfDr4jWp7gsSlvTc5A/99V1RCm9axvt616ZzeXGyA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.41':
resolution: {integrity: sha512-m66M61fizvRCwt5pOEiZQMiwBL9/y0bwU/+Kc4Ce/Pef6YfoEkR28y+DzN9rMdjo8Z28NXjsDPq9nH4mXnAP0g==}
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.42':
resolution: {integrity: sha512-n/SLa4h342oyeGykZdch7Y3GNCNliRPL4k5wkeZ/5eQZs+c6/ZG1SHCJQoy7bZcmxiMyaXs9HoFmv1PEKrZgWg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/binding-linux-x64-musl@1.0.0-beta.41':
resolution: {integrity: sha512-yRxlSfBvWnnfrdtJfvi9lg8xfG5mPuyoSHm0X01oiE8ArmLRvoJGHUTJydCYz+wbK2esbq5J4B4Tq9WAsOlP1Q==}
'@rolldown/binding-linux-x64-musl@1.0.0-beta.42':
resolution: {integrity: sha512-4PSd46sFzqpLHSGdaSViAb1mk55sCUMpJg+X8ittXaVocQsV3QLG/uydSH8RyL0ngHX5fy3D70LcCzlB15AgHw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/binding-openharmony-arm64@1.0.0-beta.41':
resolution: {integrity: sha512-PHVxYhBpi8UViS3/hcvQQb9RFqCtvFmFU1PvUoTRiUdBtgHA6fONNHU4x796lgzNlVSD3DO/MZNk1s5/ozSMQg==}
'@rolldown/binding-openharmony-arm64@1.0.0-beta.42':
resolution: {integrity: sha512-BmWoeJJyeZXmZBcfoxG6J9+rl2G7eO47qdTkAzEegj4n3aC6CBIHOuDcbE8BvhZaEjQR0nh0nJrtEDlt65Q7Sw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [openharmony]
'@rolldown/binding-wasm32-wasi@1.0.0-beta.41':
resolution: {integrity: sha512-OAfcO37ME6GGWmj9qTaDT7jY4rM0T2z0/8ujdQIJQ2x2nl+ztO32EIwURfmXOK0U1tzkyuaKYvE34Pug/ucXlQ==}
'@rolldown/binding-wasm32-wasi@1.0.0-beta.42':
resolution: {integrity: sha512-2Ft32F7uiDTrGZUKws6CLNTlvTWHC33l4vpXrzUucf9rYtUThAdPCOt89Pmn13tNX6AulxjGEP2R0nZjTSW3eQ==}
engines: {node: '>=14.0.0'}
cpu: [wasm32]
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.41':
resolution: {integrity: sha512-NIYGuCcuXaq5BC4Q3upbiMBvmZsTsEPG9k/8QKQdmrch+ocSy5Jv9tdpdmXJyighKqm182nh/zBt+tSJkYoNlg==}
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.42':
resolution: {integrity: sha512-hC1kShXW/z221eG+WzQMN06KepvPbMBknF0iGR3VMYJLOe9gwnSTfGxFT5hf8XrPv7CEZqTWRd0GQpkSHRbGsw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [win32]
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.41':
resolution: {integrity: sha512-kANdsDbE5FkEOb5NrCGBJBCaZ2Sabp3D7d4PRqMYJqyLljwh9mDyYyYSv5+QNvdAmifj+f3lviNEUUuUZPEFPw==}
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.42':
resolution: {integrity: sha512-AICBYromawouGjj+GS33369E8Vwhy6UwhQEhQ5evfS8jPCsyVvoICJatbDGDGH01dwtVGLD5eDFzPicUOVpe4g==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ia32]
os: [win32]
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.41':
resolution: {integrity: sha512-UlpxKmFdik0Y2VjZrgUCgoYArZJiZllXgIipdBRV1hw6uK45UbQabSTW6Kp6enuOu7vouYWftwhuxfpE8J2JAg==}
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.42':
resolution: {integrity: sha512-XpZ0M+tjoEiSc9c+uZR7FCnOI0uxDRNs1elGOMjeB0pUP1QmvVbZGYNsyLbLoP4u7e3VQN8rie1OQ8/mB6rcJg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [win32]
'@rolldown/pluginutils@1.0.0-beta.41':
resolution: {integrity: sha512-ycMEPrS3StOIeb87BT3/+bu+blEtyvwQ4zmo2IcJQy0Rd1DAAhKksA0iUZ3MYSpJtjlPhg0Eo6mvVS6ggPhRbw==}
'@rolldown/pluginutils@1.0.0-beta.42':
resolution: {integrity: sha512-N7pQzk9CyE7q0bBN/q0J8s6Db279r5kUZc6d7/wWRe9/zXqC52HQovVyu6iXPIDY4BEzzgbVLhVFXrOuGJ22ZQ==}
'@rollup/pluginutils@5.3.0':
resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==}
@@ -3052,6 +3055,9 @@ packages:
resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==}
hasBin: true
node-resolve-ts@1.0.2:
resolution: {integrity: sha512-OXr7jYcmWWhO0Bb4eyK7Rwi9PbWRy5+Ie7bRIL+tlD4hdkVf/HMNoZhF/ze5H31eMBee8NSVwfxSpb/WwpJt6g==}
nopt@8.1.0:
resolution: {integrity: sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==}
engines: {node: ^18.17.0 || >=20.5.0}
@@ -3412,8 +3418,8 @@ packages:
vue-tsc:
optional: true
rolldown@1.0.0-beta.41:
resolution: {integrity: sha512-U+NPR0Bkg3wm61dteD2L4nAM1U9dtaqVrpDXwC36IKRHpEO/Ubpid4Nijpa2imPchcVNHfxVFwSSMJdwdGFUbg==}
rolldown@1.0.0-beta.42:
resolution: {integrity: sha512-xaPcckj+BbJhYLsv8gOqezc8EdMcKKe/gk8v47B0KPvgABDrQ0qmNPAiT/gh9n9Foe0bUkEv2qzj42uU5q1WRg==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
@@ -4766,7 +4772,7 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.19.1
'@oxc-project/types@0.93.0': {}
'@oxc-project/types@0.94.0': {}
'@petamoriken/float16@3.9.2':
optional: true
@@ -5087,51 +5093,51 @@ snapshots:
'@radix-ui/rect@1.1.1': {}
'@rolldown/binding-android-arm64@1.0.0-beta.41':
'@rolldown/binding-android-arm64@1.0.0-beta.42':
optional: true
'@rolldown/binding-darwin-arm64@1.0.0-beta.41':
'@rolldown/binding-darwin-arm64@1.0.0-beta.42':
optional: true
'@rolldown/binding-darwin-x64@1.0.0-beta.41':
'@rolldown/binding-darwin-x64@1.0.0-beta.42':
optional: true
'@rolldown/binding-freebsd-x64@1.0.0-beta.41':
'@rolldown/binding-freebsd-x64@1.0.0-beta.42':
optional: true
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.41':
'@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.42':
optional: true
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.41':
'@rolldown/binding-linux-arm64-gnu@1.0.0-beta.42':
optional: true
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.41':
'@rolldown/binding-linux-arm64-musl@1.0.0-beta.42':
optional: true
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.41':
'@rolldown/binding-linux-x64-gnu@1.0.0-beta.42':
optional: true
'@rolldown/binding-linux-x64-musl@1.0.0-beta.41':
'@rolldown/binding-linux-x64-musl@1.0.0-beta.42':
optional: true
'@rolldown/binding-openharmony-arm64@1.0.0-beta.41':
'@rolldown/binding-openharmony-arm64@1.0.0-beta.42':
optional: true
'@rolldown/binding-wasm32-wasi@1.0.0-beta.41':
'@rolldown/binding-wasm32-wasi@1.0.0-beta.42':
dependencies:
'@napi-rs/wasm-runtime': 1.0.6
optional: true
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.41':
'@rolldown/binding-win32-arm64-msvc@1.0.0-beta.42':
optional: true
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.41':
'@rolldown/binding-win32-ia32-msvc@1.0.0-beta.42':
optional: true
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.41':
'@rolldown/binding-win32-x64-msvc@1.0.0-beta.42':
optional: true
'@rolldown/pluginutils@1.0.0-beta.41': {}
'@rolldown/pluginutils@1.0.0-beta.42': {}
'@rollup/pluginutils@5.3.0(rollup@4.52.2)':
dependencies:
@@ -5469,14 +5475,6 @@ snapshots:
chai: 5.3.3
tinyrainbow: 2.0.0
'@vitest/mocker@3.2.4(vite@7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6))':
dependencies:
'@vitest/spy': 3.2.4
estree-walker: 3.0.3
magic-string: 0.30.19
optionalDependencies:
vite: 7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6)
'@vitest/mocker@3.2.4(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6))':
dependencies:
'@vitest/spy': 3.2.4
@@ -6101,16 +6099,17 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.1(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)):
eslint-module-utils@2.12.1(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0)):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2)
eslint: 9.36.0(jiti@2.6.0)
eslint-import-resolver-node: 0.3.9
transitivePeerDependencies:
- supports-color
eslint-plugin-import@2.32.0(eslint@9.36.0(jiti@2.6.0)):
eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint@9.36.0(jiti@2.6.0)):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -6121,7 +6120,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.36.0(jiti@2.6.0)
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.1(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0))
eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.36.0(jiti@2.6.0))
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -6132,6 +6131,8 @@ snapshots:
semver: 6.3.1
string.prototype.trimend: 1.0.9
tsconfig-paths: 3.15.0
optionalDependencies:
'@typescript-eslint/parser': 8.44.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2)
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
@@ -6864,6 +6865,8 @@ snapshots:
node-gyp-build@4.8.4: {}
node-resolve-ts@1.0.2: {}
nopt@8.1.0:
dependencies:
abbrev: 3.0.1
@@ -7166,7 +7169,7 @@ snapshots:
reusify@1.1.0: {}
rolldown-plugin-dts@0.16.11(rolldown@1.0.0-beta.41)(typescript@5.9.2):
rolldown-plugin-dts@0.16.11(rolldown@1.0.0-beta.42)(typescript@5.9.2):
dependencies:
'@babel/generator': 7.28.3
'@babel/parser': 7.28.4
@@ -7177,33 +7180,33 @@ snapshots:
dts-resolver: 2.1.2
get-tsconfig: 4.10.1
magic-string: 0.30.19
rolldown: 1.0.0-beta.41
rolldown: 1.0.0-beta.42
optionalDependencies:
typescript: 5.9.2
transitivePeerDependencies:
- oxc-resolver
- supports-color
rolldown@1.0.0-beta.41:
rolldown@1.0.0-beta.42:
dependencies:
'@oxc-project/types': 0.93.0
'@rolldown/pluginutils': 1.0.0-beta.41
'@oxc-project/types': 0.94.0
'@rolldown/pluginutils': 1.0.0-beta.42
ansis: 4.2.0
optionalDependencies:
'@rolldown/binding-android-arm64': 1.0.0-beta.41
'@rolldown/binding-darwin-arm64': 1.0.0-beta.41
'@rolldown/binding-darwin-x64': 1.0.0-beta.41
'@rolldown/binding-freebsd-x64': 1.0.0-beta.41
'@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.41
'@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.41
'@rolldown/binding-linux-arm64-musl': 1.0.0-beta.41
'@rolldown/binding-linux-x64-gnu': 1.0.0-beta.41
'@rolldown/binding-linux-x64-musl': 1.0.0-beta.41
'@rolldown/binding-openharmony-arm64': 1.0.0-beta.41
'@rolldown/binding-wasm32-wasi': 1.0.0-beta.41
'@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.41
'@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.41
'@rolldown/binding-win32-x64-msvc': 1.0.0-beta.41
'@rolldown/binding-android-arm64': 1.0.0-beta.42
'@rolldown/binding-darwin-arm64': 1.0.0-beta.42
'@rolldown/binding-darwin-x64': 1.0.0-beta.42
'@rolldown/binding-freebsd-x64': 1.0.0-beta.42
'@rolldown/binding-linux-arm-gnueabihf': 1.0.0-beta.42
'@rolldown/binding-linux-arm64-gnu': 1.0.0-beta.42
'@rolldown/binding-linux-arm64-musl': 1.0.0-beta.42
'@rolldown/binding-linux-x64-gnu': 1.0.0-beta.42
'@rolldown/binding-linux-x64-musl': 1.0.0-beta.42
'@rolldown/binding-openharmony-arm64': 1.0.0-beta.42
'@rolldown/binding-wasm32-wasi': 1.0.0-beta.42
'@rolldown/binding-win32-arm64-msvc': 1.0.0-beta.42
'@rolldown/binding-win32-ia32-msvc': 1.0.0-beta.42
'@rolldown/binding-win32-x64-msvc': 1.0.0-beta.42
rollup@4.52.2:
dependencies:
@@ -7631,8 +7634,8 @@ snapshots:
diff: 8.0.2
empathic: 2.0.0
hookable: 5.5.3
rolldown: 1.0.0-beta.41
rolldown-plugin-dts: 0.16.11(rolldown@1.0.0-beta.41)(typescript@5.9.2)
rolldown: 1.0.0-beta.42
rolldown-plugin-dts: 0.16.11(rolldown@1.0.0-beta.42)(typescript@5.9.2)
semver: 7.7.2
tinyexec: 1.0.1
tinyglobby: 0.2.15
@@ -7848,7 +7851,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/mocker': 3.2.4(vite@7.1.7(@types/node@22.18.6)(jiti@2.6.0)(tsx@4.20.6))
'@vitest/mocker': 3.2.4(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(tsx@4.20.6))
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4

View File

@@ -0,0 +1,36 @@
import fs from 'node:fs/promises';
import path from 'node:path';
let content = `---
title: Prompts
---
This is the list of available prompts provided by the MCP server. Prompts are selected by the user and are sent as a user message. They can be useful to write repetitive instructions for the LLM on how to properly use the MCP server.
`;
const prompts_generators = fs.glob('./packages/mcp-server/src/mcp/handlers/prompts/*.ts');
const filename_regex = /packages\/mcp-server\/src\/mcp\/handlers\/prompts\/(?<prompt>.+)\.ts/;
for await (const file of prompts_generators) {
const title = file.match(filename_regex)?.groups?.prompt;
if (title === 'index') continue;
const module = await import(path.resolve('./', file));
content += `## ${title}
${module.docs_description}
<details>
<summary>Copy the prompt</summary>
\`\`\`md
${await module.generate_for_docs()}
\`\`\`
</details>
`;
}
await fs.writeFile('./documentation/docs/30-capabilities/30-prompts.md', content.trim() + '\n');