Neo4j MCP Server

Neo4j MCP Server

A TypeScript MCP server for executing Cypher queries and exploring Neo4j graph databases, enabling natural language database interaction through Claude.

Category
Visit Server

README

πŸ”β‰οΈ Neo4j MCP Server (TypeScript)

🌟 Overview

A Model Context Protocol (MCP) server implementation in TypeScript that provides database interaction and allows graph exploration capabilities through Neo4j. This server enables running Cypher graph queries, analyzing complex domain data, and automatically generating business insights that can be enhanced with Claude's analysis.

This is a TypeScript port of the original Python mcp-neo4j-cypher server.

🧩 Components

πŸ› οΈ Tools

The server offers these core tools:

πŸ“Š Query Tools

  • read_neo4j_cypher

    • Execute Cypher read queries to read data from the database
    • Input:
      • query (string): The Cypher query to execute
      • params (object, optional): Parameters to pass to the Cypher query
    • Returns: Query results as JSON serialized array of objects
  • write_neo4j_cypher

    • Execute updating Cypher queries
    • Input:
      • query (string): The Cypher update query
      • params (object, optional): Parameters to pass to the Cypher query
    • Returns: A JSON serialized result summary counter with update statistics

πŸ•ΈοΈ Schema Tools

  • get_neo4j_schema
    • Get a list of all node types in the graph database, their attributes with name, type and relationships to other node types
    • No input required
    • Returns: JSON serialized list of node labels with two dictionaries: one for attributes and one for relationships

🏷️ Namespacing

The server supports namespacing to allow multiple Neo4j MCP servers to be used simultaneously. When a namespace is provided, all tool names are prefixed with the namespace followed by a hyphen (e.g., mydb-read_neo4j_cypher).

πŸ“¦ Installation

  1. Clone this repository or copy the source files to your project
  2. Install dependencies:
    cd neo4j-mcp-typesccript
    yarn install
    
  3. Build the TypeScript code:
    yarn build
    

πŸ§ͺ Testing the Connection

Before running the server, you can test your Neo4j connection:

yarn test:connection

This will verify that the server can connect to your Neo4j instance.

πŸš€ Usage

πŸ–₯️ Command Line

You can run the server directly from the command line:

# Using stdio transport (default)
node dist/index.js --db-url bolt://localhost:7687 --username neo4j --password password

# Using HTTP transport
node dist/index.js --transport http --server-host 0.0.0.0 --server-port 8000

# Using SSE transport
node dist/index.js --transport sse --server-host 0.0.0.0 --server-port 8000

πŸ”§ Environment Variables

You can also configure the server using environment variables:

# Neo4j Connection
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USERNAME=neo4j
export NEO4J_PASSWORD=password
export NEO4J_DATABASE=neo4j

# MCP Server Configuration
export NEO4J_TRANSPORT=stdio
export NEO4J_NAMESPACE=mydb
export NEO4J_MCP_SERVER_HOST=127.0.0.1
export NEO4J_MCP_SERVER_PORT=8000
export NEO4J_MCP_SERVER_PATH=/mcp/

# Then run
node dist/index.js

πŸ’» Claude Desktop Integration

Add the server to your claude_desktop_config.json:

{
  "mcpServers": {
    "neo4j-typescript": {
      "command": "node",
      "args": ["/path/to/neo4j-mcp-typescript/dist/index.js"],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USERNAME": "neo4j",
        "NEO4J_PASSWORD": "your-password",
        "NEO4J_DATABASE": "neo4j"
      }
    }
  }
}

🐳 Docker Support

You can also run this in a Docker container. Create a Dockerfile:

FROM node:18-alpine

WORKDIR /app

# Copy package files
COPY package*.json ./
RUN npm install

# Copy source files
COPY . .

# Build TypeScript
RUN npm run build

# Set environment variables
ENV NEO4J_URI="bolt://host.docker.internal:7687"
ENV NEO4J_USERNAME="neo4j"
ENV NEO4J_PASSWORD="password"
ENV NEO4J_DATABASE="neo4j"
ENV NEO4J_TRANSPORT="http"
ENV NEO4J_MCP_SERVER_HOST="0.0.0.0"
ENV NEO4J_MCP_SERVER_PORT="8000"
ENV NEO4J_MCP_SERVER_PATH="/api/mcp/"

EXPOSE 8000

CMD ["node", "dist/index.js"]

πŸš€ Transport Modes

The server supports different transport protocols:

  • STDIO (default for local development): Standard input/output for Claude Desktop and local tools
  • HTTP: RESTful HTTP for web deployments and microservices
  • SSE: Server-Sent Events for web-based deployments

πŸ”§ Development

  1. Clone the repository
  2. Install dependencies: yarn install
  3. Run in development mode: yarn dev
  4. Build for production: yarn build
  5. Run tests: yarn test (if tests are added)

πŸ“„ License

This MCP server is licensed under the MIT License.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured