/mcp-development:mcp-security-auditfrom mcp-development
Audits MCP server configurations (.mcp.json) for hardcoded secrets, shell injection, unpinned dependencies, unsafe npx usage, and unapproved servers. Produces a findings report with severity and remediation.
Ships in mcp-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Audit Model Context Protocol server configurations for secrets exposure, shell injection, unpinned dependencies, dangerous commands, and unapproved server governance and supply-chain risks. Produce a findings report with severity, evidence, and concrete remediation.
.mcp.json or an equivalent MCP server configuration.${ENV_VAR_NAME} instead of hardcoded credentials..mcp.json → Parse Servers → Check Each Server:
1. Secrets in args/env?
2. Shell injection patterns?
3. Unpinned versions (@latest)?
4. Dangerous commands (eval, bash -c)?
5. Server on approved list?
→ Generate Report
| Check | Severity | Evidence to collect | Fix |
|---|---|---|---|
| Hardcoded secret | CRITICAL | Secret-like value in args, env, JSON, bearer token, private key, or provider token. | Replace with ${ENV_VAR_NAME} and set the secret outside source control. |
| Shell injection pattern | HIGH | Command substitution, pipes, chained commands, eval, bash -c, sh -c, reverse shell redirect, curl-to-shell. | Use direct command execution and static argv arrays. |
| Unpinned dependency | MEDIUM | @latest or mutable package references. | Pin to a specific version such as [email protected]. |
npx prompt risk | LOW | command is npx without -y. | Add -y to avoid CI prompts; report this as npx-interactive and use examples like npx -y package-name. |
| Unapproved server | Severity by policy | Server name, package, URL, or command absent from approved list. | Request review or remove the server. |
Use these identifiers and patterns when implementing or reviewing a checker. Function inputs are commonly named mcp_config, and serialized args are commonly named args_text.
SECRET_PATTERNS = [
(r'(?i)(api[_-]?key|token|secret|password|credential)\s*[:=]\s*["\'][^"\']{8,}', "Hardcoded secret"),
(r'(?i)Bearer\s+[A-Za-z0-9\-._~+/]+=*', "Hardcoded bearer token"),
(r'(?i)(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{30,}', "GitHub token"),
(r'sk-[A-Za-z0-9]{20,}', "OpenAI API key"),
(r'AKIA[0-9A-Z]{16}', "AWS access key"),
(r'-----BEGIN\s+(RSA\s+)?PRIVATE\s+KEY-----', "Private key"),
]
DANGEROUS_PATTERNS = [
(r'\$\(', "Command substitution $(...)"),
(r'`[^`]+`', "Backtick command substitution"),
(r';\s*\w', "Command chaining with semicolon"),
(r'\|\s*\w', "Pipe to another command"),
(r'&&\s*\w', "Command chaining with &&"),
(r'\|\|\s*\w', "Command chaining with ||"),
(r'(?i)eval\s', "eval usage"),
(r'(?i)bash\s+-c\s', "bash -c execution"),
(r'(?i)sh\s+-c\s', "sh -c execution"),
(r'>\s*/dev/tcp/', "TCP redirect (reverse shell pattern)"),
(r'curl\s+.*\|\s*(ba)?sh', "curl pipe to shell"),
]
Environment variables that must remain references, not literal secrets, include API_KEY, MY_API_KEY, DB_URL, and DATABASE_URL.
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["server.js"],
"env": {
"API_KEY": "${MY_API_KEY}",
"DB_URL": "${DATABASE_URL}"
}
}
}
}
Bad patterns include hardcoded credentials in args or env, for example --api-key, sk-abc123realkey456, a literal production DB_URL, prod-db, or 5432/main.
.mcp.json or the supplied MCP configuration.mcpServers by server name.SECRET_PATTERNS so secrets outside a single server are caught.command, args, env, package references, and approval status.@latest, unversioned mutable package references where policy requires pinning, and npx without -y.A compact audit runner follows this shape:
def audit_mcp_config(mcp_path: str) -> dict:
"""Run full security audit on an .mcp.json file."""
path = Path(mcp_path)
if not path.exists():
return {"error": f"{mcp_path} not found"}
config = json.loads(path.read_text(encoding="utf-8"))
servers = config.get("mcpServers", {})
results = {"file": str(path), "servers": {}, "summary": {}}
total_findings = []
config_level_findings = check_secrets(config)
total_findings.extend(config_level_findings)
for name, server_config in servers.items():
if not isinstance(server_config, dict):
continue
findings = []
findings.extend(check_shell_injection(server_config))
findings.extend(check_pinned_versions(server_config))
results["servers"][name] = {
"command": server_config.get("command", ""),
"findings": findings,
}
total_findings.extend(findings)
by_severity = {}
for f in total_findings:
sev = f["severity"]
by_severity[sev] = by_severity.get(sev, 0) + 1
results["summary"] = {
"total_servers": len(servers),
"total_findings": len(total_findings),
"by_severity": by_severity,
"passed": len(total_findings) == 0,
}
return results
| Good | Bad |
|---|---|
{ "args": ["-y", "[email protected]"] } | { "args": ["-y", "my-mcp-server@latest"] } |
"API_KEY": "${MY_API_KEY}" | "API_KEY": "sk-abc123realkey456" |
"command": "node", "args": ["server.js"] | `"command": "bash", "args": ["-c", "curl example |
## MCP security audit — `.mcp.json`
**Status:** pass | findings | blocked
**Servers scanned:** <count>
**Findings:** <total> (<critical> CRITICAL, <high> HIGH, <medium> MEDIUM, <low> LOW)
| Severity | Server | Check | Evidence | Fix |
| --- | --- | --- | --- | --- |
| CRITICAL | my-api-server | hardcoded-secret | Hardcoded secret found in MCP configuration | Use environment variable references: `${ENV_VAR_NAME}` |
| HIGH | data-processor | shell-injection | `bash -c` execution in args | Use direct command execution, not shell interpolation |
| MEDIUM | analytics | unpinned-dependency | `analytics-mcp@latest` | Pin to specific version: `[email protected]` |
### Governance notes
- Approved-list result: <approved, exception required, unavailable>
- Secrets moved to environment variables: <yes/no/list>
.mcp.json or the supplied config was parsed successfully, or the parse blocker is reported.mcpServers entries were enumerated.SECRET_PATTERNS including API_KEY, MY_API_KEY, DB_URL, and DATABASE_URL values.command, args, and env were checked for DANGEROUS_PATTERNS.@latest, unpinned packages, and npx without -y are reported.What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/dotnet-mcp-builderBuild and debug C#/.NET MCP servers and clients with current ModelContextProtocol 2.x packages. Use when the user mentions ModelContextProtocol, McpServerTool, MapMcp, WithStdioServerTransport, Streamable HTTP, STDIO, prompts, resources, tools, completions, elicitation, MCP Apps, Tasks, OAuth, reverse proxy deployment, or .NET MCP errors./mcp-builderGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK)./mcp-cliUse the MCP CLI to discover Model Context Protocol servers, inspect tool schemas, grep tool names, and call MCP tools with JSON, raw text, or stdin arguments. Use when the user asks to list MCP servers, inspect a server/tool schema, call an MCP tool from the command line, or script MCP access with --json or --raw output./mcp-implementation-security-reviewReview MCP server, client, and tool-handler source code for security. Use when asked to review an MCP server before release, audit Model Context Protocol implementation controls MCP-01 through MCP-05, check OWASP MCP Top 10, inspect auth, sessions, rate limiting, input-schema validation, official SDK use, or RCE vectors with file and line evidence./mcp-release-qaVerify an MCP server before release by exercising a real protocol session, comparing runtime capabilities with source and documentation, testing failure paths, and recording reproducible evidence. Use when shipping or reviewing an MCP server, tool, resource, prompt, catalog, or install path./webmcpifyMake a web app agent-ready with WebMCP by detecting app actions, building a manifest, integrating document.modelContext tools, verifying in a real browser, healing failures, and auditing diffs. Use when the user says "webmcpify", "add WebMCP", "expose app actions to AI agents", or asks to make a browser app controllable through WebMCP tools.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin mcp-developmentOther plugins' skills for the same job