MCP Memory Service MCP server
Self-hosted Python memory server with hybrid vector and BM25 search, an entity graph, scheduled consolidation, and an OAuth-protected remote mode.
MCP Memory Service stores each memory as text with tags, a memory type and a content hash, embeds it locally with an ONNX model, and keeps it in SQLite with sqlite-vec by default. Cloudflare, a hybrid of local SQLite with background sync to Cloudflare or another instance, and Milvus are the other backends. Search mixes vector similarity with BM25, can rank by recency, access frequency and quality score, and filters by tags, natural-language time ranges and store partitions. On top of the store it extracts entities into a graph with typed associations, runs scheduled consolidation (clustering, compression, controlled forgetting), and marks older memories superseded when it detects a contradiction.
The server is the mcp-memory-service package on PyPI, started with memory server, and over stdio it exposes 28 tools: storing single memories or whole sessions, search and listing, updates and deletes, document ingestion, harvesting decisions and bugs from Claude Code transcripts, quality ratings, graph traversal, conflict resolution, mistake notes, quarantine review and bootstrap profiles for short-lived agents. With MCP_STREAMABLE_HTTP_MODE=1 the same install serves Streamable HTTP at /mcp with OAuth 2.0 and dynamic client registration for claude.ai and ChatGPT, and memory server --http runs a REST API and web dashboard on port 8000; over remote transports memory_ingest and memory_harvest are withheld because they read local files. Several agents can share one instance, each tagging its writes with an X-Agent-ID header. It is Apache 2.0, self-hosted, with no paid tier.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"mcp-memory-service": {
"command": "uvx",
"args": [
"--from",
"mcp-memory-service[sqlite]",
"memory",
"server"
],
"env": {
"MCP_MEMORY_STORAGE_BACKEND": "<MCP_MEMORY_STORAGE_BACKEND>",
"MCP_MEMORY_SQLITE_PATH": "<MCP_MEMORY_SQLITE_PATH>"
}
}
}
}claude mcp add mcp-memory-service -- uvx --from mcp-memory-service[sqlite] memory serverAvailable tools
| Tool | Description |
|---|---|
| memory_store | Store a memory with optional tags and type; a conversation_id skips semantic deduplication for incremental saves. |
| memory_store_session | Store a multi-turn conversation as a single memory unit. |
| memory_search | Search memories in semantic, exact or time-based mode with tag, type and time filters. |
| memory_list | Browse memories with pagination, filtered by tag or memory type. |
| memory_delete | Delete memories by content hash, tags or time range, with a dry-run preview. |
| memory_cleanup | Find and remove duplicate memories. |
| memory_health | Check database health and return storage statistics. |
| memory_stats | Return the server's storage and service cache statistics. |
| memory_update | Update a memory's tags, type or metadata without re-storing its content. |
| memory_consolidate | Run, schedule, pause, resume or check the status of memory consolidation. |
| memory_ingest | Ingest a PDF, text, Markdown or JSON file, or a whole directory, as chunked memories. Local stdio only. |
| memory_harvest | Extract decisions, bugs, conventions and learnings from Claude Code session transcripts, dry-run by default. Local stdio only. |
| memory_quality | Rate a memory, read its quality metrics, analyze the distribution, or run a maintenance cycle. |
| memory_graph | Traverse memory associations: connected memories, shortest path, subgraph, entity extraction and listing. |
| memory_conflicts | List unresolved conflicts between contradictory memories. |
| memory_resolve | Resolve a memory conflict by choosing the winning memory. |
| mistake_note_add | Record a mistake pattern with the wrong and correct action, counting repeats. |
| mistake_note_search | Semantic search over mistake notes before starting a task. |
| mistake_note_update | Update fields of an existing mistake note. |
| mistake_note_delete | Delete a mistake note by content hash. |
| get_quarantined_memories | List memories quarantined for contradicting active beliefs. |
| unquarantine_memory | Release a quarantined memory back into retrieval. |
| commit_session_legacy | Record an ephemeral agent's end-of-session decisions, errors and corrections as observations. |
| get_bootstrap_profile | Build a behavioral context profile for a new ephemeral agent within a token budget. |
| get_onboarding_guide | Return the integration guide for a client type such as Claude Code or Kiro. |
| memory_distill | Batch-extract insights from existing memories with an LLM rewriter, dry-run by default. |
| memory_explore | Return a knowledge map of entities with query-scoped chunks for each, without an LLM call. |
| memory_detail | Return the ranked chunks and related entities for one entity. |
Required configuration
- MCP_MEMORY_STORAGE_BACKENDOptional
Storage backend: sqlite_vec (default), cloudflare, hybrid or milvus.
- MCP_MEMORY_SQLITE_PATHOptional
Path to the SQLite database for the sqlite_vec and hybrid backends.
What you can do with it
Keep Claude Code decisions across sessions
memory_harvest reads the session transcripts on disk and proposes decisions, bugs and conventions to store; the repo's Claude Code hooks then pull the relevant ones back into the next session.
One memory backend for an agent pipeline
LangGraph, CrewAI or AutoGen agents write over the REST API with an X-Agent-ID header, while Claude Desktop or Cursor reads the same store through MCP.
Memory in claude.ai or ChatGPT
Run the service behind HTTPS (the docs cover Cloudflare Tunnel, nginx and Caddy) and add it as a remote connector; OAuth with dynamic client registration handles sign-in.
FAQ
- Is it free?
- Yes. It is open source under Apache 2.0 and self-hosted. The only costs are your own infrastructure and any LLM or Cloudflare accounts you choose to configure for optional features.
- Does it support remote or OAuth?
- Yes, self-hosted. Set MCP_STREAMABLE_HTTP_MODE=1 and MCP_OAUTH_ENABLED=true and the server answers Streamable HTTP at /mcp with OAuth 2.0 and dynamic client registration, which claude.ai and ChatGPT developer mode use. There is no vendor-hosted endpoint; you run the server and put it behind HTTPS.
- Can a team share it, and how does that compare to Glen?
- Several agents and machines can point at one instance or sync through the hybrid backend, and writes can be tagged per agent. Glen captures agent sessions, Slack, GitHub, tickets, docs and calls into managed org memory without anyone running a server, and filters every recall to what the asking user is cleared to see.