Neo4j MCP Server

Neo4j MCP Server

Enables AI assistants to interact with Neo4j graph databases through natural language, supporting Cypher queries, schema management, data manipulation, and graph algorithms.

Category
访问服务器

README

Neo4j MCP Server

A Model Context Protocol (MCP) server that provides seamless integration between AI assistants (like Claude Desktop) and Neo4j graph databases. Query and manipulate your knowledge graphs using natural language!

License: MIT Docker Neo4j

Features

  • Direct Cypher Queries: Execute Cypher queries directly from your AI assistant
  • Natural Language Queries: Convert natural language questions into Cypher (template-based, LLM integration ready)
  • Schema Operations: View, create, and manage database schema (constraints, indexes)
  • Data Manipulation: Create nodes and relationships
  • Graph Algorithms: PageRank, shortest path, and more
  • Admin Tools: Get database statistics and health info
  • 100% Local: All data stays on your infrastructure
  • Docker Ready: Easy deployment with Docker Compose

Quick Start

Prerequisites

  • Docker Desktop running
  • Node.js 20+ (for local development)
  • Basic knowledge of Neo4j/Cypher

Using Docker Compose (Recommended)

  1. Clone and setup:

    git clone <your-repo-url>
    cd neo4j-mcp
    cp .env.example .env
    # Edit .env if you want to change default password
    
  2. Start the services:

    docker-compose up -d
    
  3. Verify services are running:

    docker-compose ps
    docker logs neo4j-mcp-server
    
  4. Access Neo4j Browser:

    • Open http://localhost:7474
    • Login with credentials from your .env file (default: neo4j/neo4jpassword)
  5. Configure Claude Desktop:

    Add to your claude_desktop_config.json:

    {
      "mcpServers": {
        "neo4j": {
          "command": "docker",
          "args": [
            "exec",
            "-i",
            "neo4j-mcp-server",
            "node",
            "/app/dist/index.js"
          ]
        }
      }
    }
    
  6. Restart Claude Desktop and start using Neo4j tools!

Manual Setup (Without Docker)

  1. Install dependencies:

    npm install
    
  2. Build the project:

    npm run build
    
  3. Set environment variables:

    export NEO4J_URI=bolt://localhost:7687
    export NEO4J_USER=neo4j
    export NEO4J_PASSWORD=your-password
    
  4. Run the server:

    npm start
    

Available MCP Tools

Once connected to Claude Desktop, you can use these tools:

Query Tools

  • neo4j.query - Execute raw Cypher queries
  • neo4j.natural_query - Convert natural language to Cypher (template-based)

Schema Tools

  • neo4j.get_schema - Get database schema
  • neo4j.create_constraint - Create constraints (UNIQUE, EXISTS, NODE_KEY)
  • neo4j.create_index - Create indexes (BTREE, TEXT, RANGE, POINT)

Data Tools

  • neo4j.create_node - Create nodes with labels and properties
  • neo4j.create_relationship - Create relationships between nodes

Algorithm Tools

  • neo4j.page_rank - Calculate PageRank scores
  • neo4j.shortest_path - Find shortest paths between nodes

Admin Tools

  • neo4j.get_stats - Get database statistics

Usage Examples

Example 1: Ask Claude to query your graph

You: "Show me all Person nodes in the database"
Claude: Uses neo4j.query tool

Example 2: Create data

You: "Create a Person node with name 'Alice' and age 30"
Claude: Uses neo4j.create_node tool

Example 3: Schema management

You: "Create a unique constraint on Person.email"
Claude: Uses neo4j.create_constraint tool

Configuration

Environment Variables

Variable Description Default
NEO4J_URI Neo4j connection URI bolt://localhost:7687
NEO4J_USER Neo4j username neo4j
NEO4J_PASSWORD Neo4j password password
LOG_LEVEL Logging level info

Docker Compose

The default docker-compose.yml includes:

  • Neo4j 5 with APOC plugin
  • MCP Server connected to Neo4j
  • Persistent volumes for data
  • Health checks

Project Structure

neo4j-mcp/
├── src/
│   ├── index.ts              # Main MCP server entry point
│   ├── neo4j/
│   │   └── connection.ts     # Neo4j connection management
│   ├── query/
│   │   └── engine.ts         # Natural language to Cypher engine
│   ├── tools/
│   │   ├── index.ts          # Tool registration
│   │   ├── query.ts          # Query tools
│   │   ├── schema.ts         # Schema tools
│   │   ├── data.ts           # Data manipulation tools
│   │   ├── algorithms.ts     # Graph algorithm tools
│   │   └── admin.ts          # Admin tools
│   └── utils/
│       └── validation.ts     # Input validation utilities
├── dist/                     # Compiled JavaScript (generated)
├── Dockerfile                # Multi-stage Docker build
├── docker-compose.yml        # Docker Compose configuration
├── package.json              # Node.js dependencies
├── tsconfig.json             # TypeScript configuration
├── .env.example              # Environment variables template
└── README.md                 # This file

Development

Build

npm run build

Development Mode (watch)

npm run dev

Linting

npm run lint

Format Code

npm run format

Docker Commands

# Start services
docker-compose up -d

# View logs
docker-compose logs -f neo4j-mcp

# Stop services
docker-compose down

# Stop and remove volumes (deletes data!)
docker-compose down -v

# Rebuild after code changes
docker-compose build neo4j-mcp
docker-compose up -d neo4j-mcp

Roadmap

  • [ ] Full LLM integration for natural language queries (OpenAI, Anthropic, Ollama)
  • [ ] Advanced query optimization
  • [ ] Caching layer (Redis)
  • [ ] More graph algorithms (community detection, centrality measures)
  • [ ] Graph visualization support
  • [ ] Batch operations and CSV import
  • [ ] Multi-database support
  • [ ] Kubernetes deployment manifests

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Support This Project

If you find this Neo4j MCP Server useful for your projects, please consider supporting its development!

☕ Become a Patron

This project is maintained by independent developers. Your support helps us:

  • 🚀 Add new features and improvements
  • 🐛 Fix bugs and improve stability
  • 📚 Create better documentation and tutorials
  • 🔒 Enhance security features
  • 🎯 Provide faster support and updates

Support us on Patreon

Supporter Benefits

Patrons get access to:

  • 🎯 Priority Support - Get help faster when you need it
  • 📝 Early Access - Try new features before public release
  • 💬 Direct Communication - Influence the project roadmap
  • 🎓 Exclusive Tutorials - Advanced usage guides and examples
  • 🏆 Recognition - Your name in our SUPPORTERS.md file

Other Ways to Support

  • ⭐ Star this repository on GitHub
  • 🐛 Report bugs and request features via GitHub Issues
  • 📖 Improve documentation by submitting pull requests
  • 💬 Spread the word - Share with colleagues and on social media

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Note: This is an open-source project under active development. The natural language query feature currently uses template-based matching. Full LLM integration is planned for future releases.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选