loading…
Search for a command to run...
loading…
Enables interaction with Neo4j databases from the Cursor IDE by executing Cypher queries, managing connections, and retrieving database information.
Enables interaction with Neo4j databases from the Cursor IDE by executing Cypher queries, managing connections, and retrieving database information.
A Cursor MCP (Model Context Protocol) server that enables seamless interaction with Neo4j databases directly from the Cursor IDE.
This project includes a Docker Compose configuration to easily run Neo4j in a container:
Make sure you have Docker and Docker Compose installed.
Start Neo4j using Docker Compose:
docker-compose up -d
Access the Neo4j Browser at http://localhost:7474
neo4jyour_password (as specified in the docker-compose.yml)To stop Neo4j:
docker-compose down
To stop Neo4j and remove all data:
docker-compose down -v
Note: The default password in docker-compose.yml is set to
your_password. For production use, change this to a secure password and update your.envfile accordingly.
Clone this repository:
git clone https://github.com/yourusername/neo4j-mcp.git
cd neo4j-mcp
Install dependencies:
bun install
Configure environment variables:
Create a .env file in the root directory with your Neo4j credentials:
NEO4J_URI=neo4j://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_password
NEO4J_DATABASE=neo4j
NODE_ENV=development
The server uses stdio transport for communication with Cursor, so it should be started by Cursor itself. However, you can test it manually:
# Run directly
bun run index.ts
# Run with logging using the provided script
./run-mcp-server.sh
The MCP server exposes the following tools:
Connects to a Neo4j database with the provided credentials.
Parameters:
uri: Neo4j database URI (e.g., neo4j://localhost:7687)username: Neo4j database usernamepassword: Neo4j database passworddatabase: (Optional) Neo4j database nameConnects to a Neo4j database using credentials from environment variables.
No parameters required.
Executes a Cypher query against the connected Neo4j database.
Parameters:
query: Cypher query to executeparams: (Optional) Query parametersRetrieves detailed information about the connected Neo4j database, including:
No parameters required.
Retrieves the current connection status, including:
No parameters required.
Disconnects from the Neo4j database.
No parameters required.
The following environment variables can be set in a .env file:
| Variable | Description | Default |
|---|---|---|
| NEO4J_URI | Neo4j database URI | neo4j://localhost:7687 |
| NEO4J_USERNAME | Neo4j database username | neo4j |
| NEO4J_PASSWORD | Neo4j database password | (empty) |
| NEO4J_DATABASE | Neo4j database name | (default database) |
| NODE_ENV | Environment (development/production) | development |
This MCP server is designed to be used with Cursor's MCP integration. Cursor will automatically detect and use the tools provided by this server.
index.ts - Entry point that starts the MCP serversrc/mcpNeo4jServer.ts - MCP server implementation using the MCP SDKsrc/services/neo4jService.ts - Neo4j service for database operationssrc/types/index.ts - TypeScript type definitionssrc/utils/errorHandler.ts - Utility functions for error handlingTo build the server for production:
# Build the server
bun build index.ts --outdir ./dist
# Make the output file executable
chmod +x ./dist/index.js
The build process bundles all dependencies into a single JavaScript file, making it easy to distribute and run the server without installing dependencies.
You can run the server using the provided shell script:
./run-mcp-server.sh
This script:
logs/mcp-server.logNote: The script requires Bun to be installed and available in your PATH.
MIT
Run in your terminal:
claude mcp add neo4j-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.