What MCP adds to Claude Code
Claude Code MCP setup takes about two minutes and permanently changes what the tool can do: MCP servers give Claude Code tools beyond its built-in set — searching your issue tracker, querying a database, driving a browser, reading your analytics. Servers run either locally as subprocesses or remotely as hosted services, and Claude discovers their tools automatically once connected.
This guide covers the CLI flow end to end. If you’re setting up the Claude Desktop chat app instead, that’s a different config file and a different walkthrough — see connecting Claude Desktop. For which servers are actually worth connecting once setup works, we keep a ranked list at best MCP servers for Claude Code.
The two add commands you’ll use
Everything starts with claude mcp add, run in your terminal (not inside a Claude session). There are two shapes — one for hosted (remote) servers you reach over a URL, one for local stdio servers Claude Code launches as a subprocess:
# Hosted server over Streamable HTTP (the Claude Code docs server —
# a good no-auth first test)
claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp
# Local stdio server — everything after the -- separator is the
# command Claude Code runs to start it
claude mcp add playwright -- npx -y @playwright/mcp@latest
# Server that authenticates with a static token
claude mcp add --transport http acme https://mcp.example.com/mcp \
--header "Authorization: Bearer YOUR_TOKEN"
# Then verify:
claude mcp listThe parts: the name (claude-code-docs, playwright) is yours to choose — it labels the server’s tools in Claude’s output. The --transport http flag means “hosted at a URL”; omitting it means stdio, where the command after -- is what gets launched. Environment variables a local server needs go in with --env KEY=value.
claude mcp list shows each server with a status: a check for connected, “needs authentication” for servers awaiting a sign-in, and failure states covered in the troubleshooting section. A first stdio run can show as failed while npx downloads the package — wait a moment and list again.
That generator lives at /tools/mcp-config-generator, and it also emits config for Claude Desktop, Cursor and other clients from the same input.
Scopes: local vs project vs user
Where claude mcp add writes the server determines who can use it. This is the piece most people learn by being confused — a server added in one project silently absent from another:
| Scope | File it writes | Available to | Use for |
|---|---|---|---|
| local (default) | ~/.claude.json, under this project’s entry | Only you, only this project | Experiments; servers with project-specific credentials |
| user | ~/.claude.json, top-level mcpServers key | Only you, every project | Your personal staples — docs search, browser, notes |
| project | .mcp.json in the project root | Everyone who clones the repo | Team-shared servers, committed like any other config |
Pass --scope user or --scope project to override the default. A server’s scope is fixed at add time — moving it means claude mcp remove then re-adding at the new scope. When the same name exists at multiple scopes, local wins over project, which wins over user.
The .mcp.json file (write it by hand for your team)
Project scope is the one worth writing by hand, because .mcp.json is checked into the repository and doubles as configuration-as-code. The format is the same JSON shape all three scopes use:
{
"mcpServers": {
"claude-code-docs": {
"type": "http",
"url": "https://code.claude.com/docs/mcp"
},
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}HTTP servers take a url; stdio servers take a command and args (plus an optional env object). Claude Code reads the file at session start, so restart after editing.
The first time Claude Code sees a project-scoped server it asks each user to approve it. That prompt is a real security boundary — it’s what stops a cloned repository from launching arbitrary processes on your machine without consent. If you rejected one and changed your mind, claude mcp reset-project-choices clears the decision.
Authentication: OAuth and tokens
Hosted servers from services like Sentry, Linear and Notion sit behind OAuth. The flow is two steps: add the server’s URL as normal, then authenticate from inside a session:
The /mcp panel is also where you reconnect, re-authenticate, and inspect a server’s tool list without leaving the session.
Servers that use a static token instead of OAuth take it at add time via --header "Authorization: Bearer <token>" — which is exactly how you’d connect a hosted business endpoint like a BusinessMCP workspace, where the key’s scope controls which tools the session can even see.
Troubleshooting, in the order that finds it
Most failures fall into a handful of buckets. Work down this list:
- 1“No MCP servers configured” — you added the server in a different project (local scope is per-project), or edited a file Claude Code doesn’t read. The only config files are ~/.claude.json and <project>/.mcp.json.
- 2Failed to connect (HTTP) — run claude mcp get <name> for the error detail, then curl -I the URL. A 404/405 means the server is up (many MCP endpoints only answer POST); a 401/403 means authenticate; nothing at all means the URL or your network.
- 3Failed to connect (stdio) — run the configured command directly in your terminal. If it errors, the message names what’s missing (Node, a browser, an env var). If it runs fine, you likely omitted the -- separator when adding.
- 4Connects but no tools — the server started but registered nothing, which usually means a missing API key. Pass it with --env, or in the env field of the JSON entry.
- 5Timeout at startup — slow first-run downloads. Raise the limit: MCP_TIMEOUT=60000 claude.
Two closing pointers: if you’re choosing between running servers locally versus pointing at hosted ones, the trade-offs are the subject of our remote vs local MCP guide; and Claude Code can import your existing Claude Desktop servers in one shot with claude mcp add-from-claude-desktop on macOS or WSL.
Frequently asked questions
How do I add an MCP server to Claude Code?
Run claude mcp add --transport http <name> <url> for a hosted server, or claude mcp add <name> -- <command> for a local stdio server (for example claude mcp add playwright -- npx -y @playwright/mcp@latest). Then claude mcp list to verify it shows as connected, and use it inside a claude session.
What is the .mcp.json file in Claude Code?
It’s the project-scope MCP config, written to the repo root by claude mcp add --scope project or by hand. It maps server names to either a url (HTTP servers) or a command and args (stdio servers), gets committed to version control, and prompts each teammate for approval on first use.
What’s the difference between local, project and user scope?
Local (the default) makes a server available only to you in the current project; user makes it available to you across all projects; project writes it to .mcp.json so everyone who clones the repo gets it. Scope is fixed at add time — remove and re-add to change it. Local overrides project, which overrides user.
How do I connect Claude Code to a server that needs sign-in?
Add the server URL normally, then run /mcp inside a session, select the server, and choose Authenticate — your browser opens the provider’s OAuth sign-in. Servers using static tokens instead take the credential at add time via --header "Authorization: Bearer <token>".
Why does my Claude Code MCP server show “failed to connect”?
For HTTP servers: check claude mcp get <name> for the error, then curl the URL — 404/405 means it’s up but expects POST, 401/403 means auth. For stdio servers: run the command directly in your terminal to see the real error, and confirm you included the -- separator when adding. Slow first downloads can be fixed with MCP_TIMEOUT.
Sources
BusinessMCP Team
Every guide is written from running BusinessMCP on its own platform — the match rates, reply rates, and deliverability lessons are from our own data, not recycled blog folklore. About BusinessMCP
Turn your business into one AI-ready MCP server
Connect your tools, install one tracking script, and expose your unified data to any AI agent through a single secure endpoint.
Get started free