Adding servers
# Remote server over HTTP (most hosted services)
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Remote server with an auth header
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer $API_TOKEN"
# Local stdio server: everything after -- is the command that launches it
claude mcp add --transport stdio --env AIRTABLE_API_KEY=$KEY airtable -- npx -y airtable-mcp-serverThe pattern is claude mcp add [options] <name> <url> for remote servers, and claude mcp add [options] <name> -- <command> [args] for local ones.
Scopes: who gets the server?
| Scope | Flag | Stored in | Shared? |
|---|---|---|---|
| local (default) | --scope local | ~/.claude.json, this project only | No |
| project | --scope project | .mcp.json in the repo root | Yes, via git |
| user | --scope user | ~/.claude.json, all your projects | No |
Use project scope for servers the whole team needs. It writes .mcp.json:
{
"mcpServers": {
"sentry": { "type": "http", "url": "https://mcp.sentry.dev/mcp" },
"db": {
"command": "npx",
"args": ["-y", "@example/postgres-mcp"],
"env": { "DATABASE_URL": "${DATABASE_URL}" }
}
}
}${VAR} expands from each developer's environment, so secrets stay out of git. ${VAR:-default} supplies a fallback. For safety, Claude Code asks each person to approve project-scoped servers before they're used.
Use ${ENV_VAR} references for tokens and keys. The file is shared, but the values come from each developer's own environment.
Authentication
Many hosted servers use OAuth. After adding one, run /mcp in a session, select the server and sign in through your browser. From the shell, claude mcp login <name> does the same, and claude mcp logout <name> revokes it.
Managing servers
claude mcp list # all servers with status: ✔ Connected, ! Needs authentication…
claude mcp get sentry # details for one server
claude mcp remove sentryInside a session, /mcp shows status, tool counts and authentication, and lets you reconnect, enable or disable servers. /context all shows how much context each server's tools use.
Add a remote HTTP server named "notion" at https://mcp.notion.com/mcp
Check your understanding
Which scope shares a server with your team through git?
How should tokens appear in a committed .mcp.json?
In claude mcp add ... airtable -- npx -y airtable-mcp-server, what does -- separate?
Which in-session command shows MCP server status and handles OAuth sign-in?