Skip to main content

mpak-scanner

CI PyPI Python License mpak.dev

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.

Releasing

Releases are automated via GitHub Actions. Pushing a tag triggers the full pipeline: verify, publish to PyPI (via trusted publishing), and build + push Docker image to GHCR.

Version is defined in one place: pyproject.toml. The runtime version (mpak_scanner.__version__, SCANNER_VERSION) is derived automatically via importlib.metadata.

Steps

  1. Bump version in pyproject.toml:

    # Edit pyproject.toml version field, or use hatch:
    hatch version patch   # 0.2.4 → 0.2.5
    hatch version minor   # 0.2.4 → 0.3.0
    
  2. Run verification:

    uv run ruff check src/ tests/ && uv run ruff format --check src/ tests/ && uv run ty check src/ && uv run pytest
    
  3. Commit and push:

    git commit -am "scanner: bump to X.Y.Z"
    git push
    
  4. Tag and push (this triggers the publish):

    git tag scanner-vX.Y.Z
    git push origin scanner-vX.Y.Z
    

CI will:

  • Run lint, format, type check, and unit tests
  • Verify the tag matches pyproject.toml
  • Build and publish to PyPI
  • Build and push Docker image to ghcr.io/nimblebraininc/mpak-scanner:{version} and :latest

See scanner-publish.yml.

Docker Image

The Docker image includes all external security tools (Syft, Grype, TruffleHog, ESLint, Bandit, GuardDog) and installs mpak-scanner from PyPI.

# Pull from GHCR
docker pull ghcr.io/nimblebraininc/mpak-scanner:latest

# Run a scan
docker run --rm -v /path/to/bundle.mcpb:/bundle.mcpb ghcr.io/nimblebraininc/mpak-scanner scan /bundle.mcpb

Contributing

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

License

Apache License 2.0

Metadata

Release files for mpak-scanner 0.2.9

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

Source distribution (sdist)

Source distribution for mpak-scanner 0.2.9
File Size Uploaded Provenance
mpak_scanner-0.2.9.tar.gz 151.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mpak-scanner 0.2.9
File Interpreter ABI Platform
mpak_scanner-0.2.9-py3-none-any.whl Python 3 none any Details

Total release size: 237.8 kB

Release files / mpak_scanner-0.2.9.tar.gz

Download URL mpak_scanner-0.2.9.tar.gz
Size 151.5 kB
Tags Source
SHA-256 checksum
How to use checksums
82f8847a4835fe8c02adad34c23ebb0abea8b9ff313a6f7b9da64ce260fc009c
BLAKE2b-256 checksum
How to use checksums
175316ef828e4f48c49e66287f4b2e39dd9d328b2bff8cbfc425154ad00a313d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 21, 2026.

Transparency log

Release files / mpak_scanner-0.2.9-py3-none-any.whl

Download URL mpak_scanner-0.2.9-py3-none-any.whl
Size 86.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f5ed98e221973c55c69e58ea4c15d0d3911eabc914911a49a671e08bc3fc451
BLAKE2b-256 checksum
How to use checksums
519bc5938a7b38cfbecf4bf059ff6eaafb51dd06b694982d227c72ee61e3462d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 21, 2026.

Transparency log

Security for mpak-scanner 0.2.9

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mpak_scanner-0.2.9.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 Jul 21, 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