mcp-memory-service MCP工具 是 AI Skill Hub 本期精选AI工具之一。已获得 1.8k 颗 GitHub Star,综合评分 8.2 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
为LangGraph、CrewAI、AutoGen等AI智能体框架提供开源持久化内存解决方案。支持跨对话状态保存、记忆检索和管理,帮助开发者构建具有长期学习能力的智能体应用。适合AI应用开发者和智能体框架使用者。
mcp-memory-service MCP工具 是一款基于 Python 开发的开源工具,专注于 MCP协议、智能体记忆、持久化存储 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
为LangGraph、CrewAI、AutoGen等AI智能体框架提供开源持久化内存解决方案。支持跨对话状态保存、记忆检索和管理,帮助开发者构建具有长期学习能力的智能体应用。适合AI应用开发者和智能体框架使用者。
mcp-memory-service MCP工具 是一款基于 Python 开发的开源工具,专注于 MCP协议、智能体记忆、持久化存储 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install mcp-memory-service
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install mcp-memory-service
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/doobidoo/mcp-memory-service
cd mcp-memory-service
pip install -e .
# 验证安装
python -c "import mcp_memory_service; print('安装成功')"
# 命令行使用
mcp-memory-service --help
# 基本用法
mcp-memory-service input_file -o output_file
# Python 代码中调用
import mcp_memory_service
# 示例
result = mcp_memory_service.process("input")
print(result)
# mcp-memory-service 配置文件示例(config.yml) app: name: "mcp-memory-service" debug: false log_level: "INFO" # 运行时指定配置文件 mcp-memory-service --config config.yml # 或通过环境变量配置 export MCP_MEMORY_SERVICE_API_KEY="your-key" export MCP_MEMORY_SERVICE_OUTPUT_DIR="./output"
cloudflared tunnel --url http://localhost:8765
"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: - Use Cloudflare ZeroTrust with subnet-based access control (e.g., allow Anthropic subnets + your own IPs) - Add Client IP Address Filtering to all Cloudflare API tokens (Dashboard → My Profile → API Tokens → Edit → Client IP Address Filtering) to limit abuse if a token leaks - If using IPv6, include your IPv6 /64 network in the allowlist (Python prefers IPv6 by default) - For long-running browser sessions, request the offline_access scope during authorization to receive a rotating refresh_token (lifetime via MCP_OAUTH_REFRESH_TOKEN_EXPIRE_DAYS, default 30 days). Without this scope, access tokens are the only credential — extend MCP_OAUTH_ACCESS_TOKEN_EXPIRE_MINUTES up to 1440 (24h) if you need longer single-shot sessions. - Consider an auth proxy like AuthMCP or mcp-auth-proxy for robust session management
```bash pip install mcp-memory-service MCP_ALLOW_ANONYMOUS_ACCESS=true memory server --http
🧠 Persistent Memory – Context survives across sessions with semantic search 🔍 Smart Retrieval – Finds relevant context automatically using AI embeddings ⚡ 5ms Speed – Instant context injection, no latency 🔄 Multi-Client – Works across 25+ AI applications ☁️ Cloud Sync – Optional Cloudflare backend for team collaboration 🔒 Privacy-First – Local-first, you control your data 📊 Web Dashboard – Visualize and manage memories at http://localhost:8000 🧬 Knowledge Graph – Interactive D3.js visualization of memory relationships 🏠 Homelab Quality Scoring – Point scoring at any OpenAI-compatible endpoint (Ollama, LiteLLM, vLLM) 🔗 Entity Extraction – Auto-links @mentions, #tags, URLs, and file paths from memory content to a queryable entity graph 💡 Insight Cards – Consolidation detects patterns, trends, and knowledge gaps across your memory corpus and surfaces them as structured insights 🏷️ Tag Match Filtering – tag_match=AND/OR on memory_search for precise multi-tag queries
Homelab / self-hosted quality scoring (v10.45.0+): set MCP_QUALITY_AI_PROVIDER=openai-compatible to score memories with your local LLM instead of ONNX or a cloud API:
```bash MCP_QUALITY_AI_PROVIDER=openai-compatible MCP_QUALITY_AI_BASE_URL=http://localhost:11434/v1 # Ollama MCP_QUALITY_AI_MODEL=qwen2.5:7b-instruct
See [Remote MCP Setup Guide](docs/remote-mcp-setup.md) for production deployment with Let's Encrypt, nginx, and Docker.
</details>
<details>
<summary><strong>🔧 Advanced: Custom Backends & Team Setup</strong></summary>
For production deployments, team collaboration, or cloud sync:
bash git clone https://github.com/doobidoo/mcp-memory-service.git cd mcp-memory-service python scripts/installation/install.py ```
Choose from: - SQLite (local, fast, single-user) - Cloudflare (cloud, multi-device sync) - Hybrid (best of both: 5ms local + background cloud sync) - Milvus (dedicated vector DB — Milvus Lite file, self-hosted, or Zilliz Cloud)
ℹ️ For long-lived services (MCP servers, web backends, notebook sessions), prefer Docker Milvus or Zilliz Cloud over Milvus Lite. See docs/milvus-backend.md for why.
</details>
---
Recommended models: `qwen2.5:7b-instruct` (Ollama), `mlx-community/Qwen2.5-7B-Instruct-4bit` (MLX), or any instruct model via LiteLLM proxy. On endpoint failure, scoring falls back to implicit signals automatically.
**Docker `:quality-cpu` tag** — for users who want the built-in local ONNX quality scoring (`ms-marco-MiniLM-L-6-v2` and `nvidia-quality-classifier-deberta`) without managing the one-time ONNX export themselves, and without shipping `torch`/`transformers` in their container:
bash docker pull doobidoo/mcp-memory-service:quality-cpu ```
The :quality-cpu image pre-exports both models at build time and ships only onnxruntime at runtime — no PyTorch dependency at deploy time. See tools/docker/README.md for details.
python import httpx
BASE_URL = "http://localhost:8000"
In addition to memory server --http (foreground mode), the CLI now includes server lifecycle commands for background HTTP management:
```bash
| 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 also supported)** |
| 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 (76 endpoints)** |
MemPalace is an MCP-native alternative that went viral in April 2026 with strong LongMemEval claims. A community code review (Issue #27) subsequently showed that the headline numbers reflect the underlying vector store rather than the advertised Palace architecture, and the maintainers acknowledged most points. We keep the comparison here for transparency, but readers should interpret the scores with that context in mind.
| **MemPalace** | **mcp-memory-service** | |
|---|---|---|
| LongMemEval R@5 (raw ChromaDB, zero LLM) | 96.6%¹ | 86.0% (session) / 80.4% (turn) |
| LongMemEval R@5 (with reranking) | 100%² | — |
| Storage granularity | Session-level | **Turn-level + session-level** |
| Team / multi-device sync | ❌ Local only | **✅ Cloudflare sync** |
| REST API / Web dashboard | ❌ | **✅** |
| OAuth 2.1 + multi-user | ❌ | **✅** |
| Knowledge graph | ❌ | **✅ (typed edges)** |
| Auto consolidation | ❌ | **✅ (decay + compression)** |
| Compatible AI tools | Claude-focused | **25+ tools** |
| License | MIT | **Apache 2.0** |
Why the benchmark gap? Two independent factors:
memory_store_session (added in v10.35.0) brings our score to 86.0% R@5.¹ Measured in MemPalace "raw mode" (plain text in ChromaDB with default embeddings). Per Issue #27, the Palace structural features are bypassed in this configuration. ² 100% result uses optional LLM reranking (~500 API calls) on a partially tuned test set. Clean held-out score (as reported by the maintainers): 98.4% R@5.
---
mcp-memory-service 是一个专为 AI Agent 设计的开源记忆后端服务。它通过 REST API、MCP、OAuth、CLI 和 Dashboard 等多种传输方式,为 LangGraph、CrewAI、AutoGen 等主流 AI 框架提供持久化的共享记忆能力。该服务允许 Agent 存储决策过程、共享因果知识图谱,并实现毫秒级的上下文检索,旨在解决 AI 工作流中缺乏跨会话记忆的问题,同时避免云端厂商锁定和高昂的 API 成本。
本项目提供具备语义搜索能力的持久化记忆功能,确保上下文在不同会话间依然有效。通过 AI Embeddings 技术实现智能检索,上下文注入延迟极低(仅 5ms),支持超过 25 种 AI 应用的多客户端接入。此外,它支持可选的 Cloudflare 后端进行团队协作,并遵循隐私优先原则,支持 Local-first 本地部署,让开发者完全掌控数据。
用户可以通过多种方式部署该服务。快速启动可使用 pip 安装并运行 `memory server --http` 模式。对于生产环境,推荐使用 Docker 部署,并结合 Cloudflare Tunnel 实现远程安全访问(例如使用 `cloudflared tunnel --url http://localhost:8765`)。若需自定义后端或团队协作,可以通过 git clone 源码进行构建,并根据需要配置 Docker 标签(如 `:quality-cpu`)以使用内置的 ONNX 质量评分模型。
开发者可以通过 CLI 快速启动服务。在 Agent 端,可以使用 `pip install mcp-memory-service` 并设置 `MCP_ALLOW_ANONYMOUS_ACCESS=true` 来开启 HTTP 模式。该服务不仅支持前台运行,还提供了用于后台 HTTP 管理的 CLI 生命周期命令,方便开发者在不同开发场景下灵活切换服务状态。
配置过程根据部署场景有所不同。在 Claude.ai 中使用时,需在 Settings → Connectors 中添加 Connector。对于高级自定义后端,可以通过环境变量配置 `MCP_QUALITY_AI_API_KEY`(如使用 Ollama)。推荐使用 `qwen2.5:7b-instruct` 或通过 LiteLLM proxy 接入其他模型。若需在生产环境中使用 Let's Encrypt、nginx 和 Docker 进行部署,请参考专门的 Remote MCP Setup Guide。
服务提供运行在 http://localhost:8000 的 REST API 接口。开发者可以使用 Python 的 httpx 库轻松进行交互。除了标准的 HTTP 接口外,服务还支持通过 CLI 进行生命周期管理,确保在复杂的 AI Agent Pipeline 中能够稳定地进行记忆的存储与检索。
该模块旨在为 AI Agent Pipeline 提供持久化的共享记忆。它不仅是一个简单的存储工具,更是一个集成了 REST API、MCP 和知识图谱能力的综合后端。通过将决策过程和因果关系结构化存储,Agent 可以在无需依赖云端 API 的情况下,实现极速(5ms)的上下文检索,构建出具备长期记忆和协作能力的智能体集群。
高质量开源项目,解决智能体记忆痛点,架构设计清晰,社区活跃度良好,实用价值高。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,mcp-memory-service MCP工具 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | mcp-memory-service |
| 原始描述 | 开源MCP工具:Open-source persistent memory for AI agent pipelines (LangGraph, CrewAI, AutoGen。⭐1.8k · Python |
| Topics | MCP协议智能体记忆持久化存储LangGraphCrewAIAutoGen |
| GitHub | https://github.com/doobidoo/mcp-memory-service |
| License | Apache-2.0 |
| 语言 | Python |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。