Expand description
Model Context Protocol server over ssg’s existing RPC registry.
MCP is line-delimited JSON-RPC 2.0 on stdio. The protocol surface an
editor actually needs is small — initialize, tools/list,
tools/call — so this is hand-rolled rather than pulling in an SDK for
three message shapes.
Nothing here defines tools. #[ssg_rpc] already registers every callable
with its input and output JSON Schema, and that registry is walked at
runtime, so a tool added to ssg appears over MCP without a second
declaration. A separate list would be a copy, and copies drift — the
failure this codebase has hit repeatedly.
Transport is deliberately separate from protocol: handle_line maps
one request string to an optional response string and touches no I/O, so
the whole surface is testable without spawning a process or a pipe.
Constants§
- PROTOCOL_
VERSION - MCP revision this server implements.
Functions§
- handle_
line - Handle one JSON-RPC line.
- serve
- Drive the protocol over a reader and writer.
- tools
- Every registered RPC, as an MCP tool definition.