Parent
Part of #74 (MCP server for run data + v3 event-sourced format) — PR 2 of 4.
Dependencies
Scope
Create packages/mcp/ as a custom MCP server providing domain-specific tools for run data management. The orchestrator calls these instead of Read/Edit/Write on JSON files.
Deliverables
- Package scaffolding —
package.json (@codeassembly/mcp), tsconfig.json, vitest.config.ts, CLI entry point
- 5 MCP tools:
init_run — generate run ID, create artifact directory, write v3 header, emit run_initialized
emit_event — validate event against Zod schema, append timestamped JSONL line
register_artifact — validate artifact entry, emit artifact_written event
complete_run — emit run_completed, stamp completedAt on header
get_run_state — read header + fold events → CanonicalRunStatus
- Server implementation —
@modelcontextprotocol/sdk with stdio transport
- MCP registration — add to
.claude/settings.json
- Build-on-install —
prepare script to compile on pnpm install
Acceptance criteria
- Server starts via
node packages/mcp/dist/esm/cli.js without errors
- Each tool handler tested with mock file system
- JSONL append produces valid, parseable lines
- Validation errors return descriptive messages (not silent failures)
get_run_state round-trips correctly: init → emit events → get_run_state matches expected state
- Integration test: full lifecycle (init → events → artifacts → complete → get_state)
init_run failure is loud and immediate (fail-early design for MCP unavailability)
See #74 implementation plan, Step 2 for full details.
Parent
Part of #74 (MCP server for run data + v3 event-sourced format) — PR 2 of 4.
Dependencies
packages/run-datashared types package #84 (packages/run-datamust exist first)Scope
Create
packages/mcp/as a custom MCP server providing domain-specific tools for run data management. The orchestrator calls these instead of Read/Edit/Write on JSON files.Deliverables
package.json(@codeassembly/mcp),tsconfig.json,vitest.config.ts, CLI entry pointinit_run— generate run ID, create artifact directory, write v3 header, emitrun_initializedemit_event— validate event against Zod schema, append timestamped JSONL lineregister_artifact— validate artifact entry, emitartifact_writteneventcomplete_run— emitrun_completed, stampcompletedAton headerget_run_state— read header + fold events →CanonicalRunStatus@modelcontextprotocol/sdkwith stdio transport.claude/settings.jsonpreparescript to compile onpnpm installAcceptance criteria
node packages/mcp/dist/esm/cli.jswithout errorsget_run_stateround-trips correctly: init → emit events → get_run_state matches expected stateinit_runfailure is loud and immediate (fail-early design for MCP unavailability)See #74 implementation plan, Step 2 for full details.