Skip to main content

Non-AI static analysis layer for AI IDEs and coding agents โ€” bug detection, security scanning, and CVE checking via MCP

Project description

๐Ÿฆฆ mustel

Non-AI static analysis layer for AI IDEs and coding agents.

mustel scans your Python code for bugs, security vulnerabilities, and package CVEs โ€” then feeds the results to your AI IDE as structured JSON. No API keys. No internet required inside mustel. Pure deterministic analysis.

Your Code โ†’ mustel scans โ†’ JSON report โ†’ AI IDE reads โ†’ AI IDE fixes

PyPI version Python 3.8+ License: MIT


Why mustel?

AI coding agents hallucinate bugs that don't exist and miss bugs that do. mustel solves this by giving the agent ground truth before it starts coding.

mustel unifies three analysis tools into one machine-readable JSON output:

Engine What it catches
ruff Syntax errors, unused imports, common bugs, type issues
bandit Security vulnerabilities (SQL injection, hardcoded passwords, etc.)
pip-audit Known CVEs in installed packages

Plus 20 module-specific YAML patterns covering subprocess, requests, flask, django, pickle, asyncio, and more.

The agent_prompt โ€” The Key Innovation

Every mustel report includes a pre-written agent_prompt field:

"agent_prompt": "mustel found 3 issues. Fix in this order:
PRIORITY 1 โ€” 1 HIGH security issue:
  [S001] app/db.py:112 โ€” SQL injection via string formatting
PRIORITY 2 โ€” 1 error:
  [E001] app/auth.py:47 โ€” undefined variable 'user'
PRIORITY 3 โ€” 1 warning:
  [W001] app/utils.py:23 โ€” unused import"

The AI agent reads this one field and knows exactly what to fix and in what order. No JSON parsing needed. No hallucination.


Quick Start

Install

pip install mustel

Scan your project

mustel review                    # scan current directory
mustel review ./src              # scan a specific directory
mustel review --file app.py      # scan one file
mustel review --no-packages      # skip CVE check (faster)
mustel review --watch            # auto-scan on save

Output

mustel outputs JSON conforming to schema v1:

{
  "mustel_version": "0.2.0",
  "schema_version": 1,
  "scanned_at": "2026-03-30T20:53:00Z",
  "files_scanned": 14,
  "scan_duration_ms": 340,
  "results": {
    "errors": [...],
    "security": [...],
    "warnings": [...],
    "packages": [...]
  },
  "summary": {
    "total_errors": 1,
    "total_security": 1,
    "total_warnings": 1,
    "clean": false,
    "highest_severity": "high"
  },
  "agent_prompt": "mustel found 3 issues. Fix in this order: ..."
}

MCP Server (For AI IDEs)

mustel exposes an MCP server that AI IDEs can connect to automatically:

mustel serve

Add to your AI IDE's MCP configuration:

{
  "mcpServers": {
    "mustel": {
      "command": "mustel",
      "args": ["serve"],
      "description": "Python bug and security detection"
    }
  }
}

MCP Tools

Tool Input Output
review path (optional) Full JSON scan report
review_file file_path Single-file scan report
env โ€” Python version, venv status, pip info
check_package package_name Availability, version, vulnerability status

Other Commands

mustel env                # Python environment info (JSON)
mustel check <package>    # Check if a package is installed (JSON)
mustel install <package>  # Install a package safely
mustel venv               # Virtual environment status (JSON)
mustel venv new           # Create a .venv

Benchmark Results

Tested against 4 projects with intentionally planted bugs:

Project Planted Bugs Caught Recall
Auth (SQL injection, MD5, hardcoded secrets) 5 5 100%
Async (bare except, blocking calls, race conditions) 4 4 100%
Scraper (shell injection, yaml.load, pickle) 5 5 100%
Clean (should find nothing) 0 0 โœ… 0% FP
Total 14 14 100%

Module Pattern Coverage (Tier 1)

mustel includes YAML-based pattern files for these 20 modules:

subprocess ยท requests ยท sqlite3 ยท os ยท pickle ยท json ยท hashlib ยท flask ยท django ยท fastapi ยท asyncio ยท logging ยท threading ยท tempfile ยท yaml ยท xml ยท socket ยท paramiko ยท cryptography ยท jwt

Adding a new pattern requires zero Python knowledge โ€” just write a YAML file. See CONTRIBUTING.md.


Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              AI IDE / Coding Agent                โ”‚
โ”‚       (reads mustel JSON, fixes real issues)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚ calls
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              mustel MCP Server                    โ”‚
โ”‚          mustel serve (stdio transport)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚              โ”‚              โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   ruff    โ”‚  โ”‚  bandit   โ”‚  โ”‚  pip-audit โ”‚
โ”‚  (bugs)   โ”‚  โ”‚(security) โ”‚  โ”‚   (CVEs)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚              โ”‚              โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”
โ”‚          mustel normalizer                โ”‚
โ”‚   Dedup โ†’ Categorize โ†’ Assign IDs โ†’      โ”‚
โ”‚   Generate agent_prompt โ†’ Schema v1 JSON โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

License

MIT License โ€” Copyright (c) 2026 Ameya K, Raunak N

See LICENSE for full text.

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

mustel-0.2.0.tar.gz (877.0 kB view details)

Uploaded Source

Built Distribution

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

mustel-0.2.0-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file mustel-0.2.0.tar.gz.

File metadata

  • Download URL: mustel-0.2.0.tar.gz
  • Upload date:
  • Size: 877.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mustel-0.2.0.tar.gz
Algorithm Hash digest
SHA256 896a67b9803a9aab0d7501ce88f2b810848fc4b478e891b0e23287d22f025127
MD5 f5620ba43a556828a90cc47e4a1c7a2b
BLAKE2b-256 e2ed84bb61cf3908d906dc8b26ed003482d9e65bdd1029a40e32dc730b320611

See more details on using hashes here.

File details

Details for the file mustel-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mustel-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mustel-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8797d7ab7682730b0f34ae48d249018a8864982dec3adb982e8e902f63db8b36
MD5 6a4acf291cb4d2161c532410e9099a14
BLAKE2b-256 3f6c80bbeb0ef876511807c1ff82c563e0633981641f723e216b460a62c933a7

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