MCP config file locations: where each coding agent reads its servers

MCP clients do not share a config location or a file format. Cursor, Claude Code, Codex, Windsurf, VS Code, GitHub Copilot CLI, and OpenCode each document a user-level file, and all except Windsurf also document a file inside the project. Claude Desktop documents a single user-level file. The key that holds the servers is mcpServers in most clients, servers in VS Code’s own format, mcp in OpenCode, and mcp_servers in Codex. This reference lists every location and transport, then covers a gotcha for each client and how to keep tokens out of git. Vendor columns were checked on 13 October 2026, and formats change.

Updated 9 min read

Quick reference

ClientUser scopeProject scopeRoot keyTransports
Cursor~/.cursor/mcp.json.cursor/mcp.jsonmcpServersstdio, HTTP (url)
Claude Code~/.claude.json.mcp.jsonmcpServersstdio, HTTP (type: "http")
Claude DesktopmacOS: ~/Library/Application Support/Claude/claude_desktop_config.json. Windows: %APPDATA%\Claude\claude_desktop_config.jsonNot covered in the cited docsmcpServersstdio (local servers)
Codex~/.codex/config.toml.codex/config.toml, trusted projects onlymcp_servers (TOML tables)stdio, HTTP (url)
Windsurf~/.codeium/windsurf/mcp_config.json, the file the editor’s MCP discovery uses. The Open MCP config file action opens ~/.config/devin/mcp_config.json on macOS and LinuxNot covered in the cited docsmcpServersstdio, HTTP (serverUrl or url)
VS Codemcp.json in your user profile folder (run MCP: Open User Configuration), or the portable ~/.copilot/mcp-config.json.vscode/mcp.json, or the portable .mcp.jsonservers in VS Code’s format, mcpServers in the portable filesstdio, HTTP (type: "http")
GitHub Copilot CLI~/.copilot/mcp-config.json, moved by COPILOT_HOME.github/mcp.json and .mcp.jsonmcpServersstdio (type: "local"), HTTP (type: "http")
OpenCode~/.config/opencode/opencode.jsonopencode.json, or .opencode/opencode.jsonmcplocal (stdio), remote (HTTP)

“Not covered in the cited docs” means the pages in Sources name no such file, not that the client cannot read one.

What this table leaves out

It covers stdio and HTTP only. SSE servers are not listed, although several of these vendors still document an sse type. If a client rejects a snippet, treat the vendor documentation in Sources as the authority.

Notes for each client

Cursor

Cursor merges the user and project files, and the project entry wins when the same server name appears in both. A committed entry can therefore replace a personal one. Cursor resolves ${env:NAME}, ${userHome}, and ${workspaceFolder} in command, args, env, url, and headers.

Claude Code

User-scope and local-scope servers both live in ~/.claude.json, and a local entry sits under that project’s path, so use claude mcp add --scope user instead of editing the file by hand. General Claude Code settings live in a different file, ~/.claude/settings.json. The claude mcp add command defaults to local scope, which is private to you in the current project. Pass --scope user or --scope project for the other two, and project scope writes .mcp.json at the project root. When one server name is defined in several scopes, local beats project and project beats user, and the fields are not merged. Write type on every entry that has a url: Claude Code reads an entry with no type as a stdio server, so a url without a type is a configuration error. In interactive sessions, Claude Code asks you to approve the servers in a project .mcp.json. Editing .mcp.json takes effect after you restart the session.

Claude Desktop

The documented file covers local servers that the app starts, which is why the table lists stdio only. Settings, Developer, Edit Config opens the file and creates it if it is missing. Quit Claude Desktop fully and reopen it after editing, because closing the window is not enough. Use absolute paths to the server and to the runtime it needs, and on Windows write path separators as double backslashes or forward slashes.

Codex

The file is TOML and the top-level table is mcp_servers, not mcpServers: each server gets a [mcp_servers.<name>] table. The project file is read only for trusted projects, and project files rank above the user file. The Codex app, CLI, and IDE extension share this configuration. For an HTTP server, bearer_token_env_var stores a variable name instead of the token.

Windsurf

Windsurf’s documentation now sits under the Devin Desktop name. It describes two mcp_config.json files: the Open MCP config file action opens one in the Devin configuration directory, and the editor’s MCP discovery uses a separate file under ~/.codeium/windsurf/. We could not confirm from the documentation how the two relate, so check which one your installation reads before you edit. Rig’s project-scope link for Windsurf writes .windsurf/mcp.json, a path the cited documentation does not describe, so confirm that your version reads it. Remote servers need a serverUrl or url field. The documentation says references such as ${env:NAME} are interpolated in command, args, env, serverUrl, url, and headers.

VS Code

