Enables interaction with Neo4j graph databases, providing tools to execute read and write Cypher queries, discover database schema including labels and relationship types, and verify connection status.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Neo4j MCPshow me the database schema and relationship types"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Neo4j MCP - Model Context Protocol for Neo4j
A robust Model Context Protocol (MCP) implementation that enables LLMs to interact with Neo4j graph databases using natural language.
This server uses a stable, synchronous Neo4j driver wrapped for asynchronous use, ensuring reliable connections and compatibility with modern MCP clients.
🚀 Features
Full Read/Write Access: Execute both read and write Cypher queries.
Flexible Authentication: Connect to Neo4j with or without authentication.
Schema Introspection: Automatically discover database schema (labels, relationship types).
Secure Configuration: Environment-based configuration using a
.envfile.LLM Integration: Ready to use with Cursor, Claude Desktop, and other MCP-compatible tools.
Robust Error Handling: Clear error messages for connection and query issues.
Parameterized Queries: Support for safe, parameterized queries to prevent injection.
📋 Prerequisites
Python 3.8+
A running Neo4j database (local, Docker, or cloud).
pipfor installing packages.
🔧 Installation
Clone the repository:
git clone https://github.com/your-repo/neo4j-mcp.git cd neo4j-mcpInstall in editable mode: This is the recommended way to install, as it links the
neo4j-mcp-servercommand directly to your source code.pip install -e .
⚙️ Configuration
Configuration is managed via a .env file in the project root.
Create a
Add your Neo4j connection details.
Example 1: Local Neo4j without Authentication
Create a .env file with the following content. Leave NEO4J_USERNAME and NEO4J_PASSWORD blank.
Example 2: Local or Cloud Neo4j with Authentication
Example 3: Encrypted Connection (Aura)
For cloud services like Neo4j Aura, use the neo4j+s scheme and set NEO4J_ENCRYPTED to true.
🏃 Quick Start
With your .env file configured and dependencies installed, you can start the server.
The server will start and listen for connections over stdio. If you see INFO:neo4j_mcp.server:Starting Neo4j MCP Server (stdio), it's working!
You can also start it with an SSE transport for web-based clients:
🔌 LLM Integration (Cursor Example)
Make sure the server is installed and your
.envfile is configured.In Cursor, open the MCP configuration file (
~/.cursor/mcp.jsonor via the@symbol > Tools > Settings icon).Add the following server configuration. The server uses the
.envfile from its own directory, so you don't need to specify credentials here.
Restart Cursor. The
@neo4jtool should now be available and connected.
🛠️ Available Tools
read_cypher_query(query, [parameters], [database]): Execute a read-only query.write_cypher_query(query, [parameters], [database]): Execute a write query.get_database_schema([database]): Get database labels and relationship types.test_database_connection(): Verify the connection and get server info.run_cypher_query(query, [parameters], [database], [read_only]): Run a query with explicit read/write mode.
🚨 Troubleshooting
AttributeError: type object 'SessionConfig' has no attribute 'AccessMode': Yourneo4jlibrary version might be incompatible. The project is tested withneo4j>=5.15.0.ConnectionError: Neo4j authentication failed: Check yourNEO4J_USERNAMEandNEO4J_PASSWORDin the.envfile. If your database has no auth, ensure these are blank.ConnectionError: Neo4j service unavailable: Make sure your Neo4j database is running and accessible at the specifiedNEO4J_HOSTandNEO4J_PORT.
Made with ❤️ for the Neo4j and MCP communities