mcp-memory
A drop-in replacement for Anthropic's memory server that utilizes SQLite to ensure data integrity and concurrent access. It enhances the original functionality with semantic search capabilities using vector embeddings and ONNX models.
README
mcp-memory
A drop-in replacement for Anthropic's MCP Memory server — with SQLite persistence, vector embeddings, and semantic search.
Why? The original server writes the entire knowledge graph to a JSONL file on every operation, with no locking or atomic writes. Under concurrent access (multiple MCP clients), this causes data corruption. This server replaces that with a proper SQLite database.
Features
- Drop-in compatible with Anthropic's 9 MCP tools (same API, same behavior)
- SQLite + WAL — safe concurrent access, no more corrupted JSONL
- Semantic search via sqlite-vec + ONNX embeddings (50+ languages)
- Lightweight — ~150 MB total vs ~1.4 GB for similar solutions
- Migration — one-click import from Anthropic's JSONL format
- Zero config — works out of the box, optional model download for semantic search
Quick Start
1. Add to your MCP config
{
"mcpServers": {
"memory": {
"command": ["uvx", "--from", "git+https://github.com/Yarlan1503/mcp-memory", "mcp-memory"]
}
}
}
Or clone and run locally:
{
"mcpServers": {
"memory": {
"command": ["uv", "run", "--directory", "/path/to/mcp-memory", "mcp-memory"]
}
}
}
2. Enable semantic search (optional)
cd /path/to/mcp-memory
uv run python scripts/download_model.py
This downloads a multilingual sentence model (~80 MB) to ~/.cache/mcp-memory-v2/models/. Without it, all tools work fine — only search_semantic will be unavailable.
3. Migrate existing data (optional)
If you have an Anthropic MCP Memory JSONL file, use the migrate tool or call it directly:
uv run python -c "
from mcp_memory.storage import MemoryStore
from mcp_memory.migrate import migrate_jsonl
store = MemoryStore()
store.init_db()
result = migrate_jsonl(store, '~/.config/opencode/mcp-memory.jsonl')
print(result)
"
MCP Tools
Compatible with Anthropic (9 tools)
| Tool | Description |
|---|---|
create_entities |
Create or update entities (merges observations on conflict) |
create_relations |
Create typed relations between entities |
add_observations |
Add observations to an existing entity |
delete_entities |
Delete entities (cascades to observations + relations) |
delete_observations |
Delete specific observations |
delete_relations |
Delete specific relations |
search_nodes |
Search by substring (name, type, observation content) |
open_nodes |
Retrieve entities by name |
read_graph |
Read the entire knowledge graph |
New tools (2)
| Tool | Description |
|---|---|
search_semantic |
Semantic search via vector embeddings (cosine similarity) |
migrate |
Import from Anthropic's JSONL format (idempotent) |
Architecture
server.py (FastMCP) ←→ storage.py (SQLite + sqlite-vec)
↑
embeddings.py (ONNX Runtime)
↑
paraphrase-multilingual-MiniLM-L12-v2
(384d, 50+ languages, CPU-only)
- Storage: SQLite with WAL journaling, 5-second busy timeout, CASCADE deletes
- Embeddings: Singleton ONNX model loaded once at startup, L2-normalized cosine search
- Concurrency: SQLite handles locking internally — no fcntl, no fs wars
How It Works
Each entity gets an embedding vector generated from its concatenated content:
"{name} ({entity_type}): {observation_1}. {observation_2}. ..."
When you call search_semantic, the query is encoded with the same model and compared against all entity vectors using k-nearest neighbors (cosine distance) via sqlite-vec.
Requirements
- Python >= 3.12
- uv (package manager)
Dependencies
| Package | Purpose |
|---|---|
fastmcp |
MCP server framework |
pydantic |
Request/response validation |
sqlite-vec |
Vector similarity search in SQLite |
onnxruntime |
ONNX model inference (CPU) |
tokenizers |
HuggingFace fast tokenizer |
numpy |
Vector operations |
huggingface-hub |
Model download |
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.