--- name: mcp-reference description: Model Context Protocol — external tools and resources exposed to Claude via MCP servers. layer: reference cc_feature: mcp source: https://docs.claude.com/en/docs/claude-code/mcp concept: mcp-tool-protocol last_verified: 2026-04-18 ngram_overlap_score: null review_status: approved --- # MCP — Reference Model Context Protocol (MCP) is the protocol Claude Code uses to talk to external tool servers. An MCP server advertises *tools* and *resources*; Claude Code surfaces them to Claude as callable tools. ## Architecture - **MCP server** — a process (local or remote) that implements the protocol. Can be written in any language. Communicates over stdio, HTTP, or WebSocket. - **Transport** — stdio (local subprocess), SSE/HTTP (remote), or WebSocket. Stdio is the default for local servers. - **Tools** — callable functions the server exposes. Each has a name, description, and JSON schema for inputs. - **Resources** — readable entities the server exposes (files, database rows, API responses). Addressed by URI. - **Prompts** — optional; MCP can expose templated prompts. ## Configuration MCP servers are declared in: - `.mcp.json` — project-level MCP config. - `~/.claude.json` or equivalent — user-level. - Plugin-bundled — a plugin can ship its own MCP server. Each entry specifies command, args, transport, and optional auth. ## Tool naming Tools from MCP servers appear to Claude with a namespaced name: `mcp____`. This keeps names collision-free across servers. ## Permissions - `allowed-tools` in settings or plugin frontmatter can include MCP tools by full name. - Some MCP servers require OAuth or API keys; those are configured in the server's own config, not Claude's. ## Common uses - Exposing internal APIs to Claude without hand-wrapping them (one generic MCP server → many tools). - Cross-language tool servers (Python tool called from Claude Code running in Node). - Sandboxed access to external services with explicit scoping. ## Failure modes - Server not running → tool calls fail; Claude sees an error string. - Server misbehaves → tool returns wrong schema; Claude may retry or hallucinate. - Authentication drift → 401s look like transient errors; diagnose by checking the server directly. - Security: an MCP server runs with the permissions of its own process. A malicious server is a supply-chain risk; audit before enabling.