VS Code’s own format keeps servers under servers, not mcpServers, so rename the key when you copy a snippet from a Cursor or Claude Code file. VS Code also documents a portable format, .mcp.json in the workspace root or ~/.copilot/mcp-config.json for your user, which uses mcpServers. The Add Server flow in the current documentation lists .vscode/mcp.json and the user-profile mcp.json as deprecated destinations and prefers the portable ones, while the configuration reference still documents them. VS Code can prompt for a secret when a server first starts. Declare an inputs entry with type set to promptString and password set to true, then write ${input:your-id} in env. These prompts belong to VS Code’s own format, and the migration documentation lists ${input:...} variables among the fields that do not carry over to .mcp.json.

GitHub Copilot CLI

The CLI reads project definitions from the working directory up to the repository root, and they take precedence over the user file. When .github/mcp.json and .mcp.json sit in the same directory, .mcp.json wins. Workspace servers also require the folder to be trusted. The tools field lists the tools to allow, and ["*"] allows all. The documented types are local (or stdio), http (streamable-http is accepted as an alias), and sse.

OpenCode

command is an array rather than a string. The environment key is environment, not env, and enabled switches the server on. This is the layout in the classic OpenCode documentation, which puts servers directly under mcp. The v2 pages group servers under mcp.servers and use disabled in place of enabled, so check which version you run.

What Rig writes

Rig’s Link action, on the Connections screen, writes an entry named rig into the config of Cursor, Claude Code, Codex, Windsurf, VS Code, GitHub Copilot CLI, OpenCode, and Pi. Claude Desktop is not on that list. Every entry starts a stdio launcher, not an HTTP URL:

  • command is ~/Library/Application Support/Rig/bin/rig-mcp on a Mac, as an absolute path, and %APPDATA%\Rig\bin\rig-mcp.cmd on Windows. The path contains a space, so it sits alone in command.
  • args is empty.
  • env carries RIG_MCP_TOKEN and RIG_MCP_URL, which defaults to http://127.0.0.1:47823/mcp.

Rig rewrites the launcher on every start, so the path in your config stays valid. It also rewrites the configs it linked on every start. Four layouts show how the shapes differ, and the GitHub Copilot CLI and Pi entries carry extra fields of their own. Each layout below uses a placeholder token.

Cursor, in .cursor/mcp.json. Windsurf’s entry has the same fields, and Claude Code’s adds "type": "stdio":

JSON
{
  "mcpServers": {
    "rig": {
      "command": "/Users/you/Library/Application Support/Rig/bin/rig-mcp",
      "args": [],
      "env": {
        "RIG_MCP_TOKEN": "<project-token>",
        "RIG_MCP_URL": "http://127.0.0.1:47823/mcp"
      }
    }
  }
}

VS Code, in .vscode/mcp.json. The root key is servers and the entry carries a type:

JSON
{
  "servers": {
    "rig": {
      "type": "stdio",
      "command": "/Users/you/Library/Application Support/Rig/bin/rig-mcp",
      "args": [],
      "env": {
        "RIG_MCP_TOKEN": "<project-token>",
        "RIG_MCP_URL": "http://127.0.0.1:47823/mcp"
      }
    }
  }
}

Codex, in .codex/config.toml. The same entry is TOML tables:

TOML
[mcp_servers.rig]
command = "/Users/you/Library/Application Support/Rig/bin/rig-mcp"
args = []

[mcp_servers.rig.env]
RIG_MCP_TOKEN = "<project-token>"
RIG_MCP_URL = "http://127.0.0.1:47823/mcp"

OpenCode, in opencode.json. The command becomes an array and env becomes environment:

JSON
{
  "mcp": {
    "rig": {
      "type": "local",
      "command": ["/Users/you/Library/Application Support/Rig/bin/rig-mcp"],
      "enabled": true,
      "environment": {
        "RIG_MCP_TOKEN": "<project-token>",
        "RIG_MCP_URL": "http://127.0.0.1:47823/mcp"
      }
    }
  }
}

For a client that accepts a URL, Rig can also give you a generic HTTP snippet. The hub speaks Streamable HTTP at that address and expects a bearer header. Match the key names to the table, for example serverUrl for Windsurf or type: "http" for VS Code:

