neo4j2LLM
Provides tools to connect to Neo4j, execute and analyze Cypher queries, inspect schema labels, relationship types, constraints and indexes, create nodes and relationships, and export query results.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
neo4j2LLM
π MCP Server for Neo4j Knowledge Graph Integration with Claude Desktop
A TypeScript-based Model Context Protocol (MCP) server that enables Claude Desktop to interact directly with Neo4j knowledge graphs. Built with modern technologies for performance, reliability, and ease of use.
π Table of Contents
Related MCP server: MCP Neo4j Server
β¨ Features
π Universal Neo4j Connectivity - Works with local, Docker, cloud, and AuraDB instances
π οΈ Comprehensive Toolset - 12 essential tools for knowledge graph operations
β‘ High Performance - Built with Bun runtime and optimized TypeScript
π Secure by Design - Robust validation, error handling, and connection management
π Rich Query Analysis - Query profiling, execution plans, and optimization tips
π― Type Safety - 100% TypeScript with comprehensive type definitions
π Real-time Operations - Streaming support for large datasets
π Schema Introspection - Complete database schema analysis and visualization
π Prerequisites
Node.js >= 18.0.0 or Bun >= 1.0.0
Neo4j Database (local installation, Docker, or cloud instance)
Claude Desktop with MCP support
π Installation
Option 1: Using Bun (Recommended)
# Clone the repository
git clone https://github.com/michaelhil/neo4j2llm.git
cd neo4j2llm
# Install dependencies
bun install
# Build the project
bun run build
# Run the MCP server
bun run src/index.tsOption 2: Using npm
# Clone and install
git clone https://github.com/michaelhil/neo4j2llm.git
cd neo4j2llm
npm install
# Build and run
npm run build
npm startOption 3: Docker Container
# Pull and run the container
docker run -it --rm \\
-e NEO4J_URI=bolt://host.docker.internal:7687 \\
-e NEO4J_USERNAME=neo4j \\
-e NEO4J_PASSWORD=password \\
michaelhil/neo4j2llm:latestβοΈ Configuration
Environment Variables
Create a .env file in the root directory:
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_password
NEO4J_DATABASE=neo4jClaude Desktop Configuration
Add to your Claude Desktop MCP settings:
{
"mcpServers": {
"neo4j2llm": {
"command": "bun",
"args": ["run", "/path/to/neo4j2llm/src/index.ts"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "your_password"
}
}
}
}Connection Options
The server supports multiple Neo4j deployment types:
Type | URI Format | Example |
Local Bolt |
|
|
Local HTTP |
|
|
Neo4j Cloud |
|
|
AuraDB |
|
|
π Usage
Once configured, you can use natural language with Claude to interact with your Neo4j database:
Basic Connection
Connect to my Neo4j database at bolt://localhost:7687 with username neo4j and password mypasswordQuery Execution
Show me all Person nodes in the databaseSchema Exploration
What labels and relationship types exist in my database?Data Creation
Create a new Person node with name "Alice" and age 30Performance Analysis
Explain the execution plan for: MATCH (p:Person)-[:KNOWS]->(f:Person) RETURN p, fπ οΈ Available Tools
π Connection Management
neo4j_connect
Establish connection to Neo4j database instance.
Parameters:
uri(required): Neo4j connection URIusername(required): Database usernamepassword(required): Database passworddatabase(optional): Target database namemaxConnectionPoolSize(optional): Max connection pool sizeconnectionTimeout(optional): Connection timeout in milliseconds
Example:
{
"uri": "bolt://localhost:7687",
"username": "neo4j",
"password": "password",
"database": "movies"
}neo4j_disconnect
Close connection to Neo4j database.
Example:
// No parameters requiredneo4j_test_connection
Test connection health and get database information.
Parameters:
includePerformanceTest(optional): Include response time measurement
Example:
{
"includePerformanceTest": true
}π Query Execution
neo4j_execute_query
Execute Cypher query against Neo4j database.
Parameters:
cypher(required): Cypher query stringparameters(optional): Query parameterstimeout(optional): Query timeout in millisecondsincludeStats(optional): Include execution statisticslimit(optional): Maximum records to return
Example:
{
"cypher": "MATCH (p:Person {name: $name}) RETURN p",
"parameters": {"name": "Alice"},
"limit": 100,
"includeStats": true
}neo4j_explain_query
Get execution plan for Cypher query without executing it.
Parameters:
cypher(required): Cypher query to explainparameters(optional): Query parameters
Example:
{
"cypher": "MATCH (p:Person)-[:KNOWS]->(f) RETURN p, f",
"parameters": {}
}neo4j_profile_query
Execute and profile Cypher query to analyze performance.
Parameters:
cypher(required): Cypher query to profileparameters(optional): Query parameters
Example:
{
"cypher": "MATCH (p:Person) WHERE p.age > $minAge RETURN count(p)",
"parameters": {"minAge": 25}
}π Schema Management
neo4j_get_schema
Retrieve complete database schema including labels, relationships, properties, constraints, and indexes.
Parameters:
includeStatistics(optional): Include schema statisticsincludePropertyInfo(optional): Include detailed property information
Example:
{
"includeStatistics": true,
"includePropertyInfo": true
}neo4j_get_labels
Get all node labels with their counts and sample properties.
Parameters:
includeCounts(optional): Include node counts for each labelincludeSampleProperties(optional): Include sample property namessortBy(optional): Sort by 'name' or 'count'limit(optional): Maximum number of labels to return
Example:
{
"includeCounts": true,
"sortBy": "count",
"limit": 50
}neo4j_get_relationship_types
Get all relationship types with their counts and sample properties.
Parameters:
includeCounts(optional): Include relationship countsincludeSampleProperties(optional): Include sample property namessortBy(optional): Sort by 'name' or 'count'limit(optional): Maximum number of types to return
Example:
{
"includeCounts": true,
"includeSampleProperties": true,
"sortBy": "name"
}ποΈ Graph Creation
neo4j_create_nodes
Create multiple nodes with specified labels and properties.
neo4j_create_relationships
Create relationships between existing nodes with specified properties.
π€ Data Export
neo4j_export_data
Export query results in JSON, CSV, or Cypher format.
Parameters:
nodes(required): Array of nodes to createreturnCreated(optional): Return information about created nodesbatchSize(optional): Number of nodes to create per batch
Example - Creating Nodes:
{
"nodes": [
{
"labels": ["Person"],
"properties": {"name": "Alice", "age": 30}
},
{
"labels": ["Person", "Developer"],
"properties": {"name": "Bob", "age": 25, "skill": "TypeScript"}
}
],
"returnCreated": true,
"batchSize": 100
}Example - Creating Relationships:
{
"relationships": [
{
"type": "KNOWS",
"properties": {"since": "2020"},
"startNode": {
"labels": ["Person"],
"properties": {"name": "Alice"}
},
"endNode": {
"labels": ["Person"],
"properties": {"name": "Bob"}
}
}
],
"returnCreated": true
}Example - Exporting Data:
{
"query": "MATCH (p:Person) RETURN p.name, p.age",
"format": "json",
"limit": 100
}π‘ Examples
1. Basic Database Exploration
// Connect to database
await neo4j_connect({
"uri": "bolt://localhost:7687",
"username": "neo4j",
"password": "password"
})
// Get database schema
await neo4j_get_schema({
"includeStatistics": true
})
// List all labels
await neo4j_get_labels({
"includeCounts": true,
"sortBy": "count"
})2. Query Performance Analysis
// Profile a complex query
await neo4j_profile_query({
"cypher": `
MATCH (p:Person)-[:WORKS_FOR]->(c:Company)
WHERE c.industry = $industry
RETURN p.name, c.name
ORDER BY p.name
`,
"parameters": {"industry": "Technology"}
})3. Data Creation and Querying
// Create nodes
await neo4j_create_nodes({
"nodes": [
{
"labels": ["Company"],
"properties": {"name": "TechCorp", "industry": "Technology"}
},
{
"labels": ["Person"],
"properties": {"name": "Alice", "role": "Engineer"}
}
],
"returnCreated": true
})
// Query the created data
await neo4j_execute_query({
"cypher": "MATCH (p:Person {name: 'Alice'}) RETURN p",
"includeStats": true
})ποΈ Architecture
System Overview
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β Claude Desktop βββββΊβ neo4j2LLM βββββΊβ Neo4j β
β β β MCP Server β β Database β
β β β β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββTechnology Stack
π§ Runtime: Bun (primary) / Node.js (compatible)
π Language: TypeScript (100%)
π Protocol: Model Context Protocol (MCP)
ποΈ Database: Neo4j (all versions)
π§ͺ Testing: Bun test runner
π¦ Building: Vite
π Linting: ESLint + TypeScript rules
Project Structure
neo4j2LLM/
βββ src/
β βββ core/ # Core types, errors, validation
β βββ connection/ # Neo4j connection management
β βββ services/ # Business logic services
β βββ tools/ # MCP tool implementations
β β βββ connection/ # Connection management tools
β β βββ query/ # Query execution tools
β β βββ schema/ # Schema introspection tools
β β βββ creation/ # Data creation tools
β βββ index.ts # MCP server entry point
βββ docs/ # Documentation
βββ tests/ # Test suites
βββ docker/ # Docker configurationKey Design Principles
ποΈ Factory Pattern: All services use factory functions for clean instantiation
π‘οΈ Type Safety: Comprehensive TypeScript interfaces and validation
π Functional Programming: Immutable data structures and pure functions
π¦ Error Handling: Robust error categorization and recovery
β‘ Performance: Connection pooling, query optimization, and streaming support
π§ͺ Development
Setup Development Environment
# Clone and install
git clone https://github.com/michaelhil/neo4j2llm.git
cd neo4j2llm
bun install
# Start development server
bun run dev
# Run tests
bun test
# Type checking
bun run type-check
# Linting
bun run lintProject Scripts
bun run dev # Development server with hot reload
bun run build # Build for production
bun test # Run test suite
bun test:watch # Run tests in watch mode
bun run lint # Lint code
bun run lint:fix # Fix linting issues
bun run type-check # TypeScript type checkingTesting
# Run all tests
bun test
# Run specific test file
bun test src/tools/connection/connect.test.ts
# Run tests with coverage
bun test --coverageπ³ Docker
Building the Container
# Build the Docker image
docker build -t neo4j2llm .
# Run the container
docker run -it --rm \\
-e NEO4J_URI=bolt://host.docker.internal:7687 \\
-e NEO4J_USERNAME=neo4j \\
-e NEO4J_PASSWORD=password \\
neo4j2llmDocker Compose
version: '3.8'
services:
neo4j:
image: neo4j:latest
environment:
NEO4J_AUTH: neo4j/password
ports:
- "7474:7474"
- "7687:7687"
neo4j2llm:
build: .
environment:
NEO4J_URI: bolt://neo4j:7687
NEO4J_USERNAME: neo4j
NEO4J_PASSWORD: password
depends_on:
- neo4jπ€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Workflow
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Code Standards
TypeScript for all code (no JavaScript files)
ESLint for code quality
Prettier for formatting
Comprehensive tests for new features
Documentation for all public APIs
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
Neo4j Team for the excellent graph database
Anthropic for Claude and the MCP protocol
Bun Team for the blazing fast runtime
TypeScript Team for type safety excellence
π Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Documentation: Project Wiki
Made with β€οΈ for the Knowledge Graph community
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
- platform7nDeprecatedtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Draw, shape, and edit Neo4j graph data models in toro4n with your AI assistant.
A private graph database you query in plain English or Cypher. Hosted, nothing to install.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceThis lets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things with Neo4j and your Aura account.992MIT
- AlicenseBqualityDmaintenanceThis server enables interaction between Neo4j databases and Claude Desktop, allowing users to execute Cypher queries, create nodes, and establish relationships in the database.3240 npm59MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Neo4j graph databases through natural language, supporting Cypher queries, schema management, data manipulation, and graph algorithms.MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to automatically extract entities and relationships from URLs, PDFs, and YouTube videos to build structured knowledge graphs in Neo4j. It supports custom schemas, academic citation extraction, and community detection for advanced research and content analysis.Apache 2.0