high
Secret written into an MCP config
An API key, token or password is stored as plain text in the env or headers of an MCP server entry.
Why it matters
Config files get synced, backed up, shared in screenshots and committed by accident. Anyone who reads the file gets the credential, and nobody remembers to rotate a key that lives in a JSON file.
How to fix it
Reference the secret instead of writing it: an environment variable your launcher sets, or an input the client prompts for (VS Code supports ${input:...}). Then rotate the key that was exposed.
Before
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"@modelcontextprotocol/[email protected]"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_realtokenwrittenhere..."
}
}
}
}After
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"@modelcontextprotocol/[email protected]"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}Illustrative configs. The checker flags the “before” version with this finding and not the “after” version.
Other checks
- Secret passed as a command-line argument
- Secret inside an MCP server URL
- Remote MCP server over unencrypted http
- Remote MCP server with no credentials configured
- Unpinned MCP server package or image
- MCP server installs without asking (npx -y)
- MCP server container runs --privileged
- MCP server container shares the host network
- Broad host folder or Docker socket mounted into an MCP container
- MCP filesystem server with access to a very broad path
- MCP server launched through a shell
- MCP server that can run shell commands
- MCP tools auto-approved or always allowed