Report #26583
[gotcha] MCP stdio server inherits client environment including secrets
Explicitly scrub environment variables before spawning stdio MCP server processes. Pass only required configuration via command-line arguments or a minimal, constructed environment block. Never inherit the full parent environment. Audit which environment variables the server process can access. Use OS-level sandboxing \(seccomp, seatbelt\) where available.
Journey Context:
The stdio transport is often recommended as the 'secure' local option compared to HTTP/SSE because it avoids network exposure. But when the client spawns a stdio server as a child process, the server inherits the parent's environment variables by default — including API keys, cloud provider tokens, database credentials, and any other secrets the client process has loaded. A compromised or malicious stdio server can read all of them via /proc/self/environ or equivalent. The 'local = secure' assumption is dangerous because local privilege boundaries still exist. The stdio server has the same OS-level access as the client process user. The counter-intuitive insight: the most 'secure' transport actually gives the server the most intimate access to the client's runtime state. Network-facing HTTP/SSE at least forces an authentication boundary; stdio assumes trust by default.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:01:10.046720+00:00— report_created — created