
This repository demonstrates Model Context Protocol (MCP) server development with Neo4j graph databases.
概览
This repository demonstrates Model Context Protocol (MCP) server development with Neo4j graph databases. It includes both the official Neo4j MCP server for general-purpose Cypher querying and custom implementations for ecommerce applications. * : Using the mcp-neo4j-cypher MCP server with Claude Desktop for exploratory data analysis * : Building your own MCP server and The mcp-neo4j-cypher server is a Neo4j MCP implementation that provides comprehensive Cypher query capabilities for any Neo4j database. - - Execute arbitrary Cypher queries against your Neo4j database - - Explore database schema (node labels, relationship types, property keys) - - Get information about your Neo4j database - - Works with any Neo4j database structure - - Leverages Neo4j APOC plugin for enhanced functionality 1. : - Sign up at Neo4j Aura - Create a new database instance - Note your connection URI, username, and password 2. : Add the following to your claude_desktop_config.json: 3.
README
以下为原文 README 节选,完整内容请查看原文。
Neo4j MCP Workshop
This repository demonstrates Model Context Protocol (MCP) server development with Neo4j graph databases. It includes both the official Neo4j MCP server for general-purpose Cypher querying and custom implementations for ecommerce applications.
Outline
- Module 1: Using the
mcp-neo4j-cypherMCP server with Claude Desktop for exploratory data analysis - Module 2: Building your own MCP server and
Module 1: Using the mcp-neo4j-cypher MCP server with Claude Desktop for exploratory data analysis
The mcp-neo4j-cypher server is a Neo4j MCP implementation that provides comprehensive Cypher query capabilities for any Neo4j database.
Features
execute_cypher- Execute arbitrary Cypher queries against your Neo4j databaseexplore_schema- Explore database schema (node labels, relationship types, property keys)get_database_info- Get information about your Neo4j database- Schema-agnostic - Works with any Neo4j database structure
- APOC Integration - Leverages Neo4j APOC plugin for enhanced functionality
Setup with Neo4j Aura and Claude Desktop
-
Create Neo4j Aura Database:
- Sign up at Neo4j Aura
- Create a new database instance
- Note your connection URI, username, and password
-
Configure Claude Desktop: Add the following to your
claude_desktop_config.json:
{
"mcpServers": {
"neo4j-database": {
"command": "uvx",
"args": [ "[email protected]", "--transport", "stdio" ],
"env": {
"NEO4J_URI": "",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "",
"NEO4J_DATABASE": "neo4j"
}
}
}
}
- Test the Integration:
- Restart Claude Desktop
- Ask Claude to explore your Neo4j database: “What does my Neo4j database contain?”
- Try queries like: “Find all nodes in my database” or “Show me the schema of my Neo4j database”
Module 2: Building Your Own MCP Server
Creating Custom MCP Servers
This section covers how to build your own MCP servers using different SDKs and frameworks. The examples demonstrate domain-specific implementations for ecommerce applications.
MCP Server Development SDKs
Python SDKs
FastMCP (Used in this project)
- Package:
fastmcp - Features: High-level Python framework for MCP server development
- Best for: Rapid prototyping and Python developers
- Installation:
pip install fastmcp
Official Python MCP SDK
- Package:
mcp - Features: Official Python implementation of MCP protocol
- Best for: Full control over MCP protocol implementation
- Installation:
pip install mcp
TypeScript SDKs
Official TypeScript MCP SDK (Used in this project)
- Package:
@modelcontextprotocol/sdk
安装
uvx [email protected] --transport stdio配置
{
"mcpServers": {
"neo4j-database": {
"command": "uvx",
"args": [ "[email protected]", "--transport", "stdio" ],
"env": {
"NEO4J_URI": "<YOUR_NEO4J_AURA_URI_HERE>",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "<YOUR_NEO4J_PASSWORD_HERE>",
"NEO4J_DATABASE": "neo4j"
}
}
}
}