一个MCP服务器,提供Neo4j图形数据库与Claude桌面之间的集成,通过自然语言交互实现图形数据库操作。
你可以直接使用npx运行此MCP服务器:
npx @alanse/mcp-neo4j
或者将其添加到你的Claude桌面配置中:
{
"mcpServers": {
"neo4j": {
"command": "npx",
"args": ["@alanse/mcp-neo4j-server"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "your-password"
}
}
}
}

该服务器提供了与Neo4j数据库交互的工具:
execute_query
:在Neo4j数据库上执行Cypher查询
create_node
:在图形数据库中创建新节点
create_relationship
:在两个现有节点之间创建关系
要通过Smithery自动为Claude桌面安装MCP Neo4j服务器:
npx -y @smithery/cli install @alanse/mcp-neo4j-server --client claude
git clone https://github.com/da-okazaki/mcp-neo4j-server.git
cd mcp-neo4j-server

npm install
npm run build
服务器需要以下环境变量:
NEO4J_URI
:Neo4j数据库URI(默认:bolt://localhost:7687)NEO4J_USERNAME
:Neo4j用户名(默认:neo4j)NEO4J_PASSWORD
:Neo4j密码(必需)这里是如何使用自然语言与Neo4j数据库进行交互的一些例子:
你可以问这样的问题:
示例:
User: "Show me all employees in the Sales department" Claude: Let me query the database for Sales department employees. [Executes query internally: MATCH (e:Employee)-[:WORKS_IN]->(d:Department {name: 'Sales'}) RETURN e.name, e.position] Result: - John Smith (Sales Manager) - Sarah Johnson (Sales Representative) - Mike Brown (Account Executive)
你可以给出这样的指示:
示例:
User: "Add a new person named John Doe who is 30 years old" Claude: I'll create a new Person node with the provided information. [Creates node internally with label 'Person' and properties {name: 'John Doe', age: 30}] Result: Created new person node with ID: 123
你可以请求这样的关系:
示例:
User: "Make John Doe friends with Jane Smith" Claude: I'll create a friendship relationship between these two people. [Creates relationship internally: MATCH (a:Person {name: 'John Doe'}), (b:Person {name: 'Jane Smith'}) CREATE (a)-[:FRIENDS_WITH {since: '2024-01-05'}]->(b)] Result: Created friendship relationship between John Doe and Jane Smith
你可以用自然语言执行更复杂的操作:
示例:
User: "Find all products purchased by customers who live in New York" Claude: I'll query the database for this information. [Executes query internally: MATCH (c:Customer {city: 'New York'})-[:PURCHASED]->(p:Product) RETURN c.name, collect(p.name) as products] Result: - Alice Wilson: [Premium Coffee, Tea Set, Cookies] - Bob Miller: [Premium Coffee, Water Bottle]
运行测试套件:
npm test

MIT