MCP server `env` config not passed to child processes
Bug
The env block in mcpServers configuration in ~/.claude/settings.json is silently ignored — environment variables defined there are not passed to the spawned MCP server subprocess.
Reproduction
- Add an env var to an MCP server config in
~/.claude/settings.json:
{
"mcpServers": {
"my-server": {
"command": "my-server",
"args": ["mcp"],
"env": {
"MY_VAR": "1"
}
}
}
}
- Start a Claude Code session (MCP server spawns)
- Check the running process environment:
PID=$(pgrep -f "my-server.*mcp")
ps eww -p $PID | tr ' ' '\n' | grep MY_VAR
# Returns nothing — env var is absent
Expected
MY_VAR=1 should be present in the MCP server's process environment, merged with the parent environment.
Actual
The env block is silently ignored. The MCP server inherits only the parent process environment.
Impact
This blocks the documented workaround for the node-llama-cpp Metal GPU crash (ggml PR #11427). Setting GGML_METAL_NO_RESIDENCY=1 in the MCP server's env config has no effect — the native GGML code never sees it because the env var doesn't reach the subprocess.
Workaround: set the env var in ~/.zshrc instead, so it's inherited through the shell.
Environment
- Claude Code CLI (latest as of 2026-02-24)
- macOS 26.3 (25D125), Apple Silicon (M1)
- Node v22.22.0
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