MCP DuckDB 知识图谱内存服务器
官方知识图谱内存服务器的分叉版本。
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 DuckDB 知识图谱内存服务器:
手动安装
否则,请在claude_desktop_config.json
中手动添加@IzumiSy/mcp-duckdb-memory-server
( MEMORY_FILE_PATH
是可选的)
该路径上存储的数据是 DuckDB 数据库文件。
Docker
建造
跑步
用法
使用下面的示例指令
动机
该项目通过用 DuckDB 替换其后端来增强原始 MCP 知识图谱内存服务器。
为什么选择 DuckDB?
最初的 MCP 知识图谱内存服务器使用 JSON 文件作为数据存储,并执行内存搜索。虽然这种方法对于小型数据集非常有效,但也带来了一些挑战:
- 性能:随着数据集的增长,内存搜索性能会下降
- 可扩展性:处理大量实体和关系时,内存使用量会显著增加
- 查询灵活性:复杂查询和条件搜索难以实现
- 数据完整性:确保事务和 CRUD 操作的原子性具有挑战性
选择 DuckDB 来解决以下挑战:
- 快速查询处理:DuckDB 针对分析查询进行了优化,即使处理大型数据集也能表现良好
- SQL 接口:标准 SQL 可用于轻松执行复杂查询
- 事务支持:支持事务处理以维护数据完整性
- 索引功能:允许创建索引以提高搜索性能
- 嵌入式数据库:在应用程序内工作,无需外部数据库服务器
实现细节
本实现采用DuckDB作为后端存储系统,重点关注两个方面:
数据库结构
知识图谱存储在关系数据库结构中如下图所示:
这种模式设计允许有效地存储和检索知识图谱组件,同时维护实体、观察和关系之间的关系。
模糊搜索实现
该实现将 SQL 查询与 Fuse.js 结合起来,实现灵活的实体搜索:
- DuckDB SQL 查询从数据库中检索基础数据
- Fuse.js 在检索到的数据上提供模糊匹配功能
- 这种混合方法允许结构化查询和灵活的文本匹配
- 搜索结果包括完全匹配和部分匹配,按相关性排序
发展
设置
测试
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
Claude 的内存服务器,用于在 DuckDB 中存储和检索知识图谱数据,从而增强具有持久用户信息的对话的性能和查询能力。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityAn improved implementation of persistent memory using a local knowledge graph with a customizable --memory-path. This lets Claude remember information about the user across chats.Last updated -9426512JavaScriptMIT License
- -securityAlicense-qualityProvides semantic memory and persistent storage for Claude, leveraging ChromaDB and sentence transformers for enhanced search and retrieval capabilities.Last updated -3466PythonMIT License
- -securityAlicense-qualityA persistent memory implementation using a local knowledge graph that lets Claude remember information about users across conversations.Last updated -6PythonMIT License
- AsecurityFlicenseAqualityAn implementation of persistent memory for Claude using a local knowledge graph, allowing the AI to remember information about users across conversations with customizable storage location.Last updated -1183851JavaScript