What you will be able to do
- Predict which tools an agent can call when several MCP servers are configured at once
- Choose between project scope (.mcp.json) and user scope (~/.claude.json) for a server, and say which definition wins when names collide
- Configure a shared server so each teammate's credential comes from ${VAR} expansion instead of being committed
- Write MCP tool descriptions that compete with built-in tools such as Grep
- Expose content catalogs as MCP resources, and choose an existing server over a custom build for standard integrations
Key concept
One combined tool surface — Claude Code connects to every configured MCP server and gives the agent all of their tools together, each named after its server. Three things decide how well that surface works: which servers are configured and at which scope, how their credentials get in, and how clearly each tool and resource describes itself.
1.Tools from every server arrive together
An MCP server gives Claude Code capabilities it doesn't have out of the box, such as querying a database, reading error reports or posting to chat. Most real projects use several servers. Before you design around them, you need a clear picture of what the agent actually sees when more than one is configured.
Every configured server is discovered when Claude Code connects, and all of their tools are available at the same moment. Claude Code connects to each server and asks for its tool list. That is why claude mcp list has a separate status for a server that connected but couldn't list its tools. The agent doesn't switch between servers, doesn't load them in order, and doesn't need the prompt to name a server. It picks from one combined list, so a single turn can call a schema tool, then an error-lookup tool, then a messaging tool.
Names keep the combined list unambiguous. Each MCP tool is exposed as mcp__<server>__<tool>, and the server part is the name you chose when you added it. If a GitHub server and a Jira server both expose a tool called search, the agent sees two distinct tools, one under each server's prefix.
You can inspect the whole set from code. The Agent SDK is the programmatic way to run the same Claude Code agent from a script instead of the terminal, and it accepts the same kinds of MCP server definitions. In the Python snippet below, query runs a session and streams back messages, and ClaudeAgentOptions carries the session's settings, including mcp_servers. At session start the stream includes a SystemMessage with the subtype init, an init message that lists every tool the session has. Filtering that list on the mcp__ prefix leaves the MCP tools from all servers.
async def main():
options = ClaudeAgentOptions(
mcp_servers={
# your servers
},
)
async for message in query(prompt="...", options=options):
if isinstance(message, SystemMessage) and message.subtype == "init":
mcp_tools = [t for t in message.data.get("tools", []) if t.startswith("mcp__")]
print("Available MCP tools:", mcp_tools)On recent models, tool search defers the full MCP tool definitions and loads each one when Claude needs it. This saves context but changes nothing about what is reachable: every tool from every connected server can still be called in the same session.
Checkpoint 1 of 9· Fill the gap
This Agent SDK snippet prints every MCP tool the session discovered, across all configured servers. Which prefix completes the filter so it keeps only the MCP tools?
async def main():
options = ClaudeAgentOptions(
mcp_servers={
# your servers
},
)
async for message in query(prompt="...", options=options):
if isinstance(message, SystemMessage) and message.subtype == "init":
mcp_tools = [t for t in message.data.get("tools", []) if t.startswith(" ? ")]
print("Available MCP tools:", mcp_tools)Every MCP tool name starts with mcp__, followed by the server name and then the tool name. The init message lists the tools from all connected servers in one combined set, so filtering on the shared mcp__ prefix returns the MCP tools from every server at once.
Source: code.claude.comCheckpoint 2 of 9· Exam question
A project has three MCP servers configured: a Postgres server, a Sentry server, and a Slack server, all healthy and connected. Mid-session, the agent is asked to pull a database schema, cross-reference a recent Sentry error, and post a summary to Slack in one request. What should the architect expect about tool availability for this request?
Correct answer: A — The agent receives the tools from the Postgres, Sentry and Slack servers in one combined tool list, so a single request can call schema, error and messaging tools in turn
- A. Correct. Tools from the configured MCP servers that are connected and healthy are merged into one tool list for the agent. A single request can therefore use Postgres, Sentry and Slack tools in whatever order the task needs.
- B. Claude Code does not pick one server by matching the prompt to a server name or topic. Tools from the connected servers sit in the same tool list. The agent chooses among them from their descriptions, so the prompt does not need to name a server, and this request needs tools from three servers anyway.
- C. Servers are not unlocked in stages. Tools from the connected servers are selectable from the start of the turn. The agent can call Sentry or Slack tools before, between or after Postgres calls, so finishing the schema step first is not required.
- D. Claude Code can hold connections to several MCP servers at once. The scenario's three servers are already connected together, so no disconnecting or reconnecting is needed to use a different server's tools.
2.Project scope for the team, user scope for experiments
Where a server is configured decides who gets it. The general split between shared and personal configuration is covered in Project (shared) vs user (personal) configuration scope. For MCP, it comes down to two files. A server the whole team relies on goes in .mcp.json at the project root, which is committed to the repository. A server you are only trying out goes in ~/.claude.json. Put it at user scope to have it in all your projects, or at local scope (the default) to keep it in the current project only.
| Scope | File | Available to | Use it for |
|---|---|---|---|
| local | ~/.claude.json, under the entry for this project | Only you, only this project. The default | Trying a server in one repo |
| project | .mcp.json in your project root | Everyone who clones the project | Shared team tooling |
| user | ~/.claude.json, under the top-level mcpServers key | Only you, all projects | Personal or experimental servers you want everywhere |
The scope is chosen with a flag: claude mcp add --scope project ... writes to .mcp.json, and --scope user writes to ~/.claude.json. Putting team tooling at user scope fails without any error. The server works on your machine, and every colleague who clones the repo goes without it.
A project server doesn't run just because it was committed. A server that arrives through .mcp.json shows as ⏸ Pending approval until each developer runs claude interactively and approves it. A new engineer who clones the repo and has already exported the right token still sees an approval prompt on first launch, and the server connects only after they accept it.
Names can collide across scopes. Suppose the repo's .mcp.json defines analytics, and one developer has a different analytics at local scope. Servers override by name in the order local, then project, then user. That developer gets the local definition as a whole. Fields from the project entry are not merged into it, and no conflict error appears. Everyone else still gets the project entry.
Checkpoint 3 of 9· Check yourself
Your team adds a Sentry server with claude mcp add --scope project ... and commits the resulting .mcp.json. A new engineer clones the repo, exports the needed token, and runs claude mcp list before ever launching claude. What status does the Sentry server show?
Committing .mcp.json shares the server definition, but it does not switch the server on. Each developer has to approve a project-scoped server interactively. Until they do, it shows as Pending approval, even if the token is already set.
“⏸ Pending approval (run `claude` to approve): a project-scoped server from .mcp.json that you haven’t approved yet.”Source: code.claude.com
Checkpoint 4 of 9· Exam question
A repository's .mcp.json defines a server named analytics, and a developer also has a server named analytics added with local scope on their machine pointing at a different endpoint entirely. When that developer runs Claude Code in the project, which server definition is used?
Correct answer: A — The local-scoped entry is used for this developer, and nothing from the project entry in .mcp.json is blended into its definition
- A. Correct. Local scope ranks above project scope, so on a name collision Claude Code takes the local entry as a whole. It does not blend in any fields from the project entry.
- B. Wrong. Being shared through version control gives .mcp.json no extra rank. Local scope outranks project scope, so the developer's local entry wins and the project entry is the one set aside. The developer does not need to remove or rename anything.
- C. Wrong. Entries with the same name are not combined field by field. One source wins and its complete definition is used, so a field set in the local entry never gets merged with fields from the project entry.
- D. Wrong. A name shared across scopes is not an error. Precedence between scopes settles it, so one definition still loads and connects. Nothing is skipped and no rename is required.
3.Committing the config, not the secret
Because .mcp.json is committed, anything typed into it is shared, including tokens. Claude Code fixes this by expanding environment variables inside the file. ${VAR} becomes the value of VAR in the shell of whoever runs Claude Code. ${VAR:-default} falls back to a default when the variable is unset. The committed file names the variable, and each person supplies the value.
{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
}
}
}Take a GitHub server rolled out to a whole team, where every engineer has their own personal access token. GitHub's server authenticates with a bearer header, not a browser sign-in. The right setup is a project-scoped entry in .mcp.json with the header Authorization: Bearer ${GITHUB_TOKEN}, and each engineer exports GITHUB_TOKEN in their own shell. The common alternatives each fail in a different way:
- A user-scoped entry with a pasted token never reaches the team.
- A local-scoped entry isn't stored in
.mcp.jsonat all. - Adding
.mcp.jsonto.gitignorekeeps the secret out, but it also stops sharing the file, which was the reason to use project scope.
The same expansion works for stdio servers. Put "API_KEY": "${API_KEY}" in the server's env block, and the launched process receives the user's key.
Checkpoint 5 of 9· Match them up
A team is deciding how to get each engineer's GitHub token into a shared MCP server. Match each setup to what it actually produces.
Tap a term, then the definition that fits it.
Claude Code expands ${VAR} and ${VAR:-default} inside .mcp.json from the shell of whoever runs it. That means the committed project file can name the variable while each person supplies the value. The other two setups either never reach the team or stop the file being shared.
“${VAR:-default}: expands to the value of VAR if VAR is set, or to default if it is unset”Source: code.claude.com
Checkpoint 6 of 9· Exam question
An architect is rolling out a GitHub MCP server for the whole engineering team. Every teammate has their own GitHub personal access token, and the config must be checked into the repo without ever committing a real secret. How should the architect configure this?
Correct answer: A — Add the server with project scope in .mcp.json, and set the header to Authorization: Bearer ${GITHUB_TOKEN}, with each teammate defining that variable in their shell environment
- A. Correct. Project scope writes the server to .mcp.json, which is committed and shared with the team. Claude Code expands ${GITHUB_TOKEN} from the environment of whoever connects, so each teammate's own token is used and no secret appears in the file.
- B. User scope stores the server in ~/.claude.json, a per-user file on one machine. Nothing is added to the repository, so the team does not receive a checked-in configuration, which the scenario requires.
- C. Local scope is private to one user in one project and does not write to .mcp.json, so the checked-in file would not hold the server. Having teammates edit a tracked .mcp.json to insert real tokens also risks committing a secret.
- D. Ignoring .mcp.json keeps it out of version control, so the server definition is never shared through the repo. Teammates would have to build their own copies, which fails the requirement for a checked-in team configuration.
4.Descriptions that win against built-in tools
An MCP tool sits in the same list as Claude Code's built-in tools, and the agent picks between them from their descriptions. The general rule is taught in Tool descriptions as the selection mechanism. The MCP-specific risk is that a short description loses to a familiar built-in. Imagine a docs server exposing search_docs described only as "Searches docs." Next to Grep, which the agent knows well, nothing in that description says why the MCP tool is the better choice, so the agent greps raw files instead.
The fix is to describe the capability and the output in detail. Say what the tool searches that Grep can't reach, such as an indexed doc hierarchy or content that isn't in the working tree. Say what it returns, for example ranked sections with their paths and titles. Say when to use it and when not to, and what it leaves out. A brief description leaves Claude with open questions about how the tool behaves. The detailed version gives Claude a concrete reason to route the request to the MCP tool.
Checkpoint 7 of 9· Check yourself
Despite a connected docs MCP server whose search_docs tool is described only as "Searches docs.", the agent keeps using Grep on raw files. Which change fixes the cause?
The agent chooses between MCP tools and built-in tools based on their descriptions. A short description gives it no reason to prefer the MCP tool over Grep. Describing the tool's capabilities and outputs in detail fixes this. Removing the built-in or adding servers doesn't, and all servers' tools are already available together.
“Provide extremely detailed descriptions. This is by far the most important factor in tool performance.”Source: platform.claude.com
Sources4
5.Resources as content catalogs
Tools are not the only way a server can offer data. MCP defines three primitives, and they differ in who controls them. Tools are called by the model. Resources are data that the client application attaches and manages, so the model doesn't have to decide to fetch them. That difference makes resources the right fit for a catalog: a list of what exists, which the client can surface before the model starts guessing with searches.
| Primitive | Control | Example |
|---|---|---|
| Prompts | User-controlled | Slash commands, menu options |
| Resources | Application-controlled | File contents, git history |
| Tools | Model-controlled | API POST requests, file writing |
Without a catalog, an agent finds data by trial and error. It calls a list tool, then a search tool, then another search with different terms, and each round spends a turn and some context. A server that exposes its catalog as resources skips this. The resources/list request returns entries with a uri, a name, an optional description and a mimeType. Typical catalogs are issue summaries, a documentation hierarchy, or one entry per database table schema. resources/read fetches the full content of one entry. A server that sets listChanged sends a notification when the catalog changes, so the client's view doesn't go stale.
The catalog reaches the agent through the client, not through a model-initiated search. In Claude Code the path runs like this:
- Claude Code, as the client, sends
resources/listto a server that supports resources. The model plays no part in this call. - The listed entries become available in the
@mention autocomplete, which is fuzzy-searchable, so you can find a resource by name instead of remembering its URI. - When you reference one as
@server:uri, Claude Code reads it and attaches the content to the conversation, so it is already in context when the model starts work. - Claude Code also gives the model tools to list and read MCP resources, so when nobody mentioned a resource the model can enumerate the catalog in one call and then read the entry it needs, instead of probing with repeated searches.
Resources therefore remove exploratory tool calls in two cases: a person points at an entry, so nothing is searched for, or the model lists a catalog once instead of searching repeatedly. A catalog nobody references and the model never lists saves nothing.
Compare @postgres:schema://users with @docs:file://database/user-modelCheckpoint 8 of 9· Match them up
Suppose a database MCP server wants to make its table schemas available. Match each MCP primitive to who controls it and what role it could play.
Tap a term, then the definition that fits it.
Resources are data that the client attaches and manages, so a catalog exposed as resources reaches the agent through the client rather than through the model searching for it. Tools are called by the model, which is why discovering data through tools means trial-and-error calls. Prompts are invoked by the user.
“Resources | Application-controlled | Contextual data attached and managed by the client”Source: modelcontextprotocol.io
6.Use an existing server before building your own
For standard systems such as GitHub, Sentry, Jira, browsers and databases, someone has usually published a server already. Connecting one takes a single command. claude mcp add --transport http sentry https://mcp.sentry.dev/mcp adds a hosted server. claude mcp add playwright -- npx -y @playwright/mcp@latest launches a local one. Both arrive with their tools already defined and maintained by someone else. Writing your own Jira or GitHub server means building and maintaining the same tool surface yourself, and each overlapping tool gives the agent one more ambiguous choice.
Build a custom server when the workflow is specific to your team, for example an internal deployment process or a proprietary records system that no public server covers. If those tools live in your own code, the Agent SDK can host them as an in-process SDK MCP server. You can also package them as a server that teammates launch through .mcp.json, like npx -y @your-org/api-mcp-server. Either way, keep the custom tool set small and specific to that workflow.
Checkpoint 9 of 9· Check yourself
Two integrations are planned for a team's Claude Code setup: Jira, and the team's own internal deployment process, which no public server covers. Which plan follows the lesson's guidance?
Jira is a standard system with published servers whose tools someone else maintains. Rebuilding it means maintaining the same tools yourself and gives the agent overlapping, ambiguous choices. A custom server is for team-specific workflows like an internal deployment process, and its tool set should stay small.
“bloated tool sets that cover too much functionality or lead to ambiguous decision points about which tool to use”Source: www.anthropic.com
Practise it for real
Add a shared, credential-safe MCP server to a project and confirm what the agent can see.
1.In a project directory, run
claude mcp add --scope project --transport http claude-code-docs https://code.claude.com/docs/mcp.Why: Project scope writes the entry to .mcp.json, the file that gets committed and shared.
You should see: A new .mcp.json at the project root containing a claude-code-docs entry with type http.
2.Run
claude mcp list.Why: A project-scoped server has to be approved before it connects.
You should see: claude-code-docs listed as ⏸ Pending approval (run
claudeto approve).3.Run
claude, approve the server, then type/mcp.Why: Approval is a separate step for each developer, even after the file is committed.
You should see: The server shown as connected in the /mcp panel.
4.Ask:
Use the claude-code-docs server to look up what MCP_TIMEOUT does.Why: Confirms the server's tools are in the agent's tool set next to the built-in tools.
You should see: Claude calls a tool whose name starts with mcp__claude-code-docs__ and answers from the docs.
5.Clean up with
claude mcp remove claude-code-docs.Why: Leaves the project as you found it.
You should see: The entry is gone from
claude mcp list.
Stuck? Get a nudge
If /mcp shows No MCP servers configured, check that you ran the add command from the same project directory.
Sources
(8)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://code.claude.com/docs/en/mcp-quickstartOfficial docs
“The server connected but couldn’t list its tools”
↩︎ Tools from every server arrive together“Claude Code uses whatever name you pick to label the server’s tools in Claude’s output”
↩︎ Tools from every server arrive together“Everyone who clones the project”
↩︎ Project scope for the team, user scope for experiments“A project-scoped server you haven’t approved yet.”
↩︎ Project scope for the team, user scope for experiments“for servers that take a token instead, like GitHub’s, pass it with --header”
↩︎ Committing the config, not the secret“Claude Code uses whatever name you pick to label the server’s tools in Claude’s output”
↩︎ Key concept“The server connected but couldn’t list its tools”
↩︎ Exam trap 1 - 2.https://code.claude.com/docs/en/mcpOfficial docs
“All MCP tools deferred and loaded on demand.”
↩︎ Tools from every server arrive together“${VAR}: expands to the value of environment variable VAR”
↩︎ Committing the config, not the secret“Resources are automatically fetched and included as attachments when referenced”
↩︎ Resources as content catalogs“Claude Code automatically provides tools to list and read MCP resources when servers support them”
↩︎ Resources as content catalogs“Resource paths are fuzzy-searchable in the @ mention autocomplete”
↩︎ Resources as content catalogs“${VAR}: expands to the value of environment variable VAR”
↩︎ Exam trap 3“a project-scoped server from .mcp.json that you haven’t approved yet”
↩︎ Exam trap 4“⏸ Pending approval (run `claude` to approve): a project-scoped server from .mcp.json that you haven’t approved yet.”
↩︎ Checkpoint“${VAR:-default}: expands to the value of VAR if VAR is set, or to default if it is unset”
↩︎ Checkpoint - 3.https://code.claude.com/docs/en/features-overviewOfficial docs
“MCP servers override by name: local > project > user.”
↩︎ Project scope for the team, user scope for experiments“MCP servers override by name: local > project > user.”
↩︎ Exam trap 2 - 4.
“Provide extremely detailed descriptions. This is by far the most important factor in tool performance.”
↩︎ Descriptions that win against built-in tools“The poor description is too brief and leaves Claude with many open questions about the tool’s behavior and usage.”
↩︎ Descriptions that win against built-in tools - 5.
“Contextual data attached and managed by the client”
↩︎ Resources as content catalogs“Resources | Application-controlled | Contextual data attached and managed by the client”
↩︎ Checkpoint - 6.
“listChanged: whether the server will emit notifications when the list of available resources changes.”
↩︎ Resources as content catalogs - 7.https://code.claude.com/docs/en/agent-sdk/mcpOfficial docs
“If you’re building your own tools in code, use an SDK MCP server”
↩︎ Use an existing server before building your own - 8.
“One of the most common failure modes we see is bloated tool sets that cover too much functionality”
↩︎ Use an existing server before building your own“bloated tool sets that cover too much functionality or lead to ambiguous decision points about which tool to use”
↩︎ Checkpoint