by doobidoo
Open-source persistent memory for AI agent pipelines (LangGraph, CrewAI, AutoGen) and Claude. REST API + knowledge graph + autonomous consolidation.
# Add to your Claude Code skills
git clone https://github.com/doobidoo/mcp-memory-serviceOpen-source memory backend for multi-agent systems. Agents store decisions, share causal knowledge graphs, and retrieve context in 5ms — without cloud lock-in or API costs.
Works with LangGraph · CrewAI · AutoGen · any HTTP client · Claude Desktop · OpenCode
No comments yet. Be the first to share your thoughts!
Watch the Web Dashboard Walkthrough on YouTube — Semantic search, tag browser, document ingestion, analytics, quality scoring, and API docs in under 2 minutes.
Unlike desktop-only MCP servers, mcp-memory-service supports Remote MCP for native claude.ai integration.
What this means:
5-Minute Setup:
# 1. Start server with Remote MCP enabled
MCP_STREAMABLE_HTTP_MODE=1 \
MCP_SSE_HOST=0.0.0.0 \
MCP_SSE_PORT=8765 \
MCP_OAUTH_ENABLED=true \
python -m mcp_memory_service.server
# 2. Expose via Cloudflare Tunnel (or your own HTTPS setup)
cloudflared tunnel --url http://localhost:8765
# → Outputs: https://random-name.trycloudflare.com
# 3. In claude.ai: Settings → Connectors → Add Connector
# Paste the URL: https://random-name.trycloudflare.com/mcp
# OAuth flow will handle authentication automatically
Production Setup: See Remote MCP Setup Guide for Let's Encrypt, nginx, and firewall configuration. Step-by-Step Tutorial: Blog: 5-Minute claude.ai Setup | Wiki Guide
| Without mcp-memory-service | With mcp-memory-service | |---|---| | Each agent run starts from zero | Agents retrieve prior decisions in 5ms | | Memory is local to one graph/run | Memory is shared across all agents and runs | | You manage Redis + Pinecone + glue code | One self-hosted service, zero cloud cost | | No causal relationships between facts | Knowledge graph with typed edges (causes, fixes, contradicts) | | Context window limits create amnesia | Autonomous consolidation compresses old memories |
Key capabilities for agent pipelines:
X-Agent-ID header — auto-tag memories by agent identity for scoped retrievalconversation_id — bypass deduplication for incremental conversation storagepip install mcp-memory-service
MCP_ALLOW_ANONYMOUS_ACCESS=true memory server --http
# REST API running at http://localhost:8000
import httpx
BASE_URL = "http://localhost:8000"
# Store — auto-tag with X-Agent-ID header
async with httpx.AsyncClient() as client:
await client.post(f"{BASE_URL}/api/memories", json={
"content": "API rate limit is 100 req/min",
"tags": ["api", "limits"],
}, headers={"X-Agent-ID": "researcher"})
# Stored with tags: ["api", "limits", "agent:researcher"]
# Search — scope to a specific agent
results = await client.post(f"{BASE_URL}/api/memories/search", json={
"query": "API rate limits",
"tags": ["agent:researcher"],
})
print(results.json()["memories"])
Framework-specific guides: docs/agents/
"After I work with one of the cluster agents on something I want my local agent to know about, the cluster agent adds a special tag to the memory entry that my local agent recognizes as a message from a cluster agent. So they end up using it as a comms bridge — and it's pretty delightful." — @jeremykoerber, issue #591
A 5-agent openclaw cluster uses mcp-memory-service as shared state and as an inter-agent messaging bus — without any custom protocol. Cluster agents tag memories with a sentinel like msg:cluster, and the local agent filters on that tag to receive cross-cluster signals. The memory service becomes the coordination layer with zero additional infrastructure.
# Cluster agent stores a learning and flags it for the local agent
await client.post(f"{BASE_URL}/api/memories", json={
"content": "Rate limit on provider X is 50 RPM — switch to provider Y after 40",
"tags": ["api", "limits", "msg:cluster"], # sentinel tag
}, headers={"X-Agent-ID": "cluster-agent-3"})
# Local agent polls for cluster messages
results = await client.post(f"{BASE_URL}/api/memories/search", json={
"query": "messages from cluster",
"tags": ["msg:cluster"],
})
This pattern — tags as inter-agent signals — emerges naturally from the tagging system and requires no additional infrastructure.
"The quality of life that session-independent memory adds to AI workflows is immense. File-based memory demands constant discipline. Semantic recall from a live database doesn't. Storing data on my own hardware while making it remotely accessible across platforms turned out to be a feature I didn't know I needed." — @PL-Peter, discussion #602
A production-tested self-hosted deployment using Docker containers behind a Cloudflare tunnel, with AuthMCP Gateway handling authentication:
| Layer | Role | |-------|------| | Cloudflare Tunnel | Name-based routing, subnet-based access control, authentication before hitting self-hosted resources | | AuthMCP Gateway | Auth/aggregation with locally managed users, admin UI, per-user MCP server access control, bearer token auth | | mcp-memory-service | Two Docker containers sharing one SQLite backend — one for MCP, one for the web UI (document ingestion) |
Security best practices for this setup:
MCP_OAUTH_ACCESS_TOKEN_EXPIRE_MINUTES=1440 to extend OAuth tokens to 24 hours (refresh tokens not yet supported)| | Mem0 | Zep | DIY Redis+Pinecone | mcp-memory-service | |---|---|---|---|---| | License | Proprietary | Enterprise | — | Apache 2.0 | | Cost | Per-call API | Enterprise | Infra costs | $0 | | 🌐 claude.ai Browser | ❌ Desktop only | ❌ Desktop only | ❌ | ✅ Remote MCP | | OAuth 2.0 + DCR | ❓ Unknown | ❓ Unknown | ❌ | ✅ Enterprise-ready | | Streamable HTTP | ❌ | ❌ | ❌ | ✅ (SSE deprecated) | | Framework integration | SDK | SDK | Manual | REST API (any HTTP client) | | Knowledge graph | No | Limited | No | Yes (typed edges) | | Auto consolidation | No | No | No | Yes (decay + compression) | | On-premise embeddings | No | No | Manual | Yes (ONNX, local) | | Privacy | Cloud | Cloud | Partial | 100% local | | Hybrid search | No | Yes | Manual | Yes (BM25 + vector) | | MCP protocol | No | No | No | Yes | | REST API | Yes | Yes | Manual | Yes (15 endpoints) |
MemPalace is an MCP-native alternative that went viral