MCP Security Auditor — scan any MCP server for injection patterns, risky tools, and misconfigurations
Project description
mcp-security-audit
Security auditor for MCP servers. Connects to any MCP server, enumerates its tools/resources/prompts, scans for injection patterns, classifies risk levels, and produces a scored report (0-100, grades A-F).
Works as a CLI tool (mcp-audit) or as an MCP server itself (mcp-security-audit).
Install
pip install mcp-security-audit
CLI Usage
Text report
mcp-audit scan --server "python -m my_mcp_server"
JSON report
mcp-audit scan-json --server "python -m my_mcp_server" --output report.json
With live injection tests
mcp-audit scan --server "python -m my_mcp_server" --live-tests
CI/CD
Exit code 0 for grade A/B, 1 for C/D/F:
mcp-audit scan --server "uvx some-server" || echo "Security audit failed"
MCP Server Mode
Use as an MCP server so AI assistants can audit other servers:
Claude Code
claude mcp add mcp-security-audit -- uvx mcp-security-audit
Manual
{
"mcpServers": {
"mcp-security-audit": {
"command": "uvx",
"args": ["mcp-security-audit"]
}
}
}
Tools exposed
| Tool | What it does |
|---|---|
audit_scan |
Full security audit with text report |
audit_quick_scan |
Quick scan — score, grade, top findings |
audit_classify |
Classify a single tool's risk level |
audit_check_text |
Scan text for injection patterns |
What It Checks
- Tool risk classification — categorizes every tool as SHELL / FILE / DATABASE / NETWORK / SAFE
- Injection pattern scanning — scans tool and prompt descriptions for 22 injection patterns
- Resource URI analysis — flags sensitive paths (.env, .ssh, credentials, etc.)
- High-risk ratio — warns if >50% of tools are FILE or SHELL level
- Undocumented tools — flags tools missing descriptions
- Attack surface — warns on 20+ tools (large) or 50+ (very large)
- Live injection tests (opt-in) — sends payloads to string-parameter tools
Scoring
Starts at 100, deducts per finding:
| Severity | Deduction |
|---|---|
| CRITICAL | -25 |
| HIGH | -15 |
| MEDIUM | -8 |
| LOW | -3 |
Bonus: +1 per documented tool (max +5).
Grades: A (90+), B (75+), C (60+), D (40+), F (<40)
Example Output
============================================================
MCP SECURITY AUDIT REPORT
============================================================
Server: python -m agent_safety_mcp.server
Tools: 13
Score: 92/100 (Grade A)
------------------------------------------------------------
TOOL CLASSIFICATION
------------------------------------------------------------
Tool Risk Matched
cost_guard_configure SAFE -
cost_guard_status SAFE -
injection_scan SAFE -
trace_save FILE !!save, file
...
Dependencies
- mcp — MCP protocol SDK
- ai-injection-guard — 22 prompt injection detection patterns
Part of the LuciferForge AI Agent Infrastructure Stack.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_security_audit-0.2.0.tar.gz.
File metadata
- Download URL: mcp_security_audit-0.2.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f0bc4ddca71b5f59c37ac4914cc67aeced6ea08373beb3a3b8ee9390ba83f39
|
|
| MD5 |
a0b8720b3c12fa7252b9e453b5a57c14
|
|
| BLAKE2b-256 |
d080373f0b83ac5608a5dacec9175ede01b95aecadb93481f05a6e0b03caffe9
|
File details
Details for the file mcp_security_audit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mcp_security_audit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4f07f5c91e76f54de88de1243c09f8c035e78329b6bf00e38e8b439b3be0dd9
|
|
| MD5 |
21bdc6cb29314a6e6fbb843b140dd5ea
|
|
| BLAKE2b-256 |
021d1d8a936510773444535e465a1cb131d8c697b4abc95913a2c588c44302bd
|