## Summary
- Adds a standalone `interrupt` action to the `fabro_run_interact` MCP
tool, closing a parity gap with the HTTP API (`POST
/api/v1/runs/{id}/interrupt`).
- Lets MCP callers cancel an API-mode agent's current LLM round and park
it in `SteeringHub`'s `waiting_for_steer` state without committing to
follow-up text in the same call.
- Dispatches through the existing `Client::interrupt_run`; no client or
server-side changes.
## Why not just use `message` with `interrupt: true`?
Combined interrupt+steer remains the right choice when you want to
redirect the agent. Bare interrupt is for "pause the agent while I
decide what to say next." The variant's doc comment steers callers
toward `message` or `cancel` as the usual options, since a bare
interrupt with no follow-up leaves the run idle indefinitely.
## Test plan
- [x] `cargo nextest run -p fabro-mcp-server` — 13/13 pass, including
new `interrupt_action_requires_only_run_id` unit test
- [x] `cargo nextest run -p fabro-cli -E 'test(/mcp_/)'` — 27/27 pass,
including extended
`mcp_interact_actions_resolve_selector_and_call_expected_endpoints` E2E
(mocks `POST /runs/{id}/interrupt`, asserts the tool hits it)
- [x] `cargo +nightly-2026-04-14 clippy -p fabro-mcp-server -p fabro-cli
--all-targets -- -D warnings` — clean
- [x] `cargo +nightly-2026-04-14 fmt --check` on touched crates — clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 KiB
Fabro MCP Server Test Plan
Harness Requirements
The agreed testing strategy still holds after reading the implementation plan. The plan narrows the tool contract to five Devin-shaped run tools and requires the implementation to live in a new fabro-mcp-server crate, but it does not add paid APIs, live LLM calls, external infrastructure, or browser/UI behavior. The highest-value evidence remains a real fabro mcp start subprocess driven over stdio and backed by Fabro's real local test server/auth harness.
-
Deterministic MCP stdio fixture
- Does: constructs the exact command, environment, and cwd used to spawn
env!("CARGO_BIN_EXE_fabro") mcp start. - Exposes:
command: Vec<String>,env: HashMap<String, String>, andcurrent_dir: PathBufusable by bothfabro_mcp::client::McpClientand rawstd::process::Commandtests. - Complexity: low. Add a narrow helper in
lib/crates/fabro-cli/tests/it/cmd/mcp.rs; if needed, addfabro_test::isolated_env(home_dir)to mirrorapply_test_isolation. - Tests depending on it: 5, 6, 7, 8, 9, 10, 15, 16, 17.
- Does: constructs the exact command, environment, and cwd used to spawn
-
MCP tool-call assertion helpers
- Does: calls a named MCP tool, asserts tool success or tool error, extracts
structured_content, and verifies fallback text is concise rather than a JSON dump. - Exposes:
call_tool_json(...),call_tool_error_text(...), and normalization helpers for run IDs, timestamps, paths, event IDs, cursors, durations, and elapsed times. - Complexity: low to medium. Keep it local to
cmd/mcp.rsunless more than one test file needs it. - Tests depending on it: 8, 9, 10, 11, 12, 13, 15, 16, 17.
- Does: calls a named MCP tool, asserts tool success or tool error, extracts
-
Real authenticated Fabro server fixture
- Does: starts
RealAuthHarness::start_with_dev_token(...), seeds CLI dev-token auth into the test home, creates dry-run workflows through public CLI/MCP/API surfaces, and shuts down the server. - Exposes: API target URL, persisted auth entry, HTTP client/server-visible state checks, and workflow fixture paths.
- Complexity: medium, mostly reuse existing
lib/crates/fabro-cli/tests/it/support/auth_harness.rs. - Tests depending on it: 8, 10, 11, 12, 13, 14, 17.
- Does: starts
Test Plan
-
fabro mcphelp exposes the MCP namespace- Type: integration
- Disposition: new
- Harness: output capture harness through existing
fabro_snapshot! - Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp --help. - Expected outcome: stdout snapshots a
Model Context Protocol servernamespace withstart,config, andinitsubcommands; stderr is empty; exit status is 0. Source of truth: user request forfabro mcp start,fabro mcp config,fabro mcp init <agent>, and implementation plan CLI contract. - Interactions: clap command tree, global CLI flags, snapshot filters.
-
fabro mcp start --helpdocuments stdio startup options- Type: integration
- Disposition: new
- Harness: output capture harness through
fabro_snapshot! - Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp start --help. - Expected outcome: stdout snapshots usage
fabro mcp start [OPTIONS]with--server <SERVER>and--storage-dir <DIR>; stderr is empty; exit status is 0. Source of truth: implementation plan CLI contract. - Interactions: clap flattening for
ServerConnectionArgs.
-
fabro mcp config --helpdocuments config rendering options- Type: integration
- Disposition: new
- Harness: output capture harness through
fabro_snapshot! - Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp config --help. - Expected outcome: stdout snapshots usage and the same connection override flags as
start; stderr is empty; exit status is 0. Source of truth: implementation plan CLI contract. - Interactions: clap command help and global CLI flags.
-
fabro mcp init --helpdocuments supported agent selection- Type: integration
- Disposition: new
- Harness: output capture harness through
fabro_snapshot! - Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp init --help. - Expected outcome: stdout snapshots required
<AGENT>with supported valuesclaude,cursor, andwindsurf; exit status is 0. Source of truth: user request and implementation plan supported-agent contract. - Interactions: clap value enum rendering.
-
fabro mcp configprints generic MCP client JSON- Type: integration
- Disposition: new
- Harness: output capture harness plus structured JSON parsing
- Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp config; parse stdout as JSON. - Expected outcome: stdout is valid JSON with
mcpServers.fabro.command == "fabro"andargs == ["mcp", "start"]; stderr is empty; exit status is 0. Source of truth: Daytona-shaped user request and implementation plan config JSON contract. - Interactions: config rendering, stdout contract for a non-stdio command.
-
fabro mcp configpreserves connection flags in generated startup args- Type: integration
- Disposition: new
- Harness: output capture harness plus structured JSON parsing
- Preconditions: isolated
TestContext; no auth or server required. - Actions: run
fabro mcp config --server https://example.test/api/v1 --storage-dir /tmp/fabro-mcp-storage; parse stdout as JSON. - Expected outcome: JSON contains
args == ["mcp", "start", "--server", "https://example.test/api/v1", "--storage-dir", "/tmp/fabro-mcp-storage"]; stderr is empty; exit status is 0. Source of truth: implementation plan examples for flag preservation. - Interactions: CLI argument forwarding into MCP client config.
-
fabro mcp init <agent>writes idempotent config without clobbering unrelated keys- Type: integration
- Disposition: new
- Harness: direct filesystem artifact assertion in isolated home
- Preconditions: isolated
TestContext; pre-existing Cursor config withmcpServers.otherand unrelated top-level key. - Actions: run
fabro mcp init cursor --server https://example.test/api/v1twice; read~/.cursor/mcp.json. - Expected outcome: parsed JSON preserves unrelated keys and existing
mcpServers.other, contains exactly onemcpServers.fabroentry with commandfabroand expected args, and the second run does not duplicate or reorder into an invalid shape. Source of truth: implementation plan idempotent config merge contract. - Interactions: filesystem directory creation, JSON merge/write, test home isolation.
-
fabro mcp initwrites each supported agent path- Type: integration
- Disposition: new
- Harness: direct filesystem artifact assertion in isolated home
- Preconditions: isolated
TestContext; no existing Claude, Cursor, or Windsurf config. - Actions: run
fabro mcp init claude,fabro mcp init cursor, andfabro mcp init windsurfin separate contexts; read the platform-specific config file for each. - Expected outcome: each config file exists at the path named by the implementation plan and contains
mcpServers.fabrowithcommand: "fabro"andargs: ["mcp", "start"]. Source of truth: implementation plan agent path contract. - Interactions: platform-specific path selection, filesystem writes.
-
fabro mcp initrejects invalid existing config without overwrite- Type: boundary
- Disposition: new
- Harness: output capture and filesystem artifact assertion
- Preconditions: isolated
TestContext; Cursor config file contains invalid JSON bytes. - Actions: run
fabro mcp init cursor; read the same file after failure. - Expected outcome: command exits non-zero with a clear error that includes the config path; the file content is byte-for-byte unchanged. Source of truth: implementation plan invalid JSON failure contract and error-handling strategy.
- Interactions: JSON parsing, write avoidance on error, CLI error rendering.
-
fabro mcp startinitializes over stdio and lists the five run tools
- Type: scenario
- Disposition: new
- Harness: interaction harness using deterministic MCP stdio fixture and
fabro_mcp::client::McpClient - Preconditions: isolated
TestContext; no auth; no live Fabro server. - Actions: spawn
fabro mcp start; perform MCPinitialize; calltools/list. - Expected outcome: initialize succeeds without auth/server connectivity;
tools/listreturns exactlyfabro_run_create,fabro_run_search,fabro_run_interact,fabro_run_gather, andfabro_run_events, each with an input schema. Source of truth: MCP lifecycle/tools spec as captured in the agreed strategy and implementation plan exact tool list. - Interactions:
rmcpstdio transport, existingfabro-mcpclient crate, child process lifecycle.
fabro mcp startreserves stdout for JSON-RPC only
- Type: regression
- Disposition: new
- Harness: raw subprocess stdio harness
- Preconditions: isolated
TestContext; no auth; no live Fabro server. - Actions: spawn
fabro mcp start; write a JSON-RPCinitializerequest to stdin; read the first stdout line. - Expected outcome: first stdout line parses as JSON and has
jsonrpc: "2.0"; no leading human log/help text appears on stdout; stderr may contain logs. Source of truth: MCP stdio transport contract and implementation plan stdout invariant. - Interactions: CLI logging initialization, raw process pipes, JSON-RPC framing.
- MCP startup and tool discovery are fast without auth or server
- Type: invariant
- Disposition: new
- Harness: interaction harness plus timing assertion
- Preconditions: isolated
TestContext; no auth; no live Fabro server. - Actions: measure elapsed time for spawning
fabro mcp start, initializing, and callingtools/list. - Expected outcome: operation completes under a generous smoke threshold, initially 2 seconds unless CI evidence requires a documented adjustment; all five tools are listed. Source of truth: agreed testing strategy performance smoke and implementation plan lazy API connection invariant.
- Interactions: process startup,
rmcpinitialization, tool schema generation.
fabro_run_createcreates and starts a real dry-run using persisted CLI auth
- Type: scenario
- Disposition: new
- Harness: interaction harness plus real authenticated Fabro server fixture
- Preconditions:
RealAuthHarness::start_with_dev_token(...); dev-token auth seeded into isolated home for the harness target; checked-insimple.fabrofixture installed. - Actions: spawn
fabro mcp start --server <target>; callfabro_run_createwith one run usingworkflow,dry_run: true,auto_approve: true, and labelsource=mcp-test. - Expected outcome: tool result is not an MCP error;
structured_content.runs[0]includes a run id, workflow,started: true, and status; fallback text exists and does not start with{or[; server-visible state contains the created run. Source of truth: user request for run-management MCP tools, implementation plan create semantics, OpenAPIPOST /api/v1/runs, andPOST /api/v1/runs/{id}/start. - Interactions: persisted CLI auth store, Fabro API client, manifest builder/validation, run engine dry-run path.
fabro_run_searchfilters, paginates, and includes archived runs by default
- Type: integration
- Disposition: new
- Harness: interaction harness plus real authenticated Fabro server fixture
- Preconditions: authenticated MCP server; at least two MCP-created dry-run runs with distinct labels; one terminal run archived through API or MCP.
- Actions: call
fabro_run_searchwithrun_ids,workflow,labels,status,archived,first, andaftercombinations. - Expected outcome: results are normalized run summaries; filters include only matching runs;
firstlimits page size and returns an opaque cursor when more results exist; archived runs appear unlessarchived: falseis supplied. Source of truth: implementation plan search semantics and OpenAPI list-runs include-archived behavior adapted by the plan. - Interactions: server run listing, status string normalization, timestamp/date parsing, cursor handling.
fabro_run_interact get/start/message/canceluses selector resolution and server APIs
- Type: integration
- Disposition: new
- Harness: interaction harness plus mocked HTTP server for precise API call assertions
- Preconditions: isolated
TestContext; HTTP mock server with/api/v1/runs/resolve,/runs/{id},/state,/start,/steer, and/cancelendpoints; CLI auth seeded if the mock requires auth. - Actions: call
fabro_run_interactwith actionsget,start,messagewithinterrupt: true, andcancel, using a workflow-name selector rather than the exact run id. - Expected outcome: each action first resolves the selector through
/runs/resolve; calls the matching endpoint; returns a structured object withrun_id,action, and action-specificresult; tool errors are not produced for mocked successful API responses. Source of truth: implementation plan interact semantics and OpenAPI operation descriptions for retrieve, state, start, steer, and cancel. - Interactions: run selector semantics, API error conversion, structured content projection.
fabro_run_interact archive/unarchivechanges real server-visible archived state
- Type: scenario
- Disposition: new
- Harness: interaction harness plus real authenticated Fabro server fixture
- Preconditions: authenticated MCP server; completed dry-run created through MCP or public CLI.
- Actions: call
fabro_run_interactwitharchive; callfabro_run_searchwitharchived: true; callfabro_run_interactwithunarchive; callfabro_run_searchwitharchived: false. - Expected outcome: archive action succeeds for the terminal run; archived search shows the run; unarchive action succeeds; unarchived search shows the run as terminal and not archived. Source of truth: implementation plan interact actions and OpenAPI archive/unarchive contracts.
- Interactions: archive state transitions, list/search visibility, server-side idempotence.
fabro_run_interact get_questions/answermaps answer JSON to the API contract
- Type: integration
- Disposition: new
- Harness: interaction harness plus mocked HTTP server for endpoint/body assertions
- Preconditions: isolated
TestContext; HTTP mock server returns pending questions and accepts answer submissions. - Actions: call
fabro_run_interactwithget_questions; callanswerusing representative payloads:true,false, string text,{ "option": "a" },{ "options": ["a", "b"] }, and{ "text": "hello" }. - Expected outcome:
get_questionsreturns the API question list projection;answersendsSubmitAnswerRequestwire shapes withkind: yes,no,text,selected, andmulti_selected, and returns a successful structured action result. Source of truth: implementation plan answer mapping andlib/crates/fabro-api/tests/submit_answer_request_round_trip.rs. - Interactions: generated API type shape, JSON body serialization, human-in-the-loop endpoints.
fabro_run_gatherwaits for terminal runs and returns current state on timeout
- Type: scenario
- Disposition: new
- Harness: interaction harness plus real authenticated Fabro server fixture
- Preconditions: authenticated MCP server; one completed dry-run and one submitted/non-terminal run available.
- Actions: call
fabro_run_gatheron the completed run; call it on the non-terminal run withtimeout_seconds: 1andpoll_interval_seconds: 5. - Expected outcome: completed run result has
timed_out: falseand terminal status; timeout case returns a successful structured result withtimed_out: true, current run summary, and bounded elapsed wall time rather than an MCP/process error. Source of truth: implementation plan gather semantics and agreed performance/timeout strategy. - Interactions: selector resolution, polling loop, server retrieve endpoint, terminal status classification.
fabro_run_eventslists, details, searches, filters, paginates, and truncates events
- Type: integration
- Disposition: new
- Harness: interaction harness plus real authenticated Fabro server fixture
- Preconditions: authenticated MCP server; completed dry-run with stored events.
- Actions: call
fabro_run_eventswithaction: "list"andfirst; calldetailswith returned event ids; callsearchwith a known event-name substring; call filters forevent_types,categories,direction: "desc",after,offset,limit, and a smallmax_content_length. - Expected outcome: returned events belong to the run; list ordering and pagination match requested parameters; details returns only requested event ids; search returns serialized events containing the query; category filtering uses event-name prefix; oversized serialized payloads are truncated with
truncated: true;next_cursoris derived from the last returned sequence. Source of truth: implementation plan events semantics and OpenAPIGET /api/v1/runs/{id}/events. - Interactions: event store pagination, event-name/category derivation, JSON serialization/truncation.
- Local validation errors happen before auth or network lookup and do not stop the server
- Type: boundary
- Disposition: new
- Harness: interaction harness with
--server http://127.0.0.1:9and no auth - Preconditions: isolated
TestContext; no auth entry; unreachable server URL. - Actions: call
fabro_run_gatherwith 51 run ids; calltools/list; callfabro_run_interactactionmessagewithoutmessage; calltools/listagain. - Expected outcome: each invalid tool call returns an MCP tool error mentioning the invalid field (
run_idsormessage); no auth guidance or connection error masks the local validation failure; subsequenttools/listsucceeds. Source of truth: implementation plan validate-before-client invariant and MCP tool-error contract. - Interactions: parameter validation, lazy client initialization, MCP service liveness after errors.
- Auth failures use existing Fabro login guidance and remain tool errors
- Type: boundary
- Disposition: new
- Harness: interaction harness with protected real or mocked API target
- Preconditions: isolated
TestContext; no saved auth for the target; server requires auth. - Actions: spawn
fabro mcp start --server <protected-target>; call a valid read tool such asfabro_run_search. - Expected outcome: call returns an MCP tool error, not process exit; error text includes
Run \fabro auth login` to authenticate.; subsequenttools/list` still succeeds. Source of truth: user request for no separate MCP auth and implementation plan auth invariant. - Interactions: auth store lookup, client connection, error classification/rendering.
- Invalid create inputs are rejected with field-specific tool errors
- Type: boundary
- Disposition: new
- Harness: interaction harness with no auth and unreachable server
- Preconditions: isolated
TestContext; no auth entry. - Actions: call
fabro_run_createwith emptyruns, with 51 runs, and withinputscontaining a null value. - Expected outcome: each call returns an MCP tool error naming the invalid field/key before any auth/server error; server remains alive for a subsequent
tools/list. Source of truth: implementation plan create validation and JSON-to-TOML null rejection. - Interactions: schema/validation layer, JSON-to-TOML conversion.
- Run tool successes always include structured content and concise text
- Type: invariant
- Disposition: new
- Harness: MCP tool-call assertion helpers reused by scenario tests
- Preconditions: any successful calls from tests 13, 14, 16, 18, and 19.
- Actions: for each successful call, inspect
CallToolResult. - Expected outcome:
structured_contentis present; at least one text content item is present; text content is short and does not begin with{or[;is_erroris absent or false. Source of truth: implementation plan successful tool-result invariant. - Interactions:
rmcp::model::CallToolResultconstruction and MCP client display fallback.
- Pure conversion helpers cover JSON-to-TOML and answer-request mapping
- Type: unit
- Disposition: new
- Harness:
cargo nextest run -p fabro-mcp-server run_tools - Preconditions: none beyond crate compilation.
- Actions: call conversion helpers directly for strings, bools, integers, floats, arrays, objects, null input, and every supported answer payload shape.
- Expected outcome: JSON-compatible input values map to equivalent
toml::Value; null returns an error naming the key; answer payloads serialize toSubmitAnswerRequestwire JSON with documentedkindvalues; unsupported answer objects return a tool error. Source of truth: implementation plan conversion requirements andfabro-apisubmit-answer round-trip tests. - Interactions: serde, generated API types, conversion error text.
- Existing MCP client crate behavior is not regressed
- Type: regression
- Disposition: existing
- Harness: existing
fabro-mcpcrate tests - Preconditions: repository builds with the new
fabro-mcp-servercrate added. - Actions: run
cargo nextest run -p fabro-mcp. - Expected outcome: existing stdio client initialize/list/call tests pass. Source of truth: existing automated evidence and implementation plan decision to keep
fabro-mcpas the external MCP client crate. - Interactions: workspace dependency feature unification for
rmcp, existing client transport behavior.
- Relevant existing CLI run/auth regressions still pass
- Type: regression
- Disposition: existing
- Harness: existing
fabro-cliintegration tests - Preconditions: implementation complete.
- Actions: run the existing tests matching
scenario::auth::auth_login_refresh_logout_flow,scenario::lifecycle::dry_run_create_start_attach_works_with_default_run_lookup, andcmd::ps::ps_explicit_local_tcp_target_uses_auth_store; if names drift, list tests and run the corresponding auth/lifecycle/local-target checks. - Expected outcome: all selected tests pass unchanged. Source of truth: agreed strategy existing automated evidence and user requirement that MCP reuse CLI auth/config behavior.
- Interactions: auth refresh/logout, local server run lifecycle, server target resolution.
- Final MCP command contract and workspace checks pass
- Type: regression
- Disposition: extend
- Harness: repository command checks
- Preconditions: all feature implementation and snapshots complete.
- Actions: run
cargo nextest run -p fabro-cli --test it cmd::mcp,cargo +nightly-2026-04-14 fmt --check --all,cargo +nightly-2026-04-14 clippy --workspace --all-targets -- -D warnings,ulimit -n 4096 && cargo nextest run --workspace, andcargo insta pending-snapshots. - Expected outcome: MCP command tests pass; formatting and clippy pass; workspace tests pass; no pending snapshots remain unless explicitly inspected and accepted for this feature. Source of truth: repository
AGENTS.mdbuild/test commands and snapshot policy. - Interactions: entire workspace, rustfmt/clippy pinned nightly, nextest parallelism and file descriptor limit.
Coverage Summary
Covered action space:
- CLI executable commands:
fabro mcp --help,fabro mcp start --help,fabro mcp config --help,fabro mcp init --help,fabro mcp config,fabro mcp config --server --storage-dir, andfabro mcp init claude|cursor|windsurf. - MCP protocol actions: stdio process startup,
initialize,tools/list, andtools/call. - MCP tool actions:
fabro_run_create;fabro_run_search;fabro_run_interactactionsget,start,message,interrupt,cancel,archive,unarchive,get_questions,answer;fabro_run_gather;fabro_run_eventsactionslist,details, andsearch. - Error and boundary behavior: invalid local parameters, too many run ids, null input conversion, missing action fields, unsupported answer shapes, invalid agent config JSON, missing auth, unreachable server after local validation, timeout expiry, and service liveness after tool errors.
- Integration boundaries: CLI auth store reuse, Fabro API client, real local Fabro server, run manifest construction/validation, event store, generated API answer types, and existing
fabro-mcpclient crate. - Performance smoke: initialize plus
tools/listwithout auth/server.
Explicitly excluded per the agreed strategy:
- Live LLM/provider tests. Dry-run workflows and local/mocked servers cover run-management behavior without external credentials or spend.
- Manual QA of agent apps.
inittests assert Fabro's written config path and JSON merge contract, not whether Claude/Cursor/Windsurf accept the file in a live app. - Browser/UI tests. This feature adds CLI and MCP stdio surfaces only.
- Differential tests against Daytona or Devin. Their docs inspired shape, but no runnable reference implementation is available or required.
Residual risks:
- Agent config formats may evolve externally; tests protect Fabro's chosen file/path contract only.
- MCP SDK behavior can change with
rmcpupgrades; protocol tests and existingfabro-mcptests should catch startup/list/call regressions. - Full workspace tests may be slower and subject to local FD limits; use the documented
ulimit -n 4096command beforecargo nextest run --workspace.