Server Configuration
An MCP server is a program that gives Claude new tools.
You write its config in .mcp.json or in ~/.claude.json.
Each transport takes its own options, and values can use ${VAR} expansion.
For example, { "mcpServers": { "files": { "command": "bunx", "args": ["server"] } } } starts a local server.
Edit the file, or use claude mcp add and add-json. To turn a server off, remove the entry or use /mcp. See MCP Settings and Policy. Servers live in .mcp.json, ~/.claude.json, a plugin .mcp.json, or mcpServers in plugin.json.
File Shape
.mcp.json holds one object, mcpServers, that maps a server name to an entry.
~/.claude.json uses the same entry shape under mcpServers (user scope) and under projects["<path>"].mcpServers (local scope).
A plugin can use the same shape in its .mcp.json or inline in plugin.json.
{
"mcpServers": {
"name": { "type": "http", "url": "https://example.com/mcp" }
}
}
Server Options
Source: Connect Claude Code to Tools via MCP for rows marked Documented. For the others, the program (its server schema).
| Option | Status | What It Does | How It Works | Used By |
|---|---|---|---|---|
type | Documented | Picks the transport. | stdio, sse, http, ws. streamable- is an alias of http. No type means stdio, so a url without type is an error and Claude Code skips the entry. | All |
command | Documented | The program to run. | Required, at least one character. ${VAR} is expanded. | stdio |
args | Documented | Arguments for the program. | Array of strings. Default []. ${VAR} is expanded. | stdio |
env | Documented | Env vars for the process. | Map of strings. ${VAR} is expanded. | stdio |
url | Documented | The endpoint. | ${VAR} is expanded. An empty url shows as not configured and does not connect. | http, sse, ws |
headers | Documented | Static request headers. | Map of strings. ${VAR} is expanded. Credential variables read as empty here. | http, sse, ws |
headers | Documented | A command that prints headers. | Runs in a shell on each connect. The output is a JSON object. See MCP Authentication. | http, sse, ws |
oauth | Documented | OAuth client settings. | Object with client, callback, auth, scopes. See MCP Authentication. | http, sse |
timeout | Documented | Wall-clock limit of one tool call, in ms. | A positive integer. A value below 1000 is ignored. It overrides MCP_ for this server. It is a floor for the idle timeout. | All |
always | Documented | Skips tool search deferral. | true loads all tools upfront and makes startup wait for the server (5 s cap). false defers all tools, even those the author marked (2. and later). In cloud sessions, a new conversation's first turn does not wait for local (stdio) servers of plugins synced from claude.ai unless the server sets always (since 2.1.304). | All |
role | Documented | Sets the coordinator-mode role. | Only "comms". It marks the server the coordinator uses to talk to the user. | stdio, sse, http, ws, IDE types |
tools | Documented | A per-tool policy list. | Array of { name, permission_. The policy is always_, always_, or always_. A host sets it with mcp_. | sse, http, sdk |
name | Documented | Names the in-process server. | A string. | sdk |
id, display, icon, stateless, enterprise | Documented | Describe a connector row in /. | id must match [A-. | claudeai- |
bare | Undocumented | Declares a bare elicitation capability. | When true, Claude Code sends elicitation: instead of the form and url capability. | stdio, sse, http, ws |
discovery | Undocumented | Per-server switch of the discovery cache. | Boolean. Claude Code removes it from the shown config. | sse, http |
request_ | Undocumented | A wire hint for a per-request timeout. | Folded into timeout at parse time when timeout is missing. Capped at 300000. | sse, http |
tool | Undocumented | A per-tool policy map. | Tool name to allow, ask, or blocked. ask prompts on each call. blocked hides the tool. | sse, http, claudeai- |
disable | Undocumented | Never moves calls to the background. | true keeps the call in the foreground. Read when the server is first registered. | sdk |
ide, ide, auth | Undocumented | Data of an IDE server. | auth exists only on ws-. | sse-, ws- |
cached, cached, discover, eligible, ineligible | Undocumented | Cached connector data. | discover is supported, legacy, or unknown. Claude Code removes these from the shown config. | claudeai- |
Env Var Expansion
Values in command, args, env, url, and headers can read env vars.
| Form | Status | What It Does | How It Works |
|---|---|---|---|
${VAR} | Documented | Inserts the value of an env var. | If VAR is not set and has no default, the text ${VAR} stays and claude mcp list and / show a warning. |
${VAR:- | Documented | Inserts the value, or the default. | Uses default when VAR is not set. |
| Credential names read as empty | Documented | Protects your credentials. | In a remote url and headers, names such as ANTHROPIC_, ANTHROPIC_, AWS_, HTTPS_, and NPM_ read as empty. A default is ignored. |
${CLAUDE_ | Documented | The project root. | In . and ~/., write ${CLAUDE_. A plugin config substitutes it directly. Works in command and args. |
${CLAUDE_, ${CLAUDE_ | Documented | Plugin paths. | Replaced in command, args, env (stdio) and url, headers, headers (remote). Plugin servers only. |
${user_ | Documented | A plugin option value. | Allowed in env and headers. Not allowed in headers, because it is a shell command. |
| Hidden whitespace warning | Documented | Finds pasted newlines. | Checks command, url, each args entry, and the values and key names of env and headers. Values stay unchanged. |
Names
| Rule | Status | What It Does | How It Works |
|---|---|---|---|
| Server name characters | Documented | Limits the name. | Letters, numbers, hyphens, and underscores. |
| Blocked names | Undocumented | Rejects unsafe keys. | The program also rejects constructor, prototype, __, __, __, __, __. |
| Reserved names | Documented | Protects built-in servers. | workspace, claude-, computer-, Claude Preview, Claude Browser. Claude Code skips such a server and warns. |
anthropic- | Documented | A reserved prompt source. | Prompts of a server with this name are not listed. Its tools still work. |
Precedence
- Claude Code uses the highest source for a name. It does not merge fields.
- The order, highest first, is managed, local, project, user, plugin, claude.ai connector.
- Scopes match by name. Plugins and connectors match by endpoint.
- Two URLs are the same endpoint when they differ only in scheme or host case, a default port, or a trailing slash.
- The same name with different endpoints in two scopes gives a warning. OAuth sign-ins are stored for each endpoint.
Example
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.example.com/mcp",
"headers": { "X-Team": "${TEAM_ID:-platform}" },
"timeout": 120000
},
"files": {
"command": "bunx",
"args": ["@example/files-server", "${CLAUDE_PROJECT_DIR:-.}"],
"env": { "LOG_LEVEL": "info" },
"alwaysLoad": true
}
}
}
How It Works
Related Pages
- MCP
- MCP Commands for
claude mcp addandadd-json - MCP Settings and Policy
- Plugin Manifest for
mcpServersin a plugin