Last verified

How to add MCP to Claude Code?

3 Steps · HTTP or stdio
  1. Add the server. Remote: claude mcp add --transport http sentry https://mcp.sentry.dev/mcp. Local process: claude mcp add my-server -- npx my-mcp-server.
  2. Authenticate if it needs it — --header "Authorization: Bearer …" for HTTP servers, or -e API_KEY=xxx to pass an environment variable to a stdio server.
  3. Verify with claude mcp list, then claude mcp get <name>. A server showing ⏸ Pending approval is configured but not connected.
Transports http· stdio · sse
Import from Claude Desktopmac · wsl
Config by JSON yesmcp add-json
Cost $0server may bill
§ 01 / PROOF

We actually ran it.

Methodology →
TEST RUN · AUG 01, 2026 · CLI 2.1.170

The command surface, read off the CLI itself.

claude mcp --help on 2.1.170 lists the subcommands: add, add-json, add-from-claude-desktop (Mac and WSL only), get, list. The examples in step 1 are the CLI's own, not ours — including the HTTP transport form, the header form for bearer tokens, and the -e KEY=value -- command form for stdio servers with environment variables.

The detail worth knowing before you debug anything: get reports unapproved servers from a project's .mcp.json as ⏸ Pending approval and does not connect to them, while approved servers are health-checked. A server that "isn't working" is very often a server that was never approved.

Scope: we read and quote the command surface, and we did not stand up a live third-party server as part of this run. The syntax is verified; whether your server behaves is between you and its author.

Subcommands: add · add-json · get · listImport path: from Claude DesktopUnapproved shown as: ⏸ Pending approvalCLI version: 2.1.170Live server connected: not in this run
$ claude mcp --help
Configure and manage MCP servers
add Add an MCP server to Claude Code
add-json Add a server from a JSON string
get Get details about an MCP server
list List configured MCP servers
$ claude mcp add --transport http sentry \
https://mcp.sentry.dev/mcp
$
§ 02 / WHY

Which form you need.

2.1
Remote server: HTTP with a header

Hosted services are the common case. --transport http plus the endpoint is the whole command, and anything needing auth takes a header:

claude mcp add --transport http corridor https://app.corridor.dev/api/mcp --header "Authorization: Bearer …"

Keep the token out of shell history and out of the repository — an exported environment variable referenced in the command is better than a literal string you'll forget you pasted.

2.2
Local server: stdio, with everything after --

For a server that runs as a subprocess, everything after -- is the command to launch. Environment variables go before it:

claude mcp add my-server -e API_KEY=xxx -- npx my-mcp-server

Subprocess flags belong after the command, not before the separator: claude mcp add my-server -- my-command --some-flag arg1. Getting this wrong is the usual reason a stdio server silently fails to start.

2.3
When it doesn't connect

Start with claude mcp get <name>. Three common outcomes: pending approval (a project-level .mcp.json server you haven't accepted — approve it and it connects), a failed health check (the server itself is down or the command is wrong), or simply absent (the add didn't land in the scope you expected).

If you're bringing servers over from the desktop app, claude mcp add-from-claude-desktop imports them — Mac and WSL only.

Frequently asked.

Quick follow-ups people search after this question.

Q · 01 What is MCP, briefly? +
The Model Context Protocol — an open standard for connecting AI tools to external systems. Adding a server gives Claude Code new tools: reading a tracker, querying an internal API, pulling a document. The protocol is open; the client that speaks it is Anthropic's.
Q · 02 How do I check a server is connected? +
claude mcp list for the roster, claude mcp get <name> for detail. Approved servers get health-checked; anything shown as ⏸ Pending approval is configured but not connected, which is the most common false alarm.
Q · 03 Where do API keys go? +
For HTTP servers, in a --header. For stdio servers, as -e KEY=value before the -- separator. Reference an environment variable rather than pasting a literal token into a command your shell will remember.
Q · 04 Does adding an MCP server cost anything? +
Not on the Claude Code side. The server itself might bill you, and the extra tool definitions and results become tokens in your context — so a chatty server has a real, if indirect, cost.