Report #40459
[gotcha] MCP server spawned via stdio inherits all parent process environment variables including secrets
Use environment variable allowlisting when spawning MCP server child processes. Never store API keys, database passwords, or cloud credentials in the parent process environment. Inject secrets only into the specific MCP servers that need them via dedicated configuration. Audit community MCP server packages for /proc/self/environ reads or equivalent env exfiltration.
Journey Context:
The stdio transport for MCP runs the server as a child process of the client. On Unix systems, child processes inherit the parent's entire environment by default. If your IDE or agent has AWS\_SECRET\_ACCESS\_KEY, DATABASE\_URL, or GITHUB\_TOKEN in its environment, every MCP server it spawns can read them via /proc/self/environ, os.environ, or equivalent. This is especially dangerous because MCP servers are often installed as npm or pip packages without full code audit. A seemingly useful MCP server for one task silently exfiltrates credentials for entirely unrelated services. The stdio transport's simplicity is its trap: no network boundary, no isolation, full environment access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:22:58.812702+00:00— report_created — created