|
| 1 | +--- |
| 2 | +title: Local setup |
| 3 | +--- |
| 4 | + |
| 5 | +The local (or stdio) version of the MCP server is available via the [`@sveltejs/mcp`](https://www.npmjs.com/package/@sveltejs/mcp) npm package. You can either install it globally and then reference it in your configuration or run it with `npx`: |
| 6 | + |
| 7 | +```bash |
| 8 | +npx -y @sveltejs/mcp |
| 9 | +``` |
| 10 | + |
| 11 | +Here's how to set it up in some common MCP clients: |
| 12 | + |
| 13 | +## Claude Code |
| 14 | + |
| 15 | +To include the local MCP version in Claude Code, simply run the following command: |
| 16 | + |
| 17 | +```bash |
| 18 | +claude mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp |
| 19 | +``` |
| 20 | + |
| 21 | +The `[scope]` must be `user`, `project` or `local`. |
| 22 | + |
| 23 | +## Claude Desktop |
| 24 | + |
| 25 | +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: |
| 26 | + |
| 27 | +```json |
| 28 | +{ |
| 29 | + "mcpServers": { |
| 30 | + "svelte": { |
| 31 | + "command": "npx", |
| 32 | + "args": ["-y", "@sveltejs/mcp"] |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +## Codex CLI |
| 39 | + |
| 40 | +Add the following to your `config.toml` (which defaults to `~/.codex/config.toml`, but refer to [the configuration documentation](https://github.com/openai/codex/blob/main/docs/config.md) for more advanced setups): |
| 41 | + |
| 42 | +```toml |
| 43 | +[mcp_servers.svelte] |
| 44 | +command = "npx" |
| 45 | +args = ["-y", "@sveltejs/mcp"] |
| 46 | +``` |
| 47 | + |
| 48 | +## Gemini CLI |
| 49 | + |
| 50 | +To include the local MCP version in Gemini CLI, simply run the following command: |
| 51 | + |
| 52 | +```bash |
| 53 | +gemini mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp |
| 54 | +``` |
| 55 | + |
| 56 | +The `[scope]` must be `user`, `project` or `local`. |
| 57 | + |
| 58 | +## OpenCode |
| 59 | + |
| 60 | +Run the command: |
| 61 | + |
| 62 | +```bash |
| 63 | +opencode mcp add |
| 64 | +``` |
| 65 | + |
| 66 | +and follow the instructions, selecting 'Local' under the 'Select MCP server type' prompt: |
| 67 | + |
| 68 | +```bash |
| 69 | +opencode mcp add |
| 70 | + |
| 71 | +┌ Add MCP server |
| 72 | +│ |
| 73 | +◇ Enter MCP server name |
| 74 | +│ svelte |
| 75 | +│ |
| 76 | +◇ Select MCP server type |
| 77 | +│ Local |
| 78 | +│ |
| 79 | +◆ Enter command to run |
| 80 | +│ npx -y @sveltejs/mcp |
| 81 | +``` |
| 82 | + |
| 83 | +## VS Code |
| 84 | + |
| 85 | +- Open the command palette |
| 86 | +- Select "MCP: Add Server..." |
| 87 | +- Select "Command (stdio)" |
| 88 | +- Insert `npx -y @sveltejs/mcp` in the input and press `Enter` |
| 89 | +- When prompted for a name, insert `svelte` |
| 90 | +- Select if you want to add it as a `Global` or `Workspace` MCP server |
| 91 | + |
| 92 | +## Cursor |
| 93 | + |
| 94 | +- Open the command palette |
| 95 | +- Select "View: Open MCP Settings" |
| 96 | +- Click on "Add custom MCP" |
| 97 | + |
| 98 | +It will open a file with your MCP servers where you can add the following configuration: |
| 99 | + |
| 100 | +```json |
| 101 | +{ |
| 102 | + "mcpServers": { |
| 103 | + "svelte": { |
| 104 | + "command": "npx", |
| 105 | + "args": ["-y", "@sveltejs/mcp"] |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +## Other clients |
| 112 | + |
| 113 | +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. |
0 commit comments