Skip to main content

Crate memstead_mcp

Crate memstead_mcp 

Source
Expand description

Memstead MCP server — exposes the Memstead engine via the Model Context Protocol over STDIO.

One crate, two build configs. The default build (mem-repo feature on) is the full server: the multi-mem, git-backed ServerHandler (server::McpServer) and its tool router, plus the support modules (config, lifecycle, read_mems, error_envelope). --no-default-features drops the git-branch backend, leaving the folder + archive ServerHandler (filesystem_server::FilesystemMcpServer) — a CI / wasm-adjacent config, not shipped.

Shared building blocks used by both servers live here unconditionally: error_envelopes (validation envelope) and tools (tool parameter structs).

The binary entry point (main.rs) stays thin: argument parsing, logging, then delegation into this crate.

Modules§

config
Full MCP-binary configuration helpers.
error_envelope
Tool-error envelope helpers used by the full ServerHandler to construct CallToolResult responses with the engine’s typed wire shape: text channel prefixed ERROR [<CODE>]: <message>, structured_content carrying the full payload (or absent on the prose-only path), is_error set so MCP clients render the response as a failure. Both helpers live in memstead-mcp because the full server is their only consumer; the lean filesystem server builds its envelopes through the parallel helpers inline in memstead-mcp::filesystem_server.
error_envelopes
Shared MCP error-envelope translators.
filesystem_server
filesystem-mem MCP server — parallel module to crate::server.
lifecycle
Parameter structs for the runtime mem-lifecycle tools — memstead_mem_create and memstead_mem_delete.
read_mems
Batch-install helper for the --read-mem CLI flag.
server
MCP server — McpServer struct with Engine, tool router, and ServerHandler.
tools
Tool parameter structs for the agent-facing MCP tools.

Macros§

lock_engine
Acquire an engine mutex on a tool dispatch path. A poisoned lock (a prior tool call panicked) early-returns the typed ENGINE_LOCK_POISONED envelope instead of panicking the server — usable only inside functions returning CallToolResult.