How to add MCP to Claude Code?
- 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. - Authenticate if it needs it —
--header "Authorization: Bearer …"for HTTP servers, or-e API_KEY=xxxto pass an environment variable to a stdio server. - Verify with
claude mcp list, thenclaude mcp get <name>. A server showing ⏸ Pending approval is configured but not connected.
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.
Which form you need.
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.
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.
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.
Ways to configure without typing flags.
Two alternatives when the command form is awkward — a JSON blob you already have, or servers already configured in the desktop app.
Frequently asked.
Quick follow-ups people search after this question.
Q · 01 What is MCP, briefly? +
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? +
--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.