1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! 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`](main.rs)) stays thin: argument
//! parsing, logging, then delegation into this crate.
// Multi-mem / git-backed server, compiled into the full `memstead-mcp`
// binary (default features); absent from the lean `--no-default-features`
// build, which has no git-branch backend.
/// 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`.