neuromcp
Semantic memory for AI agents — local-first MCP server with hybrid search, knowledge graph, contradiction detection, and plan-then-commit consolidation.
README
neuromcp
Semantic memory for AI agents — local-first MCP server with hybrid search, governance, and consolidation.
npx neuromcp
Why
AI agents forget everything between sessions. The default MCP memory server stores flat key-value pairs with keyword search — fine for "remember my name is Bob", useless for "what was the architectural decision we made about authentication last week?"
neuromcp solves this with hybrid search (vector embeddings + full-text), memory governance (namespaces, trust levels, lineage tracking), and automatic consolidation (dedup, decay, prune) — all running locally in a single SQLite file. No cloud, no API keys, no infrastructure.
Before & After
| Without neuromcp | With neuromcp | |
|---|---|---|
| Session memory | Gone when you close the terminal | Persisted, searchable, ranked by relevance |
| Search | Exact keyword match | Semantic — "auth architecture" finds "JWT validation middleware" |
| Duplicates | Same fact stored 50 times | Content-hash dedup + similarity-based merge |
| Stale memories | Accumulate forever | Automatic decay, pruning, and TTL sweeps |
| Multi-project | Everything in one pile | Namespace isolation per project |
| Trust | All memories equal | Trust levels (high/medium/low) + source tracking |
| Setup | API keys, cloud accounts, config files | npx neuromcp — zero config, runs locally |
How It Works
Query: "how does auth work in this project?"
│
▼
┌───────────────────────┐
│ Hybrid Search │
│ │
│ Vector (semantic) │──→ "JWT tokens validated in middleware" (0.87)
│ FTS (keyword) │──→ "auth module uses passport.js" (0.91)
│ │
│ RRF Fusion │──→ Combined ranking, best results first
└───────────────────────┘
│
▼
Filters: namespace, category, trust, date range
│
▼
Top results returned to agent
Embeddings: Auto-detects Ollama at localhost:11434 for real semantic search (nomic-embed-text). Falls back to built-in ONNX model (bge-small-en-v1.5) for basic similarity. Zero config either way.
Storage: Single SQLite file (~/.neuromcp/memory.db), WAL mode for concurrent access, content-hash deduplication at write time.
Consolidation: Plan-then-commit pipeline — preview what will change before applying. Deduplicates near-identical memories, decays old memories' importance over time, prunes below-threshold, sweeps tombstoned records past TTL.
Real-World Example
You: Where were we with the payment integration?
Claude: [searches neuromcp for "payment integration"]
Found 3 relevant memories:
- (0.92) "Decided on Stripe over PayPal — better webhook reliability,
session from 2026-03-28"
- (0.87) "Payment webhook handler at src/api/webhooks/stripe.ts needs
idempotency keys — known bug, not yet fixed"
- (0.81) "Test coverage for payment module is at 64%, target is 80%"
Based on our previous sessions: we chose Stripe, the webhook handler
needs idempotency keys (that's still open), and test coverage needs
work. Want me to start with the idempotency fix?
Quick Start
npx neuromcp
Creates ~/.neuromcp/memory.db on first run. Downloads ONNX model automatically.
Recommended: Add Ollama for real semantic search
# Install Ollama from https://ollama.com, then:
ollama pull nomic-embed-text
neuromcp auto-detects it. No config needed.
| Provider | Semantic Quality | Setup |
|---|---|---|
| Ollama + nomic-embed-text | Excellent — real semantic understanding, 8K context | ollama pull nomic-embed-text |
| ONNX (built-in fallback) | Basic — keyword overlap, no deep semantics | Zero config |
Installation
Claude Code
// ~/.claude.json → mcpServers
{
"neuromcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "neuromcp"]
}
}
Claude Desktop
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"neuromcp": {
"command": "npx",
"args": ["-y", "neuromcp"]
}
}
}
Cursor / Windsurf / Cline
Same format — add to your editor's MCP settings.
Per-project isolation
// .mcp.json in project root
{
"mcpServers": {
"neuromcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "neuromcp"],
"env": {
"NEUROMCP_DB_PATH": ".neuromcp/memory.db",
"NEUROMCP_NAMESPACE": "my-project"
}
}
}
}
MCP Surface
Tools (8)
| Tool | Description |
|---|---|
store_memory |
Store with semantic dedup. Returns ID and match status. |
search_memory |
Hybrid vector + FTS search with RRF ranking. Filters by namespace, category, tags, trust, date. |
recall_memory |
Retrieve by ID, namespace, category, or tags — no semantic search. |
forget_memory |
Soft-delete (tombstone). Supports dry_run. |
consolidate |
Dedup, decay, prune, sweep. commit=false for preview, true to apply. |
memory_stats |
Counts, categories, trust distribution, DB size. |
export_memories |
Export as JSONL or JSON. |
import_memories |
Import with content-hash dedup. |
Resources (13)
| URI | Description |
|---|---|
memory://stats |
Global statistics |
memory://recent |
Last 20 memories |
memory://namespaces |
All namespaces with counts |
memory://health |
Server health + metrics |
memory://stats/{namespace} |
Per-namespace stats |
memory://recent/{namespace} |
Recent in namespace |
memory://id/{id} |
Single memory by ID |
memory://tag/{tag} |
Memories by tag |
memory://tag/{namespace}/{tag} |
Tag within namespace |
memory://namespace/{ns} |
All in namespace (max 100) |
memory://consolidation/log |
Recent consolidation entries |
memory://consolidation/log/{id} |
Specific operation log |
memory://operations |
Active/recent operations |
Prompts (3)
| Prompt | Description |
|---|---|
memory_context_for_task |
Search relevant memories and format as LLM context |
review_memory_candidate |
Show proposed memory alongside near-duplicates |
consolidation_dry_run |
Preview consolidation without applying |
Memory Governance
Namespaces isolate memories by project, agent, or domain. Each memory belongs to exactly one namespace. Use NEUROMCP_NAMESPACE env var or specify per-operation.
Trust levels (high, medium, low, unverified) indicate confidence in the source. High-trust memories rank higher in search results and resist decay.
Soft delete tombstones memories instead of removing them. Tombstoned records survive for NEUROMCP_TOMBSTONE_TTL_DAYS (default 30) — recoverable until the next consolidation sweep.
Content hashing (SHA-256) deduplicates at write time. Identical content in the same namespace returns the existing memory instead of creating a duplicate.
Lineage tracking records source (user, auto, consolidation, claude-code, error), project ID, and agent ID per memory. Full audit trail for governance.
Configuration
All via environment variables. Defaults work for most setups.
| Variable | Default | Description |
|---|---|---|
NEUROMCP_DB_PATH |
~/.neuromcp/memory.db |
Database file path |
NEUROMCP_MAX_DB_SIZE_MB |
500 |
Max database size |
NEUROMCP_EMBEDDING_PROVIDER |
auto |
auto, onnx, ollama, openai |
NEUROMCP_EMBEDDING_MODEL |
auto |
Model name (auto-detected) |
OLLAMA_HOST |
http://localhost:11434 |
Ollama server URL |
NEUROMCP_DEFAULT_NAMESPACE |
default |
Default namespace |
NEUROMCP_TOMBSTONE_TTL_DAYS |
30 |
Days before permanent sweep |
NEUROMCP_AUTO_CONSOLIDATE |
false |
Enable periodic consolidation |
NEUROMCP_CONSOLIDATE_INTERVAL_HOURS |
24 |
Consolidation frequency |
NEUROMCP_DECAY_LAMBDA |
0.01 |
Importance decay rate |
NEUROMCP_DEDUP_THRESHOLD |
0.92 |
Cosine similarity for dedup |
NEUROMCP_MIN_IMPORTANCE |
0.05 |
Prune threshold |
NEUROMCP_AUTO_COMMIT_SIMILARITY |
0.95 |
Auto-merge threshold |
NEUROMCP_SWEEP_INTERVAL_HOURS |
6 |
TTL sweep frequency |
NEUROMCP_LOG_LEVEL |
info |
debug, info, warn, error |
Comparison
| Feature | neuromcp | @modelcontextprotocol/server-memory | mem0 | cortex-mcp |
|---|---|---|---|---|
| Search | Hybrid (vector + FTS + RRF) | Keyword only | Vector only | Vector only |
| Embeddings | Built-in ONNX (zero config) | None | External API | External API |
| Governance | Namespaces, trust, soft delete | None | None | Basic |
| Consolidation | Plan-then-commit | None | None | Manual |
| Storage | SQLite (single file) | JSON file | Cloud / Postgres | SQLite |
| Infrastructure | Zero | Zero | Cloud account | Zero |
| MCP surface | 8 tools, 13 resources, 3 prompts | 5 tools | N/A | 4 tools |
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。