Skip to main content

mcpsweep

A small, dependency-free discovery and fingerprinting scanner for MCP-over-HTTP servers. It finds Model Context Protocol endpoints on a host or network, performs the JSON-RPC initialize handshake to fingerprint each one, enumerates its tools / resources / prompts, and flags risky or poisoned tools.

It is strictly read-only — it performs the handshake and */list calls only, and never invokes a tool (tools/call).

Authorized use only. Scan hosts you own or are explicitly permitted to test.

Why

MCP servers are easy to spin up and often ship with no authentication, over-broad tools (arbitrary SQL, shell, money movement), or instructions hidden inside a tool's description (tool poisoning). mcpsweep helps you inventory that surface — including shadow servers nobody registered — and see the risk at a glance.

Install

pip install mcpsweep

Or from source:

git clone https://github.com/krishnareddypadala/mcpsweep && cd mcpsweep
pip install .

Usage

# scan one host on a known port
mcpsweep 10.10.0.31 --ports 8090

# route everything through Burp for inspection
mcpsweep 10.10.0.31 --ports 8090 --proxy http://127.0.0.1:8080

# sweep a subnet and a port range, also list resources/prompts
mcpsweep 10.10.0.0/28 --ports 8000-9100 --full

# a full URL, and a target list from a file
mcpsweep http://10.10.0.31:8090/mcp/api
mcpsweep -iL targets.txt --exclude 10.10.0.5

# authenticated scan (servers that require a token)
mcpsweep 10.10.0.31 --ports 8090 --bearer "$TOKEN"
mcpsweep 10.10.0.31 --ports 8090 -H "X-Api-Key: abc123"

# reports: JSON, Markdown, SARIF (GitHub code-scanning), self-contained HTML
mcpsweep 10.10.0.31 --ports 8090 --format json  -o report.json
mcpsweep 10.10.0.31 --ports 8090 --format md    -o report.md
mcpsweep 10.10.0.31 --ports 8090 --format sarif -o report.sarif
mcpsweep 10.10.0.31 --ports 8090 --format html  -o report.html

# CI gates: only show high+, fail the build on any critical
mcpsweep 10.10.0.31 --ports 8090 --severity high --fail-on critical

# drift detection between two JSON scans (continuous posture monitoring)
mcpsweep diff yesterday.json today.json --fail-on-drift

Key options

Flag Purpose
--target-file/-iL read targets from a file (one per line, # comments)
--exclude comma-separated hosts to skip
--ports ports/ranges, e.g. 8090,8000,9000-9010
--paths URL paths to probe (defaults cover /mcp, /mcp/api, /sse, …)
--scheme http, https, or both
--header/-H, --bearer custom header(s) / bearer token for authenticated scans
--proxy send all traffic via a proxy (e.g. Burp on 127.0.0.1:8080)
--insecure/-k skip TLS verification
--full also enumerate resources/list and prompts/list
--severity only report endpoints at/above a level
--fail-on exit 2 if any endpoint is at/above a level (CI gate)
--format/-f text (default), json, md, sarif, html
--concurrency/-c parallel probes (default 16)

Exit codes: 0 found (or clean), 1 nothing found, 2 --fail-on threshold hit, 3 drift found (diff --fail-on-drift).

Drift detection

mcpsweep 10.10.0.31 --ports 8090 -f json -o baseline.json   # week 1
mcpsweep 10.10.0.31 --ports 8090 -f json -o current.json    # week 2
mcpsweep diff baseline.json current.json

Reports new / removed servers and tools, newly-poisoned descriptions, and risk-level changes — turning point-in-time scans into continuous monitoring.

Windows / Git Bash note: Git Bash (MSYS) rewrites arguments that look like Unix paths, so --paths /mcp/api becomes a Windows path before the tool sees it. Either omit --paths (the built-in defaults are unaffected), prefix the command with MSYS_NO_PATHCONV=1, or run from PowerShell / cmd.

What it detects

  • Live MCP endpoints across many candidate paths/ports, via the initialize handshake (Streamable-HTTP and SSE-framed responses).
  • Server fingerprint: name, version, protocol, capabilities, instructions.
  • No authentication: initialize that succeeds with no credentials.
  • Auth-gated endpoints: 401/403 with an MCP/WWW-Authenticate signature.
  • Risky tools: name/description heuristics tag rce, sql, money, destructive, write, secret, pii, filesystem, …
  • Prompt injection / poisoning in tool descriptions and server instructions, prompt templates, and resource listings ("ignore previous instructions", "silently", "password_hash", …).
  • Injection surface: high-impact tools (sql/rce/…) that accept a free-form string parameter.
  • HTTP fingerprint: Server / X-Powered-By headers, and server names that hint at an elevated or untrusted purpose.

A per-endpoint risk score rolls these up into low / medium / high / critical.

Library use

from mcpsweep import scan

for ep in scan(["10.10.0.31"], ports=[8090], proxy="http://127.0.0.1:8080"):
    print(ep.url, ep.server_name, ep.risk_level)
    for t in ep.tools:
        print("  ", t.name, t.tags, "POISONED" if t.poisoned else "")

License

MIT

Download files

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

Source Distribution

mcpsweep-0.2.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

mcpsweep-0.2.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file mcpsweep-0.2.0.tar.gz.

File metadata

  • Download URL: mcpsweep-0.2.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for mcpsweep-0.2.0.tar.gz
Algorithm Hash digest
SHA256 54eb67ed01f0d990bc9c58eecbd6032bd162a5ccf8cc76935a1c02a74044e79d
MD5 a48546ce69ec9aa0927438f1fbfe6d1d
BLAKE2b-256 bfcb9e333de26ae9536821e2ae49d8f7668cc3262cd9077cf481f85ba3d712e1

See more details on using hashes here.

File details

Details for the file mcpsweep-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcpsweep-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for mcpsweep-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51385c9953aa4cfd88323b1ba5a96a9d778faea766047e98a3d7a1f556475003
MD5 f5a0ad1e8d05bb5b1dd6dc9d1783d9f4
BLAKE2b-256 ffd283c0298dd156ff7cb07182845413040ba8e5e0dddc79f53e6482364a88e9

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 Sentry Error logging StatusPage Status page