NE
OfficialDatabase

Neo4j Memory-Backed Graph MCP Server Schema and Cypher

Explore Neo4j MCP server with memory-backed graph: view schema, run read/write Cypher, and configure separate graph-database-backed memory for storage.

Quick Install
npx -y @neo4j-contrib/mcp-neo4j

Overview

The Neo4j Memory-Backed Graph MCP Server implements the MCP (Model Context Protocol) concept for Neo4j-style graph access backed by an in-memory graph store. It lets you spin up a lightweight, Cypher-capable graph instance that behaves like a Neo4j database for reads and writes without requiring a full persistent Neo4j server. That makes it convenient for rapid prototyping, tests, demos, and transient data processing where persistence is not required.

In addition to a pure in-memory mode, the server can be configured to use a separate graph-database-backed memory store so that the “memory” backing is persisted to an underlying Neo4j instance. In other words, you can choose ephemeral memory for temporary workloads or a graph-database-backed memory for longer-lived storage while still using the same MCP/Cypher interface.

Features

  • In-memory Neo4j-compatible graph exposing Cypher read/write access
  • Optionally backed by a separate Neo4j graph database for persistent memory
  • Compatible with standard Neo4j drivers and cypher-shell for queries
  • Ability to inspect schema (labels, relationship types, indexes) via standard procedures
  • Lightweight server suitable for local development, CI, or demos
  • Exposed MCP endpoints for integration with tools that consume MCP

Installation / Configuration

Build from source (Maven example):

git clone https://github.com/neo4j-contrib/mcp-neo4j.git
cd mcp-neo4j
mvn clean package -DskipTests

Run the server from the packaged jar:

java -jar target/mcp-neo4j-<version>.jar --config file:/path/to/application.conf

Or run via Docker (example):

docker run -p 7687:7687 -p 7474:7474 \
  -e MCP_CONFIG=/config/application.conf \
  -v $(pwd)/application.conf:/config/application.conf \
  neo4j-contrib/mcp-neo4j:latest

Example configuration (HOCON/YAML-like; adapt to your format):

mcp {
  server {
    bolt {
      enabled = true
      address = "0.0.0.0:7687"
    }
    http {
      enabled = true
      address = "0.0.0.0:7474"
    }
  }

  memory {
    backend = "in-memory" # or "graph-db"
  }

  graph-db {
    uri = "bolt://neo4j-host:7687"
    username = "neo4j"
    password = "password"
    database = "neo4j" # optional for multi-db Neo4j
  }
}

Configuration key summary:

KeyPurpose
mcp.server.bolt.addressBolt endpoint for Cypher clients
mcp.server.http.addressHTTP admin / MCP endpoints
mcp.memory.backend“in-memory” or “graph-db” backing
mcp.graph-db.uriBackend Neo4j Bolt URI (if graph-db)
mcp.graph-db.username/passwordCredentials for backend Neo4j

Available Resources

  • GitHub repository: https://github.com/neo4j-contrib/mcp-neo4j/
  • Neo4j drivers: official drivers for Java, Python, JavaScript, etc.
  • Cypher shell: command-line tool for executing Cypher against Bolt endpoints
  • Neo4j schema procedures: CALL db.labels(), CALL db.relationshipTypes(), CALL db.indexes(), CALL db.schema.nodeTypeProperties()

These work against the MCP server when it exposes a Neo4j-compatible Bolt endpoint.

Running Cypher: Examples

Using cypher-shell (assumes server exposes Bolt at bolt://localhost:7687):

# create nodes
cypher-shell -u neo4j -p password "CREATE (:Person {name:'Alice'}), (:Person {name:'Bob'})"

# read nodes
cypher-shell -u neo4j -p password "MATCH (p:Person) RETURN p.name LIMIT 25"

Python example using the official neo4j driver:

from neo4j import GraphDatabase

uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

with driver.session() as session:
    result = session.run("CREATE (a:Test {value: $v}) RETURN