MCP Permission Auditor — scan, enumerate, and risk-score all locally configured MCP servers
Project description
mcp-audit
You're giving AI direct access to your computer. Do you actually know what you've installed?
mcp-audit gives you x-ray vision into every MCP server configured on your system: what it can do, how risky it is, whether its descriptions are hiding adversarial instructions, and whether it's changed since you last looked. It is local-first, needs no API key by default, and makes networked LLM analysis opt-in.
PyPI package: mcp-permission-audit. Installed command: mcp-audit.
Features
- Capability inventory — catalogs server tools, prompts, and resources; tool, prompt, and resource capabilities are classified across six permission categories:
file_read,file_write,network,shell_execution,destructive,exfiltration - Config-only inference —
scan --skip-connectinfers conservative risks from declared commands, transports, credential key names, package runners, and remote URLs - Risk scoring — composite 0–10 per server as a weighted sum of per-category max(weight × confidence), with a five-dimension breakdown (file access, network, shell, destructive, exfiltration)
- Stable finding metadata — permission and prompt-injection findings include stable rule IDs, severity, evidence, and suggested remediation so reports are easier to triage
- Local policy gates —
scan --policy policy.yamlevaluates reports against local YAML rules and exits nonzero for CI enforcement - Report redaction — terminal, JSON, and SARIF report paths share a redaction layer for likely credential values
- Prompt injection detection —
scan --inject-checkscans tool names and descriptions for instruction-override patterns, hidden directives, and adversarial phrasing; pattern-based, no LLM required - Schema drift tracking —
mcp-audit pinconnects to servers and snapshots current tool schemas; subsequentscan --pin-checkflags added, removed, and changed tools with plain-language summaries, changed-field hints, and suggested actions - Multi-client support — reads configs from Claude Desktop, Claude Code, Cursor, VSCode, and Windsurf — plus any custom path via
--config - Structured output — Rich terminal report plus JSON and SARIF 2.1.0 export for ingestion by GitHub Advanced Security and SARIF-aware SAST pipelines
- Documented output contract — JSON, SARIF rule IDs, and policy exit codes are documented in
docs/OUTPUT-CONTRACT.md - Watch mode —
mcp-audit watchre-scans on config file changes viawatchfiles(optional extra: install withmcp-permission-audit[watch])
Quick Start
Prerequisites
- Python 3.11+
uv(recommended) orpip
Installation
uvx --from mcp-permission-audit mcp-audit discover
# or install permanently:
uv tool install mcp-permission-audit
# with watch mode support:
uv tool install 'mcp-permission-audit[watch]'
Usage
# Discover configured MCP servers without connecting to them
mcp-audit discover
# Scan all configured MCP servers
mcp-audit scan
# Config-only scan that does not spawn or connect to servers
mcp-audit scan --skip-connect
# Filter to specific clients (comma-separated)
mcp-audit scan --clients claude_desktop,cursor
# Check tool names and descriptions for prompt-injection patterns
mcp-audit scan --inject-check
# Pin current tool schemas, then detect drift on later scans.
# Pinning connects to servers so it can capture real tool schemas.
mcp-audit pin
mcp-audit scan --pin-check
# Export JSON or SARIF 2.1.0
mcp-audit scan --json audit.json --sarif audit.sarif
# Fail CI on local policy violations
mcp-audit scan --policy policy.yaml
# Optional LLM-assisted classification (requires ANTHROPIC_API_KEY)
mcp-audit scan --llm-analysis
# Watch mode — re-scan on config change; use --skip-connect for config-only watching
mcp-audit watch
Tech Stack
| Layer | Technology |
|---|---|
| Language | Python 3.11+ |
| CLI | Click 8 |
| Output | Rich |
| MCP protocol | mcp SDK 1.27+ |
| Validation | Pydantic v2 |
| Config parsing | PyYAML + json5 |
| Watch mode | watchfiles (optional extra) |
| Optional LLM | Anthropic SDK |
Architecture
The scanner enumerates MCP client config files, connects to each configured server, and calls tools/list, prompts/list, and resources/list over the MCP protocol when those capabilities are available. Stdio servers are started as subprocesses via anyio; HTTP/SSE servers are contacted at their configured URL. Returned tool schemas, prompt arguments, and resource URIs flow into the permission classifier (schema walker + regex ruleset over six permission categories) and the optional injection detector (pattern ruleset for instruction-override, role-switch, and hidden-directive phrasing). The risk scorer composes a per-category weighted sum clamped to 0–10 from tool findings; prompt and resource findings are reported separately for review and policy gates. Reports render via Rich; JSON and SARIF 2.1.0 export are first-class. The pin store serializes SHA256 schema hashes plus reviewable tool snapshots to ~/.mcp-audit-pins.yaml for actionable drift detection on subsequent --pin-check scans.
Local Policy Gates
Policies are local YAML files evaluated after a scan. A failing policy exits with code 2 after terminal, JSON, or SARIF output is written.
fail_on:
severity: high
drift: true
deny:
permissions:
- shell_execution
max_risk: 7
allow_servers:
- github
servers:
github:
max_risk: 5
deny:
permissions:
- shell_execution
See examples/policies/ for starter policies.
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_permission_audit-1.0.0a2.tar.gz.
File metadata
- Download URL: mcp_permission_audit-1.0.0a2.tar.gz
- Upload date:
- Size: 41.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
628e928c976c95efd6c65496d86b1c7ad4843d1aa44f817e51c198ebbca9246a
|
|
| MD5 |
8331db1be9ba86b3fc8439c185567cad
|
|
| BLAKE2b-256 |
7710814920704fe27269f1f941428f4e9228b64f97298bbe1646dc3d105c0ff9
|
Provenance
The following attestation bundles were made for mcp_permission_audit-1.0.0a2.tar.gz:
Publisher:
publish.yml on saagpatel/MCPAudit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_permission_audit-1.0.0a2.tar.gz -
Subject digest:
628e928c976c95efd6c65496d86b1c7ad4843d1aa44f817e51c198ebbca9246a - Sigstore transparency entry: 1484624297
- Sigstore integration time:
-
Permalink:
saagpatel/MCPAudit@b7a9d771ee3e6ced26a21b4c4f380738a5c5903f -
Branch / Tag:
refs/tags/v1.0.0a2 - Owner: https://github.com/saagpatel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7a9d771ee3e6ced26a21b4c4f380738a5c5903f -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_permission_audit-1.0.0a2-py3-none-any.whl.
File metadata
- Download URL: mcp_permission_audit-1.0.0a2-py3-none-any.whl
- Upload date:
- Size: 54.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89184c7c56f0920d8d1a85d56a91410c7645af56bbbff5ce3197caa89ccbe826
|
|
| MD5 |
8091b0f37cc789fda8f2c274d6ed6281
|
|
| BLAKE2b-256 |
dc6007bf30828ec668ce18890651cfb3aea0df6b7e99132dc9ac30833ba1e461
|
Provenance
The following attestation bundles were made for mcp_permission_audit-1.0.0a2-py3-none-any.whl:
Publisher:
publish.yml on saagpatel/MCPAudit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_permission_audit-1.0.0a2-py3-none-any.whl -
Subject digest:
89184c7c56f0920d8d1a85d56a91410c7645af56bbbff5ce3197caa89ccbe826 - Sigstore transparency entry: 1484624335
- Sigstore integration time:
-
Permalink:
saagpatel/MCPAudit@b7a9d771ee3e6ced26a21b4c4f380738a5c5903f -
Branch / Tag:
refs/tags/v1.0.0a2 - Owner: https://github.com/saagpatel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7a9d771ee3e6ced26a21b4c4f380738a5c5903f -
Trigger Event:
push
-
Statement type: