Security scanner for MCP bundles. Powers mpak Certified verification.
Project description
mpak-scanner
Security scanner for MCP bundles (.mcpb). Reference implementation of the mpak Trust Framework (MTF), an open security standard for MCP server packaging.
Built by NimbleBrain, mpak-scanner powers the mpak Certified verification on the mpak registry, analyzing bundles for supply chain risks, code quality issues, and compliance with the MTF specification.
What it does
mpak-scanner analyzes MCP bundles (.mcpb files) for security issues before installation:
- Supply Chain: SBOM generation, vulnerability scanning, dependency analysis
- Code Quality: Secret detection, malicious pattern detection, static analysis
- Artifact Integrity: Manifest validation, content hashes, signatures
- Provenance: Source repository verification, author identity, build attestation
- Capability Declaration: Tool declarations, permission scopes
Compliance Levels
The scanner evaluates bundles against four compliance levels defined in the MTF specification:
| Level | Name | Target | Controls |
|---|---|---|---|
| L1 | Basic | Personal projects | 6 |
| L2 | Standard | Team tools, published packages | 12 |
| L3 | Verified | Production, enterprise | 17 |
| L4 | Attested | Critical infrastructure | 20 |
Installation
# Install with uv (recommended)
uv pip install mpak-scanner
# Or with pip
pip install mpak-scanner
External Tools
The scanner integrates with these tools for deeper analysis. Controls gracefully skip if a tool is not installed.
| Tool | Purpose | Install |
|---|---|---|
| Syft | SBOM generation | brew install syft |
| Grype | Vulnerability scanning | brew install grype |
| TruffleHog | Secret detection | brew install trufflehog |
| GuardDog | Malicious package detection | uv pip install guarddog |
| Bandit | Python static analysis | uv pip install bandit |
| ESLint | JavaScript static analysis | npm install -g eslint eslint-plugin-security |
Usage
Command Line
# Scan a bundle
mpak-scanner scan bundle.mcpb
# Output JSON report
mpak-scanner scan bundle.mcpb --json
# Check specific compliance level
mpak-scanner scan bundle.mcpb --level 2
Python API
from mpak_scanner import scan_bundle
report = scan_bundle("bundle.mcpb")
print(f"Compliance Level: {report.compliance_level}")
print(f"Risk Score: {report.risk_score}")
for finding in report.findings:
print(f"[{finding.severity}] {finding.control}: {finding.message}")
Specification
This scanner implements the mpak Trust Framework (MTF). See the full specification for details on compliance levels, controls, and verification methods.
Development
# Install dev dependencies
uv sync --dev
# Run all tests
uv run pytest
# Lint and format
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
# Type check
uv run ty check src/
# Full verification
uv run ruff check src/ tests/ && uv run ruff format --check src/ tests/ && uv run ty check src/ && uv run pytest
Test Fixtures
The scanner ships with test fixtures for validation:
| Fixture | Tests | Expected |
|---|---|---|
clean-l1-bundle/ |
Valid L1 bundle | All controls pass |
has-secrets-bundle/ |
CQ-01 detection | Fails with secret findings |
invalid-manifest-bundle/ |
AI-01 validation | Fails on missing fields |
missing-tools-bundle/ |
CD-01 validation | Fails on tool issues |
has-vulns-bundle/ |
SC-02 detection | Fails with CVE findings |
node-server-bundle/ |
Node.js bundle | All controls pass |
unsafe-node-bundle/ |
CQ-05 detection | Fails with unsafe patterns |
See tests/fixtures/README.md for details.
Related Projects
- mpak registry - Search, download, and publish MCP bundles
- mpak Trust Framework - The security specification this scanner implements
- mpak CLI - CLI for working with MCP bundles
Contributing
See CONTRIBUTING.md for how to add new controls or improve detection rules.
License
Project details
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 mpak_scanner-0.2.3.tar.gz.
File metadata
- Download URL: mpak_scanner-0.2.3.tar.gz
- Upload date:
- Size: 133.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb40846d455cede65b01a2cf7224217b3851bedb9bd93f6567f3a535a701436d
|
|
| MD5 |
6c09623af11efdcabd84ea55e2f018dc
|
|
| BLAKE2b-256 |
70d7b22cfa28a6c54496dbbd79062d52ea76466b48ff165f2a265fb1a5185daf
|
File details
Details for the file mpak_scanner-0.2.3-py3-none-any.whl.
File metadata
- Download URL: mpak_scanner-0.2.3-py3-none-any.whl
- Upload date:
- Size: 78.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017a139e840658a1749b03051c6310493941cdcd03f3a7fd16a6ae0d5e8e48ff
|
|
| MD5 |
79850d9a92b58bbae8beeae10e4de40a
|
|
| BLAKE2b-256 |
e51f412de859cdf7d3a7a88f0b9c66a5216183ff2b8db2f261391135ea4797e4
|