Skip to main content

Security scanner for MCP bundles. Powers mpak Certified verification.

Project description

mpak-scanner

Security scanner for MCP bundles.

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

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
uv pip install mpak-scanner

# Or with pip
pip install mpak-scanner

External Dependencies

The scanner requires these tools to be installed:

Tool Purpose Install
Syft SBOM generation brew install syft
Grype Vulnerability scanning brew install grype
TruffleHog Secret detection brew install trufflehog
GuardDog Malicious pattern detection pip install guarddog
Bandit Python static analysis pip install bandit

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

The scanner implements the mpak Trust Framework (MTF). See spec/MTF-0.1.md for the full specification.

Development

Running Tests

# Install dev dependencies
uv pip install -e ".[dev]"

# Run all tests
uv run pytest

# Run with verbose output
uv run pytest -v

# Run specific test class
uv run pytest tests/test_scanner.py::TestCleanL1Bundle -v

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

See tests/fixtures/README.md for details.

Code Quality

# Linting
uv run ruff check src/ tests/

# Format check
uv run ruff format --check src/ tests/

# Type checking
uv run ty check src/

# Fix lint issues
uv run ruff check --fix src/ tests/
uv run ruff format src/ tests/

License

  • Code: Apache License 2.0
  • Specification: Creative Commons Attribution 4.0 International (CC BY 4.0)

Contributing

See docs/CONTRIBUTING.md for how to add new controls or improve detection rules.

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

mpak_scanner-0.1.0.tar.gz (95.1 kB view details)

Uploaded Source

Built Distribution

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

mpak_scanner-0.1.0-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file mpak_scanner-0.1.0.tar.gz.

File metadata

  • Download URL: mpak_scanner-0.1.0.tar.gz
  • Upload date:
  • Size: 95.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for mpak_scanner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 661e3c0281604b40132b05d444a97b98966e2d11caef0b1999c23f36d6d879d0
MD5 8a55ad4c74a9a90e99815cd80085d9ab
BLAKE2b-256 979680fb471cfd8397ba7248baa1480428118246a49fa267db17f68ad2c89ba8

See more details on using hashes here.

File details

Details for the file mpak_scanner-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mpak_scanner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 375d7cfd4f10502ea90c2d6be37a0b8422465d1fd16cccf09098ee35669141f2
MD5 b954aed3308b8bd4abfa6903138211e0
BLAKE2b-256 741ef0a38e937f11e01617bdbe9a4be3dccd97e6e055e917845ce2db8488ef41

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