Skip to main content

Crate ssg_mcp

Crate ssg_mcp 

Source
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.