A whole environment file is passed to the server

Low env-passthrough

Loading a whole .env file gives the server every secret in it, not just the one it needs.

Why it matters

Loading a whole .env file (VS Code's envFile, or docker --env-file) gives the server every variable in it: database URLs, payment keys, cloud credentials. A server that only needs one token gets all of them.

How to fix it

Pass only the variables the server needs, by name.

List the variables the server needs in "env", by name, referencing your environment.

Before

"envFile": "${workspaceFolder}/.env"

After

"env": { "SENTRY_TOKEN": "${env:SENTRY_TOKEN}" }

Applies to every MCP client that reads a JSON config: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf and others.

Other checks

Published ; awaiting review.