dotsagent.io
Language:English
Anthropic

Add MCP servers to Claude Code

Claude Code takes servers from the claude mcp add command or from a .mcp.json file at the repository root.

macOS
~/.claude.json
Windows
~/.claude.json
Linux
~/.claude.json
Project file
.mcp.json
Top-level key
mcpServers
Format
json
OAuth for remote servers
Yes

Example config

This example adds GitHub's hosted server and Playwright as a local server, in the shape this client expects.

.mcp.json
{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
shell
claude mcp add --transport http --scope project github https://api.githubcopilot.com/mcp/
claude mcp add --scope project playwright -- npx @playwright/mcp@latest

Notes and quirks

  • Local scope, the default, and user scope are stored in ~/.claude.json; project scope lives in .mcp.json.
  • Every entry with a url also needs a type such as http; a url on its own is an error.
  • Values in the file expand ${VAR} and ${VAR:-default}.
  • Run /mcp in a session to sign in to OAuth servers. For pre-registered OAuth apps, pass --client-id, --client-secret and --callback-port.

Build a Claude Code config →

Other clients

Sources

  1. code.claude.com/docs/en/mcp

Independent reference for people who build AI agents. Not affiliated with any vendor named here.

© 2026 DotsAgent · Facts checked October 1, 2026