claude mcp add: the command for each MCP server, and the mistakes to avoid
Claude Code can add an MCP server from one command instead of a hand-edited config file. It is quick, but the syntax has a few traps. Everything here was run against Claude Code 2.1.278 in September 2026, in Git Bash and Windows PowerShell.
The pattern: claude mcp add <name> -- <command> [arguments]. The -- is required whenever the server's arguments start with a dash, such as npx -y.
The command for each server
These are the servers in our directory. Each command produced exactly the same server entry as the config builder does. Replace the placeholder paths with real ones. Where a server needs a key, the command refers to an environment variable, so set that variable first (see the next section).
Filesystem
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/your/project
Git
claude mcp add git -- uvx mcp-server-git --repository /path/to/your/repo
GitHub
claude mcp add github -e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN}' -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
Context7
claude mcp add context7 -- npx -y @upstash/context7-mcp
Playwright
claude mcp add playwright -- npx @playwright/mcp@latest
Chrome DevTools
claude mcp add chrome-devtools -- npx -y chrome-devtools-mcp@latest
Fetch
claude mcp add fetch -- uvx mcp-server-fetch
Firecrawl
claude mcp add firecrawl -e 'FIRECRAWL_API_KEY=${FIRECRAWL_API_KEY}' -- npx -y firecrawl-mcp
Brave Search
claude mcp add brave-search -e 'BRAVE_API_KEY=${BRAVE_API_KEY}' -- npx -y @brave/brave-search-mcp-server
Tavily
claude mcp add tavily -e 'TAVILY_API_KEY=${TAVILY_API_KEY}' -- npx -y tavily-mcp@latest
Notion
claude mcp add notion -e 'NOTION_TOKEN=${NOTION_TOKEN}' -- npx -y @notionhq/notion-mcp-server
Memory
claude mcp add memory -- npx -y @modelcontextprotocol/server-memory
Sequential Thinking
claude mcp add thinking -- npx -y @modelcontextprotocol/server-sequential-thinking
Time
claude mcp add time -- uvx mcp-server-time
Keep keys out of the file: use single quotes
For servers that need a key, the commands above end up storing the text ${NAME}, which Claude Code fills in from your environment when it starts the server. The key itself never lands in the config file, so the file is safe to commit. That only works if your shell leaves the ${NAME} alone, which is what single quotes do. We tested both ways with a dummy key:
Git Bash, single quotes: {"FIRECRAWL_API_KEY":"${FIRECRAWL_API_KEY}"} (a reference)
Git Bash, double quotes: {"FIRECRAWL_API_KEY":"sk-dummy-123"} (the real key, saved in the file)
PowerShell, single quotes: {"FIRECRAWL_API_KEY":"${FIRECRAWL_API_KEY}"} (a reference)
PowerShell, double quotes: {"FIRECRAWL_API_KEY":""} (empty: PowerShell has no such variable)
So always use single quotes around the NAME=${NAME} part. Double quotes either bake your secret into a config file or silently save an empty one. More on this in keeping API keys out of your MCP config.
Two mistakes and the exact errors they give
Forgetting the --
claude mcp add ctx7 npx -y @upstash/context7-mcp error: unknown option '-y'
Claude Code thinks -y is one of its own options. Put -- between the name and the command.
Putting -e before the name
claude mcp add -e KEY=val ctx7 -- npx -y @upstash/context7-mcp Invalid environment variable format: ctx7, environment variables should be added as: -e KEY1=value1 -e KEY2=value2
The -e option swallows the next words, including the server name. Write the name first, then -e options, then --.
Where the server gets saved: scopes
By default the server is added to your local config: private to you, in the current project. Add --scope project to write a .mcp.json file in the project that you can commit and share, or --scope user to make it available in every project. A server saved to .mcp.json must be approved the first time Claude Code sees it.
With --scope project, here is what the command wrote for the Filesystem server:
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/project"],
"env": {}
}
}
}
It adds "type": "stdio" and an empty "env" compared with what the builder writes. They mean the same thing.
Check that it worked
claude mcp list context7: npx -y @upstash/context7-mcp - ✔ Connected claude mcp get context7 context7: Scope: Local config (private to you in this project) Status: ✔ Connected Type: stdio Command: npx Args: -y @upstash/context7-mcp
If you see ✘ Failed to connect, see fixing connection errors. To remove a server:
claude mcp remove context7
Windows PowerShell and add-json
There is also claude mcp add-json <name> '<json>', which takes the whole server entry as JSON. In Git Bash it worked as expected. In Windows PowerShell 5.1, the plain version failed:
claude mcp add-json --scope project ctx7 '{"command":"npx","args":["-y","@upstash/context7-mcp"]}'
Invalid configuration: : Invalid input
PowerShell 5.1 strips the double quotes when it hands the text to another program. Escaping each quote with a backslash fixed it:
claude mcp add-json --scope project ctx7 '{\"command\":\"npx\",\"args\":[\"-y\",\"@upstash/context7-mcp\"]}'
The simpler fix is to use claude mcp add with -- as above, which has no JSON to quote. You can also skip the command entirely and paste the config from the builder into a .mcp.json file.