Adding an MCP server
Useclaude mcp add to register a server. The command syntax depends on the transport type.
- Stdio (default)
- HTTP
- SSE
Stdio servers run as a local subprocess. The command and any arguments are passed directly.Examples:
Scopes
Every MCP server is stored in one of three user-controlled scopes. Use-s or --scope to choose:
| Scope | Flag | Where it’s stored | Who it applies to |
|---|---|---|---|
local | -s local (default) | Global Claude config, keyed to current project | You, in this project only |
project | -s project | .mcp.json in the project root | Everyone who checks out the project |
user | -s user | Global Claude config | You, in all your projects |
Listing and removing servers
The .mcp.json config file
When you use--scope project, Claude Code writes to a .mcp.json file in the current working directory. You can also create or edit this file directly.
type field is optional for stdio servers (it defaults to "stdio"). For remote servers you must set "type": "sse" or "type": "http".
Environment variable expansion
Claude Code expands environment variables in MCP server configs at connection time. This applies tocommand, args, env values, and url/headers fields for remote servers.
Transport types
The source defines the following transport types for MCP server configs:| Type | Description |
|---|---|
stdio | Launches a local subprocess and communicates over stdin/stdout. Default when no --transport is given. |
sse | Connects to a remote server using Server-Sent Events over HTTP. |
http | Connects to a remote server using streamable HTTP. |
The
ws (WebSocket) transport type exists in the codebase but is not exposed via claude mcp add. The sse-ide, ws-ide, and sdk types are internal and used by IDE integrations.Authentication for remote servers
For SSE and HTTP servers that require OAuth, pass the OAuth client ID and optionally a client secret:--client-id, --client-secret, and --callback-port are only valid for sse and http transports. They are ignored for stdio servers.Enabling and disabling servers
You can enable or disable MCP servers without removing them:Reconnecting a server
If a server connection drops, you can reconnect it from within a session:Enterprise policy settings
Administrators can control which MCP servers are available using policy configuration. Two lists are supported:allowedMcpServers— an allowlist. When set, only listed servers are permitted. An empty list blocks all servers.deniedMcpServers— a denylist. Listed servers are always blocked, even if they appear in the allowlist.
* wildcards (remote servers).
The enterprise-managed MCP config file is stored at the managed path as managed-mcp.json. When this file exists, it takes exclusive control of MCP configuration and users cannot add servers manually.
Using MCP tools in a session
Once a server is connected, its tools appear in the tool list and Claude can call them automatically. Tools from MCP servers are prefixed with the server name (e.g.,mcp__myserver__toolname).
Connected servers are shown with a status indicator. If a server has needs-auth status, you will be prompted to complete authentication before its tools are available.