Skip to main content

Module mcp

Module mcp 

Source
Expand description

MCP server — the read path into the knowledge graph.

Without this, the graph is write-only in practice. SessionEnd ingests episodes and SessionStart runs consume, which only prints EPHEMERAL.md; nothing in a normal session ever queries the store. Bayesian confidence, HNSW search, provenance weighting and temporal decay all sit behind a command a human has to type by hand. An MCP server closes that loop: the agent asks its own memory, with the actual question, at the moment the question comes up.

§Shape

JSON-RPC 2.0 over stdin/stdout, one message per line — the standard local MCP transport. The surface is small on purpose: initialize, ping, tools/list, tools/call, and notifications, which are consumed silently. Anything else is a JSON-RPC method not found; nothing here panics on hostile input.

Every tool runs through crate::serve_client::execute, so the MCP server is just another daemon client and inherits the daemon’s locking discipline, concurrency and auto-start. It never opens the store itself.

§Read-only

No tool writes. The graph’s confidence model deliberately discounts what the agent asserts about itself (see [graph.provenance]); a tool that let the model create entities and edges directly would route around exactly the mechanism that keeps self-generated claims from becoming evidence. Writing stays on the ingest path, where every episode is stamped with its authorship.

Modules§

render
Turning retrieval results into text an LLM can use.
tools
The tool catalogue exposed over MCP.

Structs§

DaemonBackend
The real backend: the graph daemon for a memory directory.
McpServer
An MCP server over some GraphBackend.
RpcError
A JSON-RPC error, as returned in the error member of a response.

Constants§

PREFERRED_PROTOCOL_VERSION
The revision offered to a client that asks for one we do not implement.
SUPPORTED_PROTOCOL_VERSIONS
MCP revisions this server speaks, newest first.

Traits§

GraphBackend
The graph operations this server runs tools against.

Functions§

negotiate_protocol_version
Echo the client’s revision when we speak it, otherwise offer ours.
run
Serve MCP over stdin/stdout until the client closes the connection.