One MCP server name can be declared in three places at once. Ask a team which server sits behind a given tool and you may get three answers. Each can point at a different endpoint with different permissions, and only one of them is running. Getting that right starts before any config edit, with a plain question: who should be able to reach this tool at all?
Scope is a security decision
An MCP server can read files, call APIs, query databases or trigger actions far outside the editor. Where you register it decides how far that reach goes. Scope decides where the server is available, where its definition lives and who can change it.
Treat scope as an afterthought and one of two things happens. A team dependency hides in one person's private configuration. Or a personal credential gets committed into the repository.
Claude Code has three scopes: local, project and user. They describe who can use a server; the files behind them are a detail. Choose by blast radius, meaning who gets the server's power if something goes wrong. Is the server tied to one checkout, safe for every contributor, or a personal tool that should follow one developer between repositories?
Storage separates shared declarations from private state
A project-scoped server is declared in .mcp.json at the repository root. It travels with the project and shows up in a pull request. That makes it the right home for shared definitions whose endpoint, arguments and required environment-variable names are safe for anyone who can read the repository.
Local and user-scoped registrations normally live in home-level Claude Code state, commonly ~/.claude.json. Local ties a server to one project on that machine. User makes it available across all of that developer's projects. The exact JSON nesting is internal and can change between versions. Confirm registrations with Claude Code's MCP inspection commands instead of scripting against hand-edited paths.
The word "local" confuses people. It means private to one project, yet the declaration lives outside the checkout. A third file adds to the mix-up: its name suggests it holds these registrations, but it never does.
The three files people mix up
Most scope confusion is really file confusion. Keep these three apart and the rest tends to follow:
.mcp.json: sits at the repository root, committed and reviewable in a pull request. It holds project-scoped server declarations, meaning identity, transport, endpoint or package reference, and the names of required environment variables. It is a shared contract, and secrets stay out of it.~/.claude.json: home-level Claude Code state that lives outside any checkout. It holds both local-scoped registrations, bound to one project on this machine, and user-scoped ones, available across this developer's projects. It is private by default and does not travel with a clone..claude/settings.local.json: project-local Claude Code settings and permission grants. No MCP server is ever registered here, and mistaking it for.mcp.jsonis exactly how a definition can look committed when it is not.
One more term needs pinning down. Shadowing is one scope silently overriding another of the same name. Local beats project, and project beats user. So the server that runs may not be the one anyone reviewed in .mcp.json.
Name collisions resolve from local to project to user
The precedence is deliberate. A team publishes a project definition. A developer points the same name at staging locally for an afternoon. A user-wide personal tool still acts as the fallback everywhere else.
The cost of that flexibility is silent shadowing. For example, say all three layers define analytics. The developer who pointed it at staging "for an afternoon" can still be calling staging weeks later, and nobody notices. Identical names can carry different permissions, endpoints, or transports.
Prove the precedence with a harmless test server before you trust it on a live repository. The test takes about ten minutes:
- Register a test server in each of the three scopes, each with a distinct scope label in its output.
- After each registration, confirm which file changed. Project should alter
.mcp.json; local and user should alter home-level Claude Code state. - In that repository, inspect the resolved server and call the harmless tool once. The label tells you the winning layer.
- Repeat the call from a second repository. That separates a project-specific local entry from a user-wide one.
Keep the test name well away from production. Rerun the check after a Claude Code update, a home-directory migration or a change to a managed development environment. Any of them can move the storage underneath you.
The scope matrix exposes the real trade-offs
| Scope | Availability | Primary storage | Repository exposure | Secret posture | Migration behavior |
|---|---|---|---|---|---|
| Local | One developer in one project | Project-associated data in ~/.claude.json |
None by default | Reference a local environment variable or secret manager; keep values out of config | Does not follow a clone; recreate or transfer through an approved personal setup process |
| Project | Contributors working from the repository | .mcp.json in the project root |
High if committed or shared | Store only non-sensitive declaration data and variable names; never place tokens in the file | Travels with the repository; each person supplies approved credentials locally |
| User | One developer across projects | User-level data in ~/.claude.json |
None by default | Suitable for personal credentials with controlled local storage | Transfer selectively; copying a whole home config can bring unrelated servers and stale secrets |
Project scope alone does not make a server safe for the team. A shared declaration can still be risky. It may point at a script that can change, accept any shell arguments, or ask every contributor to export a powerful token. Git makes the definition visible and reviewable. It does not check what the server does or approve the data it can reach.
So a project entry holds only what is needed to connect: the server name, an approved transport, the endpoint or package, and the names of required settings. Login values belong in each developer's approved secret store, or in the company's identity system if there is one. Git then keeps a clean history with no credentials in it.
Repo safety breaks at four predictable points
The first failure is a token committed in .mcp.json, sometimes as a literal env value. Removing it later does not erase it from clones, forks, CI logs or Git history. Rotate it, assess the exposure, and replace it with a reference or a documented variable name.
The window is wider than it looks. Picture a repository with 30 contributors and a CI system that clones it about 200 times a day. A token committed on Monday and removed on Friday has been copied into roughly 1,000 CI workspaces. Add every laptop that pulled that week and any fork. Rewriting history cleans one remote, not the copies. So rotation comes first and history cleanup second. Rotation takes minutes and closes every copy at once; a force-push closes none of them.
The second failure is an absolute local path in a project declaration. It works for its author and breaks on other systems, home folders, containers or remote machines. A project server must work from the repository alone, or from a documented setup step anyone can follow. Otherwise it is a local tool with a project label.
The third is more power than the job needs. A read-only documentation connector and a server that writes production records need very different levels of trust. Write down what data a server can reach, what it may do and which credentials it needs. Its name tells you none of this. The OWASP Top 10 for LLM Applications (2025 edition) lists this risk as LLM06, excessive agency. Give a model tools with more permission than it needs, and sooner or later it will use them in a way nobody intended, through a bug or through injected instructions.
The fourth is quieter. A user-scoped server can suddenly work in a brand-new repository, because user scope is available everywhere while the project has no record of it. That is fine for a personal utility. It is wrong for anything the team must understand, audit and support.
Shared servers also carry a newer attack. In April 2025 the security firm Invariant Labs described "tool poisoning" attacks. Instructions hidden in an MCP tool's description push the model into actions the user never asked for, such as reading private files and passing them to another tool. A project-scoped server arrives with every clone. Review its descriptions like any other dependency: pin the version, read what the tool tells the model about itself, and treat an unexplained change in a description as a security incident.
Make .mcp.json a team contract
Review a new entry in .mcp.json the way you would review a new package dependency. Paste these six questions into the pull-request template:
- What problem does the server solve, and who owns it?
- What data does it receive?
- What actions can it take, read-only or write?
- Where does its authentication come from?
- How does it behave when its endpoint is down?
- Which pinned version is declared, and what do its tool descriptions say?
If those answers live only in one developer's shell history, the integration is not shared.
Give every project-scoped server an owner. That person need not field every support request. They do decide when the endpoint changes, when permissions expand and when the server is retired. Pair the review with a short validation note: the expected tool name, a non-sensitive test request and the permission boundary that must not move.
Two numbers keep this honest. The count of project servers without a named owner should stay at zero. The count of entries whose validation request has not run in the last 90 days catches servers that exist on paper but no longer behave as reviewed.
Keep installation commands and onboarding screenshots in the setup hub. This guide governs storage and sharing. A single hub can maintain the platform-specific steps without turning .mcp.json into a competing manual.
Versioned declarations matter more as the number of servers grows. Informal config in home folders stops working at scale: nobody can review it, it has no visible owner, and it disappears when a laptop is replaced. Putting every server into Git is not the answer either. Version the safe declarations, keep credentials out of the repository, and use local and user scope for personal settings.
Claude Code's MCP documentation is the reference for how scopes behave. Check it again when you upgrade, especially if automated onboarding or managed machines rely on where config is stored. A scope model people understand lasts longer than a script tied to an undocumented JSON layout.
Choose the smallest scope that preserves work
Reach for local scope first. It suits experimental connectors, repository-specific debugging tools and servers whose credentials are not fit for broad use. It limits accidental distribution while the team works out whether the tool is worth maintaining.
Move to project scope only after a reproducibility test passes. A new contributor should understand what the server is for, get access through an approved route, and use it without borrowing anyone's secret. The project gains a shared contract and takes on the review and support work that comes with it.
Save user scope for personal tools that do the same job across repositories, such as a private knowledge connector or a developer-owned workflow service. Never use it for anything the build, test, release or incident process depends on. A required dependency belongs under project governance even when its credentials stay local.
| Decision question | Preferred scope |
|---|---|
| Does the server contain personal access, temporary endpoints, or unproven permissions? | Local |
| Must a clean checkout reveal the server and its approved purpose to every contributor? | Project |
| Does one developer need the same non-project-specific tool in unrelated repositories? | User |
| Would a duplicate name create a dangerous endpoint or permission change? | Rename it or remove the lower-priority definition |
Small teams have a fair complaint here. Two developers, one repository, one internal API. A shared .mcp.json with owners, review notes and validation requests looks like ceremony, while user scope takes a minute. As long as both know exactly what the server does and neither can write production data through it, the shortcut is defensible.
The shortcut stops working at clear points. A third person joins who was not there when the server was added. A CI job starts to depend on the tool. A credential can write data. Each of these turns a private habit into a hidden team dependency. The rule: keep personal scope while the team is two people and the server is read-only. As soon as either changes, move the declaration into .mcp.json and give it an owner.
Rerun the ten-minute precedence test after each upgrade, and a shadowed definition shows up in a test log long before it can show up in an incident.