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
Metadata
Release files for mcp-security-audit 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_security_audit-0.2.0.tar.gz | 15.5 kB | Without provenance | Details for mcp_security_audit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_security_audit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_security_audit-0.2.0-py3-none-any.whl |
Total release size: 33.3 kB
Release files / mcp_security_audit-0.2.0.tar.gz
| Download URL | mcp_security_audit-0.2.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f0bc4ddca71b5f59c37ac4914cc67aeced6ea08373beb3a3b8ee9390ba83f39
|
|
BLAKE2b-256 checksum How to use checksums |
d080373f0b83ac5608a5dacec9175ede01b95aecadb93481f05a6e0b03caffe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Release files / mcp_security_audit-0.2.0-py3-none-any.whl
| Download URL | mcp_security_audit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4f07f5c91e76f54de88de1243c09f8c035e78329b6bf00e38e8b439b3be0dd9
|
|
BLAKE2b-256 checksum How to use checksums |
021d1d8a936510773444535e465a1cb131d8c697b4abc95913a2c588c44302bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Security for mcp-security-audit 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.