On this page

0119: MCP stdio adapter

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

Context

Agents need dynamic MCP tools while sharing a server and enforcing their existing grants before any tool request leaves the runner.

Decision

Provide a separate edition-2026 plugins/mcp member. Its v0 adapter speaks newline-delimited JSON-RPC 2.0 over stdio, supporting initialize, tools/list, tools/call and mapping cancellations to notifications/cancelled. Multiplex request IDs so agents share one server per runtime through the registry in ADR-0118. Expose MCP tools as M12 dynamic tools; validate their JSON Schema at dispatch and authorize grants before sending the request. Confirm the M12 authorization interface before implementation.

Consequences

The conservative v0 implementation is pure Harness protocol state; the host sends outbound NDJSON bytes and supplies complete response lines. IDs correlate callers even when replies arrive out of order. Dispatch uses M12 tools.check_tool before enqueueing and validates only schema type, required and properties, failing closed on unknown schema keywords and arguments. Tool metadata becomes DynamicTool values and ToolCall dispatch uses M12 Tools/ToolHooks, without automatic runner registration.

The registry in plugins/agent/native/hrt_tools.h lacks a language handle and read/write binding; no new natives are provided. Runtime sharing and runner dynamic-port integration remain open. Process.run_input supports EOF-buffered fake tests, not a persistent interactive server. Tests cover protocol state and batch fakes; a live handshake, cancellation and real-server interoperability are not established.

Alternatives

Offline edition-bundle registration is deferred: mcp uses an explicit path dependency on the unbundled agent_platform. The package itself uses edition 2026. The v0 schema types are object, string, signed 64-bit integer and boolean; other types/keywords and fractional/out-of-range JSON numbers fail closed, including constraints on absent optional properties. No kernel language or diagnostic changes are needed.

One server per agent wastes processes. Network transport and a broader protocol implementation add scope and are deferred from v0.