JSON
{
  "mcpServers": {
    "rig": {
      "url": "http://127.0.0.1:47823/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Reload after editing

A client needs a restart or reload before it lists a new server. These are the steps Rig’s own link hints give, plus the Claude Desktop step from the documentation:

  • Cursor: approve the MCP prompt when it appears.
  • Claude Code: start a new session.
  • Codex, GitHub Copilot CLI, and OpenCode: restart the client, then run /mcp to check that rig is listed.
  • VS Code: reload the window.
  • Windsurf: reload the MCP settings.
  • Claude Desktop: quit fully and reopen.

Keep tokens out of git

An env or headers value that holds a token is a credential in a file. Treat these files like the .env files in the env example checklist, including what to do when one leaks.

What the Rig hub token is. A random 24-byte hex string that Rig generates and keeps in its own mcp.json settings file, ~/Library/Application Support/Rig/mcp.json on a Mac. The hub listens on 127.0.0.1:47823 unless you change the port, takes the token as an Authorization: Bearer header, and answers a wrong one with a 401. There is one hub-wide token, plus an optional project-scoped token for each project.

What a token allows. Whatever the MCP access mode allows. read offers read-only tools, control adds starting, stopping, and ports, and full offers everything. A fresh install defaults to control, and writes wait for an Approve click in Rig. A project-scoped token cannot use the group start and stop tools or read the screen frame, and its kill_port frees only that project’s own port. See the MCP tools overview and Project-scoped MCP.

Project scope. Rig’s project-scope links use the project-scoped token, never the hub token. Rig refuses to write if git already tracks the file, because an exclude rule does not hide a tracked file. After writing, it appends the path to .git/info/exclude. That file belongs to your clone and does not travel with the repository, and Rig skips the step outside a git repository. Project-scoped MCP tokens explains when to prefer them.

Rotation. Rotating the token in Rig creates a new hub token and a new token for each project that had one. Rig rewrites your linked user-scope configs straight away and your project-scope files the next time it starts, so a project file keeps its old token, and gets a 401, until you restart Rig or link that project again. A copy of the old token anywhere else stops working.

Any other server. A project-scope file is shared the moment it is committed. Commit it only when every value in it is safe for anyone who can read the repository. Where a client supports references, write the variable name and keep the value in your shell: ${env:NAME} in Cursor and Windsurf, ${NAME} in Claude Code, ${input:id} prompts in VS Code, and bearer_token_env_var for an HTTP server in Codex. The MCP config generator writes the snippet for each client, rewrites ${NAME} references into each client’s own syntax, and warns when a value looks like a token.

Frequently asked questions

Where is the Cursor MCP config file?

~/.cursor/mcp.json for every project, and .cursor/mcp.json inside a project. Both use the root key mcpServers. Cursor merges them, and the project entry wins when a server name appears in both.

Why does my MCP config work in Cursor but not in VS Code?

The root key differs. Cursor and Claude Code read servers from mcpServers, and VS Code’s own mcp.json reads them from servers. Rename the key, or paste the snippet into the MCP config generator, which converts between the layouts. VS Code’s portable .mcp.json uses mcpServers, so a snippet in that layout belongs there.

Can I share MCP servers with my team through git?

Yes, for servers that need no secret. Claude Code reads .mcp.json, Cursor reads .cursor/mcp.json, and VS Code reads .vscode/mcp.json. Codex reads .codex/config.toml only for trusted projects. Use variable references for anything sensitive, and keep personal tokens in user-scope files.

Does Claude Desktop have a project-level MCP file?

The documentation we cite names one user-level file, claude_desktop_config.json, and no project file. The file covers local servers that the app starts.

Which transports do these clients accept?

Every client in the table accepts stdio, meaning it starts the server as a local program. All except the documented Claude Desktop file also accept a remote server over HTTP, under different key names. Cursor, Claude Code, Windsurf, VS Code, and Copilot CLI document an SSE transport as well.

Does Rig write these config files for me?

For seven of the eight clients, yes. The Link action on the Connections screen writes the rig entry for Cursor, Claude Code, Codex, Windsurf, VS Code, GitHub Copilot CLI, and OpenCode. Claude Desktop is not covered, so add Rig there by hand.

Sources

  1. Connect Claude Code to tools via MCPOfficial documentation, checked 13 October 2026
  2. Connect to MCP servers (Claude Code quickstart)Official documentation, checked 13 October 2026
  3. Cursor: Model Context Protocol (MCP)Official documentation, checked 13 October 2026
  4. Codex: Model Context ProtocolOfficial documentation, checked 13 October 2026
  5. Codex: Configuration referenceOfficial documentation, checked 13 October 2026
  6. Windsurf: Cascade MCP integrationOfficial documentation, checked 13 October 2026
  7. VS Code: MCP configuration referenceOfficial documentation, checked 13 October 2026
  8. VS Code: add and manage MCP serversOfficial documentation, checked 13 October 2026
  9. VS Code: migrate Copilot customizationsOfficial documentation, checked 13 October 2026
  10. GitHub Docs: adding MCP servers for Copilot CLIOfficial documentation, checked 13 October 2026
  11. OpenCode: MCP serversOfficial documentation, checked 13 October 2026
  12. OpenCode: MCP servers, v2 documentationOfficial documentation, checked 13 October 2026
  13. OpenCode: configOfficial documentation, checked 13 October 2026
  14. Model Context Protocol: connect to local MCP servers (Claude Desktop)Official documentation, checked 13 October 2026
  15. Rig documentation: Connect AI editors (MCP) (linker output, token scope, and git exclude behaviour confirmed in Rig’s source code)Rig source code, checked 13 October 2026

Run your whole stack from one window

Rig is a Mac app that starts, stops, and watches the processes in your project, with logs and ports in one place. Local use is free, and your source code stays on your Mac.

Related

https://userig.app/learn/mcp-config-file-locations