Nexus Memory MCP
<p align="right"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a></p>
# Nexus Memory MCP
> 🧠 **Local-First Persistent Memory & Cross-Model Session Handoff MCP Server (part of the [Nexus](https://github.com/ysunyang4/Nexus) ecosystem)**
> *Model-Agnostic, High-Performance, Privacy-Guaranteed Scoped Intelligence*
[](https://modelcontextprotocol.io)
[](LICENSE)
[](https://sqlite.org)
---
## 🌟 Why Nexus Memory MCP?
Today, AI agents suffer from two primary memory challenges:
1. **The official Memory MCP is too simplistic**: `@modelcontextprotocol/server-memory` is an unindexed flat JSON knowledge graph with no project isolation, no automatic deduplication, and zero cross-session handoff capability.
2. **Cloud memory services compromise privacy**: Solutions like Mem0 or third-party APIs require streaming your proprietary source code and sensitive conversations to external clouds, introducing token billing, latency, and data leakage risks.
**Nexus Memory MCP** extracts the battle-tested **`IntelligenceStore` + `MemoryRuntime` + `SessionHandoffManager`** from the core Nexus architecture into a lightweight, standalone MCP server:
* 🔒 **100% Local Privacy**: Backed by high-concurrency SQLite in WAL mode at `~/.nexus/nexus-memory.db`. Zero cloud dependency, microsecond reads/writes.
* 🛡️ **Physical Secret Redaction**: Built-in `redactSensitiveTokens` engine automatically sanitizes API keys (`sk-...`), Nexus tokens (`lb_...`), GitHub PATs, database credentials, and private keys before persistence.
* 🗂️ **Multi-Tier Scope Isolation**: Strict boundaries for `GLOBAL` (cross-project preferences), `PROJECT` (project-specific architecture & rules), `SESSION`, and `TASK`.
* 🔄 **Cross-Model Session Handoff**: Finish a milestone in Claude Desktop, generate an 8-character handle (`nx-a1b2c3d4`), and paste a single wake prompt into Cursor, ChatGPT, or Gemini to instantly restore full context!
* ⚡ **Zero-LLM Token Budget Cap (<800 Tokens)**: Compacts key decisions, active files, and pending tasks deterministically without consuming token budgets for summarization.
---
## 🚀 Quickstart (1 Minute Setup)
```bash
git clone https://github.com/ysunyang4/Nexus-Memory-MCP.git
cd Nexus-Memory-MCP
pnpm install && pnpm run build
```
### 1. Claude Desktop Configuration
Edit your Claude Desktop config:
* **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
* **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
Add to `mcpServers`:
```json
{
"mcpServers": {
"nexus-memory": {
"command": "node",
"args": [
"<path-to-Nexus-Memory-MCP>/dist/index.js"
]
}
}
}
```
### 2. Cursor / VS Code / Antigravity Setup
In your MCP settings:
* **Name**: `nexus-memory`
* **Type**: `command (stdio)`
* **Command**: `node <path-to-Nexus-Memory-MCP>/dist/index.js`
---
## 🛠️ Core Tools & Resource Reference
| Tool / Resource | Description | Key Parameters |
| :--- | :--- | :--- |
| `nexus_memory_bootstrap` | Load a compact (`<700` tokens) digest of high-importance `GLOBAL` & `PROJECT` memories at session start | `scopeId`, `minImportance`, `maxTokens` |
| `nexus_memory_set` | Save/update a scoped memory with secret sanitization and an explicit write receipt (`created`/`updated`/`unchanged`, `redacted`) | `key`, `content`, `scope`, `type`, `importance`, `confidence`, `tags` |
| `nexus_memory_get` | Exact lookup of a single active memory by `id` or `key` + `scope` | `id`, `key`, `scope`, `scopeId` |
| `nexus_memory_search` / `nexus_memory_recall` | Search and rank memories with multi-attribute scoring and reasoning | `query`, `scope`, `tags`, `minImportance`, `limit` |
| `nexus_memory_list` | List active memories with optional scope filtering | `scope`, `scopeId`, `limit` |
| `nexus_session_handoff` | Package current session into a compact bundle (`<800` tokens) with an 8-char handle | `title`, `summary`, `keyDecisions`, `activeFiles`, `pendingTasks` |
| `nexus_session_resume` | Resume session context using an 8-char handle (or auto-read `.nexus/session_handle.txt`) | `handle`, `releaseAfterRead` |
| `nexus_memory_consolidate` | Merge duplicate memories, unify tags, and archive superseded records | `scope`, `scopeId` |
| `nexus://memory/bootstrap` *(Resource)* | Markdown digest of high-importance `GLOBAL` and `PROJECT` memories | — |
---
## 🧪 Verification
Includes a comprehensive test suite covering secret redaction, write receipts, session bootstrap, scoped memory CRUD, score ranking, and cross-session handoffs:
```powershell
pnpm test
```
* **Status**: `12 tests passed (100% pass rate)`
---
## 📄 License
Licensed under the [Apache-2.0 License](LICENSE).
Part of the [Nexus](https://github.com/ysunyang4/Nexus) local AI infrastructure ecosystem.
TDQS
Scored across 9 tools
Most tools have a recognizable role (list vs get vs set vs consolidate vs bootstrap vs session handoff/resume), but nexus_memory_search is explicitly documented as an alias of nexus_memory_recall, creating a genuine duplicate-selection hazard. The recall/search/list trio also overlaps around keyword ranking, forcing an agent to reason about subtle differences rather than obvious ones.
Names follow a steady snake_case namespace_resource_action pattern (nexus_memory_list/get/set/recall/search/consolidate/bootstrap, nexus_session_handoff/resume). Minor deviation: the session tools read as noun-oriented (handoff, resume) rather than the verb-first style of the memory tools, but the shared prefixes keep things predictable.
Nine tools is a well-scoped size for a persistent-memory server covering storage, retrieval, ranking, consolidation, and session continuity. The only wasted slot is nexus_memory_search, which duplicates nexus_memory_recall instead of adding a distinct capability.
The lifecycle covers create/update (set), read (get, list, search/recall), and deduplicate (consolidate), plus strong session handoff/resume and bootstrap support. However, there is no delete/forget/expire operation, so an agent cannot remove stale or incorrect memories — a notable gap for a memory system.