On this page

0153: MCP server-mode plugin

Status: Proposed — design default, pending the maintainer's confirmation

Context

Harness needs a deterministic, testable MCP server library while keeping transport I/O in the host example. This numbering starts at 0150, leaving 0122–0149 for the owner's in-progress M14 ADRs.

Decision

Add plugins/mcp_server as a pure step-function plugin, pinned to MCP protocol 2024-11-05. It exposes state creation, tool registration and serve_line; the example main owns stdin/stdout. Support initialize, initialized notification, ping, tools/list and tools/call; sort listed tools and validate arguments with wire.conforms. Preserve request IDs and request order, with specified JSON-RPC errors for malformed input, invalid requests/params and unknown methods. Use fake stdin transcripts for tests. Depend on mcp for wire; if that dependency is blocked, extract wire.hn to plugins/jsonrpc first.

Consequences

The library has no I/O and remains fixture-testable in both backends. Server lifecycle and transport remain explicit host responsibilities.

Alternatives considered

Embedding transport in the plugin couples protocol logic to effects. Extracting JSON-RPC preemptively adds scope; do it only if the mcp dependency is blocked.