使用说明
neo4j mcp
MCP服务器 Neo4j --运行Cypher查询,探索图模式,并通过stdio检查数据库信息。
安装
bunx @daanrongen/neo4j-mcp
工具(共8个)
| 域 | 工具 | 覆盖范围 |
|---|---|---|
| 查询 | run_query, run_read_query |
执行Cypher查询(写和只读) |
| 模式 | get_schema, get_labels, get_relationship_types, get_indexes, get_constraints |
检查图形架构和元数据 |
| 信息 | get_server_info |
Neo4j服务器地址和版本 |
配置
| 变量 | 必填 | 描述 |
|---|---|---|
NEO4J_URL |
是 | 螺栓URL(例如。 bolt://localhost:7687 或 neo4j://localhost:7687) |
NEO4J_PASSWORD |
是 | Neo4j密码(用户名默认为 neo4j) |
设置
克劳德桌面版
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"neo4j": {
"type": "stdio",
"command": "bunx",
"args": ["@daanrongen/neo4j-mcp"],
"env": {
"NEO4J_URL": "bolt://localhost:7687",
"NEO4J_PASSWORD": "your-password"
}
}
}
}
克劳德代码CLI
claude mcp add neo4j \
-e NEO4J_URL=bolt://localhost:7687 \
-e NEO4J_PASSWORD=your-password \
-- bunx @daanrongen/neo4j-mcp
发展
bun install
bun run dev # run with --watch
bun test # run test suite
bun run typecheck # tsc type check
bun run lint # biome lint
bun run build # bundle to dist/main.js
就地检查
bun run inspect 启动 MCP检查员 反对当地建筑:
bun run build && bun run inspect
这将在浏览器中打开检查器UI,您可以在其中交互式调用任何工具并检查请求/响应形状。
建筑
src/
├── config.ts # Effect Config — NEO4J_URL, NEO4J_PASSWORD
├── main.ts # Entry point — ManagedRuntime + StdioServerTransport
├── domain/
│ ├── Neo4jClient.ts # Context.Tag service interface
│ ├── errors.ts # Neo4jError, QueryError, NodeNotFoundError
│ ├── models.ts # Schema.Class models (QueryResult, SchemaInfo, IndexInfo, …)
│ ├── query.test.ts # Domain query tests (uses Neo4jClientTest)
│ └── schema.test.ts # Domain schema tests (uses Neo4jClientTest)
├── infra/
│ ├── Neo4jClientLive.ts # Layer.scoped — neo4j-driver connection with acquireRelease
│ └── Neo4jClientTest.ts # In-memory Ref-based test adapter
└── mcp/
├── server.ts # McpServer wired to ManagedRuntime
├── utils.ts # formatSuccess, formatError
└── tools/ # query.ts, schema.ts, info.ts
许可证
麻省理工学院