Open-source MCP testing · Rust · Hegel · Bombadil-style

Autonomous fuzzing for MCP servers.

Point Blofeld at an MCP URL. It discovers every tool, resource, and prompt, chains returned IDs across calls, checks protocol and custom invariants, and shrinks any failure to a minimal replayable trace.

cargo install blofeld
blofeld https://your-mcp-server.example.com/mcp
Shadowy faceless mastermind seated in a red wingback chair ominously patting a smug white cat

Live walkthrough

Watch how Blofeld works across four modes.

Start with one URL for zero-config discovery and shrinking, or add a YAML spec for shadow state machines, read-only staging guards, and adversarial attacks. Switch modes or step frame-by-frame below.

$ blofeld http://localhost:3000/mcp --save-trace failure.trace.json
Step 1 / 5
MCP wire & engine trace EXPLORING
    Live ValuePool & Hegel shrinker Zero config

    Architecture

    Built like Bombadil. Powered by Hegel.

    Designed to run the same way you use Bombadil for web and terminal UIs: point it at a live MCP server, explore autonomously, check invariants continuously, and shrink counterexamples—powered by Hegel underneath.

    01 · Zero-config discovery

    One URL, full coverage

    Speaks Streamable HTTP (JSON and SSE) and --stdio. Runs MCP discovery, bootstraps zero-argument read-only tools like businesses or list_*, and feeds harvested IDs and slugs into downstream calls automatically.

    02 · Native Hegel engine

    Schema-guided fuzzing & shrinking

    Embeds hegeltest (libhegel) directly in Rust for valid, boundary, and malformed JSON Schema generation—including formats and pattern regexes—plus simultaneous trace, payload, and symbolic-ID shrinking.

    03 · Local, CI & Replay

    Same binary everywhere

    Run locally with deterministic --seed and --replay, save redacted counterexample traces for regression tests, or run inside deterministic simulation environments with live entropy and structured property logs.

    Zero-config checks

    Built-in protocol invariants.

    Every step of every session checks these properties automatically—no test harness required.

    Built-in MCP protocol and safety invariants checked by Blofeld
    Property What it catches
    no_transport_error Dropped connections, unexpected EOF / child crashes, timeouts, or unparseable HTTP/SSE bodies.
    no_http_5xx HTTP 500–599 internal server errors under valid, boundary, or malformed tool arguments.
    valid_jsonrpc_envelope Missing jsonrpc: "2.0", mismatched request/response IDs, or responses with both/neither result and error.
    valid_tool_result Successful tools/call responses missing a valid MCP content array or malformed content blocks.
    output_schema_conformance Tools declaring outputSchema that omit structuredContent or return data violating the declared schema.
    stdout_hygiene Stray non-JSON-RPC log bytes written to stdout by stdio MCP servers.
    no_internal_error_leak Raw Rust panics, Python tracebacks, unhandled promise rejections, or segfault signatures leaked on 2xx or 4xx responses.

    Declarative YAML · CEL

    State machines, read probes & adversarial fuzzing.

    Start with zero config, or pass --spec / --rules to check domain invariants in YAML—evaluated in pure Rust with CEL. Every section is optional: begin with simple rules, or model full stateful workflows and let Blofeld try to break them.

    1. 01 · Generate

      Drive valid & hostile calls

      Draws from actions:, schema fuzzing, or --adversarial attacks (cross-state calls, nested mutations, replays).

    2. 02 · Assert rules

      Check response invariants

      Evaluates never_contains, max_latency_ms, valid_calls_succeed, and CEL when: / assert: guards.

    3. 03 · Update model

      Advance shadow state

      Runs matching transitions: to verify postconditions and update or delete keys in episode state.

    4. 04 · Probe server

      Cross-check live reality

      Calls read-only probes: (after: mutating or every_step) to prove server state matches your model.

    Tracks created, locked, and deleted items in shadow state, probes list_items after every mutating call to catch ghost deletes, and asserts locked items reject deletion.

    blofeld http://localhost:3000/mcp --spec items.yaml
    ∅ create_item open lock_item delete_item locked deleted delete_item (must fail: !ok) + probe list_items on mutations
    Valid transitions: Forbidden transition Blofeld attempts
    state:
      items: {}
      count: 0
    
    init:
      - name: seed-count
        call: { tool: list_items, arguments: {} }
        update:
          count: "size(res.items)"
    
    transitions:
      - name: item-created
        tool: create_item
        when: "ok"
        assert: "has(res.id) && !(res.id in state.items)"
        update:
          "items[res.id]": "'open'"
          count: "state.count + 1"
      - name: item-locked
        tool: lock_item
        when: "ok"
        update:
          "items[args.id]": "'locked'"
      - name: item-deleted
        tool: delete_item
        when: "ok"
        delete: ["items[args.id]"]
        update:
          count: "state.count - 1"
    
    probes:
      - name: list-matches-model
        after: mutating
        call: { tool: list_items, arguments: {} }
        assert: "ok && size(res.items) == state.count"
    
    actions:
      - tool: lock_item
        when: "'open' in values(state.items)"
        args: { id: "pick_key_where(state.items, 'open')" }
      - tool: delete_item
        when: "size(state.items) > 0"
        args: { id: "pick_key(state.items)" }
    
    rules:
      - name: no-sql-errors
        never_contains: "SQLITE_ERROR"
      - name: locked-item-cannot-be-deleted
        tool: delete_item
        when: "args.id in state.items && state.items[args.id] == 'locked'"
        assert: "!ok"

    Authentication

    Agent-friendly token handling

    Keep login outside the fuzzer. Pass a token directly, via environment variable, or straight from an OAuth login JSON file (accessToken, access_token, or token).

    blofeld https://localhost:8787/mcp -k \
      --token-file .context/auth.json \
      --read-only

    Saved traces automatically redact Authorization, Cookie, and API key/token headers so counterexamples are safe to share or commit.

    Adversarial mode

    Three ways Blofeld attacks your model

    • Cross-state violations: bypasses when: guards and relaxes pick_key_where filters to invoke tools on entities in the wrong lifecycle state.
    • Deep payload mutations: mutates inner fields of valid action arguments—swapping live IDs, injecting boundary values, flipping types, and dropping or adding keys.
    • Step replays: re-sends earlier calls verbatim (preserving idempotency_key) or with one mutated field to catch duplicate writes and conflict bugs.

    State resets cleanly on every run, during Hegel and symbolic ddmin shrinking, and during --replay.

    Coding agents

    Hand Blofeld to your agent.

    Install the skill directly into Claude Code, Codex, Cursor, or Antigravity, or paste the prompt below—your agent fetches https://blofeld.dev/skill.md and runs the full fuzz, shrink, replay, and fix loop.

    npx skills add economico/blofeld
    Follow https://blofeld.dev/skill.md to fuzz our local MCP server, save any failing trace, confirm it replays red, fix the root cause, and re-run a clean campaign.

    Questions

    Before you point it at a server

    Is it safe to run against staging or production?
    Pass --read-only to restrict calls to tools annotated with readOnlyHint: true, or narrow scope with --only <tool> and --exclude <tool>. For full read/write fuzzing, run against an isolated local instance.
    How does it work with OAuth-protected MCP servers?
    If a server rejects initialize with HTTP 401, Blofeld prints the WWW-Authenticate / resource_metadata hint and tells you (or your agent) to obtain a bearer token and pass --token-file or BLOFELD_TOKEN.
    Does it require Python or an external Hegel process?
    No. Blofeld links hegeltest's native Rust engine (libhegel) directly into a single static-feeling Rust binary with zero Python or runtime sidecars.
    Can Blofeld try to break my state machine?
    Yes—pass --adversarial (or set adversarial_rate: 0.2 in your spec). Blofeld will actively bypass when: preconditions, mutate nested action payloads, and replay earlier calls while still verifying all rules:, transitions:, and probes:.
    Can I test local stdio MCP servers too?
    Yes—run blofeld --stdio node server.js. Blofeld spawns the process per session, checks JSON-RPC framing, catches crashes/EOFs, and flags non-JSON stdout pollution.