Skip to main content

Module mcp

Module mcp 

Source
Expand description

zenith mcp — a token-efficient MCP server over stdio.

Speaks JSON-RPC 2.0 line-delimited on stdin/stdout (the MCP stdio transport) and exposes the zenith command surface as MCP tools. It is hand-rolled on serde_json (already a dependency) rather than pulling an async MCP SDK, so the binary stays small.

Design (not a thin CLI wrapper):

  • every tool returns a trimmed structured object (structuredContent plus a compact-JSON text mirror), never raw human stdout;
  • all node/op/surface schema detail is fetched on demand via the single zenith_schema meta-tool (progressive disclosure);
  • large or binary artifacts are returned as resources links backed by the content-addressed session store, never inlined;
  • documents are addressable by doc-id, and the scratch/candidate/promote/ finalize workspace loop is drivable end-to-end.

Logs go to stderr; stdout is reserved for the JSON-RPC framing.

Functions§

handle_message
Handle one JSON-RPC message. Returns Some(response) for requests and None for notifications (and for messages that need no reply).
run
Run the stdio MCP server until stdin closes. Always returns success.
run_http
Fallback when the binary was built without the http feature: report and fail.