neo4j-mcp-readonly
Click on "Deploy 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-mcp-readonlyshow me the database schema"
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 Server
A Model Context Protocol (MCP) server that provides read-only access to your Neo4j database. This server allows you to connect Cursor IDE to your Neo4j database and run safe, read-only Cypher queries with comprehensive database exploration tools.
๐ Quick Start
Installation
# Install globally
npm install -g neo4j-mcp-readonly
# Or use with npx (no installation required)
npx neo4j-mcp-readonly --helpBasic Usage
# Start with command line arguments
neo4j-mcp-readonly --neo4j-uri bolt://localhost:7687 --neo4j-username neo4j --neo4j-password mypassword
# Or use environment variables
NEO4J_URI=bolt://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=mypassword neo4j-mcp-readonlyRelated MCP server: MCP MySQL Server
๐ Features
๐ Read-only queries: Only allows safe read operations (MATCH, RETURN, WITH, UNWIND, etc.)
๐ก๏ธ Query validation: Automatically blocks dangerous operations like CREATE, DELETE, SET, MERGE
๐ Schema exploration: Get database schema information including labels, relationships, and properties
๐ Database statistics: Node/relationship counts, property analysis, and more
๐งช Connection testing: Built-in connection testing functionality
โก CLI support: Easy command-line configuration
๐ณ Docker ready: Example Docker Compose configuration included
๐ง Flexible auth: Support for environment variables and command-line arguments
๐ ๏ธ Configuration Methods
Method 1: Command Line Arguments
neo4j-mcp-readonly \
--neo4j-uri bolt://localhost:7687 \
--neo4j-username neo4j \
--neo4j-password your_passwordMethod 2: Environment Variables
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USERNAME=neo4j
export NEO4J_PASSWORD=your_password
neo4j-mcp-readonlyMethod 3: Mixed Approach
# Environment for sensitive data, CLI for the rest
export NEO4J_PASSWORD=your_secure_password
neo4j-mcp-readonly --neo4j-uri bolt://myserver:7687 --neo4j-username myuser๐ฏ Usage with Cursor IDE
Option 1: Using npx (Recommended)
Add this to your Cursor MCP settings:
{
"mcpServers": {
"neo4j": {
"command": "npx",
"args": [
"neo4j-mcp-readonly",
"--neo4j-uri", "bolt://localhost:7687",
"--neo4j-username", "neo4j",
"--neo4j-password", "your_password_here"
]
}
}
}Option 2: Using Environment Variables
{
"mcpServers": {
"neo4j": {
"command": "npx",
"args": ["neo4j-mcp-readonly"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "your_password_here"
}
}
}
}Option 3: Minimal Setup (Password Only)
For simple local setups where you only need to specify the password:
{
"mcpServers": {
"neo4j": {
"command": "npx",
"args": ["neo4j-mcp-readonly", "--neo4j-password", "your_password_here"]
}
}
}This assumes default values: bolt://localhost:7687 and username neo4j.
Configuration Steps
Install the package (if not using npx):
npm install -g neo4j-mcp-readonlyAdd MCP server to Cursor:
Open Cursor IDE
Go to Cursor Settings (Cmd/Ctrl + ,)
Search for "MCP" or go to Extensions > MCP
Add the configuration (see examples above)
Restart Cursor for changes to take effect
Start querying:
Can you show me the schema of my Neo4j database? How many User nodes do I have? Show me sample data for the Movie label
๐ ๏ธ Available Tools
Core Tools
Tool | Description | Parameters |
| Execute read-only Cypher queries |
|
| Get database schema (labels, relationships, properties) | None |
| Test database connectivity | None |
Analysis Tools
Tool | Description | Parameters |
| Count nodes by label or total |
|
| Count relationships by type or total |
|
| Get Neo4j version, edition, and statistics | None |
| Get sample data for exploration |
|
Schema Analysis Tools
Tool | Description | Parameters |
| List all database indexes | None |
| List all database constraints | None |
| Analyze properties of a node label |
|
| Analyze properties of a relationship type |
|
๐ก Example Queries
Basic Data Exploration
MATCH (n:Person) RETURN n.name, n.age LIMIT 10Relationship Analysis
MATCH (p:Person)-[r:FRIENDS_WITH]->(f:Person)
RETURN p.name, f.name, r.sinceProperty-based Filtering
MATCH (m:Movie)
WHERE m.year > 2000
RETURN m.title, m.year
ORDER BY m.year DESC๐ Security Features
Allowed Operations
MATCH- Pattern matchingRETURN- Return resultsWITH- Chain query partsUNWIND- Expand listsSHOW- Show database metadataRead-only
CALLprocedures (schema, labels, etc.)
Blocked Operations
CREATE- Creating nodes/relationshipsDELETE/DETACH DELETE- Deleting dataMERGE- Creating or matchingSET- Setting propertiesREMOVE- Removing properties/labelsDROP- Dropping indexes/constraintsALTER- Altering schemaMost
CALLprocedures (except read-only ones)
๐ณ Docker Setup
Use the provided Docker Compose example:
# Copy the example
cp examples/docker-compose.yml .
# Edit password in docker-compose.yml
# Then start Neo4j
docker-compose up -d
# Connect with MCP server
neo4j-mcp-readonly --neo4j-password your_password_here๐ง Development
Local Development
git clone https://github.com/ThisIsVoid/neo4j-mcp-readonly.git
cd neo4j-mcp-readonly
npm install
npm run build
npm run devBuilding
npm run buildTesting
# Test connection
neo4j-mcp-readonly --help
# Test with your database
NEO4J_PASSWORD=test neo4j-mcp-readonly๐ Advanced Configuration
Custom Neo4j Configurations
# Neo4j Aura
neo4j-mcp-readonly \
--neo4j-uri neo4j+s://xxxx.databases.neo4j.io \
--neo4j-username neo4j \
--neo4j-password your_aura_password
# Neo4j Enterprise with custom port
neo4j-mcp-readonly \
--neo4j-uri bolt://enterprise-server:7687 \
--neo4j-username readonly_user \
--neo4j-password readonly_password
# Local Neo4j with custom database
neo4j-mcp-readonly \
--neo4j-uri bolt://localhost:7687/movies \
--neo4j-username neo4j \
--neo4j-password mypasswordEnvironment File Setup
Create a .env file:
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_secure_passwordThen run:
source .env
neo4j-mcp-readonly๐จ Troubleshooting
Connection Issues
Verify Neo4j is running:
# Check if Neo4j is listening netstat -an | grep 7687Test direct connection:
# Use Neo4j's cypher-shell cypher-shell -u neo4j -p your_passwordCheck firewall/network:
Ensure port 7687 is accessible
Check if authentication is required
Configuration Issues
Invalid credentials:
Configuration error: neo4j.password: Password is requiredSolution: Provide password via
--neo4j-passwordorNEO4J_PASSWORDConnection refused:
Failed to connect to Neo4j: ServiceUnavailableSolution: Check URI and ensure Neo4j is running
MCP Issues
Server not found in Cursor:
Verify npx can find the package:
npx neo4j-mcp-readonly --helpCheck Cursor MCP configuration syntax
Restart Cursor after configuration changes
Query blocked:
Query contains forbidden operationsSolution: Ensure query only contains allowed read operations
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ Publishing to NPM
Publishing to NPM is free for open source packages. Here's how to publish:
First Time Setup
Create NPM account: Visit npmjs.com and sign up
Login locally:
npm loginUpdate package.json: Change repository URLs to your GitHub repo
Publishing
# Build the package
npm run build
# Publish (runs prepublishOnly script automatically)
npm publish
# For beta versions
npm publish --tag betaUpdating
# Update version
npm version patch # or minor, major
# Publish update
npm publish๐ Star History
If this project helps you, please consider giving it a star on GitHub!
๐ Support
๐ Bug Reports: GitHub Issues
๐ฌ Discussions: GitHub Discussions
๐ Documentation: This README and inline code comments
๐ฏ Examples: Check the
/examplesdirectory
Made with โค๏ธ for the Neo4j and Cursor communities
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only access to your Citlyze workspace: AI search visibility, citations, and recommendations.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor โ on any device. Read-only, encrypted, audited.
Query your org's data in natural language โ read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides read-only access to PostgreSQL databases, enabling users to inspect database schemas and execute read-only queries through a Model Context Protocol server.4-
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to MySQL databases, enabling schema inspection, table listing, and execution of SELECT queries through the Model Context Protocol.317 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides secure, read-only access to Snowflake databases through the Model Context Protocol. It allows users to query data while strictly prohibiting destructive SQL commands like INSERT, UPDATE, or DELETE.MIT
- AlicenseAqualityCmaintenanceRead-only Model Context Protocol server for Microsoft SQL Server, enabling safe schema discovery, profiling, and querying with zero risk of data modification.14549 npm8MIT