Local-first MCP memory for AI agents — the curated state (notebook). Pairs with mcp-vl-msa-rs for searchable corpus.
git clone https://github.com/DioNanos/mcp-memory-rs{
"mcpServers": {
"mcp-memory-rs": {
"command": "mcp-memory-rs",
"env": {
"MCP_MEMORY_TOKEN": "<mcp_memory_token>"
}
}
}
}MCP_MEMORY_TOKENResumen de MCP Servers
# mcp-memory-rs
Local-first MCP memory server in pure Rust. Persistent, versioned, queryable
memory for AI agents — owned by the user, not by a platform.
State lives on your disk as plain JSON categories backed by SQLite (FTS5).
Every write is versioned and backed up. A fleet of devices syncs through an
optional HTTP endpoint with merkle manifests and optimistic concurrency.
No cloud account, no embedding service, no network dependency in the default
mode.
## Why
Agent memory tied to a vendor dies with the vendor session. This server keeps
the agent's long-lived state — identity, projects, infrastructure notes,
per-device workflows — in files you can read, grep, diff, and back up
yourself. Any MCP client (Claude Code, Codex, or anything speaking MCP stdio)
gets the same memory; swapping the model does not lose the state.
Design choices that follow from that:
- **Local-first**: the stdio server works fully offline against local storage.
Sync is a separate, explicit step — never a hidden dependency.
- **Plain storage**: one JSON file per category plus a SQLite index. The
database can be rebuilt from the files; the files are the truth.
- **Versioning by default**: every write keeps history; deletes create a
backup first. `memory_history` and `memory_compact` manage the tail.
- **Concurrency-safe writes**: `expected_hash` turns clobbering races between
concurrent agents into explicit conflicts.
- **Zero ML in the core**: full-text search is SQLite FTS5 with BM25;
`memory_search_semantic` adds an optional TF-IDF hybrid. No model downloads.
> **The pair:** for *corpus* recall (chunked documents, BM25 retrieval,
> original-text injection) see the companion server
> [mcp-vl-msa-rs](https://github.com/DioNanos/mcp-vl-msa-rs). This server holds
> the curated agent state; that one holds the queryable corpus.
```mermaid
flowchart LR
A["AI agent<br/>(any MCP client)"]
A -->|"curated state<br/>read / write / sync"| M["mcp-memory-rs<br/><i>the notebook</i>"]
A -->|"corpus recall<br/>index / search / fetch"| V["mcp-vl-msa-rs<br/><i>the library</i>"]
M --- D1[("JSON categories<br/>SQLite FTS5")]
V --- D2[("tantivy BM25<br/>collections")]
```
## Install
**Prebuilt binary** (recommended) — download the archive for your platform from
the [latest release](https://github.com/DioNanos/mcp-memory-rs/releases/latest),
extract, and point your MCP client at the binary:
```bash
tar xzf mcp-memory-rs-x86_64-unknown-linux-gnu.tar.gz
install -m755 mcp-memory-rs-*/mcp-memory-rs ~/.local/bin/
```
Prebuilt targets (Linux + Android): `x86_64-unknown-linux-gnu`,
`x86_64-unknown-linux-musl`, `aarch64-unknown-linux-gnu`,
`aarch64-unknown-linux-musl` (edge / ARM / Termux), `aarch64-linux-android`.
**macOS**: no prebuilt binary is shipped (it would need Apple code-signing).
Install from source instead — `cargo install` compiles it on your Mac in one
command, no signing needed:
```bash
cargo install --git https://github.com/DioNanos/mcp-memory-rs --locked
```
`--locked` uses the committed `Cargo.lock` (reproducible build).
## Quick start
```bash
cargo build --release
# stdio MCP server, offline mode (default)
./target/release/mcp-memory-rs
```
Claude Code (`~/.claude.json`) or any MCP client:
```json
{
"mcpServers": {
"memory": {
"command": "/path/to/mcp-memory-rs",
"env": { "MCP_DEVICE": "my-laptop" }
}
}
}
```
Codex (`~/.codex/config.toml`):
```toml
[mcp_servers.memory]
command = "/path/to/mcp-memory-rs"
env = { MCP_DEVICE = "my-laptop" }
# auto-approve read-only tools (memory_read/list/search/…); writes still gated
default_tools_approval_mode = "approve"
```
Configuration is TOML — copy [`config/example.toml`](config/example.toml) and
adjust. Environment variables override file values (`MCP_DEVICE`,
`MCP_MEMORY_MODE`, `MCP_MEMORY_DIR`, …); the example file documents all of
them.
## Memory model
Memory is organized in **categories**: named JSON documents (`base`,
`projects`, `my-laptop`, `workflow_my-laptop`, …). Reads return the document
plus metadata (content hash, size, last writer, timestamp). Writes replace the
category or, with `merge=true`, patch it per top-level key.
### Access control
Multi-device fleets get a small, explicit ACL (`[acl]` in the config):
| Rule | Effect |
|---|---|
| `admin_devices` | Listed devices write everything. |
| `device_categories` | Device `name` writes category `name` and `workflow_name` — its own namespace only. |
| agent scope | Device `foo-agent` writes `foo_*` categories. |
| everyone | All devices read everything. |
Unknown categories are denied for non-admin writers — fail closed.
### Fleet sync
Each node runs local-first; one node (or any number) exposes the HTTP API as a
sync remote. `sync_manifest` builds a merkle-rooted fingerprint of all
categories; `sync_diff` compares manifests; `memory_sync` pushes dirty
categories or pulls remote changes. Conflicts between nodes are resolved by
the configured `conflict_strategy` (last-write-wins by default);
`expected_hash` preconditions protect direct writes (MCP and HTTP), not the
sync envelope.
The HTTP API is an **admin/sync plane**: the bearer token grants full access
to every category. Per-category ACL applies on the MCP stdio surface, where
the device identity is known locally; HTTP callers are identified only by the
shared token, so no per-device ACL is enforced there.
The HTTP server **requires** `MCP_MEMORY_TOKEN` and refuses to start without
it. Bind it to loopback (the default) and tunnel between nodes; do not expose
it to the public internet.
```bash
MCP_MEMORY_TOKEN=<secret> ./target/release/mcp-memory-rs --http
```
## Tool surface
| Tool | Description |
|---|---|
| `memory_read` | Read a category (optional field filtering). |
| `memory_write` | Replace or merge-patch a category; versioned; `expected_hash` precondition. |
| `memory_delete` | Delete a category (backup created first). |
| `memory_list` | All categories with hash/size/last-update metadata. |
| `memory_search` | FTS5 full-text search, BM25 ranking, category/date/actor filters, snippets. |
| `memory_search_semantic` | Hybrid TF-IDF + FTS5 search. |
| `memory_history` | Version history of a category. |
| `memory_delta` | Changes since a known hash (cheap polling). |
| `memory_context` | Multi-category warmup read, token-budget oriented. |
| `memory_compact` | Prune old versions and backups. |
| `memory_status` | Local-first status: dirty queue, manifest hash, last sync. |
| `memory_doctor` | Diagnostics: paths, database, categories, sync config. |
| `sync_manifest` | Merkle-rooted manifest of all categories. |
| `sync_diff` | Compare local vs remote manifest: push/pull/conflict sets. |
| `sync_push` / `sync_pull` | Export/import sync envelopes. |
| `memory_sync` | One sync step against the configured remote (`push_dirty` / `pull_remote`). |
The same surface is available over HTTP (`/api/v1/*`) for non-MCP consumers;
`/health` is unauthenticated, everything else requires the bearer token.
### AI client compatibility
The server is built to be self-explanatory to a weak client model:
- At `initialize` it returns an **instructions** string describing the memory
model and the entry-point tools. Some lightweight clients ignore this field;
if your client never surfaces it, read the tool descriptions instead — they
carry the same guidance (e.g. `memory_read` takes `category`, not `key`).
- Read-only tools are annotated `readOnlyHint`, so a client such as Codex can
auto-approve them. On Codex, an `unsupported call` / `user cancelled`
result usually means the tool-approval gate fired, not a server fault — set
`default_tools_approval_mode = "approve"` (see the Codex snippet above).
- The server speaks the standard MCP handshake. A client must complete
`initialize` and send `notifications/initialized` like any MCP client.
## Storage layout
Default `base_dir` is `~/.memory`; the example config uses
`~/.local/state/mcp-memory-rs` (XDG-style). Either way the layout is:
```
<base_dir>/
├── categories/ # one .json file per category — the source of truth
├── backups/ # automatic pre-delete/pre-overwrite backups
└── memory.db # SQLite: FTS5 index, versions, sync state (rebuildable)
```
## Building and testing
```bash
cargo build --release # single static-friendly binary
cargo test # unit + integration tests
cargo clippy --all-targets -- -D warnings
```
No build-time network access, no C dependencies beyond bundled SQLite.
## License
Apache-2.0. See [LICENSE](LICENSE).
Lo que la gente pregunta sobre mcp-memory-rs
¿Qué es DioNanos/mcp-memory-rs?
+
DioNanos/mcp-memory-rs es mcp servers para el ecosistema de Claude AI. Local-first MCP memory for AI agents — the curated state (notebook). Pairs with mcp-vl-msa-rs for searchable corpus. Tiene 0 estrellas en GitHub y se actualizó por última vez today.
¿Cómo se instala mcp-memory-rs?
+
Puedes instalar mcp-memory-rs clonando el repositorio (https://github.com/DioNanos/mcp-memory-rs) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar DioNanos/mcp-memory-rs?
+
DioNanos/mcp-memory-rs aún no ha sido auditado por nuestro agente de seguridad. Revisa el repositorio original en GitHub antes de usarlo en producción.
¿Quién mantiene DioNanos/mcp-memory-rs?
+
DioNanos/mcp-memory-rs es mantenido por DioNanos. La última actividad registrada en GitHub es de today, con 0 issues abiertos.
¿Hay alternativas a mcp-memory-rs?
+
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.
Despliega mcp-memory-rs en tu cloud
Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.
¿Mantienes este repo? Añade un badge a tu README
Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.
[](https://claudewave.com/repo/dionanos-mcp-memory-rs)<a href="https://claudewave.com/repo/dionanos-mcp-memory-rs"><img src="https://claudewave.com/api/badge/dionanos-mcp-memory-rs" alt="Featured on ClaudeWave: DioNanos/mcp-memory-rs" width="320" height="64" /></a>Más MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。