> ## Documentation Index
> Fetch the complete documentation index at: https://docs.specpilot.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your AI IDE

> Add SpecPilot's MCP server to Claude Code, Cursor, VS Code, Windsurf, Codex or Antigravity.

The easiest way is the Connect Your AI IDE card on Home, or step 1 of the Setup view. Pick your IDE, click Copy and paste it into the file the card names. The config has the right address and token for the App that is running. The page remembers your choice in this browser.

## Where each IDE reads it

| IDE | File | Where |
| - | - | - |
| Claude Code | `.mcp.json` | In the project |
| Cursor | `.cursor/mcp.json` | In the project |
| VS Code (Copilot) | `.vscode/mcp.json` | In the project |
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | Your home folder |
| Codex | `~/.codex/config.toml` | Your home folder |
| Antigravity | `.agents/mcp_config.json` | In the project |

## The config

These use `SPECPILOT_MCP_TOKEN` (see [Keep the token](https://docs.specpilot.dev/mcp/on-off.md#keep-the-token)) and the default port, 4321.

> [tab] Claude Code
>
> ```json .mcp.json theme={null}
> {
>   "mcpServers": {
>     "specpilot-local": {
>       "type": "http",
>       "url": "http://127.0.0.1:4321/mcp",
>       "headers": {
>         "X-SpecPilot-Token": "${SPECPILOT_MCP_TOKEN}"
>       }
>     }
>   }
> }
> ```

> [tab] Cursor
>
> ```json .cursor/mcp.json theme={null}
> {
>   "mcpServers": {
>     "specpilot-local": {
>       "url": "http://127.0.0.1:4321/mcp",
>       "headers": {
>         "X-SpecPilot-Token": "${env:SPECPILOT_MCP_TOKEN}"
>       }
>     }
>   }
> }
> ```

> [tab] VS Code
>
> ```json .vscode/mcp.json theme={null}
> {
>   "servers": {
>     "specpilot-local": {
>       "type": "http",
>       "url": "http://127.0.0.1:4321/mcp",
>       "headers": {
>         "X-SpecPilot-Token": "${env:SPECPILOT_MCP_TOKEN}"
>       }
>     }
>   }
> }
> ```

> [tab] Windsurf
>
> Put your `SPECPILOT_MCP_TOKEN` value in place of the placeholder.
>
> ```json ~/.codeium/windsurf/mcp_config.json theme={null}
> {
>   "mcpServers": {
>     "specpilot-local": {
>       "serverUrl": "http://127.0.0.1:4321/mcp",
>       "headers": {
>         "X-SpecPilot-Token": "<SPECPILOT_MCP_TOKEN value>"
>       }
>     }
>   }
> }
> ```

> [tab] Codex
>
> Codex reads `SPECPILOT_MCP_TOKEN` from the environment.
>
> ```toml ~/.codex/config.toml theme={null}
> [mcp_servers.specpilot-local]
> url = "http://127.0.0.1:4321/mcp"
> env_http_headers = { "X-SpecPilot-Token" = "SPECPILOT_MCP_TOKEN" }
> ```

> [tab] Antigravity
>
> Put your `SPECPILOT_MCP_TOKEN` value in place of the placeholder, and add the file to `.gitignore`.
>
> ```json .agents/mcp_config.json theme={null}
> {
>   "mcpServers": {
>     "specpilot-local": {
>       "serverUrl": "http://127.0.0.1:4321/mcp",
>       "headers": {
>         "X-SpecPilot-Token": "<SPECPILOT_MCP_TOKEN value>"
>       }
>     }
>   }
> }
> ```

Without the variable, the card puts the token itself in the config and says it changes each time `serve` starts. Add project config files to `.gitignore`.

## Check it works

Open the Setup view of a folder without specs. Step 1 shows `Waiting for a connection`, then `Connected` with your IDE's name once your IDE calls the server. Or ask your agent to list your SpecPilot projects.

## If it is refused

* **"did not carry a valid X-SpecPilot-Token header"**: the token changed when `serve` restarted. Copy the config again, or [keep the token](https://docs.specpilot.dev/mcp/on-off.md#keep-the-token).
* **Port already in use**: start with another port, for example `specpilot serve --port 4322`, and copy the config again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.