Skip to main content

MCP Env Vars

These env vars change how Claude Code starts, times out, and limits MCP servers. Set them in the shell or in the env key of a settings file. For example, MCP_TIMEOUT=30000 gives a server 30 seconds to start.

Export the variable, or add it to env in a settings file. Some are switches, such as ENABLE_CLAUDEAI_MCP_SERVERS and MCP_CONNECTION_NONBLOCKING.

Documented Variables​

Each name links to its row on the env var pages, which hold the status, the values, the defaults, and the notes. Source: Connect Claude Code to Tools via MCP, Environment Variables, and Settings Reference. Plugin and MCP Env Vars and the other env var pages list all env vars of Claude Code.

Variables Claude Code Sets for Servers​

Claude Code puts these in the env of a stdio server or a headersHelper.

Undocumented Variables​

Only the program shows these. They can change without notice.

Example​

Slow server, big results, no connector fetch
export MCP_TIMEOUT=60000
export MCP_TOOL_TIMEOUT=300000
export MAX_MCP_OUTPUT_TOKENS=50000
export ENABLE_CLAUDEAI_MCP_SERVERS=false
claude
The same in settings
{ "env": { "MCP_TIMEOUT": "60000", "MAX_MCP_OUTPUT_TOKENS": "50000" } }

How It Works​