The mistake
Writing a token directly into env, args or headers; launching servers with npx -y pkg, uvx pkg or @latest; giving a filesystem server /, C:\ or your home directory; running docker servers with --privileged or the docker socket; remote servers over plain http.
Why it is dangerous
MCP client configs are copied between machines, pasted into issues and committed to repos, and the token travels with the file. Unpinned packages download whatever the registry serves at every client start, so a compromised maintainer account runs on your machine with your permissions. A broad filesystem root exposes SSH keys, browser profiles and cloud credentials to a single prompt injection.
How to fix it
- Rotate any token that was written into the file.
- Reference it instead: Claude Code / .mcp.json
"env": { "KEY": "${KEY}" }; VS Code"${input:key}"with a password input; Cursor"${env:KEY}". - Pin an exact package version (and a digest for docker images), and give filesystem servers only the project folder.
What this checker looks for
This page runs mcp-audit, which reads
mcp.json / .mcp.json / claude_desktop_config.json and MCP server source (Python, JS/TS). The rules most relevant to this page:
| Rule | What it finds |
|---|---|
MCP001 | Hard-coded secret in MCP config |
MCP002 | MCP server launched without a pinned version |
MCP003 | MCP server pinned to a moving tag (@latest / :latest) |
MCP004 | Filesystem MCP server given a broad root |
MCP005 | Docker MCP server with privileged or host access |
MCP006 | Remote MCP server over plain http |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run mcp-audit rules for the full list.