Skip to main content
Model Context Protocol (MCP) is an open standard that lets Claude connect to external systems — databases, APIs, developer tools, and more — through a defined transport and tool-call interface. Claude Code acts as an MCP client, spawning or connecting to MCP servers and making their tools available during a session.

How Claude Code uses MCP

When a session starts, Claude Code connects to all configured MCP servers and discovers their available tools and resources. These appear alongside built-in tools in Claude’s context. When Claude invokes an MCP tool, the call is routed to the appropriate server over its configured transport. MCP servers are listed and managed with the /mcp slash command.

MCP transports

Claude Code supports the following transport types:
TypeKeyDescription
StdiostdioLaunches a subprocess and communicates over stdin/stdout. Default for local servers.
HTTPhttpConnects to an HTTP endpoint implementing the MCP HTTP transport.
SSEsseServer-Sent Events over HTTP. Used for streaming-capable remote servers.
WebSocketwsWebSocket transport for bidirectional streaming.
SDKsdkInternal SDK-managed transport placeholder (used by IDE extensions).

MCP config file format

MCP servers are defined in JSON configuration files using a mcpServers object:
{
  "mcpServers": {
    "my-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@my-org/my-mcp-server"],
      "env": {
        "API_KEY": "${MY_API_KEY}"
      }
    },
    "remote-server": {
      "type": "http",
      "url": "https://mcp.example.com/v1",
      "headers": {
        "Authorization": "Bearer ${AUTH_TOKEN}"
      }
    },
    "sse-server": {
      "type": "sse",
      "url": "https://api.example.com/mcp/sse"
    }
  }
}
Environment variable references (${VAR_NAME}) are expanded from the current process environment at connection time.
Server names may only contain letters, numbers, hyphens, and underscores.

Configuration scopes

MCP servers can be configured at three scopes:
ScopeFile locationCommitted to git
project<project-root>/.mcp.jsonYes — shared with team
local<project-root>/.claude/settings.local.json (mcpServers key)No
user~/.claude/settings.json (mcpServers key)No
enterpriseManaged path managed-mcp.jsonNo — MDM-deployed
When the same server name exists in multiple scopes, the order of precedence is: enterprise > local > project > user. If an enterprise managed MCP config file exists, it has exclusive control — no other scopes are loaded.

Adding an MCP server

Using the CLI

1

Add a stdio server

claude mcp add my-server -- npx -y @my-org/my-mcp-server
This adds the server to your local config by default. Use --scope project to write to .mcp.json instead:
claude mcp add --scope project my-server -- npx -y @my-org/my-mcp-server
2

Add an HTTP server

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
Add custom headers:
claude mcp add --transport http corridor https://app.corridor.dev/api/mcp \
  --header "Authorization: Bearer $TOKEN"
3

Add an SSE server with OAuth

claude mcp add --transport sse my-api https://api.example.com/sse \
  --client-id my-client-id --client-secret
The --client-secret flag prompts for the secret interactively, or you can set it via MCP_CLIENT_SECRET in your environment.
4

Verify the server appears

Open a new Claude Code session and run:
/mcp
The server should appear in the list. If its status is failed, check the server command and environment variables.

Using the /mcp slash command

Run /mcp inside a session to open the interactive MCP management UI. From there you can:
  • View all connected, pending, failed, and disabled servers
  • Enable or disable individual servers
  • Inspect which tools each server provides

Using --mcp-config

Pass a config file directly when launching Claude Code:
claude --mcp-config ./my-mcp-config.json
Servers from this file are loaded as dynamic scope and merged with other configured servers.
Servers loaded via --mcp-config are subject to enterprise policy filtering. Servers blocked by deniedMcpServers or not in allowedMcpServers will be dropped with a warning.

Removing an MCP server

# Remove from local config
claude mcp remove my-server

# Remove from project .mcp.json
claude mcp remove --scope project my-server

# Remove from user config
claude mcp remove --scope user my-server

MCP tools vs. resources

MCP servers expose two types of content:
  • Tools — callable functions that Claude can invoke (e.g., search_database, create_issue). Tools appear in the active tool list and are invoked via the MCPTool internal tool.
  • Resources — read-only data that Claude can reference (e.g., file contents, API responses). Resources are listed separately and can be attached to context.
Use /mcp to see which tools and resources each connected server provides.

Enterprise policy

Enterprise administrators can control which MCP servers users can run:
{
  "allowedMcpServers": [
    { "serverName": "approved-server" },
    { "serverCommand": ["npx", "-y", "@corp/internal-mcp"] },
    { "serverUrl": "https://*.corp.example.com/*" }
  ],
  "deniedMcpServers": [
    { "serverName": "blocked-server" }
  ]
}
The denylist takes precedence over the allowlist. See Configuration for the full policy reference.

Configuration

Configure global settings and enterprise policies.

Plugins

Install plugins that provide MCP servers automatically.

Tool system

Understand how Claude invokes tools including MCP tools.

Commands reference

Full reference for slash commands.

Build docs developers (and LLMs) love