MCP Neo4j Knowledge Graph Memory Server
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Supports containerized deployment of both the MCP server and Neo4j database through Docker and docker-compose for simplified setup and management.
Uses Neo4j as the backend storage engine for the knowledge graph, providing powerful graph querying capabilities, high performance, and scalability for complex knowledge graph applications.
MCP Neo4j Knowledge Graph Memory Server
简介
MCP Neo4j Knowledge Graph Memory Server是一个基于Neo4j图数据库的知识图谱记忆服务器,用于存储和检索AI助手与用户交互过程中的信息。该项目是官方Knowledge Graph Memory Server的增强版本,使用Neo4j作为后端存储引擎。
通过使用Neo4j作为存储后端,本项目提供了更强大的图查询能力、更好的性能和可扩展性,特别适合构建复杂的知识图谱应用。
功能特点
- 🚀 基于Neo4j的高性能图数据库存储
- 🔍 强大的模糊搜索和精确匹配能力
- 🔄 实体、关系和观察的完整CRUD操作
- 🌐 与MCP协议完全兼容
- 📊 支持复杂的图查询和遍历
- 🐳 Docker支持,便于部署
安装
前提条件
- Node.js >= 22.0.0
- Neo4j数据库(本地或远程)
通过npm安装
使用Docker
环境变量配置
服务器使用以下环境变量进行配置:
环境变量 | 描述 | 默认值 |
---|---|---|
NEO4J_URI | Neo4j数据库URI | bolt://localhost:7687 |
NEO4J_USER | Neo4j用户名 | neo4j |
NEO4J_PASSWORD | Neo4j密码 | password |
NEO4J_DATABASE | Neo4j数据库名称 | neo4j |
与Claude集成
在Claude Desktop中配置
在claude_desktop_config.json
中添加以下配置:
在Claude Web中使用MCP Inspector
- 安装MCP Inspector
- 启动Neo4j Memory Server:Copy
- 在另一个终端启动MCP Inspector:Copy
- 在浏览器中访问MCP Inspector界面
使用方法
Claude自定义指令
在Claude的自定义指令中添加以下内容:
API示例
如果您想在自己的应用程序中使用本服务器,可以通过MCP协议与其通信:
为什么选择Neo4j?
相比于原始版本使用的JSON文件存储和DuckDB版本,Neo4j提供了以下优势:
- 原生图数据库:Neo4j是专为图数据设计的数据库,非常适合知识图谱的存储和查询
- 高性能查询:使用Cypher查询语言可以高效地进行复杂的图遍历和模式匹配
- 关系优先:Neo4j将关系作为一等公民,使得实体间的关系查询更加高效
- 可视化能力:Neo4j提供了内置的可视化工具,方便调试和理解知识图谱
- 扩展性:支持集群部署,可以处理大规模知识图谱
实现细节
数据模型
知识图谱在Neo4j中的存储模型如下:
模糊搜索实现
本实现结合了Neo4j的全文搜索功能和Fuse.js进行灵活的实体搜索:
- 使用Neo4j的全文索引进行初步搜索
- Fuse.js提供额外的模糊匹配能力
- 搜索结果包括精确和部分匹配,按相关性排序
开发
环境设置
测试
发布
贡献指南
欢迎贡献代码、报告问题或提出改进建议!请遵循以下步骤:
- Fork本仓库
- 创建您的特性分支 (
git checkout -b feature/amazing-feature
) - 提交您的更改 (
git commit -m 'Add some amazing feature'
) - 推送到分支 (
git push origin feature/amazing-feature
) - 创建一个Pull Request
相关项目
许可证
本项目采用MIT许可证 - 详见LICENSE文件。
联系方式
This server cannot be installed
Enhanced knowledge graph memory server for AI assistants that uses Neo4j as the backend storage engine, enabling powerful graph queries and efficient storage of user interaction information with full MCP protocol compatibility.