Skip to content

Verify end-to-end MCP integration after server registration #131

Description

@williamthorsen

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

  • All 5 MCP tools exercised through the protocol layer (not direct function calls)
  • run-index.json verified as v3 header-only (no phases, phaseDecisions, status in context)
  • run-log.jsonl verified to contain all expected events with server-injected timestamps
  • get_run_state returns correct CanonicalRunStatus at each lifecycle checkpoint
  • All 13 event types exercised via the review cycle test
  • Error cases verified: invalid schemas return isError: true
  • Stdio smoke test: subprocess spawns, connects, and calls init_run successfully
  • All existing tests continue to pass
  • TypeScript strict mode passes

Depends on

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions