Expand description
MCP server (HTTP/SSE + UDS) for trusty-memory.
Why: Claude Code and other MCP-aware clients integrate with trusty-memory
through the standardized Model Context Protocol; we expose memory + KG
tools so they can be called by name. Claude Code itself speaks stdio,
but the in-process serve --stdio path was removed in issue #150
because it deadlocked on the redb exclusive write lock whenever a
long-lived daemon was already running — the canonical stdio integration
is now the trusty-memory-mcp-bridge binary (PR #149), which pipes
Claude Code’s stdio over a Unix domain socket to the daemon.
What: Provides run_http / run_http_dynamic / run_http_on (axum
HTTP/SSE + REST + UI) and the transport::uds module (Unix-domain
socket transport for the MCP bridge), plus an AppState that carries
the shared PalaceRegistry, on-disk data root, and a lazily-initialized
embedder.
Test: cargo test -p trusty-memory validates handshake + dispatch via
the in-process handle_message unit tests and the tests/uds_roundtrip.rs
end-to-end harness.
Re-exports§
pub use activity::ActivityEntry;pub use activity::ActivityFilter;pub use activity::ActivityLog;pub use activity::ActivitySource;pub use attribution::CreatorInfo;pub use attribution::CreatorSource;pub use mcp_service::MemoryMcpService;pub use tools::MemoryMcpServer;
Modules§
- activity
- Persistent activity log for the trusty-memory daemon (issue #96).
- attribution
- Drawer creator-attribution tag helpers.
- bm25_
supervisor - Per-palace
trusty-bm25-daemonspawn supervisor (issue #193). - bootstrap
- Knowledge-graph bootstrap helpers.
- chat
- Chat HTTP surface for trusty-memory: OpenRouter/Ollama SSE chat, tool dispatch, chat-session CRUD, and inter-project messaging endpoints.
- commands
- Per-subcommand handlers for the
trusty-memorybinary. - discovery
- Automatic project alias discovery.
- hook_
emit - Cross-process hook activity emit.
- kg_
extract - Deterministic KG triple extraction from drawer content.
- mcp_
service ServiceDescriptorimpl for the trusty-memory MCP service.- messaging
- Inter-project messaging primitive (issue #99).
- openrpc
- OpenRPC 1.3.2 service description for
trusty-memory-mcp. - project_
root - Issue #88: project-root detection and palace-slug enforcement.
- prompt_
facts - Prompt-facts surface: hot KG predicates exposed via a per-message tool.
- prompt_
log - Enriched-prompt logger for the UserPromptSubmit / SessionStart hooks (issue #105).
- service
MemoryService— pure business-logic facade overAppState.- tools
- MCP tool surface for trusty-memory.
- transport
- Transport-layer infrastructure for the trusty-memory daemon.
- web
- HTTP API + embedded SPA shell for the trusty-memory admin UI.
Structs§
- AppState
- Shared application state passed to every request handler.
Enums§
- Daemon
Event - Live daemon events broadcast to connected SSE subscribers.
- Hook
Type - Hook type — labels the Claude Code hook that triggered a submission.
- Injection
Kind - Injection kind — labels what the hook actually injected (or attempted).
Constants§
- DEFAULT_
HTTP_ PORT - Preferred starting port for the trusty-memory HTTP daemon.
- HOOK_
PROMPT_ EXCERPT_ CHARS - Maximum bytes retained in the trigger-prompt excerpt embedded on a
HookFiredevent.
Functions§
- bind_
dynamic_ port - Bind a
TcpListenerto127.0.0.1, dynamically selecting a port. - handle_
message - Handle a single MCP JSON-RPC message and produce its response.
- hook_
prompt_ excerpt - Reduce a triggering prompt to the short excerpt embedded on a
HookFiredactivity event. - http_
addr_ path - Path to the canonical address-discovery file for the trusty-memory daemon.
- resolve_
palace_ registry_ dir - Resolve the directory that actually holds the per-palace subdirectories.
- run_
http - Convenience: bind
addrand serve viarun_http_on. - run_
http_ dynamic - Convenience: bind dynamically (7070..=7079, OS fallback) and serve.
- run_
http_ on - Run the optional HTTP/SSE + web admin server.