Claude Code MCP scopes: local, project and user
Claude Code has three places a server can live, and claude mcp add picks the least obvious one by default. That single fact explains most “my server vanished” reports. This page covers where each scope is stored, what .mcp.json is for and which scope wins when names collide.
| Scope | Stored in | Added by default | Visible in | Shared |
|---|---|---|---|---|
| Local | ~/.claude.json, under projects.<path>.mcpServers | Yes | The project it was added in | No |
| Project | .mcp.json at the project root | No, --scope project | That project | Yes, through git |
| User | ~/.claude.json, top-level mcpServers | No, --scope user | Every project | No |
This is why a server “disappears”. claude mcp add with no flag stores the server in local scope, which belongs to the directory you ran it in. Open Claude Code in another directory and the server is not there, because it was never defined there. On Windows the file is %USERPROFILE%\.claude.json.
Add, list and remove
claude mcp add --transport http <name> <url>
claude mcp add --scope project --transport http <name> <url>
claude mcp add --scope user --transport http <name> <url>
claude mcp list
claude mcp get <name>
claude mcp remove <name>
Project scope: .mcp.json
A .mcp.json file at the root of a repository is meant to be committed, so everyone who opens the project gets the same servers.
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "https://example.com/mcp"
}
}
}
- Approval. In interactive sessions Claude Code asks before it uses a server defined in a project’s
.mcp.json, so the servers of a repository you just cloned do not start without your say-so. - Environment variables.
${VAR}expands to the variable and${VAR:-default}falls back to a default. This works incommand,args,env,urlandheaders, which keeps secrets out of the committed file.
Which one wins
If the same server name exists in more than one place, Claude Code connects once, in this order: local, project, user, then servers supplied by plugins, then claude.ai connectors, with organisation-managed servers ranking above all of them. The whole entry from the winning source is used; fields are not merged across scopes. A project-scoped server with the same name as a user-scoped one does not inherit its env; it replaces it.
Turning a server off
Claude Code’s /mcp panel switches servers on and off per project. Separately, ~/.claude/settings.json can carry a deniedMcpServers array of objects with a serverName field. Kytto reads that list as “off”. A denied server stays fully defined in the config and simply does not run, so a server that looks correctly configured, and is, can still be switched off from a file you were not looking at.
About ~/.claude.json itself
It is not a small config file. It also holds per-project history and routinely runs to hundreds of kilobytes, so do not edit it in a tool that reformats on save. Claude Code also writes an empty mcpServers: {} entry for every directory it has ever run in, so an empty entry tells you nothing: a long-used machine carries dozens of them. Close Claude Code before editing, because it rewrites the file.
Kytto shows the top-level mcpServers as “Claude Code” and reads each projects.<path>.mcpServers entry that actually defines a server as its own read-only row, labelled with the project path. It does not search your repositories for .mcp.json files.