Phase 05 Plan 03: MCP Stdio Server Summary
Newline-delimited JSON-RPC 2.0 stdio server over the shared dispatcher: probe-plus-initialize handling, six-tool unchanged-map routing, and a client-shaped end-to-end drive, with no tool logic in the surface.
Performance
- Duration: not tracked by executor (plan constraints forbid running gates)
- Started: 2026-10-22
- Completed: 2026-10-22
- Tasks: 3
- Files modified: 2 created, 0 modified
Accomplishments
src/mcp/server.tsspeaks newline-delimited JSON-RPC 2.0 over stdio withnode:readlineplusJSONonly: one newline-terminated object per reply on stdout, all diagnostics on stderr, stop on stdin close, no new dependency (P5-D2)- Answers
server/discoverandinitializewith revision2026-07-28, stateless per request, exactly asmcp.mdQ5 records (P5-D9) - Exposes all six tools via
tools/listplustools/call, converts each request into theToolCallmap unchanged, returnsToolDispatcher.call'sToolOutcomeverbatim, and touches no dispatcher member exceptcall(P5-D11) test/mcp/server.test.tsproves framing purity, both handshakes, six-tool unchanged routing in order, catalogue-faithful refusals, and a probe-first status-plus-write drive whose replies deep-equal the harness dispatcher's own outcomes with the sharedrealm activelabel
Task Commits
No per-task commits were made by the executor: the assignment forbids all git commands and commits, and the orchestrator commits between waves.
- Task 1: stdio framing with stdout purity (P5-D2, P5-D9) — uncommitted (orchestrator commits)
- Task 2: Revision handshake and six-tool routing over the dispatcher (P5-D9, P5-D11) — uncommitted (orchestrator commits)
- Task 3: Stdio-client-shaped end-to-end drive (P5-D1, TOOL-05) — uncommitted (orchestrator commits)
Files Created/Modified
src/mcp/server.ts- MCP stdio server (createMcpServer,MCP_PROTOCOL_VERSION,MCP_TOOL_DESCRIPTORS,McpDispatcherpick type); type-only dispatcher import,callis the sole member usedtest/mcp/server.test.ts- 10 TOOL-05 tests: framing purity (3), probe plus initialize (2), six-tool routing plus refusal plus P5-D11 source pin (3), client-shaped drive plus shared-label pin (2); in-memory PassThrough stdio, no real process
Decisions Made
- Refusals ride as
resultenvelopes carrying the verbatimToolOutcome: the catalogue code surfaces by construction with no server-added mapping decision, and the deep-equal refusal test pins the exact shape. - Malformed lines take no stdout reply at all (stderr diagnostic only): a
Parse errorenvelope would still be stdout traffic for unparseable bytes, so total purity is the stronger and simpler rule. - The
tools/callargument cross is{ [name]: args } as ToolCallwith validation deferred to the pipeline: the server checks only name membership and record shape, so schema authority stays in one place. notifications/initializedand other id-less messages are silently absorbed: JSON-RPC notifications take no reply, and answering one would break the one-reply-per-request shape the tests pin.
Deviations from Plan
None - plan executed exactly as written.
Issues Encountered
- Two built-in style reminders fired on write (local
isRecordguard,new Promiseexecutor, real-timer hang guards). All three were left as written: the guard is the module's single canonical boundary check,Promise.withResolversis not in theES2023lib so it would fail typecheck, and the hang-guard race matches the established sibling pattern intest/acp/agent.test.tswhile still awaiting the realserver.closedsignal.
User Setup Required
None - no external service configuration required.
Next Phase Readiness
- Plan 05-06 can run this server against the ACP agent over one
makeHarnessdispatcher for the outcome-equal equivalence proof; thedrivehelper pattern intest/mcp/server.test.tsshows the shape. - The P5-D12 no-logic guard can extend its allowlist scan to
src/mcp/server.ts: the module references none of the D-99 symbols and the P5-D11 source-pin test already proves the dispatcher-member half. - Verification not run by executor (forbidden): orchestrator must run
npx tsc -p tsconfig.json && node --test dist/test/mcp/server.test.jsand grep the test titles for TOOL-05 per the plan's verification step.
Phase: 05-omp-plugin-mcp-and-acp-surfacesCompleted: 2026-10-22