Skip to content

Inherit proxy env vars in MCP server subprocesses - #235

Merged
anticomputer merged 2 commits into
mainfrom
anticomputer/proxy-env-passthrough
May 6, 2026
Merged

anticomputer merged 2 commits into
mainfrom
anticomputer/proxy-env-passthrough

Conversation

@anticomputer

Copy link
Copy Markdown
Contributor

When toolbox YAML specifies an explicit env block, the subprocess gets only those vars (plus HOME/PATH from the MCP SDK defaults). HTTP_PROXY/HTTPS_PROXY from the parent are lost.

This breaks HTTPS inside network-isolated environments like AWF, where all traffic must route through a Squid proxy. The MCP file viewer and other servers fail with [SSL] record layer failure because Python tries direct connections that hit iptables DNAT instead of using the proxy.

Fix: inherit proxy-related env vars from the parent process into MCP server subprocess environments when they're not already set by the toolbox config.

When toolbox YAML specifies an explicit env block, the MCP SDK
creates a subprocess with only those vars plus HOME/PATH/etc.
HTTP_PROXY/HTTPS_PROXY from the parent are lost, breaking HTTPS
inside network-isolated environments (e.g. AWF) where all traffic
must route through a proxy.

Inherit proxy-related env vars (HTTP_PROXY, HTTPS_PROXY, NO_PROXY
and lowercase variants) from the parent process into MCP server
subprocess environments.
Copilot AI review requested due to automatic review settings May 6, 2026 16:58
@anticomputer
anticomputer merged commit e51455a into main May 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant