Model Context Protocol lets Claude reach your tools, data, and APIs. This is the end-to-end config
reference: wiring servers into Claude Code (claude mcp add, .mcp.json,
scopes, OAuth) and onto the Anthropic API (the Messages-API MCP connector and Managed Agents).
Generators emit the exact command and JSON.
An MCP server exposes tools (callable functions), resources (readable data), and prompts (slash commands) over a transport. An MCP client — Claude Code, or the Anthropic API's connector — connects and surfaces those capabilities to the model.
| Transport | Where the server runs | Use it for |
|---|---|---|
| HTTP (Streamable HTTP) ★ | Remote URL | Cloud services — the recommended default; supports OAuth |
| stdio | Local process on your machine | Local tools, custom scripts, direct system access |
| SSE | Remote URL | Legacy remote — deprecated, prefer HTTP |
| WebSocket | Remote URL (push) | Servers that push events unprompted; .mcp.json only |
claude mcp addOne command per transport. The server's name is how you reference it everywhere else.
# claude mcp add --transport http <name> <url> claude mcp add --transport http notion https://mcp.notion.com/mcp # with a bearer token header claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \ --header "Authorization: Bearer YOUR_PAT"
# claude mcp add [opts] <name> -- <command> [args...] (everything after -- runs the server) claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \ -- npx -y airtable-mcp-server # the -- is REQUIRED: it separates Claude's flags from the server's own args
# deprecated — use HTTP where available
claude mcp add --transport sse asana https://mcp.asana.com/sse \
--header "X-API-Key: your-key-here"-- rule for stdio
Everything after -- is the server command, passed untouched. Without it, Claude tries to parse the
server's flags (like --port) as its own. Also: put at least one option between --env and the
server name, or the CLI reads the name as another KEY=value pair.claude mcp list # all configured servers + status claude mcp get github # details for one server claude mcp remove github # remove it claude mcp add-json db '{"type":"stdio","command":"/path","args":[],"env":{}}' claude mcp add-from-claude-desktop # import from Claude Desktop (macOS/WSL) # inside a session: /mcp # status, OAuth login, clear auth
The --scope flag decides which projects a server loads in and whether it's shared.
| Scope | Loads in | Shared w/ team | Stored in |
|---|---|---|---|
local (default) | Current project only | No — private to you | ~/.claude.json |
project | Current project only | Yes — via version control | .mcp.json in project root |
user | All your projects | No — private to you | ~/.claude.json |
Precedence when the same name is defined twice (whole entry wins, fields are not merged):
local → project → user → plugins → claude.ai connectors.
.mcp.json format (project scope){
"mcpServers": {
"shared-server": {
"command": "/path/to/server",
"args": [],
"env": {}
}
}
}{
"mcpServers": {
"api-server": {
"type": "http",
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer TOKEN" }
}
}
}// ${VAR} and ${VAR:-default} expand in command, args, env, url, headers
{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": { "Authorization": "Bearer ${API_KEY}" }
}
}
}.mcp.json with ${API_KEY} placeholders, and keep the real values in each
developer's environment. A missing required variable with no default fails the config parse (loud, not silent).Fill this in and copy the matching claude mcp add command and the .mcp.json entry.
--header "Authorization: Bearer ...", or
headers in .mcp.json. Best for PAT-style APIs (e.g. GitHub).--env KEY=value for stdio servers (passed into the
spawned process), or env in .mcp.json./mcp and complete the browser flow. Claude
Code triggers this automatically when a server returns 401/403; tokens are stored
securely and refreshed for you.# fixed callback port (server pre-registers a redirect URI) claude mcp add --transport http --callback-port 8080 my-server https://mcp.example.com/mcp # pre-configured OAuth client (no dynamic registration); --client-secret prompts masked claude mcp add --transport http \ --client-id your-client-id --client-secret --callback-port 8080 \ my-server https://mcp.example.com/mcp
oauth.scopes (a single space-separated string) in
.mcp.json — it overrides whatever the server advertises. For non-OAuth schemes (Kerberos, SSO,
short-lived tokens), generate headers at connect time with headersHelper.ntn_ integration token works against Notion's REST API but not as the MCP server credential.The MCP connector lets a raw API call reach a remote MCP server with no separate MCP client. Two
pieces: mcp_servers (the connection) and an mcp_toolset in tools (which tools
to enable).
anthropic-beta: mcp-client-2025-11-20 (the older mcp-client-2025-04-04 is deprecated).
Remote HTTP/SSE only — no local stdio. Not available on Bedrock/Vertex; not ZDR-eligible.| Field | In | Notes |
|---|---|---|
type:"url" | mcp_servers | Only "url" is supported |
url | mcp_servers | Must start with https:// |
name | mcp_servers | Referenced by exactly one toolset |
authorization_token | mcp_servers | Optional OAuth bearer; you obtain & refresh it |
mcp_server_name | mcp_toolset | Must match a server name |
default_config / configs | mcp_toolset | enabled, defer_loading — allow/deny tools |
mcpTools, mcpMessages, mcpResourceToContent)
to convert them for the Messages API.Managed Agents split MCP config across two objects so secrets stay out of the reusable agent definition:
{type, name, url} only — no auth — plus an
mcp_toolset to grant access.mcp_oauth with auto-refresh, or
static_bearer), matched to the server by URL. Attach it at session create via vault_ids.# 1. Agent declares the server (no auth here) agent = client.beta.agents.create( name="MCP Agent", model="claude-opus-4-8", mcp_servers=[{"type": "url", "name": "linear", "url": "https://mcp.linear.app/mcp"}], tools=[{"type": "agent_toolset_20260401"}, {"type": "mcp_toolset", "mcp_server_name": "linear"}], ) # 2. Vault holds the credential, attached to the session by id session = client.beta.sessions.create( agent=agent.id, environment_id=env.id, vault_ids=["vlt_..."], # contains the Linear MCP OAuth credential )
session.error
event and retries on the next idle→running transition..mcp.json show as ⏸ Pending approval until you accept them
interactively. Reset choices with claude mcp reset-project-choices.mcp__<server>__<tool> (plugin servers:
mcp__plugin_<plugin>_<server>__<tool>). Use that full form in permission rules and
subagent tools lists.MAX_MCP_OUTPUT_TOKENS. Tool search (on by default) defers tool schemas so adding many servers barely
touches your context window.