Skip to content

Drive Crucible from an agent (MCP server)

Crucible can act as an MCP server so an agent running inside the same container (Claude Code, a script, any MCP client) can drive the workbench headlessly, without the egui UI. It speaks JSON-RPC 2.0 (MCP) over a loopback Unix-domain socket.

The server exposes 25 tools in two halves, gated separately:

  • 19 read tools, always available (in either mode): capture history, findings and evidence curation, and read-only context (scope, sitemap, projects, beacon events, run status, session posture, payload packs). Curation writes (adding, editing, re-anchoring or deleting a finding, and attaching or detaching evidence) are local record-keeping the operator could do by hand in the UI. They send nothing to a target, so they ride the read token.
  • 6 attack/write tools, off by default: crucible.craft.send, crucible.barrage.start, crucible.search.start, crucible.attacker.start, crucible.ipi.stage and crucible.runs.cancel. These fire traffic at a target, so they only appear once the operator arms write mode in Options → MCP server (see Arm the attack tools) or from the environment. The server always starts in read-only mode.

The transport is the loopback socket only. There is no TCP listener and no first-class client integration yet.

Not the same as Target → MCP. That tab detects and probes MCP servers a target exposes (Crucible attacking MCP). This page is the opposite: Crucible being an MCP server you drive. See Target → MCP for the detection feature.


Requirements

  • macOS or Linux. The transport is a Unix-domain socket. On Windows the server is compiled out and Options → MCP server reads "Available on macOS and Linux only." The Crucible runtime container is Linux, so this is the normal place to use it.
  • Crucible running with the server enabled (below). The agent must be able to reach the socket file, so it runs in the same container or host as Crucible.

Enable it

Off by default. Launch Crucible with the environment variable set:

CRUCIBLE_MCP=1 crucible

CRUCIBLE_MCP accepts 1 or true (case-insensitive). The legacy BASANOS_MCP alias is still accepted. In the runtime container, pass it through to the launch (for example docker run -e CRUCIBLE_MCP=1 …).

You can also start and stop it at runtime from Options → MCP server (Start / Stop, next to a ● Running / ● Stopped status chip). Prefer this on a desktop launch, because an app opened from Finder or a launcher does not inherit your shell's environment. The env var and the button drive the same server.

On start the log confirms it:

mcp server started (read-only history tools) socket=… token_file=…

"read-only" in that line is the starting mode. The attack tools stay hidden until you arm write mode.

Where the socket and token live

Both sit in the Crucible data directory: $CRUCIBLE_DATA_DIR (legacy alias BASANOS_DATA_DIR), or the platform default, which is ~/.local/share/crucible on Linux and ~/Library/Application Support/ai.crucible.crucible on macOS.

Thing Path Override
Socket $CRUCIBLE_DATA_DIR/crucible.mcp.sock CRUCIBLE_MCP_SOCK=/path/to.sock
Read auth token $CRUCIBLE_DATA_DIR/mcp_token (auto-created, 0600)
Write attack token $CRUCIBLE_DATA_DIR/mcp_attack_token (exists only while write mode is on, 0600)

The socket is chmodded 0600 after bind. The read token is generated on first start (256-bit, hex) and reused afterwards; delete the file to rotate it. Every connection presents a token in initialize. The read token authenticates read access. The attack token (minted only while write mode is armed) authenticates read and write. Both token files are created owner-only from the first byte (the 0600 mode is part of the open(2) call, so no wider-permissioned file ever exists).


Connect an agent

