# How to add an MCP server to Claude Code

Level 3: Connect AI to your tools · 7 min · Updated 19 November 2026 · Path: Connect MCP servers to your assistant

By the end you'll add remote and local MCP servers to Claude Code, pick the right scope and check their status with /mcp.

You're deep in a refactor and Claude Code keeps guessing at a library's API from memory. Or you want it to read the failing test run, or the ticket, instead of you pasting them in. One command fixes that: `claude mcp add` connects Claude Code to an [MCP](https://ai-powered.com/academy/glossary/mcp) server, and from then on it can look things up for itself.

The same command handles both kinds of server: a URL on the internet, or a program on your machine.

*Diagram: Adding a server, step by step.* Pick a server you trust, add it to your app (a URL or a command), sign in or restart, then try a small task and approve the first tool call.

## Add a remote server

The pattern is:

```shell
claude mcp add --transport http <name> <url>
```

For example, Context7 serves version-specific library documentation and code examples from a public URL. This is its exact command, built from its registry record:

[Context7](https://ai-powered.com/mcp/context7) in Claude Code (Terminal):

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

If the server takes a token in a header instead of a sign-in, add `--header`:

```shell
claude mcp add --transport http my-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"
```

Some older servers only speak SSE. Claude Code's docs call SSE deprecated and, as of 19 November 2026, say that version 2.1.265 and later tries HTTP first and falls back to SSE by itself. On earlier versions, use `--transport sse`.

## Add a local server

Everything after `--` is the command that starts the server:

```shell
claude mcp add [options] <name> -- <command> [args...]
```

Here is Microsoft's Playwright server, which lets Claude open and test web pages:

[Playwright MCP](https://ai-powered.com/mcp/playwright-mcp-2) in Claude Code (Terminal):

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

Pass keys with `--env KEY=value`, once per key. Put another option, such as `--transport stdio`, between the last `--env` and the server name, or Claude Code reads the name as one more key:

```shell
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server
```

## Choose who gets the server

Every server is saved in a scope. Pick one with `--scope` (or `-s`):

**Just for you**

- **local** (the default): you, in this project only. Saved in `~/.claude.json`.
- **user**: you, in every project. Also in `~/.claude.json`.

**For your whole team**

- **project**: everyone who works in this repository.
- Saved in `.mcp.json` at the project root, so you commit it with the code.
- Claude Code asks each person to approve it the first time.

```shell
claude mcp add --transport http shared-server --scope project https://example.com/mcp
```

A project's `.mcp.json` can read secrets from environment variables, so no one commits a key:

```json
{
  "mcpServers": {
    "api-server": {
      "type": "http",
      "url": "https://api.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${API_KEY}"
      }
    }
  }
}
```

To be asked about a project's servers again, run `claude mcp reset-project-choices`.

## Check, sign in and tidy up

- `claude mcp list` shows your servers, `claude mcp get <name>` shows one, `claude mcp remove <name>` deletes it.
- Inside Claude Code, `/mcp` shows each server's status and finishes an OAuth sign-in in your browser. The same menu has **Clear authentication**.

**Try it**

Add Context7 with the command above, start Claude Code in a project and ask: "Use Context7 to look up how to define a route in the version of Next.js this project uses." Approve the [tool call](https://ai-powered.com/academy/glossary/tool-call) and watch it fetch the docs instead of guessing.

## Servers developers use

Popular servers for development work, from the directory:

MCP servers for developer tools from the directory:

- [GitHub](https://ai-powered.com/mcp/github-2): Official MCP server connecting AI assistants to GitHub repos, issues and workflows
- [fastmcp](https://ai-powered.com/mcp/fastmcp): Python framework for building MCP servers, clients and interactive apps
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Local MCP server that builds a code knowledge graph for AI coding agents
- [XERJ](https://ai-powered.com/mcp/xerj): Local search engine for AI agents with cited answers over your code and docs
- [REA](https://ai-powered.com/mcp/rea): CLI and MCP server that lets coding agents reverse engineer apps and binaries

**Watch out**

Claude Code's docs ask you to trust each server before you connect it, and warn that servers which fetch outside content can expose you to prompt injection: text in a web page or an issue that tries to give Claude instructions. Prefer servers published by the service itself, and keep keys in environment variables, never in committed files.

## Key takeaways

- Remote: `claude mcp add --transport http <name> <url>`.
- Local: `claude mcp add <name> -- <command> [args]`.
- `--scope project` writes `.mcp.json` for the team; `/mcp` shows status and handles sign-in.

## What to try next

- Set up the same servers in [Cursor](https://ai-powered.com/academy/connect-mcp-servers/cursor) if you switch editors.
- Ready to make your own? [Build your first MCP server](https://ai-powered.com/academy/build-mcp-servers/first-mcp-server) in about fifteen minutes.

## Sources

Official documentation, checked on 19 November 2026:

- [Connect Claude Code to tools via MCP (Claude Code docs)](https://code.claude.com/docs/en/mcp)

Next lesson: [How to add an MCP server to Cursor](https://ai-powered.com/academy/connect-mcp-servers/cursor)
