Skip to main content
Glama

🐞 BugScout

Let your AI hunt bugs — safely, in Docker, with receipts.

License: Apache 2.0 Python 3.11+ MCP FastMCP Docker sandbox PostgreSQL CI Stars

English · العربية · مصري · خليجي · شامي · الدارجة · Español · Français · Deutsch · Português · 中文 · 日本語 · Русский · हिन्दी · Türkçe · 한국어


Table of contents

Why you need this · What it does · How it works · Quick start · Usage · Guards · What was verified · Docs · Contributing · License

Related MCP server: Sandbox MCP

Why you need this

Letting an AI agent "go test my code" usually ends one of three ways: it runs untrusted code on your machine, it forgets what it already tried and loops, or it reports a "bug" that was a flaky test. BugScout is the missing substrate:

Problem with a bare agent

What BugScout does about it

It executes target code on your laptop

Everything that runs target code runs in a locked-down Docker sandbox (no network, dropped capabilities, CPU/memory limits)

It has no memory and repeats itself

An asset graph and an append-only exploration tree in Postgres; duplicate test ideas return the existing node

It hits DELETE /users "to see what happens"

Server-side guards: scope, destructive actions, budget, stuck detection, human confirmation for serious bugs

It reports flaky or one-off failures as bugs

A failure is re-run before it counts; one that does not reproduce becomes flaky, and the same bug found 20 times is one finding

NOTE

You (or rather the LLM host: Claude Code, Codex) do the planning. BugScout stores, executes, checks and enforces.

What it does

  • Maps a Python package or an OpenAPI spec into a graph of functions, classes, endpoints and their relations.

  • Static stage: complexity (radon), lint (ruff), types (mypy), security (bandit), copy-paste (duplication), dead code (vulture).

  • Dynamic stage: pytest, Hypothesis property tests, schemathesis, hand-made HTTP requests, user-written rules.

  • Oracles: crash / HTTP 5xx, response schema, behaviour diff against the previous git commit, your own invariants.

  • Quality: coverage per function and per test, mutation score, flaky-test detection, duplicate-test detection.

  • Performance: empirical time complexity (O(n²) vs the allowed O(n log n)), benchmark regressions between commits, CPU hotspots, memory hogs, API profiling.

  • Reports the deduplicated result: bugs, static issues, coverage, hotspots, regressions.

42 tools, 7 read-only resources (run://{id}/…) and 3 prompts (testing_loop, write_charter, triage_bug).

How it works

 host (Claude Code / Codex)  ──MCP──▶  BugScout (FastMCP server)
                                         ├─ Postgres  runs · asset graph · exploration tree · findings · events
                                         ├─ guards    scope · destructive · budget · stuck · serious-bug
                                         └─ Docker    bench (tools + tests) · sut (your API) · ref (previous commit)
  1. The host sends a charter: target, scope, oracles, rules, budget.

  2. It works the loop in the testing_loop prompt: map → static stage → run tests → check oracles → record bugs → performance pass → report.

  3. Every executing call passes the guards first. An escalation pauses only its own branch; the host moves on.

  4. record_bug re-runs the repro, fingerprints it and deduplicates. High and critical bugs wait for a human.

Quick start

git clone https://github.com/yassienashrafwasfy/bugscout && cd bugscout
docker compose up -d postgres            # Postgres 16 (user/password: test/test)
docker build -t bugscout-sandbox:latest sandbox
uv sync
uv run bugscout                          # stdio; migrations run on start

Usage

Claude Code — .mcp.json in the repo root (already included):

{ "mcpServers": { "bugscout": { "command": "uv", "args": ["run", "bugscout"],
  "env": { "DATABASE_URL": "postgresql://test:test@localhost:5432/bugscout" } } } }

Codex — ~/.codex/config.toml:

[mcp_servers.bugscout]
command = "uv"
args = ["run", "--directory", "/path/to/bugscout", "bugscout"]
env = { DATABASE_URL = "postgresql://test:test@localhost:5432/bugscout" }

Then tell your agent: "Use the testing_loop prompt from bugscout and test ./my_project." (Use write_charter to build the charter together.)

A minimal charter:

{ "target": {"kind": "python", "repo_path": "/path/to/repo", "package": "mypkg"},
  "scope": {"include": ["mypkg/*"], "exclude": []},
  "oracles": ["crash", "diff_git", "rule"],
  "reference": {"git_ref": "HEAD~1"},
  "budget": {"max_steps": 300, "max_requests": 1000, "max_minutes": 60} }

Try it on the planted-bug examples in examples/ (sample_lib, sample_api).

Guards

Guard

Behaviour

Scope

A target outside scope.include/exclude, or a host outside allowed_hosts, returns escalation_required

Destructive

DELETE/PUT/PATCH and risky POSTs escalate before anything is sent; schemathesis skips them and says so

Budget

Steps, requests, minutes; warning at 90 %, hard stop at 100 %

Stuck

No new findings / progress over a window of steps raises one escalation

Serious bug

high / critical need answer_escalation before they count as confirmed

What was and was not verified

WARNING

Seedocs/REFERENCE.md for the per-phase table.

  • Automated: 39 tests against real Postgres and real Docker containers, including a scripted-host e2e over a stdio server that finds every planted bug in both examples.

  • Live: one real Claude Code session (claude -p following testing_loop) found both planted bugs in sample_api for about $0.22; see docs/LIVE_RUN.md. Not yet run live: sample_lib, Codex.

Docs

docs/REFERENCE.md: all tools, charter fields, sandbox details, design notes · examples/: planted bugs · .github/workflows/ci.yml: CI.

Contributing

Issues and PRs are welcome. Run uv run pytest -m "not docker" for the quick suite and uv run pytest -m docker (one file at a time, on an idle machine) for the sandbox, oracle and performance tests.

License

Apache License 2.0.

Star history

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Runs, tests, and finds issues in your Python services with zero code changes, then helps your AI agent fix what breaks and proves it with acceptance tests.
      48
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents to safely run commands, install dependencies, test, and modify code inside disposable, policy-enforced Docker sandboxes isolated from the host, returning results and diffs.
      15
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to run cybersecurity reconnaissance and analysis tools through controlled containerized sandboxes, with input validation, policy allowlists, timeouts, structured JSON output, and immutable audit logging.
      MIT