Engram::McpServer
Hand-rolled newline-delimited JSON-RPC 2.0 MCP server, driven over
injected IO so it can be exercised through IO::Memory pairs in specs
and wired to real stdio in production.
Reads one JSON-RPC message per line from input; writes at most one
JSON-RPC response line per request to output (notifications get no
reply at all); EOF on input ends #run (there is no shutdown method).
Seam: search and sync collaborators
search.cr and sync.cr are built in a parallel stage. Rather than
reference their concrete types directly, this server takes three narrow
Procs plus the already-built Store:
search_memories : SearchProc—(query, topic, limit, include_superseded) -> Array(MemoryHit)recent_memories : RecentProc—(topic, limit) -> Array(MemoryHit)run_sync : RunSyncProc—() -> Nil, a full re-sync (used byrememberafter writing a new migration file, so apply/rollback/supersedes-recompute stay the sole responsibility ofsync.cr)
memory_status reports embedder state and last-sync time by reading
engram_meta keys "embedder_enabled" and "last_sync_at" off the
Store — the assumption is that sync.cr writes those keys on every run.
This isn't spelled out in docs/SPEC.md and is called out again in this
builder's final report as the concrete contract the integrator must honor.
Constants
Protocol versions this server understands, newest first.
Static tools/list payload for the 5 tools this server exposes.
Constructors
Instance methods
The protocol version this session negotiated in initialize (defaults to our newest before that happens).