Anysphere · Cursor editor · Cursor CLI
Cursor config file: where it lives & format
Cursor MCP config file: where .cursor/mcp.json lives, its format and copy-paste examples. For the full walkthrough, see the step-by-step guide.
1. Find the config file
.cursor/mcp.json (project)~/.cursor/mcp.json (global)
Uses the "mcpServers" key. Remote servers take a "url" (plus optional "headers").
2. Add a local (stdio) server
Example: Context7, which runs locally with npx.
.cursor/mcp.json{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
]
}
}
}
3. Add a remote (HTTP) server
Example: Notion's hosted server. You sign in with OAuth the first time it connects.
.cursor/mcp.json{
"mcpServers": {
"notion": {
"url": "https://mcp.notion.com/mcp"
}
}
}
4. If it won't connect
- Validate the file. One trailing comma breaks the whole file.
- Check the top-level key: VS Code uses
servers; Claude Code, Cursor and Antigravity usemcpServers; Codex uses TOML tables. - If
npxisn't found, the app may not see your shell's PATH (common with nvm). Use the full path tonpx. - Restart the agent or reload the window after editing.
Cursor MCP transports, variables and OAuth
Cursor supports three MCP transports: stdio (a local command Cursor manages), SSE and Streamable HTTP (a URL, with OAuth). Official servers install with one click from the Cursor Marketplace in Customize, and team admins can distribute servers through a team marketplace; those appear in Customize alongside your personal and workspace servers.
mcp.json supports interpolation, so secrets can stay out of the file: ${env:NAME} for environment variables, ${userHome}, ${workspaceFolder} (the folder containing .cursor/mcp.json) and ${workspaceFolderBasename}. Stdio servers can also load an envFile such as ${workspaceFolder}/.env, but remote HTTP and SSE servers do not support envFile.
For providers without OAuth dynamic client registration, mcp.json accepts static OAuth credentials: CLIENT_ID is required, CLIENT_SECRET and scopes are optional. Without scopes, Cursor reads scopes_supported from /.well-known/oauth-authorization-server. Cursor uses fixed OAuth redirect URLs, so when you set up the provider's OAuth app, register both the web and desktop callbacks if your users sign in from both. For community servers, Cursor points to cursor.directory.
Source: cursor.com · Checked Oct 24, 2026
Frequently asked questions
.cursor/mcp.json (project) or ~/.cursor/mcp.json (global).
Guides, pricing & comparisons
How to add an MCP server to Cursor
Portable agent skills: one SKILL.md for every coding agent
Agent Skills moves to the Agentic AI Foundation: what changes
MCP security: the risks in MCP servers and how to lock them down
Cursor Agent SDK: build, test and deploy agents as code
MCP OAuth: connect a remote MCP server in Claude Code, Codex and Cursor
Cursor rules examples: .mdc files for each rule type
Fix spawn npx ENOENT when starting an MCP server
MCP connection closed: find why a server will not connect
Claude Fable 5.2: model choice, CursorBench and Pro week
Cursor Auto mode and Cursor Router: Cost, Balance and Intelligence
Cursor Cloud Agents (formerly Background Agents): setup, access and limits
Gemini 4 Carbon in coding tools: API pricing, Cursor and CursorBench
MCP Apps: add interactive UI to an MCP server for Claude and Cursor
Cursor vs Claude Code: documented features compared
OpenAI Codex vs Cursor: documented features compared
Cursor vs GitHub Copilot: documented features compared
Google Antigravity vs Cursor: documented features compared
Cursor pricing, usage pool and limits
AGENTS.md vs CLAUDE.md vs Cursor rules
AGENTS.md templates for Laravel and Next.js
MCP servers that work in every coding agent