Skip to main content

🔌 SecurAI MCP Scanner

Regression

🇮🇷 راهنمای فارسی

A security scanner for MCP (Model Context Protocol) server configurations and live tool surfaces - the protocol that connects AI agents (Claude, Cursor, VS Code, ChatGPT plugins, etc.) to external tools.

Part of the SecurAI toolkit - this is the member of the family that covers the agent/tool layer, complementing the others' focus on AI-generated application code.

This experimental scanner checks configuration and advertised tool metadata. It does not prove server exploitability or inspect server source code. No false-positive reduction benchmark has been measured for the optional semantic judge.

What it checks

  1. Server configuration (static, no connection needed) - command injection via shell interpreters, unpinned supply-chain dependencies (npx -y pkg with no version), plaintext secrets in config files, overly broad filesystem access (--allow-all, root paths), missing transport security on remote servers (plain HTTP, no auth headers).
  2. Tool descriptions ("tool poisoning") - every MCP tool has a description field the model reads on every turn, whether or not a human ever sees it. This is a live prompt-injection surface. The scanner pattern-matches for instruction-override language, data-exfiltration instructions, tool-routing hijacks, and hidden/invisible Unicode characters used to smuggle text past a UI.
  3. Drift / "rug pull" detection - pin a baseline of a server's current tools (name + description + input schema, hashed). Every later scan diffs against it. A tool that silently changes behavior after approval - the core trust-model gap CSA's research flagged in 2026 - shows up as a critical finding instead of going unnoticed.

Optionally:

  • --live connects to the real server (stdio / SSE / streamable-HTTP) via the official mcp SDK and pulls its actual, current tool list, rather than trusting what's written in a config file.
  • --llm-judge sends flagged (and unflagged) tool descriptions to a Claude model for a semantic second opinion, to cut down regex false positives.

Install

git clone https://github.com/ElhamBidarigh/securAI-mcp-scanner.git
cd securAI-mcp-scanner
python3 -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

pip install -e ".[all]"         # both --live and --llm-judge
# or:
pip install -e ".[live]"        # just live introspection
pip install -e ".[llm]"         # just the LLM judge

To install straight from GitHub without cloning:

pip install "git+https://github.com/ElhamBidarigh/securAI-mcp-scanner.git"

The core (config_parser, static_checks, heuristics, baseline, report) has zero external dependencies - it runs on stock Python 3.10+, so you can run a static scan on a client's machine without installing anything beyond Python itself.

Quick start

python -m mcp_trust_scanner.cli scan examples/vulnerable_config.json

This scans an intentionally vulnerable demo config and prints a Markdown report to stdout. See examples/sample_report.md for a full example of the generated output.

Usage

mcp-trust-scanner scan CONFIG.json [options]
Flag What it does
--live Connect to each server and pull its real, current tool list (requires pip install mcp)
--live-timeout SECONDS Timeout per server in --live mode (default: 20)
--llm-judge Semantic review of tool descriptions via the Anthropic API (requires pip install anthropic)
--api-key KEY Anthropic API key (or set ANTHROPIC_API_KEY)
--baseline-dir DIR Where baselines are stored (default: .mcp-trust/baselines)
--pin Save/update the baseline for every server scanned
--no-drift-check Skip comparing against a saved baseline
--out FILE.md Write the Markdown report to a file
--json-out FILE.json Also write a machine-readable JSON report
--sarif-out FILE.sarif Also write a SARIF 2.1.0 file for GitHub Code Scanning
--client-name NAME Name printed on the report header
--consultant-name NAME Your name, printed on the report header
--consultant-contact C Your email/site, printed on the report header
--fail-on SEVERITY Exit non-zero if any finding at/above this severity exists - useful in CI
--quiet Suppress the console summary line

Typical config file locations

Client Config path
Claude Desktop (macOS) ~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows) %APPDATA%\Claude\claude_desktop_config.json
Claude Code .mcp.json in the project root, or ~/.claude.json
Cursor .cursor/mcp.json
VS Code .vscode/mcp.json

Example: full client assessment

python -m mcp_trust_scanner.cli scan client_config.json \
  --live --llm-judge \
  --client-name "Client Org" \
  --consultant-name "Your Name" \
  --out report.md --json-out report.json

Example: CI gate against rug pulls

# first run, after manual review: approve and pin the current state
python -m mcp_trust_scanner.cli scan .mcp.json --pin

# every subsequent run (e.g. in a pre-commit hook or GitHub Action):
python -m mcp_trust_scanner.cli scan .mcp.json --fail-on high

This fails the build if a tool's description/schema changed since the last approved baseline, or if any new high/critical config issue shows up.

SARIF and GitHub Code Scanning

mcp-trust-scanner scan .mcp.json --sarif-out results.sarif

SARIF is the standard format for static analysis results. Uploaded to GitHub, the findings appear in the repository's Security > Code scanning tab and as annotations on pull requests. Each rule id (CFG-003, TDX-002, ...) becomes a SARIF rule, severity maps to the alert level, and the location is the line where the server is declared in the config file.

GitHub Action

This repository is also a reusable GitHub Action. It installs the scanner, scans a config file, uploads the SARIF file to Code Scanning, writes the report to the job summary, and fails the job when a finding reaches the threshold.

