Neo4j MCP Server
About
A read-only query service for Neo4j graph databases.
Details
- Author
- stuzhy
- Categories
- Database, Knowledge Base, Other, Developer Tools
Jump to
Setup
Install Neo4j MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/stuzhy/java-neo4j-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Neo4j MCP Server 是基于 Spring AI 和 Model Context Protocol (MCP) 构建的 Neo4j 数据库只读查询服务。它为 AI 助手提供了安全访问 Neo4j 图数据库的能力。
编辑src/main/resources/application.properties:
# Neo4j 数据库连接配置 neo4j.uri=bolt://localhost:7687 neo4j.username=neo4j neo4j.password=your_password neo4j.database=neo4j
# 编译和运行 ./mvnw spring-boot:run # 或者打包后运行(跳过测试) ./mvnw clean package -DskipTests java -jar target/neo4jmcp-0.0.1-SNAPSHOT.jar
INFO o.s.a.m.s.a.McpServerAutoConfiguration : Registered tools: 10 INFO com.hy.neo4jmcp.Neo4jmcpApplication : Started Neo4jmcpApplication
// 示例调用 executeCypher("MATCH (n:Person) RETURN n.name LIMIT 10", {})
// 示例:查找特定属性的Person节点 findNodesByLabel("Person", {"age": 25}, 50)
// 示例:查找节点123和456之间的KNOWS关系 getRelationshipsBetweenNodes(123, 456, "KNOWS")
// 示例:获取节点123的2层邻居,最多返回100个 getNodeNeighborhood(123, 2, 100)
// 示例:在Person节点中搜索包含"John"的属性 searchNodesByText("John", "Person", 50)
{ "mcpServers": { "neo4j": { "command": "java", "args": ["-jar", "/path/to/neo4jmcp-0.0.1-SNAPSHOT.jar"] } } }
{ "mcpServers": { "neo4j-server": { "command": "java", "args": [ "-jar", "/Users/carl/IdeaProjects/neo4jmcp/target/neo4jmcp-0.0.1-SNAPSHOT.jar" ] } } }
- ✅ 仅允许MATCH,RETURN,WITH,OPTIONAL MATCH,UNWIND等读取操作
- ❌ 禁止CREATE,MERGE,DELETE,SET,DROP等写入操作
- ✅ 允许部分SHOW命令(CONSTRAINTS, INDEXES, PROCEDURES, FUNCTIONS)
spring.ai.mcp.server.enabled=true spring.ai.mcp.server.name=neo4j-mcp-server spring.ai.mcp.server.type=ASYNC spring.ai.mcp.server.stdio=true
neo4j.uri=bolt://localhost:7687 neo4j.username=neo4j neo4j.password=your_password neo4j.database=neo4j neo4j.max-connection-pool-size=50 neo4j.connection-acquisition-timeout=60s neo4j.connection-timeout=5s neo4j.max-transaction-retry-time=15s neo4j.max-query-execution-time=30s neo4j.max-result-records=1000
- 检查 Neo4j 服务是否启动
- 验证连接参数(URI、用户名、密码)
- 确认防火墙设置
- 查看启动日志中的 "Registered tools" 信息
- 确认 Spring AI 自动配置正常工作
logging.level.com.hy.neo4jmcp=DEBUG logging.level.org.springframework.ai.mcp=DEBUG
-- 查看数据库概览 MATCH (n) RETURN labels(n), count(n) -- 探索节点关系 MATCH (n)-[r]->(m) RETURN type(r), count(r) ORDER BY count(r) DESC -- 查找高度连接的节点 MATCH (n)-[r]-() RETURN n, count(r) as degree ORDER BY degree DESC LIMIT 10
-- 查看所有标签 CALL db.labels() -- 查看所有关系类型 CALL db.relationshipTypes() -- 查看属性键 CALL db.propertyKeys()
参考项目根目录的Java_MCP_Server_Development_Guide.md获取详细的开发指南和最佳实践。
- 查看控制台日志获取详细错误信息
- 检查 Neo4j 数据库连接状态
- 验证 MCP 客户端配置正确性
Enables AI assistants to use a Neo4j knowledge graph for standardized coding workflows, acting as a dynamic instruction manual and project memory.
Behavioral test gap analysis and grounded integration test generation via knowledge graph; finds untested behaviors, ranks by blast radius, proves via mutation kill.
Neo4j graph database server (schema + read/write-cypher) and separate graph database backed memory
Query a hybrid graph (Neo4j) and vector (Qdrant) database for powerful semantic and graph-based document retrieval.
Connects to Neo4j graph databases with ability to use GDS functions ( when available), a read only mode , and set the sample size for schema detection
MCP Memory Server - Python Implementation
A Python implementation of the MCP memory server for knowledge graph storage and retrieval, using JSONL files for persistence.
Integrate the Neo4j graph database with clients through natural language interactions.
MCP server for Neo4j — run Cypher queries, explore schema, and inspect database info over stdio
Interact with and explore graph data in a Neo4j database.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





