mcp-memory-service is an open-source persistent shared memory service for AI agent pipelines. Its core goal is to solve the problem of AI assistants forgetting context in new sessions, automatically capturing project context, architectural decisions, and code patterns so that existing information is available when a new session starts.
Purpose The service provides a self-hosted persistent memory backend for AI agents, supporting multiple transport methods through a unified REST API, MCP, OAuth, CLI, and dashboard, allowing agents to share memory across different sessions and different frameworks, and supporting retrieval of a causal knowledge graph.
Main capabilities
- Framework-agnostic REST API, no MCP client library required, endpoint list located at /api/docs.
- Knowledge graph, agents can share causal chains rather than only facts.
- X-Agent-ID request header, automatically tags memories by agent identity, enabling scoped retrieval.
- conversation_id, bypasses deduplication to support incremental conversation storage.
- SSE events, providing real-time notifications when any agent stores or deletes a memory.
- Embedding vectors run locally via ONNX, so memory data does not leave your own infrastructure.
- Persistent memory supports cross-session context and has semantic search.
- Intelligent retrieval, using AI embeddings to automatically find relevant context.
- About 5 millisecond speed, instant context injection, no latency.
- Optional Cloudflare backend cloud sync for team collaboration.
- Privacy-first, local-first, users control their own data.
- Web dashboard, can http://localhost:8000 visualize and manage memories, including eight tabs: Dashboard, Search, Browse, Documents, Manage, Analytics, Quality, and API Docs.
- Knowledge graph, interactively visualizing memory relationships via D3.js.
- Homelab quality scoring, can score on any OpenAI-compatible endpoint (Ollama, LiteLLM, vLLM).
- Entity extraction, automatically linking @mentions, #tags, URLs, and file paths to a queryable entity graph.
- Insight cards, the consolidation process presents patterns, trends, and knowledge gaps as structured insights.
- Tag match filtering, memory_search supports tag_match=AND/OR for precise multi-tag queries.
Usage Can be integrated in multiple ways:
- Configure AI clients: add the service to configuration files, such as ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows, and ~/.config/Claude/claude_desktop_config.json on Linux, then restart Claude Desktop to enable cross-session memory; after restarting Claude Code, the memory tools will appear automatically.
- REST API operations: use POST /api/memories to store memories, POST /api/search to search, and POST /api/search/by-tag to retrieve by tag. Send X-Agent-ID: <id> in the storage request, and the server will tag that memory with agent:<id>, after which tag search can be used to limit the retrieval scope accordingly.
- OpenCode plugin: the plugin is provided as repository files, requiring cloning the repository once; installation steps, the /memory slash command, and endpoint overrides are described in opencode/README.md.
- Remote MCP: via OAuth 2.0 over HTTPS, supporting self-hosted or cloud-hosted use, usable in the browser without a desktop application; claude.ai It can connect to the same endpoint as ChatGPT (Developer Mode). For Cloudflare Tunnel, Let's Encrypt, nginx, Caddy, and Docker production environment configurations, see Remote MCP Setup and the 5-minute tutorial.
- Backend options: SQLite (local, fast, single-user), Cloudflare (cloud, multi-device sync), Hybrid (local reads at about 5ms plus background cloud sync, recommended for production), or Milvus (dedicated vector database: Lite file, self-hosted, or Zilliz Cloud). For self-hosted team deployments, the Hybrid backend can sync to another HTTP MCP Memory Service via MCP_HYBRID_SECONDARY_BACKEND=http instead of Cloudflare. For long-running services, prefer Docker Milvus or Zilliz Cloud over Milvus Lite.
Use cases
- Agent frameworks (REST): LangGraph, CrewAI, AutoGen, OpenClaw/Nanobot, and any HTTP client.
- CLI and terminal (MCP): Claude Code, Gemini CLI, OpenCode, Codex CLI, Goose, Aider, Amp.
- Desktop and IDE (MCP): Claude Desktop, VS Code, Cursor, Windsurf, Raycast, JetBrains, Zed.
- Chat (MCP): ChatGPT (Developer Mode), claude.ai (remote MCP over HTTPS).
- For the full list and clients that do not support OAuth (such as Home Assistant), see docs/integrations.md.
Limitations and notes
- Security note: The server binds to 127.0.0.1 by default (local only). Using --host 0.0.0.0 or MCP_HTTP_HOST=0.0.0.0 exposes the API to the network and should only be used in trusted environments with authentication and firewall rules, or behind TLS termination or a VPN overlay.
- Some configuration commands are optimized for quick start, avoidingloading heavy ML dependencies unless needed.
- Milvus Lite is not recommended for long-running services; prefer Docker Milvus or Zilliz Cloud.
- This service is maintained by one person; you can support its development via Ko-fi, Buy Me a Coffee, or PayPal.
- Detailed documentation covers the following areas: Setup Guide, Agent Integration Guides, Remote MCP Setup, Configuration Guide, Architecture Overview, Knowledge Graph Dashboard, Benchmarks (LongMemEval, DevBench, LoCoMo), Migration Guide, Troubleshooting, Wiki, and more.