Context
The MCP server (@codeassembly/mcp) is fully implemented with 5 tools (init_run, emit_event, register_artifact, complete_run, get_run_state), registered in .claude/settings.json (#85), and the orchestrator skill has been migrated to use MCP calls (#87). However, no test exercises the tools through the actual MCP protocol layer — the existing lifecycle.test.ts calls TypeScript functions directly, bypassing the JSON-RPC wire format, tool dispatch, and Zod input validation that the MCP SDK handles.
Problem
The gap between function-level tests and real-world usage means issues in the protocol layer — serialization bugs, broken tool registration, incorrect error signaling — would go undetected until a live orchestration run.
Proposed solution
Add protocol-level integration tests that exercise the MCP server through the SDK's Client API, verifying the full JSON-RPC round-trip for all 5 tools.
- Primary tests: Use
InMemoryTransport (fast, in-process) to test tool discovery, full lifecycle, review cycle events (all 13 event types), checkpoint state reconstruction, and error propagation.
- Smoke test: Use
StdioClientTransport (subprocess spawn) for a single test that validates the real cli.ts entry point and stdio framing.
Files to create
| File |
Purpose |
packages/mcp/src/__tests__/protocol.test.ts |
InMemoryTransport protocol tests (5 test groups) |
packages/mcp/src/__tests__/protocol-stdio.test.ts |
StdioClientTransport smoke test |
No configuration changes needed — the vitest glob already matches.
Acceptance criteria
Depends on
Context
The MCP server (
@codeassembly/mcp) is fully implemented with 5 tools (init_run,emit_event,register_artifact,complete_run,get_run_state), registered in.claude/settings.json(#85), and the orchestrator skill has been migrated to use MCP calls (#87). However, no test exercises the tools through the actual MCP protocol layer — the existinglifecycle.test.tscalls TypeScript functions directly, bypassing the JSON-RPC wire format, tool dispatch, and Zod input validation that the MCP SDK handles.Problem
The gap between function-level tests and real-world usage means issues in the protocol layer — serialization bugs, broken tool registration, incorrect error signaling — would go undetected until a live orchestration run.
Proposed solution
Add protocol-level integration tests that exercise the MCP server through the SDK's
ClientAPI, verifying the full JSON-RPC round-trip for all 5 tools.InMemoryTransport(fast, in-process) to test tool discovery, full lifecycle, review cycle events (all 13 event types), checkpoint state reconstruction, and error propagation.StdioClientTransport(subprocess spawn) for a single test that validates the realcli.tsentry point and stdio framing.Files to create
packages/mcp/src/__tests__/protocol.test.tspackages/mcp/src/__tests__/protocol-stdio.test.tsNo configuration changes needed — the vitest glob already matches.
Acceptance criteria
run-index.jsonverified as v3 header-only (nophases,phaseDecisions,statusin context)run-log.jsonlverified to contain all expected events with server-injected timestampsget_run_statereturns correctCanonicalRunStatusat each lifecycle checkpointisError: trueinit_runsuccessfullyDepends on
Create✅ Mergedpackages/mcpserver with run-data tools #85 (MCP server registration)Update orchestrator skills to use MCP tools and v3 events #87 (Orchestrator migration to MCP)✅ Merged