Skip to main content

MCP Security Auditor — scan any MCP server for injection patterns, risky tools, and misconfigurations

Project description

mcp-security-audit

PyPI version License: MIT Python 3.10+

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

  1. Tool risk classification — categorizes every tool as SHELL / FILE / DATABASE / NETWORK / SAFE
  2. Injection pattern scanning — scans tool and prompt descriptions for 22 injection patterns
  3. Resource URI analysis — flags sensitive paths (.env, .ssh, credentials, etc.)
  4. High-risk ratio — warns if >50% of tools are FILE or SHELL level
  5. Undocumented tools — flags tools missing descriptions
  6. Attack surface — warns on 20+ tools (large) or 50+ (very large)
  7. 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

Part of the LuciferForge AI Agent Infrastructure Stack.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_security_audit-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_security_audit-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_security_audit-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_security_audit-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for mcp_security_audit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6ed804e9361c93ce229bf987d85f9f537455b70f42905cee083054ac043de1d4
MD5 849acf04605df5c239c8deafaf665a71
BLAKE2b-256 c4d03c4d7768ec640e77e9895d6041840f3a32dc4aea2f5c4a96d9000bb55da5

See more details on using hashes here.

File details

Details for the file mcp_security_audit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_security_audit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d9f7fe959aa83077794a11a027d86ca036f1fd422fc1f5c02664314c7e3d2ce
MD5 6c4abe5c5f4a40ef784cab03fa8329d4
BLAKE2b-256 68c8fec43cb8cc3b339af4c1999d4eb504a037fb31277cfc4c68c6a6a968973f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page