How to add MCP servers to Cursor (mcp.json)
Cursor reads MCP servers from an mcp.json file. You can also install servers from the Cursor Marketplace on the Customize page.
Checked against the official docs on 2026-11-26. Apps change often; the sources are linked at the bottom.
Where the config file lives
| Global, all projects (macOS, Linux; on Windows in your user folder) | ~/.cursor/mcp.json |
| One project | .cursor/mcp.json in the project root |
| Top-level key | mcpServers |
Add a local server (runs on your computer)
- Add a command-based (stdio) server
Give the command, its arguments and any environment variables. Use${env:NAME}to read a secret from your environment instead of pasting it.{ "mcpServers": { "github": { "command": "docker", "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GITHUB_TOKEN}" } } } } - Turn it on
Open Customize in the sidebar, find the server under MCP and make sure its toggle is on.
Add a remote server (a URL)
- Add the server URL
Remote servers just need aurl. Addheadersonly if the service uses an API key.{ "mcpServers": { "linear": { "url": "https://mcp.linear.app/mcp" }, "remote-with-key": { "url": "https://api.example.com/mcp", "headers": { "Authorization": "Bearer ${env:MY_SERVICE_TOKEN}" } } } } - Sign in
For OAuth servers, Cursor runs the sign-in for you (authorization code flow with PKCE) and finishes it in your browser. Servers installed with Add to Cursor from the Marketplace sign in with OAuth as part of the install.
Tips
- Logs: open the Output panel (Cmd/Ctrl+Shift+U) and pick MCP Logs.
- Updating an npm-based server: remove it in Customize, run
npm cache clean --force, then add it again. - Cursor supports stdio, SSE and Streamable HTTP servers.
- The global
~/.cursor/mcp.jsonapplies in the editor and the Cursor CLI. Hosted Cloud Agents don't read it: they use the servers set up at cursor.com/agents and your team's servers, and keep their own sign-ins (to sign out there, use the server's Cloud row in Customize).
Common problems in Cursor
- MCP server not showing in Cursor (or showing a red dot)
- Fix "spawn npx ENOENT" when starting an MCP server
- MCP server can't see my API key (env vars not passed)
- Too many MCP tools: trimming tools in Cursor, VS Code, Codex and Devin Desktop
- Remote MCP server says "Needs authentication" or 401 after it used to work