Skip to main content
Glama
yarinvak

Neo4j MCP Server

by yarinvak

πŸ”β‰οΈ 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.

Related MCP server: Neo4j MCP 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.

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yarinvak/neo4j-mcp-typescript'

If you have feedback or need assistance with the MCP directory API, please join our Discord server