本地设置
MCP 服务器的本地(或 stdio)版本可通过 @sveltejs/mcp npm 包获取。你可以全局安装它,然后在配置中引用它,或者使用 npx 运行它:
¥The local (or stdio) version of the MCP server is available via the @sveltejs/mcp npm package. You can either install it globally and then reference it in your configuration or run it with npx:
npx -y @sveltejs/mcp以下是如何在一些常见的 MCP 客户端中进行设置:
¥Here’s how to set it up in some common MCP clients:
Claude Code
要在 Claude Code 中包含本地 MCP 版本,只需运行以下命令:
¥To include the local MCP version in Claude Code, simply run the following command:
claude mcp add -t stdio -s [scope] svelte -- npx -y @sveltejs/mcp[scope] 必须是 user、project 或 local。
¥The [scope] must be user, project or local.
Claude Desktop
在“设置”>“开发者”部分中,点击“编辑配置”。它将打开包含 claude_desktop_config.json 文件的文件夹。编辑文件以包含以下配置:
¥In the Settings > Developer section, click on Edit Config. It will open the folder with a claude_desktop_config.json file in it. Edit the file to include the following configuration:
{
	"mcpServers": {
		"svelte": {
			"command": "npx",
			"args": ["-y", "@sveltejs/mcp"]
		}
	}
}Codex CLI
将以下内容添加到你的 config.toml(默认为 ~/.codex/config.toml,但有关更高级的设置,请参阅 配置文档):
¥Add the following to your config.toml (which defaults to ~/.codex/config.toml, but refer to the configuration documentation for more advanced setups):
[mcp_servers.svelte]
command = "npx"
args = ["-y", "@sveltejs/mcp"]Gemini CLI
要在 Gemini CLI 中包含本地 MCP 版本,只需运行以下命令:
¥To include the local MCP version in Gemini CLI, simply run the following command:
gemini mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp[scope] 必须是 user、project 或 local。
¥The [scope] must be user, project or local.
OpenCode
运行以下命令:
¥Run the command:
opencode mcp add并按照说明操作,在 ‘选择 MCP 服务器类型’ 提示符下选择 ‘本地’:
¥and follow the instructions, selecting ‘Local’ under the ‘Select MCP server type’ prompt:
opencode mcp add
┌  Add MCP server
│
◇  Enter MCP server name
│  svelte
│
◇  Select MCP server type
│  Local
│
◆  Enter command to run
│  npx -y @sveltejs/mcpVS Code
- 打开命令面板 - ¥Open the command palette 
- 选择“MCP:”添加服务器... - ¥Select “MCP: Add Server...” 
- 选择 “命令 (stdio)” - ¥Select “Command (stdio)” 
- 在输入框中插入 - npx -y @sveltejs/mcp并按下- Enter- ¥Insert - npx -y @sveltejs/mcpin the input and press- Enter
- 当提示输入名称时,请插入 - svelte- ¥When prompted for a name, insert - svelte
- 选择是否要将其添加为 - Global或- WorkspaceMCP 服务器- ¥Select if you want to add it as a - Globalor- WorkspaceMCP server
Cursor
- 打开命令面板 - ¥Open the command palette 
- 选择“查看:”打开“MCP 设置” - ¥Select “View: Open MCP Settings” 
- 点击 “添加自定义 MCP” - ¥Click on “Add custom MCP” 
它将打开一个包含你的 MCP 服务器的文件,你可以在其中添加以下配置:
¥It will open a file with your MCP servers where you can add the following configuration:
{
	"mcpServers": {
		"svelte": {
			"command": "npx",
			"args": ["-y", "@sveltejs/mcp"]
		}
	}
}Zed
- 打开命令面板 - ¥Open the command palette 
- 搜索并选择 “agent:open 设置” - ¥Search and select “agent:open settings” 
- 在设置面板中查找 - Model Context Protocol (MCP) Servers- ¥In settings panel look for - Model Context Protocol (MCP) Servers
- 点击 “添加服务器” - ¥Click on “Add Server” 
- 选择:”添加自定义服务器” - ¥Select: “Add Custom Server” 
它将打开一个包含 MCP 服务器配置的弹出窗口,你可以在其中添加以下配置:
¥It will open a popup with MCP server config where you can add the following configuration:
{
	"svelte": {
		"command": "npx",
		"args": ["-y", "@sveltejs/mcp"]
	}
}其他客户端(Other clients)
¥Other clients
如果我们未包含你正在使用的 MCP 客户端,请参阅其 stdio 服务器文档,并使用 npx 作为命令,-y @sveltejs/mcp 作为参数。
¥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.