How to add MCP servers to Claude Code (claude mcp add)
Claude Code is Anthropic's coding agent for the terminal. You add servers with the claude mcp command, and it saves them for you. It works the same on macOS, Windows and Linux.
Checked against the official docs on 2026-11-26. Apps change often; the sources are linked at the bottom.
Where the config file lives
| Local and user scope (all systems) | ~/.claude.json (in your home folder) |
| Project scope, shared with your team | .mcp.json in the project root |
| Top-level key | mcpServers |
Where a server is saved (scopes)
| Scope | Who gets it | Stored in |
|---|---|---|
| local (default) | Only you, only in this project | ~/.claude.json, under the project's path |
| project (--scope project) | Everyone who works in the project | .mcp.json in the project root (commit it) |
| user (--scope user) | Only you, in every project | ~/.claude.json |
Add a remote server (a URL)
- Add the server with its URL
Remote HTTP servers are the recommended option for hosted services.claude mcp add --transport http notion https://mcp.notion.com/mcp - Pass an API key header if the server needs one
Use--header(or-H).claude mcp add --transport http secure-api https://api.example.com/mcp \ --header "Authorization: Bearer your-token" - Sign in
Startclaudeand type/mcp, then follow the sign-in for servers that use OAuth./mcp
- SSE is deprecated. If a service only offers SSE,
claude mcp add --transport httptries HTTP first and switches to SSE on its own (Claude Code v2.1.265 or later), or you can pass--transport sse. - In a JSON config, an entry with a
urlmust also have"type": "http"(see this fix).
Add a local server (runs on your computer)
- Add the server with its command after --
Everything after--is the command that starts the server. Put--envbefore the server name.claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \ -- npx -y airtable-mcp-server - Or paste JSON from another app's instructions
If a server only gives a Claude Desktop or CursormcpServersblock, add one entry withadd-json.claude mcp add-json example '{"command":"npx","args":["-y","@example/mcp-server"]}' - Keep tokens off the command line (2.1.327 or later)
Pass-instead of the JSON and Claude Code reads the entry from standard input, so a token in it doesn't end up in your shell history. This works from a normal terminal, not inside a Claude Code session.claude mcp add-json github - < github-mcp.json
Check and manage servers
claude mcp list # every server and its status
claude mcp get notion # details for one server
claude mcp remove notion
Tips
- Project servers from a
.mcp.jsonwait for your approval the first time (details). - Slow servers:
MCP_TIMEOUT=10000 claudesets a 10-second startup timeout. - Large tool results: Claude Code warns above 10,000 tokens and caps output at 25,000 by default; raise it with
MAX_MCP_OUTPUT_TOKENS(details). - Remote server won't connect? Since Claude Code 2.1.329, the server's page in
/mcpshows a Server message row with the error the server sent back. - Skills from MCP servers (public beta, Claude Code 2.1.331 or later): a server can now offer skills next to its tools. Type
/or run/skillsto find them; they are namedserver:skill, for example/docs:pdf. Block a server's skills with adenyrule such asSkill(mcp__docs__*)in/permissions. - Slow tools: add
"timeout": 600000(milliseconds) to a server's.mcp.jsonentry to give its tool calls up to ten minutes.
Common problems in Claude Code
- Claude Code: MCP server added but not available ("No MCP servers configured")
- Claude Code: MCP server "has a url but no type"
- Claude Code: project MCP server stuck on "Pending approval"
- Claude Code: MCP tool output is too large (MAX_MCP_OUTPUT_TOKENS)
- Claude Code: MCP server connects but shows no tools (or every tool call fails)
- Remote MCP server says "Needs authentication" or 401 after it used to work