Learn how to use the Model Context Protocol to create intelligent AI applications
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:
{
"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.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.
{
"servers": {
"neo4j-cypher": {
"command": "uvx",
"args": [
"mcp-neo4j-cypher"
],
"env": {
"NEO4J_URI": "neo4j+s://dbid.databases.neo4j.io:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "<your password here>",
"NEO4J_DATABASE": "neo4j"
}
}
}
}
Tip
|
You can also use the VS Code MCP: Add Server command to setup the |
Tip
|
You can obtain a Neo4j Aura instance by enrolling to the Developing with Neo4j MCP Tools course on Neo4j GraphAcademy. |
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
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
orexecute_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.