ModulesPhase 2: Control

7. Connecting tools

/mcp
The 30-second answer

"MCP, the Model Context Protocol, is the open standard Claude Code uses to reach your other systems: issue trackers, databases, monitoring, internal APIs. You add a server with claude mcp add, over HTTP for remote services or as a local stdio process, at one of three scopes: local for just you in one project, project to share it with the team through a committed .mcp.json, or user for all your projects. Remote servers sign in with OAuth from /mcp. Tool search keeps dozens of servers cheap by loading only tool names until Claude needs one. And because a server is code you didn't write that hands Claude text other people wrote, admins can pin exactly which servers may run with managed allowlists, denylists, or a fixed managed-mcp.json."

The sentence that marks you as an architect: every MCP server is a trust decision, and Anthropic reviewing a connector is not the same as auditing it.

Say it yourself first, then compare.
See it

8 pictures, in order.

Use the arrow keys or the dots. Tap a picture to see it full size.

Four ways to reach an MCP server1 of 8
Know it

The facts someone can check.

Transports
Transport Use it for Add it with
HTTP (recommended) Remote services. The most widely supported, and the one OAuth works with claude mcp add --transport http <name> <url>
SSE (deprecated) Older remote servers. From v2.1.265, --transport http falls back to SSE on its own claude mcp add --transport sse <name> <url>
stdio A local program: files, a browser, a database socket claude mcp add <name> -- <command> [args]
WebSocket Servers that push events. Header auth only, no OAuth claude mcp add-json <name> '{"type":"ws","url":"wss://..."}'
  • For stdio, everything after -- is the server's command, passed through untouched. Without it, Claude Code would try to read the server's flags as its own.
  • A JSON entry with a url and no type is an error, because no type means stdio. Add "type": "http".
  • A connected server can offer more than tools: resources you @-mention (@github:issue://123), prompts that become commands (/mcp__github__pr_review 456), and elicitation, where the server asks you to fill a form or open a sign-in link.
Scopes
Scope Loads in Shared Stored in
Local (default) This project only No ~/.claude.json, under the project's path
Project This project only Yes, through git .mcp.json at the project root
User All your projects No ~/.claude.json, top level
  • MCP local scope is not .claude/settings.local.json. It lives in your home directory, inside ~/.claude.json.
  • When the same server appears in several places, one whole definition wins, with no merging of fields: local, then project, then user, then plugin servers, then claude.ai connectors. A server your organization provides through managedMcpServers beats all of them (v2.1.259 or later).
  • Project servers ask first. In an interactive session you approve each .mcp.json server before it connects; claude mcp reset-project-choices clears your answers. A cloned repo can't approve its own servers until you trust the folder.
  • Except where nobody can be asked: claude -p, Agent SDK, and cloud sessions load project servers without the prompt. disabledMcpjsonServers keeps a server out in every mode, and --strict-mcp-config uses only the servers you pass with --mcp-config.
  • .mcp.json can use ${VAR} and ${VAR:-default} in command, args, env, url, and headers, so the file can be shared without secrets in it.
  • Your own credentials stay home. In a remote server's url or headers, names like ANTHROPIC_API_KEY and AWS_BEARER_TOKEN_BEDROCK read as empty, so a repo can't send your keys to a server it names.
Tool search

Tool definitions are big. With tool search, on by default, Claude Code loads only each tool's name and each server's instructions at the start, and pulls in a tool's full definition when Claude searches for it. There's no fixed cap on tools per server; the practical limit is your context window.

ENABLE_TOOL_SEARCH Behavior
unset or true Every MCP tool deferred and loaded on demand
auto Load upfront while definitions total under 10% of the context window, search above that
auto:N The same, with your own percentage
false Load every tool upfront
  • "alwaysLoad": true on a server puts its tools in context every turn, and startup waits for them, up to the 5-second connect timeout. Use it for a handful of tools Claude needs constantly.
  • Server instructions matter more with tool search on: they're how Claude knows when to search for a server's tools. They're cut at 4,096 characters, the same as the description of a tool that loads upfront; a deferred tool's description gets 16,384.
  • /context shows tools labeled deferred, which is how you prove tool search is doing its job.
Output and time limits
  • 10,000 tokens: a tool result that big shows a warning.
  • 25,000 tokens: the default maximum, raised with MAX_MCP_OUTPUT_TOKENS. A bigger result is saved to a file Claude can read when it needs to, not dropped.
  • 50,000 characters: a text result longer than this goes to a file too, whatever its token count. A server author can raise one tool's threshold with anthropic/maxResultSizeChars, up to 500,000.
  • 16 MiB: the largest single response Claude Code reads from an HTTP or SSE server.
  • 2 minutes: a main-conversation call still running moves to a background task you can see in /tasks.
  • Idle timeout: 5 minutes with no response or progress for remote servers, 30 for stdio.
  • 128 characters: a tool whose full name, mcp__server__tool, runs longer is left out so the server's other tools still work.
Signing in
  • A remote server that answers 401 or 403 is flagged; Claude Code shows a startup notice. Run /mcp, pick the server, and sign in in your browser. Tokens are stored securely and refreshed automatically.
  • claude mcp login <name> signs in from your shell; --no-browser prints the URL instead, for SSH sessions. claude mcp logout <name> or Clear authentication in /mcp revokes it.
  • Static tokens go in --header "Authorization: Bearer ...". If the server rejects that header, the connection fails; it doesn't fall back to OAuth.
  • Headless runs can't sign in. claude -p and the Agent SDK have no /mcp panel, so sign in from an interactive session first.
  • claude mcp remove also deletes the server's stored OAuth tokens.
Trusting a third-party server
  • Anthropic reviews Directory connectors against listing criteria, but doesn't security-audit or manage any MCP server. Write your own, or use servers from providers you trust.
  • Prompt injection is the main risk: a server that fetches web pages, issues, or email hands Claude text an attacker could have written.
  • .mcp.json isn't the whole list. User and local scope, plugins, and claude.ai connectors all add servers from outside the repo.
  • The controls stack: permission rules on mcp__server__tool names (Module 5), hooks matching mcp__.* (Module 6), requiresUserInteraction on a tool so every call prompts even in auto mode, and least-privilege credentials, such as a read-only database user.
Managed MCP for an organization
Pattern What it does Configure
Disable MCP No servers load, apart from a few built-ins managed-mcp.json with no servers
Fixed deployment Everyone gets the same servers and can't add others managed-mcp.json
Provided servers Everyone gets your remote servers and keeps their own managedMcpServers
Approved catalog Users add from your list; anything else is blocked allowedMcpServers plus allowManagedMcpServersOnly: true
Denylist only Block known-bad servers deniedMcpServers
  • Every server is checked in three steps: merge the allow and deny lists from every scope, check the denylist (a match always blocks), then check the allowlist (remote servers match by serverUrl, stdio servers by serverCommand).
  • serverName is a label, not a control. A user can call any server github. Enforce with URL or command entries.
  • allowedMcpServers: [] allows nothing; leaving it out allows everything.
  • Without allowManagedMcpServersOnly, a user's own allowlist entries merge in and can widen yours. Denylists always merge, so anyone can block servers for themselves.
  • managed-mcp.json lives at a system path: /Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL, C:\Program Files\ClaudeCode\ on Windows. It can't come through server-managed settings, so it travels by MDM.
What /mcp actually does

Opens the server list: each server's status, its tool count, and sign-in. From a server's menu you can authenticate, reconnect, disable it for this project, or clear its authentication. /mcp reconnect <server> or reconnect all, /mcp enable, and /mcp disable change state without opening the list. In a -p run, /mcp prints a text summary instead.

Quiz

Answer out loud, then flip the card.

Mark each one honestly. Cards you miss stay flagged for review, in this browser.

0 of 8 right
Question 1

A SaaS vendor asks which transport their MCP server should use for Claude Code customers.

Streamable HTTP. It's the recommended, most widely supported remote transport, and the one the docs pair with OAuth sign-in. SSE is deprecated, and WebSocket supports header auth only. Also tell them to write clear server instructions, because with tool search on, that's how Claude decides when to look for their tools.

Question 2

A team wants everyone to get the same Jira server without sharing anyone's credentials. How?

Project scope: commit the server to .mcp.json and let each developer sign in with OAuth, or reference a token with ${JIRA_TOKEN} so the file holds no secret. Each person approves the server once. If the whole company should get it without opting in, an admin provides it with managedMcpServers instead.

Question 3

A developer has 20 MCP servers connected. Won't that flood the context window?

Not by default. Tool search defers definitions, so only tool names and server instructions load at the start, and a full definition loads when Claude searches for it. /context shows the deferred tools. alwaysLoad is the exception to use sparingly, and ENABLE_TOOL_SEARCH=auto loads tools upfront only while they fit under 10% of the window.

Question 4

Security wants only approved MCP servers to run. What do you configure?

In managed settings, allowedMcpServers with serverUrl and serverCommand entries, plus allowManagedMcpServersOnly: true so developers can't widen it. Add deniedMcpServers for anything known-bad; a deny always wins. Don't rely on serverName, since anyone can name a server anything. For total control, deploy managed-mcp.json by MDM: then only its servers load.

Question 5

An MCP tool returns a 100,000-token database dump. What happens?

Over 10,000 tokens Claude Code shows a warning, and over the 25,000-token default it saves the result to a file and gives Claude the path, so Claude reads only what it needs. The server author can raise that tool's own threshold with anthropic/maxResultSizeChars, up to 500,000 characters; the user can raise the general cap with MAX_MCP_OUTPUT_TOKENS. The better fix is usually a server that paginates.

Question 6

A customer says "it's in the Anthropic Directory, so it's safe." Is it?

Anthropic reviews Directory connectors against listing criteria, but doesn't security-audit or manage any MCP server. Ask who runs it, whether it returns text other people wrote (the prompt injection risk), and what its credentials can do. Then contain it: least-privilege tokens, ask or deny rules on its write tools, and a hook on its tool names if you need to inspect arguments.

Question 7

A server works in their terminal but fails in a CI job that runs claude -p. Why?

It needs OAuth, and -p runs have no /mcp panel to sign in from. Sign in from an interactive session or with claude mcp login <name> first, or give the CI job a token through a header. Also note that -p loads a repo's .mcp.json servers without asking, so pin what CI may connect to with --strict-mcp-config.

Question 8

The same server name is defined at user scope and project scope with different URLs. Which one connects?

Only one: the project definition, because local beats project beats user, and the whole entry comes from the winner with no field merging. Claude Code warns about the conflict in /mcp and claude mcp list. Sign-ins are stored per endpoint, so you'd sign in separately wherever a different definition loads.

Traps

Wrong answers that sound right.

Before you tap, say why each one is wrong.

Try it

Three moves in a fresh project.

Facts checked against code.claude.com/docs/en/mcp, managed-mcp, security, permissions, and commands on 2026-10-25. Claude Code ships fast: confirm anything that matters against the official docs.