Lesson 36.1 · 1 of 5 · 4 min read · Reviewed 24 Nov 2026
The `.mcp.json` file and scopes
By the end, you can
- Configure MCP servers in .mcp.json.
- Choose local, project or user scope.
Chapter 35 explained what MCPModel Context Protocol (MCP): An open protocol that standardises how AI applications connect to tools, data and prompts through servers. is. Here’s how a host such as Claude CodeClaude Code: Anthropic’s agentic coding tool that works in your terminal, IDE and CI, reading and editing code and running commands. configures its servers.
.mcp.json
{
"mcpServers": {
"tracker": {
"command": "npx",
"args": ["-y", "@example/tracker-mcp"],
"env": {"TRACKER_TOKEN": "${TRACKER_TOKEN}"}
},
"docs": {
"type": "http",
"url": "https://mcp.example.com/docs"
}
}
}
The first is a stdiostdio transport: Running an MCP server as a local process that talks to the client over standard input and output. server started as a command; the second is a remote HTTP server.
Scopes
| Scope | Where it lives | Who gets it |
|---|---|---|
| local | Your user settings, for this project | You, here |
| project | .mcp.json in the repo |
The whole team |
| user | Your user settings | You, everywhere |
claude mcp add --scope project … writes to .mcp.json. For safety, Claude Code asks each person to approve project servers before first use.
Key points
- .mcp.json at the project root lists the team's shared MCP servers.
- Local scope is just you in this project; user scope is you in every project.
- Commit .mcp.json so the whole team gets the same servers, but never put secrets in it.
Add a shared project MCP server
Add one MCP server at project scope, see it land in .mcp.json, and add a second one at local scope for comparison.
You will have: A committed .mcp.json with one project server, plus a short note of which scope each of your servers uses and why.
Steps
- In a scratch git repository, run claude mcp add --scope project with a harmless server, for example the reference filesystem server pointed at the repo folder.
- Open .mcp.json at the project root and check the server's command, args and env appear there.
- Add a second server with --scope local and confirm it does not appear in .mcp.json.
- Start Claude Code in the repo, approve the project server when asked, and run /mcp to see both servers and their status.
- Run claude mcp list from a terminal and compare its output with /mcp.
- Write two lines in the repo README saying which server is shared with the team and which is just yours.
Done when
- .mcp.json lists exactly the project server and contains no tokens.
- /mcp shows both servers as connected.
- A fresh clone of the repo picks up the project server but not the local one.
Docs: Connect Claude Code to tools via MCP (Claude Code docs) · Model Context Protocol: introduction