# DuckDB Graph Memory MCP — File-Backed Memory DB > DuckDB Graph Memory MCP is a fork of the MCP memory server that stores the knowledge graph in a DuckDB file for SQL queries and scaling beyond JSON. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Add to `claude_desktop_config.json`: ```json { "mcpServers": { "graph-memory": { "command": "npx", "args": ["-y", "@izumisy/mcp-duckdb-memory-server"], "env": { "MEMORY_FILE_PATH": "/path/to/your/memory.data" } } } } ``` 2. Restart Claude Desktop / your MCP client. 3. Verify: store 3 facts, then query them back and confirm the file path is a DuckDB database file. ## Intro DuckDB Graph Memory MCP is a fork of the MCP memory server that stores the knowledge graph in a DuckDB file for SQL queries and scaling beyond JSON. - **Best for:** agent builders who need a self-hosted memory graph that can grow beyond JSON and remain queryable - **Works with:** MCP clients (Claude Desktop), Node.js npx runner, a writable filesystem path for the DuckDB file - **Setup time:** 10-20 minutes ## Practical Notes - Quant: memory is stored in a DuckDB file, so you can backup/rotate it like any other database artifact. - Quant: treat memory writes as an explicit policy—capture only verified facts to keep retrieval precision high. ## Why it matters JSON-based memory servers often hit scaling and query flexibility limits. DuckDB-backed storage gives you SQL ergonomics and stronger integrity for long-lived agent memory. - Simple npx-based setup keeps integration lightweight. - File-backed storage enables backups, migrations, and audits with standard tooling. - The README explains why DuckDB helps (performance, scalability, query flexibility, transactions). ## Rollout pattern - Start with a dedicated memory file per project to avoid cross-project contamination. - Define a memory write policy: only write decisions, constraints, and stable preferences. - Schedule periodic cleanup or consolidation so the knowledge graph stays useful over time. ## Watchouts A local memory file can still leak secrets if your agent writes them. Treat the file as sensitive and keep it out of synced folders or shared drives. ### FAQ **Q: Is this the official MCP memory server?** A: It is a fork of the official knowledge graph memory server with DuckDB storage changes. **Q: Where is data stored?** A: In a DuckDB database file at `MEMORY_FILE_PATH`. **Q: How do I keep it clean?** A: Write only verified facts and run periodic consolidation/cleanup so retrieval stays high-signal. ## Source & Thanks > Source: https://github.com/IzumiSy/mcp-duckdb-memory-server > License: MIT > GitHub stars: 55 · forks: 12 --- ## 快速使用 1. 写入 `claude_desktop_config.json`: ```json { "mcpServers": { "graph-memory": { "command": "npx", "args": ["-y", "@izumisy/mcp-duckdb-memory-server"], "env": { "MEMORY_FILE_PATH": "/path/to/your/memory.data" } } } } ``` 2. 重启 Claude Desktop / MCP 客户端。 3. 验证:先写入 3 条事实,再检索回来,并确认该路径对应的是 DuckDB 数据库文件。 ## 简介 DuckDB Graph Memory MCP 是 MCP 记忆服务器的一个分支版本,把知识图谱记忆存到 DuckDB 文件里,支持更强的 SQL 查询与更好的扩展性,适合长期记忆变大后的检索与治理。 - **适合谁:** 需要自托管知识图谱记忆,并希望记忆规模变大后仍可查询/治理的 Agent 构建者 - **可搭配:** MCP 客户端(Claude Desktop 等)、Node.js npx 运行器、可写的本地文件路径(DuckDB 文件) - **准备时间:** 10-20 分钟 ## 实战建议 - 量化信息:记忆以 DuckDB 文件形式存储,可像数据库一样做备份/轮换与版本管理。 - 量化信息:把写入当作策略:只写已验证事实,才能保持检索精度。 ## 为什么值得收录 JSON 记忆服务在规模变大时容易遇到性能和查询灵活性问题。DuckDB 作为底座能带来 SQL 的可操作性与更强的数据完整性,更适合长期记忆。 - npx 方式接入简单轻量,集成成本低。 - 文件型数据库便于备份、审计与迁移。 - README 解释了 DuckDB 的优势(性能/扩展性/事务/查询灵活性)。 ## 落地路径 - 每个项目独立一份 memory 文件,避免跨项目串线。 - 定义写入策略:只记录决策、约束与稳定偏好。 - 定期做清理/归并,保持知识图谱长期高信噪比。 ## 注意事项 本地记忆文件依然可能泄露秘密(如果 agent 写入了)。把它当敏感数据,避免放到同步盘或共享盘。 ### FAQ **这是官方版本吗?** 答:它是官方知识图谱记忆服务的 fork,主要改为 DuckDB 存储。 **数据存在哪里?** 答:存到 `MEMORY_FILE_PATH` 指向的 DuckDB 数据库文件里。 **如何保持干净?** 答:只写已验证事实,并定期做归并/清理,避免检索变噪音。 ## 来源与感谢 > Source: https://github.com/IzumiSy/mcp-duckdb-memory-server > License: MIT > GitHub stars: 55 · forks: 12 --- Source: https://tokrepo.com/en/workflows/duckdb-graph-memory-mcp-file-backed-memory-db Author: MCP Hub