Skip to main content

MCPSafe

PyPI version License: MIT Python 3.11+

MCP supply chain security scanner. Detect tool poisoning, prompt injection, data exfiltration, and other attacks in MCP server definitions.

Installation

pip install mcpsafe

Usage

Basic scan

mcpsafe ./my-mcp-server

JSON output

mcpsafe ./my-mcp-server --format json

SARIF for CI/CD

mcpsafe ./my-mcp-server --format sarif > results.sarif

Severity filter

mcpsafe ./my-mcp-server --min-severity HIGH

Exclude patterns

mcpsafe ./my-mcp-server --exclude "vendor/*" --exclude "node_modules/*"

Detected Vulnerabilities

Rule ID Category Severity Description
tool_poisoning_instructions TOOL_POISONING CRITICAL Detects prompt injection patterns such as "ignore previous instructions", "you are now in admin mode", "override previous", "disregard", and "new instructions:" in tool names and descriptions.
hidden_behavior HIDDEN_BEHAVIOR HIGH Detects hidden actions and concealed behaviors like "secretly send/copy/read", "without notifying the user", hidden instructions/directives, and directives that the user must not notice.
data_exfiltration DATA_EXFILTRATION HIGH Detects hidden data sending patterns such as "send all data to", "exfiltrate", and covert data exfiltration in tool descriptions.
behavioral_mismatch BEHAVIORAL_MISMATCH HIGH Detects when tool descriptions contradict their stated purpose — e.g. tools described as benign but containing keywords like "secretly", "silently", "covertly", or "ignore the user".
external_url EXTERNAL_URL MEDIUM Flags any external URL in tool descriptions (excluding localhost/127.0.0.1) that could indicate callback or data exfiltration endpoints.
parameter_smuggling PARAMETER_SMUGGLING MEDIUM Detects hidden or undocumented parameters and attempts to embed secret data in responses or metadata.

Exit Codes

Code Meaning
0 Clean — no CRITICAL or HIGH findings detected
1 One or more CRITICAL or HIGH findings were detected

CI/CD Integration

MCPSafe includes a GitHub Action (action.yml) for seamless CI/CD integration. It runs a scan, uploads results as a SARIF artifact, and integrates with GitHub Code Scanning.

name: MCPSafe Scan
on:
  push:
    branches: [main]
  pull_request:

jobs:
  mcpsafe:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run MCPSafe
        uses: onicarps/MCPSafe@main
        with:
          path: "."
          severity: "LOW"
          version: "0.1.0"

      # The action automatically uploads SARIF results to GitHub Code Scanning.
      # Findings will appear under the "Security" tab in your repository.

You can also invoke MCPSafe directly in any CI pipeline:

pip install mcpsafe
mcpsafe ./my-mcp-server --format sarif > results.sarif

License

MIT

Metadata

Release files for onicarps-mcpsafe 0.1.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 onicarps-mcpsafe 0.1.0
File Size Uploaded
onicarps_mcpsafe-0.1.0.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for onicarps-mcpsafe 0.1.0
File Interpreter ABI Platform
onicarps_mcpsafe-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / onicarps_mcpsafe-0.1.0.tar.gz

Download URL onicarps_mcpsafe-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a21419c382a5c8cd46e82804e5427c4148d6854925a2fd55b53e51fe424c832e
BLAKE2b-256 checksum
How to use checksums
85e9b5b5049fbd2fa412456b96ad70f4ebc9b98b893678898040dcd93f761b0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / onicarps_mcpsafe-0.1.0-py3-none-any.whl

Download URL onicarps_mcpsafe-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53d537f033500603966af7c1f074245e7f498f29602170f3bd8850416b3ce8a2
BLAKE2b-256 checksum
How to use checksums
0ae86c9702602cbbaa6977a5e2e603f74160bc67df58782a2826c8673398310a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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