
neo4j-graphacademy/genai-mcp-neo4j-tools
Analytics & monitoringhttps://graphacademy.neo4j.com/courses/genai-mcp-neo4j-tools
Overview
[quote] Learn how to use the Model Context Protocol to create intelligent AI applications link:https://graphacademy.neo4j.com/courses/genai-mcp-neo4j-tools/[Enroll for free at Neo4j GraphAcademy^]. // tag::setup[] The server is written in Python, so you will use the uvx command to install the server from PyPI and run the server locally, and configure VS Code to communicate with the server using the Standard Input/Output (stdio) transport method. To install the Neo4j Cypher MCP server in VS Code, open the .vscode/mcp.json file and add the server configuration: .mcp.json [source,json] ---- { "servers": { "neo4j-cypher": { "command": "uvx", "args": [ "mcp-neo4j-cypher" ] } } } ---- The Neo4j Cypher MCP server will require environment variables to allow it to connect to an instance. * NEO4J_URI - The connection URI for your Neo4j database (e.g., neo4j+s://dbid.databases.neo4j.
README
Developing with Neo4j MCP Tools
[quote] Learn how to use the Model Context Protocol to create intelligent AI applications
link:https://graphacademy.neo4j.com/courses/genai-mcp-neo4j-tools/[Enroll for free at Neo4j GraphAcademy^].
== Set up the Neo4j Cypher MCP Server
// tag::setup[]
The server is written in Python, so you will use the uvx command to install the server from PyPI and run the server locally, and configure VS Code to communicate with the server using the Standard Input/Output (stdio) transport method.
== Step 1: Install the server
To install the Neo4j Cypher MCP server in VS Code, open the .vscode/mcp.json file and add the server configuration:
.mcp.json [source,json]
{ “servers”: { “neo4j-cypher”: { “command”: “uvx”, “args”: [ “mcp-neo4j-cypher” ] } } }
== Step 2: Set environment variables
The Neo4j Cypher MCP server will require environment variables to allow it to connect to an instance.
NEO4J_URI- The connection URI for your Neo4j database (e.g.,neo4j+s://dbid.databases.neo4j.io)NEO4J_USERNAME- Your Neo4j username (typicallyneo4j)NEO4J_PASSWORD- Your Neo4j password
You can set these variables by adding a new env section to the neo4j-cypher entry in the mcp.json file.
.mcp.json [source, json, subs=“attributes+”]
{ “servers”: { “neo4j-cypher”: { “command”: “uvx”, “args”: [ “mcp-neo4j-cypher” ], “env”: { ifdef::instance-ip[] “NEO4J_URI”: “{instance-scheme}://{instance-ip}:7687”, “NEO4J_USERNAME”: “{instance-username}”, “NEO4J_PASSWORD”: “{instance-password}”, ifdef::instance-database[] “NEO4J_DATABASE”: “{instance-database}” endif::[] ifndef::instance-database[] “NEO4J_DATABASE”: “neo4j” endif::[] endif::[] ifndef::instance-ip[] “NEO4J_URI”: “neo4j+s://dbid.databases.neo4j.io:7687”, “NEO4J_USERNAME”: “neo4j”, “NEO4J_PASSWORD”: “”, “NEO4J_DATABASE”: “neo4j” endif::[] } } } }
[TIP]
You can also use the VS Code MCP: Add Server command to setup the .vscode/mcp.json file, and then add the env section manually.
ifndef::instance-ip[] [TIP] You can obtain a Neo4j Aura instance by enrolling to the link:https://graphacademy.neo4j.com/courses/genai-mcp-neo4j-tools/[Developing with Neo4j MCP Tools course on Neo4j GraphAcademy^]. endif::[]
// end::setup[]
// tag::managing[]
== Managing the Server
Once configured, you can manage the MCP server using VS Code’s built-in commands:
- Run MCP: List Servers from the Command Palette to view all configured servers
- Start, Stop, or Restart servers as needed
- Show Output to view server logs for troubleshooting
- Browse Resources to see what the server provides
== Using the tools
Now, when you ask GitHub Copilot Chat to interact with your Neo4j database, the following sequence will occur:
. Copilot analyzes the request and determines that a Neo4j tool is needed.
. Copilot requests permission to use the Neo4j tools (such as get_schema or execute_cypher).
. Once you have granted permission, Copilot invokes the tool with the appropriate parameters.
. The MCP server connects to your Neo4j database, executes the operation, and returns the result.
VS Code will ask your permission before running a tool, providing the options to run the tool once or always run the tool without asking permission.
This step is so important. Anyone can build or deploy an MCP server, so it is crucial that potentially destructive steps are approved by a human. Make sure you trust the developer of the server and the capabilities of the tool, especially when working with database operations.
// end::managing[]
Install
uvx mcp-neo4j-cypher