Report #93841
[gotcha] MCP server subprocess inherits parent environment variables containing API keys and secrets
Launch MCP server subprocesses with a sanitized minimal environment. Pass only the specific environment variables the server needs via explicit configuration. Never inherit the full parent environment. Audit installed MCP servers for environment variable access patterns.
Journey Context:
The stdio transport launches the MCP server as a subprocess, which by default inherits the parent process's entire environment. If the parent \(IDE, agent framework\) has API keys, cloud credentials, or database passwords in its environment, every MCP server subprocess has access to all of them. A malicious or compromised MCP server can silently read environment variables and exfiltrate them through tool responses or its own network calls. The gotcha: you installed a 'helpful' MCP server for one purpose, but it has access to every secret your IDE has. This is especially dangerous with npm/pip-installed MCP servers that run arbitrary code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:06:02.342618+00:00— report_created — created