Local-first memory system for AI agents with hybrid search and graph reasoning
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Why Cozo Memory?
LLMs have short-term memory limits. Standard RAG retrieves documents but can't connect facts across time. Cozo Memory gives your AI agent persistent, structured memory β it remembers past conversations, infers relationships, detects contradictions, and explores its knowledge graph β fully on your machine, with optional local LLM integration via Ollama for intelligent actions (cleanup, reflection, summarization, agentic routing).Most memory stacks combine separate databases: SQLite for facts, Chroma for vector search, NetworkX for graphs. CozoDB replaces all of that with one embedded engine: relational, graph, vector, and full-text search in a single query language, one file, zero sync lag.
Local-first memory for Claude & AI agents with hybrid search, Graph-RAG, and time-travel β runs entirely on your machine. Optional Ollama integration enables LLM-powered actions (cleanup, reflect, summarize, agentic retrieval).
Now add the server to your MCP client (e.g. Claude Desktop) β see Integration below.
π Hybrid Search - Combines semantic (HNSW), full-text (FTS), and graph signals via Reciprocal Rank Fusion for intelligent retrieval
π§ Agentic Retrieval - Auto-routing engine analyzes query intent via local LLM to select optimal search strategy (Vector, Graph, or Community)
β±οΈ Time-Travel Queries - Version all changes via CozoDB Validity; query any point in history with full audit trails
π― GraphRAG-R1-Inspired Adaptive Retrieval - Intelligent system with Progressive Retrieval Attenuation (PRA) and Cost-Aware F1 (CAF) scoring, conceptually inspired by GraphRAG-R1 (Yu et al., WWW 2026) and adapted for CozoDB, that learns from usage
β³ Temporal Conflict Resolution - Automatic detection and resolution of contradictory observations with semantic analysis and audit preservation
π 100% Local - Embeddings via ONNX/Transformers; data stays on your machine. Some advanced features (cleanup, reflect, summarize, agentic search) require an optional Ollama service for local LLM inference β but the core search, CRUD, and graph operations work without any LLM.
π§ Multi-Hop Reasoning - Logic-aware graph traversal with vector pivots for deep relational reasoning
ποΈ Hierarchical Memory - Multi-level architecture (L0-L3) with intelligent compression and LLM-backed summarization
A common first question is: "Why not just combine existing tools?"
| If you need... | Typical separate stack | CozoDB Memory |
|---|---|---|
| Structured data & relations | SQLite / PostgreSQL | β Built-in relational engine |
| Semantic / vector search | Chroma / Qdrant / Pinecone | β HNSW + FTS + RRF in one engine |
| Graph traversal & reasoning | NetworkX / Neo4j | β Native graph queries + PageRank |
| Time-travel / versioning | Custom audit tables | β
Built-in Validity time-travel |
| Unified query language | Multiple APIs + glue code | β Single Datalog query across all dimensions |
The core insight: Most memory stacks bolt vector search onto a graph DB, or graph search onto a vector DB. CozoDB is different: it is a single engine that natively combines relational, graph, vector, and full-text search. That means:
Most "Memory" MCP servers fall into two categories:
This server fills the gap in between ("Sweet Spot"): A local, database-backed memory engine combining vector, graph, and keyword signals β powered by CozoDB's unified engine rather than a patchwork of separate databases.
| Feature | CozoDB Memory (This Project) | Official Reference (@modelcontextprotocol/server-memory) | mcp-memory-service (Community) | Database Adapters (Qdrant/Neo4j) |
|---|---|---|---|---|
| Backend | CozoDB (Graph + Vector + Relational + FTS in one engine) | JSON file (memory.jsonl) | SQLite / Cloudflare | Specialized DB (only Vector or Graph) |
| Search Logic | Agentic (Auto-Route): Hybrid + Graph + Summaries | Keyword only / Exact Graph Match | Vector + Keyword | Mostly only one dimension |
| Inference | Yes: Built-in engine for implicit knowledge | No | No ("Dreaming" is consolidation) | No (Retrieval only) |
| Community | Yes: Hierarchical Community Summaries | No | No | Only clustering (no summary) |
| Time-Travel | Yes: Queries at any point in time (Validity) | No (current state only) | History available, no native DB feature | No |
| Maintenance | Janitor: LLM-backed cleanup | Manual | Automatic consolidation | Mostly manual |
| Deployment | Local (Node.js + Embedded DB) | Local (Docker/NPX) | Local or Cloud | Often requires external DB server |
The core advantage is Intelligence and Traceability: By combining an Agentic Retrieval Layer with Hierarchical GraphRAG, the system can answer both specific factual questions and broad thematic queries with much higher accuracy than pure vector stores.
EMBEDDING_MODEL=Xenova/all-MiniLM-L6-v2 β only ~400 MB RAM needed (see Embedding Model Options)cozo-nodeSome advanced actions use a local LLM via Ollama for intelligent processing. The core server works without Ollama (CRUD, search, graph operations), but the following actions require it:
| Action | Purpose |
|---|---|
cleanup | LLM-backed observation consolidation |
reflect | Generate insights, detect contradictions |
summarize_communities | LLM-generated community summaries |
compact | Session / entity compaction with LLM summarization |
agentic_search | Query intent classification for auto-routing |
Setup (if you need these features):
If Ollama is not running, the affected actions gracefully fall back to non-LLM behavior (where possible) or return a clear error message.
Notes:
@xenova/transformers downloads the embedding model (may take time)CozoDB Memory supports multiple embedding models via the EMBEDDING_MODEL environment variable:
| Model | Size | RAM | Dimensions | Best For |
|---|---|---|---|---|
Xenova/bge-m3 (default) | ~600 MB | ~1.7 GB | 1024 | High accuracy, production use |
Xenova/all-MiniLM-L6-v2 | ~80 MB | ~400 MB | 384 | Low-spec machines, development |
Xenova/bge-small-en-v1.5 | ~130 MB | ~600 MB | 384 | Balanced performance |
Configuration Options:
Option 1: Using .env file (Easiest for beginners)
Option 2: MCP Server Config (For Claude Desktop / Kiro)
Option 3: Command Line
Download Model First (Recommended):
Note: Changing models requires re-embedding existing data. The model is downloaded once on first use.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/cozo-memory)<a href="https://allmcps.com/mcp/cozo-memory"><img src="https://allmcps.com/api/badge/cozo-memory?style=directory" alt="Cozo Memory on AllMCPs" /></a>