Configure MCP servers at the right scope
-
MUST choose the scope by who needs the server, not by convenience:
Scope Who gets it Use for Claude Code location User You, in every project Personal tools you use everywhere (your memory store, notes, personal calendar) ~/.claude.json(--scope user)Local (default) You, in this project only Experiments, personal credentials for a project service, servers you have not reviewed for the team ~/.claude.jsonunder the project path (--scope local)Project Everyone who clones the repo Servers the project needs to be worked on (its database, issue tracker, code index) .mcp.jsonat repo root, committed (--scope project)Managed Everyone in the organisation Approved corporate servers; allow/deny policy Managed settings / managed-mcp.json -
MUST NOT put secrets in
.mcp.jsonor any committed config. Reference them as environment variables (${API_KEY}) supplied by each user’s environment or secret store, or use the server’s OAuth sign-in. -
MUST review a project-scoped server like code before committing it: it will be offered to everyone who opens the repo.
-
MUST give the same server one definition. When a name is defined in several scopes, the highest-precedence definition wins whole (Claude Code: local, then project, then user, then plugin, then connectors, with organisation-managed above all), so duplicates silently shadow each other.
-
SHOULD make
.mcp.jsonportable: no absolute paths to one person’s machine,${VAR:-default}for URLs that differ by environment, and a README orAGENTS.mdline saying which variables each server needs. -
SHOULD prefer the HTTP transport for remote servers and stdio for local processes; avoid deprecated transports (SSE) where HTTP is available.
-
SHOULD, in organisations, publish approved servers through managed configuration and restrict which others may be added.
-
SHOULD remove servers that are no longer used; every configured server adds tools, startup time and attack surface.
-
MAY keep a personal override of a project server at local scope (for example pointing at your own test instance), knowing it shadows the project definition for you.
When to apply
Section titled “When to apply”Adding, sharing or auditing MCP servers for any MCP client. Locations above are for Claude Code; other clients have equivalent user, workspace and organisation scopes — check their docs.
Examples
Section titled “Examples”# Personal, everywhereclaude mcp add --scope user --transport stdio notes -- notes-mcp-server# Team, committed in .mcp.jsonclaude mcp add --scope project --transport http issues https://issues.example.com/mcp# Just me, this project (default)claude mcp add --transport http staging-db https://staging.example.com/mcp.mcp.json (committed):
{ "mcpServers": { "issues": { "type": "http", "url": "${ISSUES_URL:-https://issues.example.com}/mcp", "headers": { "Authorization": "Bearer ${ISSUES_TOKEN}" } }, "code-index": { "type": "stdio", "command": "codanna", "args": ["serve", "--watch"] } }}Anti-patterns
Section titled “Anti-patterns”- A personal API key committed in
.mcp.json. - The same server added at user and project scope with different settings, so team members get different tools.
- Every experimental server added at user scope, loading into every project.
- Absolute
/Users/alice/…paths in a shared config.
Checklist
Section titled “Checklist”- Scope matches audience (user / local / project / managed)
- No secrets in committed config; variables documented
- Project servers reviewed before commit
- One definition per server name
- Unused servers removed