Skip to main content

mcp_memory/
lib.rs

1pub mod actions;
2pub mod config;
3pub mod errors;
4pub mod http;
5pub mod intern;
6pub mod kg;
7pub mod protocol;
8pub mod search;
9pub mod server;
10pub mod store;
11pub mod tools;
12pub mod types;
13
14use clap::{Parser, ValueEnum};
15
16/// Wire transport the server listens on. The JSON-RPC/MCP semantics are
17/// identical across all three — only the framing differs.
18#[derive(Copy, Clone, Debug, PartialEq, Eq, ValueEnum)]
19#[clap(rename_all = "lowercase")]
20pub enum Transport {
21    /// Newline-delimited JSON-RPC over stdin/stdout (default; for Claude
22    /// Desktop / Claude Code and other process-spawning clients).
23    Stdio,
24    /// Newline-delimited JSON-RPC over a TCP socket (one message per line),
25    /// accepting many concurrent connections.
26    Tcp,
27    /// MCP Streamable HTTP: POST JSON-RPC to `/mcp` (responses as JSON or, when
28    /// the client `Accept`s it, an SSE stream), plus `GET /mcp` for a standalone
29    /// server→client SSE stream.
30    Http,
31}
32
33#[derive(Parser, Debug)]
34#[command(name = "MCP Memory Server")]
35#[command(about = "Knowledge graph memory server for MCP — entities, relations, and observations persisted via binary log", long_about = None)]
36pub struct Args {
37    /// Path to the memory file
38    #[arg(short = 'f', long = "memory-file")]
39    pub memory_file: Option<String>,
40
41    /// Transport to listen on: stdio, tcp, or http
42    #[arg(short = 't', long = "transport", value_enum, default_value_t = Transport::Stdio)]
43    pub transport: Transport,
44
45    /// Address to bind for the `tcp` and `http` transports
46    #[arg(short = 'b', long = "bind", default_value = "127.0.0.1:8080")]
47    pub bind: String,
48
49    /// Log level
50    #[arg(short, long, default_value = "info")]
51    pub log_level: String,
52}