MCP Integration in Claude Code
MCP servers and tool integration in Claude Code
Last reviewed
Recommended
MCP Integration in Claude Code — Timed Test 5 (10 questions)
No account needed. Answers and explanations arrive when you submit.
What this topic tests
The mix every MCP Integration in Claude Code set is built to, and the questions published against it so far. Nothing here is hidden before you start.
| Level | Target share | Published |
|---|---|---|
| Easy | 40% | 20 |
| Medium | 40% | 20 |
| Hard | 20% | 10 |
| Total | 50 |
MCP Integration in Claude Code — the theory
What Connecting A Server Actually Changes
Connect a server when you keep pasting data into chat from a system Claude cannot see. What MCP is as a standard is a separate subject.
The transport is mostly chosen for you. HTTP servers are the recommended option for connecting to remote MCP servers, stdio servers run as local processes on your machine and are what local access needs, and the SSE (Server-Sent Events) transport is deprecated.
Two details cost people an afternoon each. A JSON entry that has a url but no type is a configuration error, because Claude Code reads an entry with no type as a stdio server — so a config copied from another client's documentation fails complaining about a missing command. On the command line the trap is the separator, because everything after -- is passed to the server untouched; leave it out and Claude Code reads the server's own flags as its own.
Three Scopes, Two Files, One Winner
Local scope is the default. A local-scoped server loads only in the project where you added it and stays private to you. User scope is the same privacy with a wider reach, across every project on the machine. Project scope is the shared one: project-scoped servers enable team collaboration by storing configurations in a .mcp.json file at your project's root directory — check .mcp.json into version control so everyone on your team gets the same MCP tools and services.
Scope is not editable: a server's scope is fixed when you add it, so changing scope means removing the entry and re-adding it at the new one. On a collision, when the same server is defined in more than one place, Claude Code connects to it once, using the definition from the highest-precedence source — local, then project, then user. Crucially, the entire server entry from that source is used; fields are not merged across scopes. You do not get your local URL with the project's headers. You get one entry, whole.
A missing-server report is usually a scope report. Local-scoped servers are tied to the project where you added them: the repository root, or the exact directory if you weren't in a git repository.
The Approval Is A Security Boundary, Not A Formality
For security reasons, Claude Code prompts for approval in interactive sessions before using project-scoped servers from .mcp.json files. The reason is worth stating plainly, because it changes how you read a pull request: the prompt exists so a repository you clone can't launch processes on your machine without your consent.
The boundary is interactive-only, though. claude -p runs, Agent SDK sessions, and cloud sessions can't show that prompt: Claude Code loads project-scoped servers there without asking. The blunt instrument still works everywhere: a disabledMcpjsonServers entry in any settings file still rejects the server.
What The Tool Surface Costs
Each connected server takes some space in Claude's context window because its tool names and server instructions load into every session. That is no longer the whole story: tool search keeps MCP context usage low by deferring tool definitions until Claude needs them, and only tool names and server instructions load at session start, so adding more MCP servers has minimal impact on your context window. Tool search is enabled by default.
You can opt a server out of deferral, but pay knowingly: use this for a small number of tools that Claude needs on every turn, since each upfront tool consumes context that would otherwise be available for your conversation.
Output is capped separately: Claude Code displays a warning when any MCP tool output exceeds 10,000 tokens and the default maximum is 25,000 tokens. Sometimes the answer is not MCP at all — tools like gh, aws, gcloud, and sentry-cli are still more context-efficient than MCP servers because they don't add any per-tool listing.
Signing In, And What Happens When A Server Wobbles
Claude Code marks a remote server as needing authentication when the server responds with 401 Unauthorized or 403 Forbidden. After that, a stale token is handled for you: when a request to an OAuth server you already signed in to returns 401 Unauthorized, Claude Code refreshes the stored token, reconnects, and retries the request once. Two limits matter before you script anything. Automation cannot sign in — in non-interactive mode there's no /mcp panel, so Claude Code can't run the OAuth flow for you — and a hand-supplied header has no fallback: if you configured headers.Authorization for the server and the server rejects that header, Claude Code reports the connection as failed instead of falling back to OAuth.
Drops are handled unevenly, deliberately. If an HTTP or SSE server disconnects mid-session, Claude Code automatically reconnects with exponential backoff: up to five attempts, starting at a one-second delay and doubling each time. Local ones are not — stdio servers are local processes and are not reconnected automatically. And a slow call does not freeze the session: an MCP tool call in the main conversation that is still running after two minutes moves to a background task instead of blocking the session.
Permissions, And The Two Rules You Cannot Override
MCP tools obey the same permission system as everything else, named by server and optionally by tool: mcp__puppeteer matches any tool provided by the puppeteer server. Allow rules are stricter than deny rules about wildcards: the server segment must be glob-free so the rule names a specific server you configured. A blanket allow across every server is refused by design.
Two things beat your rules. A server author can mark a tool as always needing a person, and then Claude Code shows that tool's permission prompt on every call, even in acceptEdits, auto, and bypassPermissions permission modes, and doesn't offer a "don't ask again" option for it. Your organisation can do the same to a connector tool: Claude Code prompts on every call with the reason Your organization requires approval for this tool, or, one step further, Claude Code filters the tool out before Claude sees it, so it never appears in the tool list.
When It Breaks, Read The Status Before Anything Else
Start by disbelieving the confirmation. The Added confirmation means the entry was saved, not that the command runs. Then read claude mcp list, remembering that a failure status means Claude Code couldn't connect to that server, not that the list command failed.
Four symptoms cover most reports. Connected with no tools: if the list is empty, the server started but didn't register any tools, which usually means it's missing a required environment variable such as an API key. A stdio server that will not start: relative file paths in command or args are a frequent cause, since they resolve against the directory you launched Claude Code from rather than the location of .mcp.json. And an authentication failure right after pasting a token, where Claude Code flags config values with hidden leading or trailing whitespace but doesn't trim the whitespace and uses the values exactly as written.
One more, because it wastes whole mornings: Claude Code reads .mcp.json at session start, so an edit without a restart changes nothing.
The Trust You Extend
Verify you trust each server before connecting it. The publisher's own boundary is explicit: Anthropic reviews connectors against its listing criteria before adding them to the Anthropic Directory, but does not security-audit or manage any MCP server. A directory listing is a review of the submission, not of the code.
For teams the default is permissive — by default, anyone running Claude Code can connect any MCP server they choose — and the fix is administrative. Two rules matter most. Nothing overrides a denylist match. And the obvious lever is the weak one: a serverName entry, in either list, is not a security control, because the name is whatever the user typed.
Where to Go Next
MCP Fundamentals covers the protocol this page configures — what a server is, what it exposes, and why the standard exists — rather than Claude Code's particular way of loading one. Claude Code Basics is the permission system, the agentic loop and the session model that MCP tools plug into. And Cursor Basics shows the same protocol wired into a different client, which is the fastest way to see which parts of this page are MCP and which are Claude Code.
Sample questions
Three questions from this topic, with the answer and the reasoning shown.
Q1EasyA connector appears in Anthropic's Directory. What does that listing tell you about the server behind it?
- That the server's code has been audited, since that is what a review before listing normally involves.
- That no further trust decision is needed from you, because the review has already made that judgement.
- That Anthropic operates the server, so the usual questions about a third party do not really apply.
- That it met listing criteria on review, not that its code has been audited for security.Correct
Explanation
The principle — A listing tells you that something passed the check that was actually performed, which is rarely the check you were hoping for.
Why the key is correct — Anthropic reviews connectors against its listing criteria before adding them to the Directory, but does not security-audit or manage any MCP server. The instruction to the user is unchanged: verify you trust each server before connecting it.
Why the others are wrong — No code audit is implied. The trust decision remains yours, because only you know what is at stake. And Anthropic lists these servers rather than operating them.
Remember this — Listed means reviewed for listing, not audited for safety.
Sources — Anthropic's Claude Code security page and MCP reference.
Q2EasyA permission rule names an MCP server and nothing after it. Which of that server's tools does the rule cover?
- None of them, because a rule has to name each tool individually before it covers anything.
- All of them, because naming the server alone matches every tool it provides.Correct
- None of them, because naming a server on its own denies its tools rather than matching them.
- Only the ones whose names match the vendor's own naming, rather than the label you gave the server.
Explanation
The principle — An MCP permission rule is built from two parts, the server and optionally a tool, and leaving the second part off widens the rule rather than breaking it.
Why the key is correct — MCP rules use the server name as configured in Claude Code, optionally followed by the name of a tool from that server. A rule naming only the server matches any tool that server provides.
Why the others are wrong — Individual tools do not have to be listed. A bare server name matches rather than denies; the list the rule sits in decides that. And the name used is your own label, not the vendor's.
Remember this — Server alone means every tool from that server.
Sources — Anthropic's Claude Code permissions reference.
Q3EasyA remote MCP server drops in the middle of a session. What does Claude Code do about it?
- It leaves the server down and waits for you to reconnect it yourself from the MCP panel.
- It reconnects on its own, up to five attempts, with the delay doubling each time.Correct
- It keeps trying indefinitely, on the reasoning that the connection should be restored whenever it can be.
- It retries at a steady interval, because a fixed gap between attempts is simpler and more predictable.
Explanation
The principle — Transient drops should heal themselves, but not forever, and not at a pace that makes a struggling server worse.
Why the key is correct — If an HTTP or SSE server disconnects mid-session, Claude Code automatically reconnects with exponential backoff: up to five attempts, starting at a one-second delay and doubling each time. After that the server is marked failed and you can retry it yourself.
Why the others are wrong — Manual reconnection is the fallback rather than the first response. The attempts are bounded rather than endless. And the delay widens instead of staying fixed.
Remember this — Five attempts, each waiting twice as long as the last.
Sources — Anthropic's Claude Code MCP reference.
Practise all 50 questions
Every published question in MCP Integration in Claude Code, with its answer and explanation.
- A connector appears in Anthropic's Directory. What does that listing tell you about the server behind it?easy
- A permission rule names an MCP server and nothing after it. Which of that server's tools does the rule cover?easy
- A remote MCP server drops in the middle of a session. What does Claude Code do about it?easy
- A remote MCP server responds to Claude Code with a 401 or a 403. How does Claude Code treat that server?easy
- A server has been added at local scope on a shared build machine. Who can use it, and where?easy
- A vendor publishes its MCP server at an https endpoint and documents both an HTTP address and an SSE address for it. Which transport does Claude Code's documentation put forward as the recommended one?easy
- An internal service exposes only an SSE endpoint for its MCP server, and a colleague says that means Claude Code cannot connect to it. What is the accurate position?easy
- An MCP tool returns a very large result. At what point does Claude Code warn you, and where is the default ceiling?easy
- Claude Code asks you to approve a server defined in a repository you have just cloned. What is that prompt protecting you from?easy
- In an interactive session, which MCP servers does Claude Code ask you to approve before they are used?easy
- One definition of a server wins on precedence over another. What happens to the fields in the definition that lost?easy
- The command that adds an MCP server prints its confirmation line. What has that line established?easy
- The same MCP server name is defined at two different scopes on your machine. What does Claude Code do when the session starts?easy
- With tool definitions deferred, what does a connected MCP server still put into context at the start of every session?easy
- You connect an MCP server that exposes forty tools. By default, what does Claude Code do with those tool definitions?easy
- You need Claude to drive a browser installed on your own laptop and read what it renders. Which kind of MCP server is that job asking for?easy
- You run the command that adds an MCP server and you do not pass a scope flag. Which scope does the server land in?easy
- You signed in to a remote MCP server last week. Today a request to it comes back unauthorized because the stored token has expired. What does Claude Code do?easy
- You want one allow rule to cover MCP tools across every server you have configured, so you try a wildcard in the server position. What is the outcome?easy
- Your team wants everyone working on one repository to get the same MCP server without each person configuring it. Which scope does that, and what makes it reach them?easy
- A colleague has connected fifteen MCP servers and argues that deferral makes the unused ones free. Where does that reasoning break?medium
- A colleague suggests avoiding scope collisions by giving the same underlying server a different name at each scope. What does that actually change?medium
- A local stdio MCP server crashes halfway through a long session. You keep working and expect it to come back the way a remote one does. What happens?medium
- A repository commits a settings file that approves its own MCP servers, so that teammates are not interrupted. A colleague clones it, starts a session, and finds the servers sitting unapproved. Why?medium
- A server's tools are needed on almost every turn, so you configure it to load its tools upfront instead of leaving them deferred. What have you bought, and what have you paid?medium
- A server shows as connected, but selecting it reveals an empty tool list. The process is clearly running. What is the most likely cause?medium
- A stdio server defined in your project's shared configuration starts for one teammate and fails for another. Its command uses a path relative to the project root. What explains the difference?medium
- An MCP tool call in your main conversation is still running after two minutes. What happens to the session while it continues?medium
- A server you added and used all last week is missing when you start Claude Code in a second repository on the same laptop. Nothing was uninstalled and your credentials are unchanged. Where should you look first?medium
- You add a local MCP server whose start-up command takes its own flags, and you type the whole thing after the server name without a double-dash separator. The command fails complaining about an option it does not recognise. Why?medium
- You add an allow rule for a particular MCP tool and switch to a permissive mode so the session runs unattended. That one tool still stops and asks for approval every time it is called. Why?medium
- You added a server for yourself weeks ago and now want the whole team to have it. You re-run the add command with the project scope flag and the same server name. What do you have to do to actually promote it?medium
- You configure a remote server with your own authorization header rather than signing in, and the server rejects the header. You expect Claude Code to offer the browser sign-in instead. What actually happens?medium
- You copy a server block out of another MCP client's setup instructions into your project configuration. It carries a url field and no type field. The session starts, the server does not appear, and the reported problem mentions a missing command. What has happened?medium
- You declined the approval prompt for a project server once and want to be certain it never loads for you again, in scripted runs as well as interactive ones. What actually achieves that?medium
- You script a nightly Claude Code run that needs a remote MCP server behind a browser sign-in. Nobody will be watching. What has to be true for the run to reach that server?medium
- Your continuous integration job runs Claude Code non-interactively in a repository whose configuration defines two MCP servers. Nobody approved them on the build machine. What happens on that run?medium
- Your organisation blocks a server by policy. You add an allowlist entry for it in your own settings, hoping to readmit it for your team. What happens?medium
- Your organisation has set one tool on a shared connector to require approval. You add an allow rule for it locally so your own sessions stop asking. What happens next time you use it?medium
- Your project's shared configuration defines a server with an authorization header. You add the same server name locally with a corrected URL and no header, then find the server connecting unauthenticated. What went wrong?medium
- A long session keeps running out of room. You have several MCP servers connected, and a command-line tool exists that covers what one of those servers does. A colleague proposes raising the tool-output cap instead, arguing that large results are what fills the window. What is the better move, and why?hard
- A network blip takes out two MCP servers at once: a hosted one reached over HTTP and a local one started as a process on your machine. A few seconds later the hosted server is working again and the local one is still gone. A colleague concludes the local server is unreliable and suggests raising its timeout. What is really going on?hard
- A scheduled job has been failing for a week on one remote MCP server. Run by hand from a terminal on the same machine, with the same configuration, everything works. The job's logs show the server's tools were unavailable, and a colleague proposes adding a retry loop around the whole run. What is actually wrong, and what fixes it?hard
- A teammate says a connector tool has stopped working. On inspection, the tool is not merely refusing calls — Claude never offers it and behaves as though it does not exist, while the connector's other tools work normally. Your permission rules mention neither the tool nor the server. What is the most likely cause?hard
- You are asked to stop your organisation using a particular MCP server. You add a denylist entry matching the label people use for it and confirm it no longer loads on your own machine. A colleague warns that this will not hold. Why are they right, and what would actually enforce it?hard
- You are reviewing a pull request from an outside contributor. Among the changes is a new project configuration entry defining an MCP server that runs a command from a package you do not recognise. A reviewer argues the entry is safe to merge because everyone will get an approval prompt before it can do anything. Your repository is also built by a nightly job that runs Claude Code non-interactively. How should you respond?hard
- You edit the project's shared MCP configuration to fix a server's URL while a session is open, then ask Claude to use that server. It still reaches the old address. You edit again, more carefully, with the same result, and a colleague suggests the file must be being ignored. What explains it?hard
- You paste an access token into a server's headers, and the server rejects it immediately. The token was copied from the vendor's console and works fine when you use it with a command-line HTTP client. Listing your servers shows a note about the configuration alongside the failure. What has happened, and what fixes it?hard
- Your team commits a corrected server definition to the shared configuration. Everyone picks it up except one colleague, whose sessions still reach the old endpoint. They confirm they pulled the change and that the shared file on their disk is correct, and they see no warning of any kind. What is happening, and what fixes it?hard
- Your team wants Claude to open pages in a real browser to check that a fix renders correctly, and someone proposes running the browser tool as a hosted server so nobody has to install anything. A second person points at the documentation's preference for HTTP as support for that plan. What is wrong with the reasoning, and what should the team do?hard
Frequently asked
What people ask about mcp integration in claude code.
I added a server and claude mcp list says it failed. What do I check first?
Why does my teammate see the MCP server and I do not?
Claude Code keeps asking me to approve a server that is committed to our repository. Why?
Does adding more MCP servers eat my context window?
I have an allow rule for an MCP tool, so why am I still being prompted?
Is a server in the Anthropic Directory safe to connect?
More Claude Code topics
Related guides
Troubleshooting · 9 min read
Your MCP server connects and the tools still do not run
The server is green, the tool count is right, and the model answers without touching any of it. That is a selection problem, not a connection problem: ten causes with distinct fingerprints, from a six-word description to the thirtieth tool that pushed the right one out of reach.
Troubleshooting · 9 min read
Why your MCP server isn't showing up in Claude Code
An MCP server that adds cleanly and then shows no tools has about ten possible causes, and each leaves a different fingerprint. A symptom-first triage guide: what the /mcp statuses actually mean, why scope cannot be changed in place, and the config error that makes Claude run your URL as a local process.