这是一个模型上下文协议(MCP)服务器,提供从TypeScript声明中直接提取的权威Svelte 5和SvelteKit定义。通过一个统一的接口获取所有Svelte 5概念的精确语法、参数和示例。
定义优先方法:与多个专用工具不同,此服务器提供了一个强大的svelte_definition工具,访问超过28个全面定义,涵盖:
svelte_definition单一且强大的工具,适用于所有Svelte 5和SvelteKit概念:
svelte_definition(identifier: string, format?: "syntax"|"quick"|"full")
示例:
svelte_definition("$state") - 完整的$state文档svelte_definition("snippets", "quick") - 带有示例的代码片段概述svelte_definition("onclick", "syntax") - 仅TypeScript签名svelte_definition("migration-patterns") - Svelte 4 → 5迁移指南响应格式:
"syntax" - 仅TypeScript签名(约50字)"quick" - 定义+最小示例(约200字)"full" - 带有示例的完整文档(约500-1000字,默认)核心符文: $state, $state.raw, $state.snapshot, $derived, $derived.by, $props, $bindable, $effect, $effect.pre, $effect.root, $effect.pending, $effect.tracking
开发工具: $inspect, $host
功能与模式: snippets, onclick, component-events, migration-patterns, await-expressions, remote-functions, global-state, common-mistakes, lifecycle-equivalents
事件处理: custom-events, event-delegation, event-modifiers
TypeScript接口: snippet, snapshot
svelte_definition替代了16+个专用工具$state还是remote-functions,接口都相同await-expressions)remote-functions)$effect家族、$state变体、$derived.by、$bindableClaude Desktop(通过WSL)
{
"mcpServers": {
"mcp-svelte-docs": {
"command": "wsl.exe",
"args": ["bash", "-c", "npx -y mcp-svelte-docs"]
}
}
}
Cursor
Windsurf(通过WSL)
{
"mcpServers": {
"mcp-svelte-docs": {
"command": "wsl.exe",
"args": ["bash", "-c", "npx -y mcp-svelte-docs"]
}
}
}
Windows(无WSL)
{
"mcpServers": {
"mcp-svelte-docs": {
"command": "npx",
"args": ["-y", "mcp-svelte-docs"]
}
}
}
macOS / Linux
{
"mcpServers": {
"mcp-svelte-docs": {
"command": "npx",
"args": ["-y", "mcp-svelte-docs"]
}
}
}
欢迎贡献!请随时提交Pull Request。
MIT许可证 - 详情见LICENSE文件。
基于: