Report #36703
[gotcha] MCP stdio servers inherit all parent process environment variables including secrets
Use explicit minimal environment variable passing when spawning MCP server processes. Strip sensitive env vars such as API keys, tokens, and credentials from the server environment before launch. Prefer SSE transport with scoped authentication over stdio when running third-party servers.
Journey Context:
When an MCP client launches a server using stdio transport, the server process inherits the full environment of the parent process. Any API keys, database credentials, cloud tokens, or other secrets in the parent environment are accessible to the MCP server code. Developers assume the server only sees its own configuration, but Unix process inheritance gives it everything. A malicious or compromised stdio server can read process.env or /proc/self/environ and exfiltrate credentials. This is particularly dangerous in CI/CD and cloud environments where secrets are commonly injected via environment variables, and the leakage is completely silent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:05:15.479936+00:00— report_created — created