Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

MCPiranha

PyPI CI Python 3.12+

Find security risks in Model Context Protocol (MCP) servers before giving them access to your files, credentials or other tools. MCPiranha scans client configurations, Python and JavaScript/TypeScript source, published packages, and live server metadata.

Static scans do not start servers or run package code. Live inspection and tool invocation are explicit opt-ins. Reports show both findings and what the scanner could actually inspect.

See the changelog for release history, upgrade notes and unreleased changes.

Quick start · Common tasks · Reading results · Limits · Full usage guide

Quick start

Requires Python 3.12+. Docker is needed for sandboxed local server connections, not static scans.

# Run without installing, using uv
uvx mcpiranha scan .mcp.json

# Or install the command
pipx install mcpiranha
mcpiranha scan .mcp.json

Use mcpiranha --help to list commands, or mcpiranha scan --help for scan options and short descriptions. Every command supports --help.

Without a target, mcpiranha scan discovers supported client configurations on your machine and in the current project. Supported clients and config paths include Claude Desktop/Code, Cursor, VS Code, Codex CLI and others on macOS, Linux and Windows.

Registry/advisory lookups use the network by default and send package names and versions to registries and OSV. Add --offline for local or saved evidence only.

Common tasks

Task Command
Scan a client configuration mcpiranha scan .mcp.json
Scan a source directory explicitly mcpiranha scan path:./server-source --offline
Inspect an npm release without installing it mcpiranha scan npm:@scope/server@1.2.3
Inspect a PyPI release without installing it mcpiranha scan pypi:some-server==1.2.3
Select one server from a config mcpiranha scan .mcp.json --server search
Inspect live tools, prompts and resources mcpiranha scan .mcp.json --server search --connect
Inspect risky combinations of servers mcpiranha flows .mcp.json
Export GitHub code-scanning results mcpiranha scan .mcp.json -f sarif -o scan.sarif

--server selects an exact name or ID and can be repeated. Add --client cursor to narrow client discovery. Unmatched selectors fail before acquisition. Cross-server checks use only the selected servers; scan the whole configuration to assess their interactions.

What it checks

Area Examples
Model-facing content Prompt injection, hidden instructions, encoded payloads, secret-export links
Source behavior Shell/SQL injection, path traversal, SSRF, secret harvesting, persistence
Client configuration Embedded secrets, insecure endpoints, excessive approval settings
Supply chain Known vulnerabilities/malware, dependency risks, publisher/provenance changes
Cross-server interactions Untrusted content combined with private-data access or code execution
Opt-in runtime behavior Synthetic credential access, process activity and unexpected network destinations

See the rule catalog for individual checks and severity guidance.

Reading results

A finding includes severity, confidence, evidence, location and remediation. Severity is potential impact; confidence is certainty in the analysis. A high-severity static finding can have medium confidence and still need review.

Coverage is reported per server for configuration, tools, source, package/dependency checks, dynamic tracing and invocation. Read it alongside the findings:

Coverage status Meaning
completed Evidence was collected within the supported analysis model; not proof of safety
partial Some evidence or analysis was omitted; the report explains why
skipped That stage did not run, such as tool listing during a static scan
failed / unknown The stage failed or its completeness cannot be established

Helper flows follow local import aliases, namespaces and common re-exports using a cached work queue. Unresolved local bindings or exhausted analysis/finding budgets mark source coverage partial, retaining findings and snapshot limitations. Completion does not establish that arbitrary dynamic calls, custom classes or validators were understood. basename() alone does not establish containment; use a checked path or filename allowlist.

Use in CI

mcpiranha scan path:./server-source --offline --strict \
  --require-coverage source --fail-on high -f json -o scan.json
Exit code Meaning
0 No unsuppressed finding at or above the threshold; requested checks passed
1 Findings meet the configured failure threshold
2 Scan/input failure, a strict-mode warning, or an unmet coverage requirement

--strict fails on scan warnings, including partial source analysis. Repeat --require-coverage to require additional stages. Requirements apply to every selected server; a static scan cannot satisfy tool-listing coverage. Saved evidence can satisfy a coverage requirement but does not imply a fresh connection or lookup.

Reviewed exceptions belong in .mcpiranha.yaml, with a reason and optional expiration. Suppressed findings remain visible in JSON and SARIF.

Live inspection and change detection

# Start/list the selected server; no tool invocation
mcpiranha scan .mcp.json --server search --connect --save-snapshots ./captures

# Pin launch settings and tool definitions, then detect subsequent changes
mcpiranha lock .mcp.json --connect
mcpiranha verify .mcp.json --connect

Local package servers run in a Docker sandbox by default, with dummy credentials, a read-only filesystem and runtime networking disabled. Remote URLs require --connect; OAuth is available with --oauth. Tool calls require explicit --invoke NAME and can have side effects.

For synthetic-credential tracing, bounded fuzzing, remote authentication and sandbox options, see the usage guide.

Limits

Detection is bounded and heuristic. A clean report does not prove that a server is safe. Novel paraphrases, unresolved/dynamic calls, arbitrary heap objects, custom validators, filesystem races and dormant runtime triggers remain gaps. Registry dependency resolution may differ from an installed environment; Docker image source is not analyzed.

The labeled evaluation records attacks, benign controls, misses, false alarms and implementation fingerprints. Its examples were used during development; passing that set is not an independent estimate of real-world accuracy. Tests also cover two existing vulnerable/fixed release pairs. Broader independent validation remains necessary.

Development and documentation

uv sync --all-extras
uv run pytest -q
uv run ruff check .
uv run pyright

The optional local classifier is experimental. The LLM layer, runtime guard proxy and MCP server mode are planned; see classifier details.

Metadata

Release files for MCPiranha 0.4.0

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for MCPiranha 0.4.0
File Size Uploaded Provenance Actions
mcpiranha-0.4.0.tar.gz 193.1 kB With provenance Details for mcpiranha-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for MCPiranha 0.4.0
File Interpreter ABI Platform Actions
mcpiranha-0.4.0-py3-none-any.whl Python 3 none any Details for mcpiranha-0.4.0-py3-none-any.whl

Total release size: 431.2 kB

Release files / mcpiranha-0.4.0.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL mcpiranha-0.4.0.tar.gz
Size 193.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1c8ff058199f98a69fa25835b4b579db900decf22790302d4ebd84cfe6b48d54
BLAKE2b-256 checksum
How to use checksums
9217a2ce37db7ba6142eabcaa72b2b5057b3aabe06d5c40afac61a80eff96883
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 Oct 26, 2026.

Transparency log

Release files / mcpiranha-0.4.0-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL mcpiranha-0.4.0-py3-none-any.whl
Size 238.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47126ee6af02c9da9677d50f6eb502209fb8c3cee169ba74249122751019b35c
BLAKE2b-256 checksum
How to use checksums
86fc1628bf8fadef45338c0cef7acafaf5f77735c6537fb2a0e84c9f405bc484
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 Oct 26, 2026.

Transparency log

Security for MCPiranha 0.4.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.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for mcpiranha-0.4.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 Oct 26, 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.

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