# MCP Memory Service — Persistent Agent Memory API > Persistent memory service for agent pipelines: REST API + knowledge graph + consolidation, with MCP integration for Claude and friends. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Install: ```bash pip install mcp-memory-service ``` 2. Start an HTTP server (for local dev): ```bash MCP_ALLOW_ANONYMOUS_ACCESS=true memory server --http # API at http://localhost:8000 ``` 3. Store a memory (example): ```bash curl -sS -X POST http://localhost:8000/api/memories \ -H 'Content-Type: application/json' \ -H 'X-Agent-ID: researcher' \ -d '{"content":"API rate limit is 100 req/min","tags":["api","limits"]}' ``` ## Intro Persistent memory service for agent pipelines: REST API + knowledge graph + consolidation, with MCP integration for Claude and friends. - **Best for:** teams building agent workflows that need shared, queryable, long-lived memory beyond one chat session - **Works with:** any HTTP client; common agent frameworks; MCP-capable clients (optional) - **Setup time:** 20–45 minutes ## Practical Notes - Quant: the project calls out a framework-agnostic REST API with 76 endpoints—start by standardizing 5–10 “memory ops” your agents must use. - Quant: track retrieval precision by running the same query across 10 tasks and measuring how often the top-3 hits are actually used. --- ## How to design memory you can trust Treat memory as *data you can audit*, not magical recall: - Store short, atomic facts with tags (source, system, owner, environment). - Always include an `X-Agent-ID` strategy so retrieval can be scoped. - Separate “write” and “read” phases: write after the task, read before the task. ## A simple workflow pattern 1. **Task start:** query with a narrow tag set. 2. **During work:** write only verified decisions (not raw speculation). 3. **Task end:** consolidate duplicates and add a short summary memory. ## Safety defaults If you enable anonymous access for local testing, keep it strictly on localhost and disable it in any shared environment. ### FAQ **Q: Is this only for MCP clients?** A: No. You can treat it as a plain HTTP memory service; MCP integration is optional. **Q: How do I avoid noisy memories?** A: Write only verified facts and decisions, and require tags + agent scope for every write. **Q: What should I measure first?** A: Retrieval precision and reuse rate: how often retrieved items are actually used in the next task. ## Source & Thanks > Source: https://github.com/doobidoo/mcp-memory-service > License: Apache-2.0 > GitHub stars: 1,835 · forks: 278 --- ## 快速使用 1. 安装: ```bash pip install mcp-memory-service ``` 2. 启动 HTTP 服务(本地开发示例): ```bash MCP_ALLOW_ANONYMOUS_ACCESS=true memory server --http # API: http://localhost:8000 ``` 3. 写入一条记忆(示例): ```bash curl -sS -X POST http://localhost:8000/api/memories \ -H 'Content-Type: application/json' \ -H 'X-Agent-ID: researcher' \ -d '{"content":"API rate limit is 100 req/min","tags":["api","limits"]}' ``` ## 简介 面向 Agent 流水线的持久化记忆服务:提供 REST API、知识图谱与自动归并能力,可接入 MCP/Claude 等工具链,适配 LangGraph/CrewAI 等框架,把上下文沉淀为可检索、可复用的长期资产。 - **适合谁:** 需要跨任务共享、可检索、可长期沉淀记忆的 Agent 团队与工作流 - **可搭配:** 任何 HTTP 客户端;常见 agent 框架;可选 MCP 客户端 - **准备时间:** 20–45 分钟 ## 实战建议 - 量化建议:项目说明 REST API 覆盖 76 个 endpoints;先选出 5–10 个必须统一的“记忆操作”再扩展。 - 量化建议:把同一查询在 10 个任务里复跑,统计 top-3 命中内容被实际采用的比例(检索精度)。 ## 如何把记忆做成“可相信的数据” 把记忆当作**可审计的数据层**,而不是“玄学召回”: - 存储短小、原子化事实,并用 tags 标注来源/系统/所有者/环境。 - 设计好 `X-Agent-ID` 规范,确保检索可以按 agent 身份隔离。 - 把“写入”和“读取”拆成两个阶段:任务前读,任务后写。 ## 一个可落地的流程模板 1. **任务开始:** 用少量关键 tags 做窄检索。 2. **执行过程中:** 只写入已验证的决策与结论(不要把猜测当事实)。 3. **任务结束:** 做一次去重/归并,再补一条可复用的总结记忆。 ## 安全默认 匿名访问只用于本地测试;任何共享环境都应关闭,并加上鉴权与网络隔离。 ### FAQ **只能给 MCP 客户端用吗?** 答:不是。它也可以作为普通 HTTP 记忆服务使用;MCP 集成是可选项。 **怎么避免记忆变成噪音?** 答:只写入已验证事实/决策;每次写入都要求 tags + agent 作用域。 **优先量化什么?** 答:检索精度与复用率:被检索出来的内容在下一次任务中被真正采用的比例。 ## 来源与感谢 > Source: https://github.com/doobidoo/mcp-memory-service > License: Apache-2.0 > GitHub stars: 1,835 · forks: 278 --- Source: https://tokrepo.com/en/workflows/mcp-memory-service-persistent-agent-memory-api Author: MCP Hub