---
title: "How to Add MCP to Claude Code: claude mcp add & Scopes"
url: "https://mcpshelf.co/guides/claude-code"
description: "Add MCP servers to Claude Code with claude mcp add: local and remote servers, the three scopes, API keys, pasting JSON configs, and fixing errors."
updated: "2026-11-20"
site: "MCP Shelf"
---

# How to add MCP to Claude Code

By Sophie Filer · Updated 20 Nov 2026

To add MCP to Claude Code, run one command: claude mcp add. You never have to open a JSON file unless you want to share servers with your team. Here is the short version, then the details that catch people out.

- **Add with:** `claude mcp add`
- **Team file:** `.mcp.json` in the project
- **Local servers:** Yes
- **Remote URLs:** Yes

**At a glance:**

1. **Pick a server.** Find one on the [shelf](https://mcpshelf.co/servers) and open its page.
2. **Run one command.** Copy the Claude Code tab: `claude mcp add ...`
3. **Check it starts.** Run `claude mcp list` and look for Connected.
4. **Ask Claude.** Type `/mcp` to see its tools, then ask away.

## The short version

Local server (runs on your machine):

```
claude mcp add playwright -- npx -y @playwright/mcp@latest
```

Remote server (a URL):

```
claude mcp add --transport http context7 https://mcp.context7.com/mcp
```

Check it actually starts:

```
claude mcp list
```

The double dash matters: everything after it is the command Claude Code runs to start the server, passed through untouched. `claude mcp list` starts each server and prints its status, such as Connected, Needs authentication or Failed to connect, so run it after every add.

Every server page on MCP Shelf has a Claude Code tab with the exact command, including any keys it needs.

## Choosing where the server is saved

Every server has a scope. The default is local: only you, only in the folder you ran the command from.

| Scope | How to set it | Saved in | Available to |
| --- | --- | --- | --- |
| local | default | ~/.claude.json, under this project | You, in this project |
| project | --scope project | .mcp.json in the project root | Anyone who clones the repo |
| user | --scope user | ~/.claude.json, top level | You, in every project |

Project scope writes a .mcp.json file you can commit. Claude Code will not start servers from that file until each person approves them, which is why a fresh clone shows "Pending approval" in `claude mcp list`. Start `claude` in the folder and accept the prompt. `claude mcp reset-project-choices` clears those answers if you need to choose again.

If the same name exists in more than one scope, local wins over project, and project wins over user. The whole entry from the winning scope is used; fields are not mixed.

## Passing API keys

Use `-e` (or `--env`) for environment variables and put it after the server name. If it comes straight before the name, Claude Code reads the name as another variable and stops with "Invalid environment variable format".

```
claude mcp add firecrawl -e FIRECRAWL_API_KEY=fc-your-key -- npx -y firecrawl-mcp
```

For remote servers that take a key in a header, use `--header`:

```
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_TOKEN"
```

Keys end up in plain text in ~/.claude.json, or in .mcp.json for project scope. For a file you commit, refer to environment variables instead. Claude Code expands `${NAME}` and `${NAME:-default}` in the command, args, env, url and headers of .mcp.json, so each person keeps their own key in their shell:

.mcp.json, safe to commit:

```
{
  "mcpServers": {
    "firecrawl": {
      "command": "npx",
      "args": ["-y", "firecrawl-mcp"],
      "env": { "FIRECRAWL_API_KEY": "${FIRECRAWL_API_KEY}" }
    }
  }
}
```

## Pasting a config written for another app

Most READMEs give a Claude Desktop or Cursor JSON block. Pass the object inside "mcpServers" to `claude mcp add-json`, not the whole block:

```
claude mcp add-json playwright '{"command":"npx","args":["-y","@playwright/mcp@latest"]}'
```

> **Watch out:** A remote entry needs a type. `{"url": "..."}` on its own is read as a broken local server and fails with "Invalid configuration". Add `"type": "http"`: `claude mcp add-json context7 '{"type":"http","url":"https://mcp.context7.com/mcp"}'`.

Server names may only use letters, numbers, hyphens and underscores. Rename a key such as "my server" before you add it.

The same works for servers that ship inside another app rather than as an npm package. The config for [Burp Suite's MCP extension](https://mcpshelf.co/servers/burp-suite), for example, starts a small Java proxy, and `claude mcp add-json` takes it as it is. Long argument lists come across unchanged too: the config for [MCP Language Server](https://mcpshelf.co/servers/mcp-language-server), which gives Claude Code go-to-definition and find-references through gopls or pyright, keeps its `--workspace` and `--lsp` flags inside the JSON.

## Signing in to remote servers

Servers that use OAuth show "Needs authentication" in `claude mcp list`. Type `/mcp` inside a session and pick the server, or run `claude mcp login <name>` from your shell; both open the browser. Over SSH, `claude mcp login` prints the address to open on your own computer instead. `claude mcp logout <name>` signs you out.

## Other commands worth knowing

| Command | What it does |
| --- | --- |
| claude mcp get <name> | Shows one server: scope, command, arguments, env, status and any error |
| claude mcp remove <name> | Removes it (add -s <scope> if the name exists in more than one) |
| claude mcp add-json <name> '<json>' | Adds a server from a JSON block, such as the configs on MCP Shelf |
| claude mcp add-from-claude-desktop | Copies servers over from Claude Desktop (macOS and WSL) |
| claude mcp login <name> | Signs in to a remote server from your shell |
| /mcp (inside a session) | Shows connected servers and tool counts, signs in, and turns servers on or off for this project |

## Timeouts and large results

- A server that is slow to start, such as one npx has to download first, can time out. Start Claude Code with a longer limit in milliseconds: `MCP_TIMEOUT=60000 claude`.
- Claude Code warns when one tool result passes 10,000 tokens and caps it at 25,000 by default. Raise the cap with `MAX_MCP_OUTPUT_TOKENS=50000 claude` for servers that return big pages or query results.
- A server you do not need in a project can be switched off in `/mcp` without removing it.

## Popular servers to try in Claude Code

The most-starred servers on the shelf. Each page has the Claude Code command ready to copy.

| Server | What it gives your assistant | You need |
| --- | --- | --- |
| [Sequential Thinking](https://mcpshelf.co/servers/sequential-thinking) | A numbered scratchpad the model fills in, revises and branches while it works. | Node.js 24 or newer (the package asks for it) |
| [Context7](https://mcpshelf.co/servers/context7) | Pulls current, version-specific library docs into the conversation. | Node.js 22.13 or newer for the ctx7 setup command, or Node.js 18 or newer for the local server alone |
| [Playwright MCP](https://mcpshelf.co/servers/playwright) | Microsoft's browser automation server: navigate, click, type, read. | Node.js 18 or newer |
| [GitHub](https://mcpshelf.co/servers/github) | GitHub's own server for repos, issues, pull requests and Actions. | A GitHub account |
| [Blender MCP](https://mcpshelf.co/servers/blender) | Prompt-driven modelling in a running copy of Blender. | Blender 3.0 or newer |
| [Serena](https://mcpshelf.co/servers/serena) | IDE-style "find symbol" and "edit symbol" for an agent, backed by language servers. | uv, which installs Serena and the Python 3.13 it runs on |
| [MCP Toolbox for Databases](https://mcpshelf.co/servers/mcp-toolbox-for-databases) | Google's toolbox for Postgres, MySQL, BigQuery, Spanner and other databases. | Node.js 18 or newer |
| [Framelink Figma MCP](https://mcpshelf.co/servers/framelink-figma) | Feeds Figma layout and styling to coding agents so the UI matches the design. | A Figma personal access token |

## Questions

### Where does Claude Code keep MCP servers?

Local and user servers are in ~/.claude.json. Project servers are in .mcp.json at the root of the project.

### Can I paste the JSON configs from MCP Shelf into Claude Code?

Yes. Use claude mcp add-json with the server's inner block, for example claude mcp add-json playwright '{"command":"npx","args":["-y","@playwright/mcp@latest"]}'. Add "type": "http" to a block that only has a url.

### Do Claude Code and Claude Desktop share servers?

No, they keep separate lists. claude mcp add-from-claude-desktop copies the Desktop ones across on macOS and WSL.

### Why does claude mcp list say "Failed to connect"?

Claude Code could not start or reach that server. Run claude mcp get <name> to see the error, then look it up in [Fixing MCP server errors](https://mcpshelf.co/guides/mcp-server-errors).

---

From [MCP Shelf](https://mcpshelf.co/): A short shelf of MCP servers that are worth installing. Index for agents: https://mcpshelf.co/llms.txt

