Report #10409
[gotcha] Environment variables in MCP server configs leak credentials for unrelated services to the server process
Scope environment variables per server to the minimum credentials that server actually needs. Never pass credentials for unrelated services in the same environment block. Use temporary or scoped tokens instead of long-lived API keys. Audit running server processes for visible environment variables. Consider secret-mounting mechanisms \(vault agents, temporary files\) over environment variables for high-value credentials.
Journey Context:
MCP server configurations \(e.g., Claude Desktop's claude\_desktop\_config.json\) allow specifying environment variables passed to the server subprocess at startup. Developers routinely put all their API keys — GitHub, AWS, OpenAI, Stripe — in one environment block for convenience. But the MCP server process can read every environment variable, not just the ones intended for it. A malicious or compromised server can exfiltrate credentials for services it was never supposed to access. The counter-intuitive part: you think you're giving the server access to one API, but you're actually giving it the keys to every service whose credential is in the environment. Container orchestration systems learned this lesson the hard way; MCP deployments are repeating it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:41:16.375354+00:00— report_created — created