How it shows in /mcp and in tool names (mcp__name__tool).
local: just you, this project. project: .mcp.json, shared. user: you, every project.
As you'd type it in a terminal, e.g. npx -y package-name or python server.py.
KEY=value, one per line.
claude mcp add --transport stdio playwright -- npx @playwright/mcp@latest
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
claude mcp add-json playwright '{"command":"npx","args":["@playwright/mcp@latest"]}'
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
Find a server to add
The MCP directory lists 46,224 servers, ranked by popularity, with install commands for each. Start with the official servers from companies like GitHub, Notion and Stripe, or the remote servers that need nothing installed.
Keep secrets out of git
Don't commit API keys in .mcp.json. Reference an environment variable instead, for example "env": { "API_KEY": "${API_KEY}" }, and set the variable in your shell. Claude Code expands ${VAR} references in .mcp.json when it starts the server.
Frequently asked questions
How do I add an MCP server to Claude Code?
Run claude mcp add. For a remote server: claude mcp add --transport http <name> <url>. For a local one: claude mcp add <name> -- <command> [args]. Fill in the form above to get the exact command. Then run /mcp inside Claude Code to check it connected or to sign in.
What is .mcp.json?
A file in your project root that lists MCP servers for everyone who works on the repo. It uses an mcpServers object keyed by server name. Add servers to it with claude mcp add --scope project, or write it by hand using the output above.
What is the difference between local, project and user scope?
local (the default) stores the server for you in this project only, in ~/.claude.json. project writes it to .mcp.json in the repo so the team shares it. user stores it for you across every project.
Why does the stdio command need "--"?
Everything after the double dash is passed to the server untouched, so flags meant for the server (like -y for npx or --port) are not read as options for claude mcp add.
Can I reuse a Claude Desktop or Cursor MCP config?
Yes. Those clients use the same mcpServers shape. Pass the object for one server to claude mcp add-json <name> '<json>', or copy the whole mcpServers block into .mcp.json.
Sources: Claude Code MCP docs. Claude Code Agents is an independent site, not affiliated with Anthropic.