Skip to main content

Module mcp

Module mcp 

Source
Expand description

keel mcp — the CLI doubles as an MCP server for coding agents (dx-spec §5).

A hand-rolled, dependency-free JSON-RPC 2.0 loop over stdio (one newline-delimited message per line) speaking the Model Context Protocol: initialize, ping, tools/list, tools/call. Exactly the six spec-promised tools are exposed — get_status, get_doctor_report, propose_policy (returns a keel.toml diff), get_trace, list_flows, explain_error — and each is a thin wrapper over the same library producer as the corresponding CLI command, so a tool’s text result is byte-identical to that command’s --json output (golden-tested). An agent that already understands keel status --json can diff the MCP result against it and see no change.

No daemon (dx-spec §3 invariant 3): the server is client-launched, owns no port, and exits on stdin EOF. Determinism as courtesy (dx-spec §5): responses serialize through serde_json::Value (sorted keys), the tool catalog is a fixed alphabetical list, and no wall-clock value reaches any response.

Structs§

Server
The stdio MCP server: the project it reports on plus an injected clock (a fn pointer so tests stay deterministic; only human-facing views consume it — no wall-clock value ever reaches a JSON response).

Constants§

TOOL_NAMES
The six tool names, alphabetical — the single source [tool_catalog] and anything cross-checking against it (the packaged Claude Code Skill’s consistency test, crates/keel-cli/tests/cli.rs) both read.