name: MCP scan
on: [push, pull_request]

permissions:
  contents: read
  security-events: write   # needed to upload to Code Scanning

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ElhamBidarigh/securAI-mcp-scanner@v0.2.0
        with:
          config-path: .mcp.json
          fail-on: high          # critical, high, medium, low, info or none
Input Default Meaning
config-path required Path to the MCP config file in your repo
fail-on high Fail the job at or above this severity, or none
baseline-dir empty Directory with pinned baselines, enables rug pull detection
upload-sarif true Upload to Code Scanning (needs security-events: write)
sarif-out mcp-scanner.sarif Where the SARIF file is written

Code Scanning is free for public repositories. For private repositories it needs GitHub Code Security. Set upload-sarif: "false" to skip the upload and still get the job summary and the pass or fail result.

This is a small, focused tool and not the only MCP scanner. For a more mature multi-engine scanner, look at Cisco AI Defense mcp-scanner, which combines YARA rules, an LLM judge and an optional Cisco API, and offers a REST API and an SDK. Other open-source MCP scanners exist as well, for example MCPFang and Ramparts.

What this project aims to do differently (design goals, not benchmark results):

  • A dependency-free core, so a static scan runs on stock Python with nothing to install.
  • Baseline pinning and diffing, to catch a server that changes its tools after you approved it.
  • A client-ready Markdown report written for non-technical readers, next to the JSON output.

Other tools may offer similar features. No benchmark of detection quality against them has been run, so compare before you choose, and combine tools where it makes sense.

The full SecurAI toolkit

Tool Type Link
🛡️ Audit Tool Self-assessment (browser) Live demo
🔬 Vuln Lab Educational (PHP/MySQL) Repo
🔐 JWT Analyzer CLI (Python) Repo
🔍 Active Scanner Live URL scanner (PHP) Repo
🔌 MCP Scanner CLI (Python) You are here
🧪 Prompt Tester CLI (Python) Repo

Project layout

mcp_trust_scanner/
  config_parser.py    Parses Claude Desktop / Cursor / VS Code style MCP config files
  static_checks.py     8 config-level rules (CFG-001..CFG-008)
  heuristics.py         7 tool-description prompt-injection rules (TDX-001..TDX-007)
  live_connector.py     Live stdio/HTTP/SSE introspection via the official mcp SDK
  llm_judge.py           Optional semantic second-opinion layer via the Anthropic API
  baseline.py             Pin/diff logic for rug-pull detection
  report.py               Markdown + JSON report generation
  cli.py                   Command-line interface
examples/
  vulnerable_config.json  Intentionally vulnerable demo config
  sample_report.md        Full example report generated from it
  toy_server.py            Minimal real MCP server, used to test --live end-to-end
tests/
  test_scanner.py          Core tests
  test_regressions.py      Invalid input, incomplete scans, baseline and pagination regressions

Running the tests

python -m unittest discover -s tests -v

Contributing

Issues and PRs welcome - especially new detection rules (CFG-* for config patterns, TDX-* for tool-description patterns) backed by a real-world example.

License

MIT - see LICENSE.

Author

Built by Ellie Bidarigh, a full-stack engineer moving into AI/agent security.

Scan completion and baseline safety

Exit codes: 0 = completed with no requested severity gate hit; 1 = severity gate hit; 2 = invalid input, baseline/output error, or a requested live/LLM layer failed. Failed live/LLM layers are not reported as completed. --pin does not update baselines when requested layers fail or --fail-on rejects findings. Baseline comparison also detects changed launch commands, arguments, transport or endpoint, in addition to tool definitions.

--live starts the configured local process or contacts the configured endpoint: inspect and trust the configuration before using it. It is not a sandbox. --llm-judge sends tool metadata to Anthropic. A score of 100 means no weighted findings were emitted; it is not proof of safety.

Metadata

Release files for securai-mcp-scanner 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for securai-mcp-scanner 0.2.0
File Size Uploaded Provenance Actions
securai_mcp_scanner-0.2.0.tar.gz 38.6 kB With provenance Details for securai_mcp_scanner-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for securai-mcp-scanner 0.2.0
File Interpreter ABI Platform Actions
securai_mcp_scanner-0.2.0-py3-none-any.whl Python 3 none any Details for securai_mcp_scanner-0.2.0-py3-none-any.whl

Total release size: 73.7 kB

Release files / securai_mcp_scanner-0.2.0.tar.gz

Download URL securai_mcp_scanner-0.2.0.tar.gz
Size 38.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4c9efa8f3c905d63120067fb280671d4fc22b459f6ec64af406a947c01f7d4cb
BLAKE2b-256 checksum
How to use checksums
2bad59c84a2c1d5bf7f34dde1500eec2f160814197e455737400c6d8a5763660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / securai_mcp_scanner-0.2.0-py3-none-any.whl

Download URL securai_mcp_scanner-0.2.0-py3-none-any.whl
Size 35.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4199fa7bd36020524ef1f12f442a52af462444ca9d994f3b5f2d235f4a6ea1a
BLAKE2b-256 checksum
How to use checksums
abf8ab9e0a2a885eb2bccb65c3ca17c303da7c3474f0659446453fd2edc94c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for securai-mcp-scanner 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for securai_mcp_scanner-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page