Skip to content

How to add MCP servers to Claude Code

Claude Code reads MCP servers from ~/.claude.json (for you) or .mcp.json (for one project), under the "mcpServers" key. A local server’s entry is a command with args; a remote server’s entry is its URL in "url". You can also add a server with one terminal command, claude mcp add.
Last checked against Anthropic’s docs

Quick facts

Local servers
Yes (stdio)
Remote servers
Streamable HTTP: Yes · SSE: YesURL field: url
Sign-in
OAuth: Yes · Headers: YesSign in from /mcp or with claude mcp login <name>. Fixed tokens go in --header.
Resources
Yes
Prompts
Yes
Tool approval
Yes
Tool limit
No fixed limitNo fixed per-server tool cap. Tool search loads tool definitions only when needed, so the practical limit is your context window.
Plans
Claude Code needs a Pro, Max, Ultra, Team, Enterprise or Console account. The free claude.ai plan does not include it.
Platforms
macOS, Windows and Linux

Step by step

Add a remote server

Example: a hosted server whose latest check on AI-Powered answered, Context7.

Add with the CLI

Run in a terminal

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

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp"
    }
  }
}

Add a local server

Example: a popular npm package that needs no keys, Chrome DevTools MCP.

Add with the CLI

Run in a terminal

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

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "chrome-devtools-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "chrome-devtools-mcp"
      ]
    }
  }
}

Add a server that needs an API key or header

Local servers read keys from environment variables. Replace each <NAME> placeholder with your own value in the file on your computer; never paste real keys into a website.

Example: Context7.

Add with the CLI

Run in a terminal

claude mcp add context7 --env CONTEXT7_API_KEY='<CONTEXT7_API_KEY>' -- npx -y @upstash/context7-mcp

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp"
      ],
      "env": {
        "CONTEXT7_API_KEY": "<CONTEXT7_API_KEY>"
      }
    }
  }
}

Request headers for remote servers: yes. Sign in from /mcp or with claude mcp login <name>. Fixed tokens go in --header.

Add a server that signs in with OAuth

OAuth sign-in: yes. Add the server by its URL as a remote server, then sign in when asked. Sign in from /mcp or with claude mcp login <name>. Fixed tokens go in --header.

Config file locations

ForSystemPath
You (every project)All systems~/.claude.json
One projectAll systems.mcp.json

Get the config for any server

Search the MCP servers on AI-Powered and copy the Claude Code snippet for one.

Adding several servers? Build one config with the MCP config generator.

Servers that work in Claude Code

Popular servers with an install config for Claude Code and no failing latest check.
  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 476K GitHub stars
    • Developer tools
  2. Browser Use

    MCP server

    Browser agents and cloud browsers for AI, with an MCP server for web tasks

    • 7 tools
    • Remote
    • Freemium
    • 122K GitHub stars
    • Browser automation
  3. MCP server for AI clients to scrape sites with HTTP and stealth browser sessions

    Runs locally
    • 17 tools
    • Open source
    • 105K GitHub stars
    • Web search and scraping
  4. Hosted MCP connector for creating and rendering videos from HTML through AI chat

    • Remote
    • Freemium
    • 89K GitHub stars
    • Design and media
  5. Context7

    MCP server

    Version-specific library docs and code examples piped into coding agents via MCP

    • 2 tools
    • Remote
    • Freemium
    • 65.4K GitHub stars
    • Developer tools
  6. MCP server and CLI that let coding agents drive and inspect a live Chrome browser

    Runs locally
    • Open source
    • 59.1K GitHub stars
    • Browser automation
  7. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 49.1K GitHub stars
    • Knowledge and memory
  8. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    • Remote
    • Open source
    • 34.7K GitHub stars
    • Developer tools
  9. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.7K GitHub stars
    • Developer tools
  10. ffmpeg-skill

    MCP server

    Local FFmpeg video and audio editing tools for coding agents over MCP

    Runs locally
    • Open source
    • 10.3K GitHub stars
    • Design and media
  11. Ha MCP

    MCP server

    MCP server for managing and automating Home Assistant from AI assistants

    Runs locally
    • 8 tools
    • Open source
    • 8.1K GitHub stars
    • Productivity
  12. Open-source analytics app where an AI agent builds charts and dashboards from your data

    • Remote
    • Open source
    • 7.8K GitHub stars
    • Analytics and data

Troubleshooting

The server’s own flags are read as Claude Code flags
Put -- before the server command. Everything after -- is passed to the server unchanged.
A remote server in .mcp.json is skipped with “has a url but no type”
Add "type": "http" (or "sse") to the entry. Without a type, Claude Code reads the entry as a local server.
The server takes too long to start
Raise the startup timeout, for example MCP_TIMEOUT=10000 claude for 10 seconds.
Sign-in fails with “does not support dynamic client registration”
Register an OAuth app with the server, then add it again with --client-id (and --client-secret if needed).
A tool result is cut off
Results above 25,000 tokens are limited by default. Raise MAX_MCP_OUTPUT_TOKENS before starting Claude Code.
You can’t tell whether the server or Claude Code is at fault
Test the server on its own with the MCP Inspector (npx @modelcontextprotocol/inspector). If it lists tools there, check the Claude Code setup.

Where to find logs

  • Run /mcp in a session to see each server’s status (connected, needs sign-in or failed).
  • Start Claude Code with --debug-file <path> to write a debug log.

Safety notes

  • Servers in a project’s .mcp.json need your approval before they run. Only approve servers from repositories you trust.
  • Use permission rules to allow or block single MCP tools instead of approving everything.
  • Keep tokens in environment variables (${VAR}) rather than in a .mcp.json you commit.
  • A local server runs on your computer with your access to files and the network. Add only servers whose source you trust.

Questions about MCP in Claude Code

Where does Claude Code store MCP servers?

Local and user servers are stored in ~/.claude.json. Project servers go in .mcp.json at the project root, which you can commit to share with your team. Choose with --scope local, project or user.

Can Claude Code use my claude.ai connectors?

Yes. When you are logged in with a claude.ai account, connectors you added on claude.ai show up in /mcp automatically.

Is there a limit on how many MCP tools Claude Code can use?

There is no fixed per-server tool cap. Tool search is on by default, so only tool names load at the start and full definitions load when needed.

Can I import servers from Claude Desktop?

Yes, on macOS and WSL: run claude mcp add-from-claude-desktop and pick the servers to import.

How do I use MCP resources and prompts?

Type @ to mention a resource (for example @server:protocol://path). Prompts appear as slash commands named /server:prompt.

Can I use local MCP servers in Claude Code?

Yes. Claude Code starts a local server as a command on your computer (stdio).

Does Claude Code support remote MCP servers?

Yes. Claude Code connects over Streamable HTTP and the older SSE transport. The URL goes in the "url" field.

Can Claude Code sign in to MCP servers with OAuth?

Yes. Sign in from /mcp or with claude mcp login <name>. Fixed tokens go in --header.

Other MCP clients