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:| Type | Key | Description |
|---|---|---|
| Stdio | stdio | Launches a subprocess and communicates over stdin/stdout. Default for local servers. |
| HTTP | http | Connects to an HTTP endpoint implementing the MCP HTTP transport. |
| SSE | sse | Server-Sent Events over HTTP. Used for streaming-capable remote servers. |
| WebSocket | ws | WebSocket transport for bidirectional streaming. |
| SDK | sdk | Internal SDK-managed transport placeholder (used by IDE extensions). |
MCP config file format
MCP servers are defined in JSON configuration files using amcpServers object:
${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:| Scope | File location | Committed to git |
|---|---|---|
project | <project-root>/.mcp.json | Yes — shared with team |
local | <project-root>/.claude/settings.local.json (mcpServers key) | No |
user | ~/.claude/settings.json (mcpServers key) | No |
enterprise | Managed path managed-mcp.json | No — MDM-deployed |
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
Add a stdio server
local config by default. Use --scope project to write to .mcp.json instead:Add an SSE server with OAuth
--client-secret flag prompts for the secret interactively, or you can set it via MCP_CLIENT_SECRET in your environment.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:
dynamic scope and merged with other configured servers.
Removing an MCP 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 theMCPToolinternal 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.
/mcp to see which tools and resources each connected server provides.
Enterprise policy
Enterprise administrators can control which MCP servers users can run:Related pages
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.