Claude Code is useful on its own, but the moment you want it to read a Postgres schema, open a GitHub issue, or list files outside your repo, you hit a wall. That wall is the point where MCP servers start mattering. MCP — the Model Context Protocol — is the standard interface Claude Code uses to talk to external tools and data sources, and knowing how to wire one up cleanly is the difference between a terminal agent that can only see your repo and one that can act across your whole stack.
This guide covers what MCP actually is, when you need a server and when you don't, how Claude Code discovers servers across three config scopes, a copy-pasteable .mcp.json example, how to verify a server is connected, the failure modes worth knowing in advance, and the security model you should assume by default. If you want the adjacent primitives, see the Claude Code hooks guide and the slash commands reference.
MCP is an open specification for how an AI client (Claude Code, Claude Desktop, Zed, and others) talks to external tools and data sources. An MCP server is a small program — typically a Node or Python process — that exposes three kinds of things over a standard JSON-RPC protocol: tools (functions Claude can call, like query_database or open_issue), resources (read-only data Claude can fetch, like file contents or API responses), and prompts (reusable prompt templates the server ships). Claude Code spawns the server as a child process (stdio transport) or connects to it over HTTP, then routes tool calls across the protocol during a session.
The spec and current SDK list live at modelcontextprotocol.io. The headline point: you don't have to write one to use one. A growing catalog of community and official servers already covers most of what a coding agent wants to reach.
Most Claude Code sessions don't need any MCP server. If the task lives inside your repo, the built-in file tools are enough. You start reaching for MCP when the work crosses a boundary:
The anti-pattern is adding a server because it sounds useful. Each server adds startup time, a config surface, and a security boundary. Add them when a specific recurring task justifies the cost.
Current Anthropic docs describe three MCP config scopes: local, project, and user. The terminology matters because the storage files are not always what the scope name would suggest.
~/.claude.json (not ~/.claude/settings.json — that's a separate settings file). Configure these with claude mcp add --scope user <name> ... or by editing the JSON directly. Servers here load in every Claude Code session on this machine. Good for personal tokens and per-machine conveniences..mcp.json at the repo root. This is the only scope whose file lives inside the repo, so it's what teammates see on clone. Important: Claude Code does not auto-enable project-scoped servers. The first time a session sees a new or changed .mcp.json entry, it prompts you for approval before loading that server. This is a deliberate supply-chain guardrail — pulling a branch with a malicious MCP entry can't silently run code.~/.claude.json (keyed by project path), managed via claude mcp add --scope local .... Good for your own overrides: dev-only servers, secrets, or something you don't want landing in .mcp.json.When the same server name appears in more than one scope, local wins, then project, then user.
.claude/settings.local.json is a general Claude Code settings file — it is not an MCP server scope. Don't put server definitions there; they won't load. For the authoritative layout and any per-release changes, read docs.anthropic.com/claude-code/mcp — this guide covers the mechanism and the stable shape of the config.
A representative slice of what's actually useful day-to-day. This is not exhaustive — check the MCP site and the community catalog for the current list.
| Server | What it does | Transport | Best for |
|---|---|---|---|
| filesystem | Exposes a mounted directory (outside the current project) as readable/writable resources. | stdio | Reading sibling repos, shared docs folders, or design archives without cd-ing out of the project. |
| github | Search repos, read issues/PRs, open issues, comment, inspect workflows via the GitHub API. | stdio | Multi-repo work, triaging issues, scripting release notes from PR titles. |
| postgres | Connects to a Postgres instance; exposes schema introspection and SQL execution as tools. | stdio | Schema review, read-only analytics queries, verifying migration effects on a dev DB. |
| puppeteer | Drives a headless Chromium; navigate, click, screenshot, and read page state. | stdio | Smoke-testing a deploy, scraping a one-off page, verifying a fix in a live UI. |
| slack | Reads channels, posts messages, searches history across a Slack workspace. | stdio | Pulling context from a channel before writing code, summarizing a thread into a PR description. |
| sequential-thinking | A structured "think step-by-step" tool that forces the model to decompose a problem before acting. | stdio | Long planning tasks where you want the model to externalize reasoning into a dedicated tool call. |
| context7 | Fetches up-to-date library documentation on demand so the model doesn't rely on stale training data. | stdio or HTTP | Working with fast-moving libraries (new frameworks, breaking SDK versions) where hallucinated APIs are a risk. |
.mcp.jsonDrop this at the root of your repo. Claude Code reads it on session start. This example wires up the filesystem server (scoped to a shared notes folder) and the GitHub server (using an env var — never inline a token).
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/you/notes",
"/Users/you/shared-docs"
]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
Field-by-field:
mcpServers — top-level map keyed by the name Claude Code will show for each server. Keep names short and unique; collisions across scopes resolve by the precedence rules above.command — the executable to launch. Prefer an absolute path for stability; npx works but depends on PATH and can hang on first run while it downloads.args — arguments passed to the command. For the filesystem server, trailing args are the directories to expose — every path listed is readable and writable by the server.env — env vars injected into the child process. Reference shell env vars with ${VAR} syntax. Never paste raw tokens into the committed .mcp.json; put the token in your shell profile or a local override file.Token hygiene: secrets belong in user-scope config (claude mcp add --scope user, which writes to ~/.claude.json) or an env var from your shell profile — never inline in the committed .mcp.json. The committed file should reference env vars only, so it's safe to push and safe to share.
Two reliable signals, both release-stable:
The exact chrome for this (labels, pane names, keybindings) shifts between Claude Code releases. For per-release detail, treat docs.anthropic.com/claude-code as the source of truth and this guide as the mechanism-level reference.
command path or missing executable. Run the exact command from your .mcp.json in a plain shell and see if it launches. If npx, check that your node is new enough and that the first-run download finished. Permissions on the binary matter too — a non-executable script will silently fail.env block is set in the shell that launched Claude Code, and confirm you configured the server in the right scope — a user-scope server won't see a project-scope env override.ps for the binary name), then start a fresh session. If it hangs again on the same task, that specific call is the culprit — narrow it down and file an issue against the server.MCP servers fall into two broadly different threat models. Reason about each one separately before connecting a server — the "safe" defaults for one class aren't defaults at all for the other.
These are programs spawned on your machine as child processes of Claude Code. They run with your user's permissions and can read or write anything your shell can.
DROP TABLE. Nothing in the protocol stops it./ can read SSH keys, shell history, browser cookies — anything on disk your user can see.Defaults that keep blast radius small:
/. The filesystem server takes its exposed paths as arguments — list exactly what's needed.SELECT-only privileges is still useful for schema review and analytics and cannot delete anything..mcp.json. Reference env vars only; keep tokens in user-scope config or your shell profile.Remote MCP servers reach a cloud endpoint rather than a local binary. The threat model is different — and often more consequential than local risk, because data flows off-box and actions run under delegated credentials.
Across both classes: if you didn't write the server, read its tool list in the source or README before enabling. "Looks useful" is not a review.
No. Claude Code works on any repo out of the box. MCP servers are optional extensions that connect Claude Code to external tools or data sources — databases, GitHub, Slack, filesystems outside the project — when the task genuinely needs that reach. Most sessions don't need any MCP server.
Slash commands are local prompt shortcuts you define in Markdown files under .claude/commands/. MCP servers are external processes that connect Claude Code to tools and data sources via a standard JSON-RPC protocol. Slash commands shape the prompt; MCP servers expand what Claude Code can actually do.
Yes. The Model Context Protocol spec is public at modelcontextprotocol.io. Any language with a JSON-RPC library works. Reference SDK implementations exist in TypeScript and Python, and the community maintains a growing catalog of servers for common integrations.
No. MCP is an open protocol. Servers written for Claude Desktop, Zed, Cline, or any other MCP-compatible client work in Claude Code too, and vice versa. That portability is the point of the protocol.
Check the command path in your config — absolute paths are safer than relying on PATH. Verify required env vars are present in the shell that launched Claude Code. Run the server binary manually outside Claude Code and read its stderr to see why it's crashing. Then restart the Claude Code session so it re-reads the config.
MCP servers are one piece of a Claude Code workflow. The Claude Code Starter Kit covers the rest — CLAUDE.md templates, slash commands, hooks patterns — so a new repo is productive on day one. The Cursor Rules kit covers the adjacent surface if some of your team drives from the IDE instead of the terminal.
5 CLAUDE.md templates, 10 slash commands, hooks cookbook, 20 power prompts. Pairs directly with the MCP setup patterns on this page.
5 .cursorrules templates (including Agent Mode guardrails), 10 Composer prompt snippets, settings + model selection guide.
Saved you time? Tip the maker in BTC — no account, no signup, just paste.
bc1qs04leape97ner4wqa98n94l9n0gv9aa84eg4ux
Hand-built single-file games, quizzes, and visualizers — no signup, no tracking, no cost.