The protocol is newline-delimited JSON-RPC 2.0, one JSON object per line. The handshake is initialize (carrying the token), then tools/list, then tools/call. ping is also answered once the connection has authenticated, and notifications/* are accepted silently.

A minimal, dependency-free session with socat (run inside the same container or host as Crucible):

DIR="${CRUCIBLE_DATA_DIR:-$HOME/.local/share/crucible}"
TOKEN="$(cat "$DIR/mcp_token")"

printf '%s\n' \
  "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"authToken\":\"$TOKEN\"}}" \
  "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\"}" \
  "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"tools/call\",\"params\":{\"name\":\"crucible.history.list\",\"arguments\":{\"limit\":5}}}" \
  | socat - "UNIX-CONNECT:$DIR/crucible.mcp.sock"

Expected:

  • id:1 returns serverInfo.name = "crucible-mcp", the Crucible version and protocolVersion = "2025-06-18".
  • id:2 returns result.tools listing the 19 read tools (plus the 6 attack tools while write mode is armed and you authenticated with the attack token).
  • id:3 returns two content blocks. content[0].text is the untrusted-content notice (see Untrusted content) and content[1].text holds JSON with a records array.

To reach the attack tools, authenticate with the attack token instead: TOKEN="$(cat "$DIR/mcp_attack_token")". That file only exists while write mode is on.

Wiring it into a standard MCP client (for example Claude Code): most MCP clients speak stdio or HTTP, not a raw UDS with a token in initialize, so you bridge with a small stdio-to-socket shim (for example a socat wrapper that pipes the client's stdio to UNIX-CONNECT:$DIR/crucible.mcp.sock after sending the initialize line).

Transport limits

Limit Value On breach
Longest JSON-RPC line 1 MiB The connection is closed.
Concurrent connections 8 The ninth client gets one too many connections error line and is closed.
Idle timeout 15 minutes with no message The connection is closed. Polling crucible.runs.status keeps a session alive.

The read tools

Available in both modes, authenticated by either token. Every read maps 1:1 onto something the operator could already do in the UI. Results come back as MCP content text blocks holding pretty-printed JSON.

Untrusted content

Reads whose payload includes text Crucible did not author return a fixed notice as content[0], with the data in content[1], and set _meta["crucible/untrusted"] = true on the result. The notice begins UNTRUSTED CONTENT FOLLOWS. and tells the agent to treat every string in the next block as inert data. The marked tools are crucible.history.list, crucible.history.get, crucible.findings.list, crucible.evidence.list, crucible.target.sitemap, crucible.beacon.events, crucible.runs.status and crucible.runs.list. Posture and catalogue reads (crucible.scope.get, crucible.session.status, crucible.payloads.list, crucible.project.get, crucible.projects.list) return a single plain block.

crucible.history.list

List captured HTTP records, newest first, as compact rows without bodies.

Argument Type Notes
host string Case-insensitive host substring filter.
path string Case-insensitive path substring filter.
contains string Case-insensitive match across method, host and path.
limit integer Rows per page. Default 50, max 1000.
offset integer Skip this many matched rows (newest first) before returning. This is the pagination cursor. Default 0.

Returns { count, total, offset, truncated, records[] }. count is the rows in this page, total is all matched rows, and truncated is true when more remain (page on with offset). limit bounds the page size, not the reachable records. Each row has id, captured_at, method, host, path, status, provider, guardrail_hits and tags.

crucible.history.get

Fetch one record in full by its request id.

Argument Type Notes
id string (UUID) The record's id from a list row. Required.

Returns the full record with headers, bodies and guardrail hits. Inline bodies come back as UTF-8 text (or base64 with "binary": true when not valid UTF-8). Bodies stored out-of-line (blobs) come back as blob references.

Findings

Curate the currently-open project's findings. This is local record-keeping (the same list the UI pins), so these tools ride the read token in both modes.

Tool Arguments Does
crucible.findings.add request_id (required); title, note, severity (info/low/medium/high/critical), owasp_tags (LLM01…LLM10) Record a finding against a captured record, the same finding the UI's Save as finding pins. Omit severity and tags to derive them from the record's guardrail hits: a disclosure or an unrefused attack gets a real severity, a refusal stays info.
crucible.findings.list none List the findings, newest first, with each one's id, anchor request id, title, severity, tags and timestamp.
crucible.findings.reanchor finding_id, request_id (both required) Re-point a finding at a different captured record. The prior anchor is kept in the finding's anchor history.
crucible.findings.update finding_id (required); at least one of title, note, severity, owasp_tags Partial edit of the non-anchor fields. Passing request_id here is rejected; use reanchor.
crucible.findings.delete finding_id, reason (both required) Tombstone the finding. It leaves the report but stays on disk with the reason, and findings.list still returns it with deleted_at set. There is no hard delete over MCP.

A finding commits to the open project, so open or create one first (Project tab), or it is not saved. crucible.project.get returns {"open": false} when none is open. Agent-supplied strings are byte-capped (title ≤ 512, note ≤ 8192, reason ≤ 1024). Over-cap input is rejected with a clear error, never silently truncated.

Evidence

Attach captured records to a finding as supporting evidence beyond its single anchor (for example the earlier turns of a Crescendo ladder). Also local curation, read token, both modes. An agent can only reference a record already in captured history; it cannot upload bytes, a file path or a URL.

Tool Arguments Does
crucible.evidence.attach finding_id, request_id (both required); label (≤ 512 B), note (≤ 8192 B) Attach a captured record. Up to 64 live references per finding, and 512 in total including detached ones.
crucible.evidence.list finding_id (required) List a finding's references. Detached ones are included with deleted_at set.
crucible.evidence.detach finding_id, request_id, reason (all required) Tombstone a reference, with a reason.

Context and runs

Read-only snapshots, both modes.

Tool Arguments Returns
crucible.scope.get none The capture scope's include/exclude patterns. The capture scope is a logging filter, not the attack authorisation boundary.
crucible.target.sitemap host, limit (default 50, max 200), offset The observed site map, paginated over hosts: per host, the paths with the methods and statuses seen, models observed, and whether the host looks like an MCP endpoint. At most 200 paths per host.
crucible.project.get none The open project's slug, name, target description, notes and timestamps, or {"open": false}.
crucible.projects.list none Every project saved on disk (slug, name, target description, timestamps) with an open flag on the current one. Notes are omitted; use project.get for those.
crucible.beacon.events since_id, limit (default 50, max 200) Beacon callback events (HTTP, DNS, raw TCP), oldest first. Pass the last id seen as since_id to get only newer ones.
crucible.runs.status run_id (required) One attack run's state (queued / running / complete / cancelled / failed), summary, start time and the request ids of the captures it produced. An unknown id is a JSON-RPC INVALID_PARAMS error.
crucible.runs.list none Every attack run this session. The projection keeps at most 256 rows, evicting the oldest finished runs first and never a queued or running one.
crucible.session.status none This session's posture: the MCP mode (read_only/write), whether the operator has enabled the write surface, whether an engagement grant is armed, the bound engagement slug, whether the transport is a UDS, and write_tools_available. No secret is returned.
crucible.payloads.list none The payload packs crucible.barrage.start can fire: each pack's name, version, payload count, whether it is an operator-supplied external pack, and its source URL. Names and counts only, never payload strings. Pass a listed name as barrage.start's payload_pack.

The attack tools

These fire traffic at a target. They appear in tools/list and are callable only when all of these hold: the server is in write mode, the connection authenticated with the attack token, the transport is the UDS, and the operator's write switch is on. With any gate shut the agent never sees them in discovery, and a direct call returns JSON-RPC error -32601 tool not available.

Every fire goes through Crucible's guarded-dispatch chokepoint and is authorised against the installed engagement grant's target envelope (see Arm the attack tools). MCP fires are always enforced, whatever the GUI egress policy in Options → Egress gate says. All of them run asynchronously: the call returns a run_id, and you poll crucible.runs.status or crucible.runs.list for progress and the resulting capture request ids.

Tool Does Arguments
crucible.craft.send Re-send a captured request with edits (the "Repeater-style" tool). base_request_id (required); edit {method, headers as [name, value] pairs upserted case-insensitively, body replacing the seed body}.
crucible.barrage.start Sniper fuzz: substitute each payload from a pack into a marker in the seed body and fire the lot. base_request_id, position_marker, payload_pack, caps (all required).
crucible.search.start Genetic adversarial-suffix search. Tier 1 scores each candidate with the refusal detector; a boolean judge gate confirms a breach (tier 2). base_request_id, position_marker, caps (required); optional goal, seeds, alphabet, population (24), generations (40), elite (4), mutation_rate (0.15), random_restart_frac (0.1), suffix_len (20), success_threshold (0.8), collect_n (1), plateau_k (3, 0 disables), seed (0). caps.max_requests is also the search budget.
crucible.attacker.start Multi-turn attacker loop. Crescendo or Echo Chamber only; PAIR, TAP and the other strategies are not exposed over MCP. base_request_id, goal, strategy (crescendo/echochamber) (required); param (Crescendo depth or Echo Chamber anchor count, default 3, minimum 2); max_turns (capped at 24, which is also the default).
crucible.ipi.stage Stage an indirect-prompt-injection artefact and auto-register a beacon probe. Poll runs.status for the artefact ref, callback URL and probe id. pattern (hidden_markdown_comment / markdown_image_exfil / config_file_injection), instruction (both required).
crucible.runs.cancel Cancel a queued or running run. In-flight fires are aborted and no new ones are scheduled. run_id (required).

caps are DoS ceilings the engine enforces below the agent. They are clamped to hard limits at submit and cannot be raised mid-run:

Field Hard cap
max_requests 2048
max_concurrency 16 in-flight fires
wall_clock_secs 1800
rate {n, per: second/minute} 16 per second (960 per minute)

The dispatch chokepoint also enforces concurrency and the rate window per job, and applies a process-wide ceiling of 16 MCP fires per second across every MCP caller, which bounds bursts of single-fire craft.send calls.

Argument caps. Over-cap input is an INVALID_PARAMS reject, never a truncation, because a shortened body or goal would fire a different attack.

Argument Cap
craft.send edit.body 256 KiB
craft.send edit.headers 64 entries, 8 KiB per name or value
goal (attacker.start, search.start) 8 KiB
ipi.stage instruction 16 KiB
Short identifiers (strategy, pattern, marker, pack name, method) 256 B
search.start seeds / alphabet 256 items, 4 KiB each

The exact input schema for every argument is in each tool's tools/list entry, so read it from the server rather than hand-rolling the shapes.

Heartbeat. Any authenticated tools/call counts as agent activity. If no call arrives for 180 seconds while MCP runs are in flight, Crucible cancels every in-flight MCP run on the assumption that the agent has dropped or hung. Poll crucible.runs.status during long runs.


Arm the attack tools (write mode)

The attack tools are armed from Options → MCP server, with a deliberate read-only / write choice next to mode. Read-only (the default) exposes capture history and curation. Write additionally lets an agent on the socket fire attacks.

Entering write mode:

  1. Requires an open project. Without one the panel shows ⚠ Open a project to enter Write mode. and stays read-only.
  2. Mints a short-lived engagement grant valid for 8 hours (re-mint by switching to read-only and back to write) and installs it on the process-wide dispatch gate.
  3. Builds the grant's target envelope from the project scope's include patterns as they stand at that moment. Editing the scope afterwards does not change a live grant; re-arm to pick up the change. The envelope carries no CIDR allowances, so an MCP fire whose target resolves to loopback, a private or link-local range, CGNAT, a metadata address or any other internal range is refused (blocked_resolved_ip) even when the host name is in scope. IPv6 forms that embed an IPv4 address (IPv4-mapped, IPv4-compatible, NAT64, 6to4, Teredo) are classified by the embedded address.
  4. Opens a signed audit bracket for the engagement (sealed again when you leave).
  5. Writes the grant secret to the attack-token sidecar ($CRUCIBLE_DATA_DIR/mcp_attack_token, 0600). Copy that secret into your agent's MCP config as the authToken. If the sidecar cannot be written, arming is rolled back and the panel shows ⚠ could not write attack-token sidecar: ….

While write is on, the panel shows Write grant: engagement "<slug>", expires <RFC 3339 time> and attack-token file: <path>. While the server runs, a Kill all MCP runs button blocks new fires, cancels every in-flight run and marks running runs cancelled (killed by operator kill-switch). It then reads Resume MCP runs beside kill-switch engaged: new fires blocked; press it to allow new runs. Leaving write mode (or Stop) revokes the grant, deletes the attack-token sidecar, and returns the server to read-only. Stop also resets the kill-switch. The grant also expires on its own after 8 hours.

Arm headlessly (environment)

For a headless or CI live-fire run with no GUI click, arm write mode at startup from the environment. Set both of:

Variable Value
CRUCIBLE_ARM_ENGAGEMENT The slug of the project to arm against. It must already exist on disk.
CRUCIBLE_ARM_CONFIRM The literal confirm token i-understand-live-fire.

Also set CRUCIBLE_MCP=1 so an agent can reach the server. At startup Crucible loads that project, skips the startup picker, and runs the same arming path a GUI click uses, with identical gates, grant, 8-hour expiry, audit bracket and sidecar. If CRUCIBLE_ARM_CONFIRM is missing or wrong, Crucible logs an error and stays read-only. If the project cannot be loaded, it does not arm. If the MCP server is not running, it still arms but logs a warning that no agent can reach the write tools. Everything that applies to GUI arming (the envelope, the kill-switch, expiry, revoke on exit) applies here too.


Security model

  • Loopback, container-scope only. A Unix-domain socket is not routable off the host or container and is never a network bind. Write tools are refused on any transport other than the UDS.
  • Token-gated, two capabilities. Every session presents a token in initialize, and the check is constant-time. The read token authenticates the read and curation tools. The attack token (the live grant's secret, present only while write mode is on) is the only way to reach the attack tools. The engagement binding comes from the server's own state, never from the caller.
  • Owner-only secrets. The read token, the attack-token sidecar, the audit log, its anchors file and the audit anchor signing key ($CRUCIBLE_DATA_DIR/audit/anchor-key, public half in anchor-pub.hex) are all created 0600 inside the open(2) call. crucible.log is opened 0600 too. On Windows no DACL is set and the files inherit the data directory's ACL.
  • Read-only by default; write is consent-gated and time-boxed. Curation writes touch only the open project's local records and send nothing to a target.
  • Every attack fire is authorised at the dispatch gate against the grant's envelope, with engine-clamped caps, a process-wide MCP rate ceiling, the heartbeat dead-man and an operator kill-switch. Nothing an agent sends can widen its own scope or raise its own caps.
  • Fail-closed audit. Crucible verifies the hash-chained audit log and its signed anchors when it opens. A failed verification, or any audit append that fails, raises an audit alarm (an AUDIT · ALARM chip in the status bar). While the alarm is up every enforced fire is refused with audit_unavailable, and MCP fires are always enforced. Clear it from Options → Egress gate after inspecting $CRUCIBLE_DATA_DIR/audit/.
  • Agent-facing output is marked untrusted (see Untrusted content), because captured target output is adversarial by design.
  • Treat both tokens like secrets. Anyone who can read a token file and reach the socket gets that token's access: history (which may contain sensitive request bodies) or, with the attack token, attacks. Both need access inside the container.

Troubleshooting

Symptom Likely cause
No socket file appears CRUCIBLE_MCP not set to 1/true, or a Windows build. Check the startup log for mcp server started, or press Start in Options → MCP server.
Start shows ⚠ MCP token init failed: … The data directory is not writable. Point $CRUCIBLE_DATA_DIR at a writable path.
initialize returns error -32001 Wrong or missing authToken (unauthorized: missing or invalid authToken). Re-read mcp_token. An attack token stops authenticating once the grant expires or write mode is left; re-arm and read the new mcp_attack_token.
tools/list or tools/call returns -32001 You must initialize successfully first, on the same connection.
Attack tools absent from tools/list, or a call returns -32601 tool not available Write mode is not armed, or this connection authenticated with the read token. The capability is fixed at initialize, so arm write, then open a fresh connection with mcp_attack_token.
Run fails or its fires are refused The grant expired, the kill-switch is engaged, the audit alarm is up, the target is outside the envelope, or it resolves to an internal address. Check Recent refusals in Options → Egress gate for the reason.
Runs flip to cancelled while the agent is thinking The 180-second heartbeat lapsed. Poll crucible.runs.status during long runs.
Connection drops after a long pause The 15-minute idle timeout. Reconnect and initialize again.
too many connections Eight clients are already connected. Close idle ones.
socat: connection refused Crucible isn't running, or you're pointing at the wrong socket path (check CRUCIBLE_MCP_SOCK).
Empty records History is empty. Capture some traffic, or inject synthetic traffic from Proxy → Options.

See also: Proxy → History · Target → MCP (detection) · Options (MCP server and egress gate).