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.
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
},
"playwright": {
"type": "stdio",
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
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.
Other clients
Claude DesktopCursorVS Code (GitHub Copilot)Windsurf / Devin DesktopZedOpenAI Codex CLIGemini CLIChatGPTOpenClawClineContinueJetBrains AI Assistant