Home / Guides / Add an MCP server to Claude Code

How to add an MCP server to Claude Code

Claude Code adds MCP servers from the terminal with claude mcp add. A hosted server needs only its URL. A local server needs the command that starts it, written after a --. Where the server is saved, and who else gets it, depends on the scope you pick.

Checked against the Claude Code MCP documentation on November 28, 2026. Claude Code changes often; the source link has the current details.

1. Add a hosted (remote) server

If the publisher runs an endpoint, you install nothing locally. Give the server a name and its URL:

claude mcp add --transport http notion https://mcp.notion.com/mcp

If the server signs you in with OAuth, run /mcp inside Claude Code and follow the sign-in. For a server that takes an API key in a header, add --header "Authorization: Bearer <token>". Some services still offer only an older SSE endpoint; recent Claude Code versions fall back to SSE on their own, and --transport sse forces it.

2. Add a local (stdio) server

A local server is a program Claude Code starts on your machine. Everything after -- is the command, passed through untouched. Claude's own options (--transport, --env, --scope) go before the server name:

claude mcp add --env AIRTABLE_API_KEY=<your key> --transport stdio airtable -- npx -y airtable-mcp-server

Two details catch people out. The double dash is required when the server's command has its own flags. And if the server name comes straight after --env, the CLI reads the name as another KEY=value pair and rejects it, so keep another option such as --transport stdio in between.

3. Choose a scope

ScopeLoads inShared with your teamStored in
local (default)This project onlyNo~/.claude.json, under the project's path
projectThis project onlyYes, through version control.mcp.json at the project root
userAll your projectsNo~/.claude.json

Add --scope project or --scope user to change it. When the same server name is defined at more than one scope, Claude Code uses one definition, in this order: local, then project, then user. Fields are not merged between them.

4. Share servers with .mcp.json

Project scope writes a .mcp.json file you commit, so everyone who opens the repo gets the same servers:

{
  "mcpServers": {
    "shared-server": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}

Claude Code asks each person to approve project servers the first time they start a session, because a repo could name any server. In non-interactive runs such as claude -p there is no prompt and the servers load, so review .mcp.json changes like code. claude mcp reset-project-choices clears earlier approvals. The same file format is read by GitHub Copilot in VS Code.

5. Keep keys out of the file

A committed .mcp.json should never hold a real key. Claude Code expands ${VAR} and ${VAR:-default} in a server's command, args, env, url and headers, so each person keeps the value in their own environment:

"headers": { "Authorization": "Bearer ${API_KEY}" }

An unset variable with no default does not stop the file loading; claude mcp list shows a missing-variable warning instead. Claude Code deliberately reads its own credentials (such as ANTHROPIC_API_KEY) and some others as empty when they are referenced in a remote server's URL or headers, so a repo cannot send them to a server it names. Copy a value into a variable with your own name if a server genuinely needs it.

6. Check that it connected

claude mcp list          # every server and its status
claude mcp get <name>    # one server's details
claude mcp remove <name> # take it out again

Inside a session, /mcp shows the same status and handles OAuth sign-in. Then ask for something small that only the server can do, and confirm in the transcript that its tool was called.

Commands for popular servers

Built from each server's entry in the official MCP Registry, the same commands as on their Socketlist pages. Data as of November 11, 2026. Replace anything in <angle brackets> and read the README for required settings.

playwright-mcp score 90

claude mcp add --transport stdio playwright-mcp -- npx -y @playwright/mcp

Context7 score 90

claude mcp add --env CONTEXT7_API_KEY=<context7_api_key> --transport stdio context7 -- npx -y @upstash/context7-mcp

Hosted endpoint, no install:

claude mcp add --transport http context7 https://mcp.context7.com/mcp --header 'Authorization: <authorization value>'

Chrome DevTools MCP score 95

claude mcp add --transport stdio chrome-devtools-mcp -- npx -y chrome-devtools-mcp

GitHub score 80

claude mcp add --transport stdio github -- docker run -i --rm -p 127.0.0.1:8085:8085 -e GITHUB_OAUTH_CALLBACK_PORT=8085 -e GITHUB_PERSONAL_ACCESS_TOKEN=<token> ghcr.io/github/github-mcp-server:2.1.0

Hosted endpoint, no install:

claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header 'Authorization: <authorization value>'

mongodb-mcp-server score 90

claude mcp add --env MDB_MCP_API_CLIENT_ID=<mdb_mcp_api_client_id> --env MDB_MCP_API_CLIENT_SECRET=<mdb_mcp_api_client_secret> --env MDB_MCP_CONNECTION_STRING=<mdb_mcp_connection_string> --env MDB_MCP_CONNECTION_STRINGS=<mdb_mcp_connection_strings> --env MDB_MCP_VOYAGE_API_KEY=<mdb_mcp_voyage_api_key> --transport stdio mongodb-mcp-server -- npx -y mongodb-mcp-server

Figma-Context-MCP score 97

claude mcp add --env FIGMA_API_KEY=<figma_api_key> --transport stdio figma-context-mcp -- npx -y figma-developer-mcp --stdio

Every listed server has its own command on its page. Find one with search, or start from the best MCP servers for Claude Code.

Before you add one

Each server runs with your permissions and sees what you give it. Run through the MCP server security checklist first, and if your company restricts servers, see how MCP allowlists match.