CLAUDE_CODE_MCP_ALLOWLIST_ENV

Updated by

CLAUDE_CODE_MCP_ALLOWLIST_ENV is a Claude Code environment variable: Specifies an allowlist of environment variables that MCP servers can access. MCP servers run as subprocesses and inherit the parent environment by default, which is a security concern — API keys, database credentials, and cloud tokens all leak into every MCP server process. Added in v2.1.94 and still present in v2.1.294. It is listed in the official reference.

StatusPresent in v2.1.294
AddedAdded in v2.1.94
CategoryMCP
Official docsListed

How to set it

For one session, export it in the shell that starts Claude Code:

export CLAUDE_CODE_MCP_ALLOWLIST_ENV=<value>
claude

To apply it to every session, add it to the env object of a settings file:

// ~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_MCP_ALLOWLIST_ENV": "<value>"
  }
}

Release notes that mention it

Related variables

Frequently asked questions

What does CLAUDE_CODE_MCP_ALLOWLIST_ENV do?

Specifies an allowlist of environment variables that MCP servers can access. MCP servers run as subprocesses and inherit the parent environment by default, which is a security concern — API keys, database credentials, and cloud tokens all leak into every MCP server process.

Which Claude Code version has CLAUDE_CODE_MCP_ALLOWLIST_ENV?

Added in v2.1.94 and still present in v2.1.294.

How do I set CLAUDE_CODE_MCP_ALLOWLIST_ENV?

Export it before starting Claude Code (export CLAUDE_CODE_MCP_ALLOWLIST_ENV=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.

All variables, searchable: Claude Code environment variables.