MCP supply chain security scanner
Project description
MCPSafe
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
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 onicarps_mcpsafe-0.1.0.tar.gz.
File metadata
- Download URL: onicarps_mcpsafe-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a21419c382a5c8cd46e82804e5427c4148d6854925a2fd55b53e51fe424c832e
|
|
| MD5 |
c279ee6ead73a2495eaa072bad0e3223
|
|
| BLAKE2b-256 |
85e9b5b5049fbd2fa412456b96ad70f4ebc9b98b893678898040dcd93f761b0b
|
File details
Details for the file onicarps_mcpsafe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: onicarps_mcpsafe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53d537f033500603966af7c1f074245e7f498f29602170f3bd8850416b3ce8a2
|
|
| MD5 |
d36f7aeff3700455671e2716ada3594d
|
|
| BLAKE2b-256 |
0ae86c9702602cbbaa6977a5e2e603f74160bc67df58782a2826c8673398310a
|