Neo4j Memory

DatabasesMemory and knowledge

MCP Neo4j Knowledge Graph Memory Server.

Your AI app calls the Neo4j Memory MCP server, which does the work through tools like read_graph, search_nodes, find_nodes and create_entities and sends the result back to the chat.

About Neo4j Memory

Neo4j Memory is a community MCP server from neo4j-contrib, filed in our directory under databases and memory and knowledge. MCP Neo4j Knowledge Graph Memory Server.

Neo4j Memory runs on your own machine: your AI app starts it with the command uvx mcp-neo4j-memory==0.4.2 and talks to it over standard input and output. It needs NEO4J_URI, NEO4J_USERNAME and NEO4J_PASSWORD set before Neo4j Memory starts.

The README for Neo4j Memory lists tools such as read_graph, search_nodes, find_nodes and create_entities, which your AI app can call once the server is connected.

Neo4j Memory is listed in the official MCP registry as io.github.neo4j-contrib/mcp-neo4j-memory, version 1.0.0.

At a glance

Publisher
neo4j-contrib (community)
Runs
Locally on your machine
Install from
Python package on PyPI: mcp-neo4j-memory
Written in
Python
License
MIT
GitHub stars
994
Official MCP registry
io.github.neo4j-contrib/mcp-neo4j-memory

Tools Neo4j Memory gives your AI app

  • read_graph
  • search_nodes
  • find_nodes
  • create_entities
  • delete_entities
  • create_relations
  • delete_relations
  • add_observations
  • delete_observations

Tool names as the Neo4j Memory README lists them. Your AI app shows the live list once Neo4j Memory is connected.

How to set up Neo4j Memory

  1. Install uv on the machine that runs your AI app, because Neo4j Memory starts with uvx and fetches its Python package on first run.
  2. Create NEO4J_URI, NEO4J_USERNAME and NEO4J_PASSWORD for Neo4j Memory in the connected service's own settings, scoped to the smallest permissions the job needs.
  3. Add Neo4j Memory to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Neo4j Memory tools to confirm the connection.
  5. Run one read-only task with Neo4j Memory first, such as a call to read_graph, before you allow anything that writes or sends.

Neo4j Memory compared with similar servers

  • Universal DB by Anarkh-Lee has fewer GitHub stars than Neo4j Memory (943 against 994); both are community servers, and both run locally.
  • Neo4j Data Modeling by neo4j-contrib has fewer GitHub stars than Neo4j Memory (994 against 994); both are community servers, and both run locally. The Neo4j Data Modeling README lists 16 tools to Neo4j Memory's 9.
  • NornicDB by orneryd has fewer GitHub stars than Neo4j Memory (937 against 994); both are community servers, and both run locally.

Before you connect Neo4j Memory

  • Give Neo4j Memory its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Neo4j Memory tool call until you trust what it does with them.
  • Treat text that Neo4j Memory fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Neo4j Memory on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Neo4j Memory

How marketing and sales teams put Neo4j Memory to work, by company size. Pick the size closest to yours and start Neo4j Memory on one use case.

Small business

  • A small business with its own app can ask Neo4j Memory plain questions about customers and orders, without writing SQL.
  • Owners can use Neo4j Memory to pull a list of customers who haven't bought in 90 days and plan a win-back email.
  • A small business can give Neo4j Memory its offers, FAQs and tone of voice once, so every draft starts from the same facts.
  • Neo4j Memory runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing analysts can connect Neo4j Memory to answer campaign questions from the warehouse directly, instead of waiting on the data team's queue.
  • Lifecycle teams can use Neo4j Memory to build audience lists from product data and check counts before a send.
  • Marketing teams can connect Neo4j Memory to positioning docs and past campaigns, so agents write on message without a long prompt each time.
  • Start with read_graph and search_nodes, the tools Neo4j Memory lists first, and add more once the team trusts the results.

Enterprise

  • Enterprises should point Neo4j Memory at a read replica with a read-only role, so agents query freely without risk to production data.
  • Data teams can expose curated views through Neo4j Memory, so marketing gets self-serve answers without access to raw customer tables.
  • Enterprises can use Neo4j Memory with permissions that follow the source documents, so an agent only recalls what the person asking may see.
  • Neo4j Memory is a community server, so have security review the code and pin a version before Neo4j Memory touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Neo4j Memory README

From neo4j-contrib/mcp-neo4j on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

🧠🕸️ Neo4j Knowledge Graph Memory MCP Server

mcp-name: io.github.neo4j-contrib/mcp-neo4j-memory

🌟 Overview

A Model Context Protocol (MCP) server implementation that provides persistent memory capabilities through Neo4j graph database integration.

By storing information in a graph structure, this server maintains complex relationships between entities as memory nodes and enables long-term retention of knowledge that can be queried and analyzed across multiple conversations or sessions.

With Neo4j Aura you can host your own database server for free or share it with your collaborators. Otherwise you can run your own Neo4j server locally.

The MCP server leverages Neo4j's graph database capabilities to create an interconnected knowledge base that serves as an external memory system. Through Cypher queries, it allows exploration and retrieval of stored information, relationship analysis between different data points, and generation of insights from the accumulated knowledge. This memory can be further enhanced with Claude's capabilities.

🕸️ Graph Schema
  • Memory - A node representing an entity with a name, type, and observations.
  • Relationship - A relationship between two entities with a type.
🔍 Usage Example
Let's add some memories 
I, Michael, living in Dresden, Germany work at Neo4j which is headquartered in Sweden with my colleagues Andreas (Cambridge, UK) and Oskar (Gothenburg, Sweden)
I work in Product Management, Oskar in Engineering and Andreas in Developer Relations.

Results in Claude calling the create_entities and create_relations tools.

📦 Components

🔧 Tools

The server offers these core tools:

🔎 Query Tools
  • read_graph

    • Read the entire knowledge graph
    • No input required
    • Returns: Complete graph with entities and relations
  • search_nodes

    • Search for nodes based on a query
    • Input:
      • query (string): Search query matching names, types, observations
    • Returns: Matching subgraph
  • find_nodes

    • Find specific nodes by name
    • Input:
      • names (array of strings): Entity names to retrieve
    • Returns: Subgraph with specified nodes
♟️ Entity Management Tools
  • create_entities

    • Create multiple new entities in the knowledge graph
    • Input:
      • entities: Array of objects with:
        • name (string): Name of the entity
        • type (string): Type of the entity
        • observations (array of strings): Initial observations about the entity
    • Returns: Created entities
  • delete_entities

    • Delete multiple entities and their associated relations
    • Input:
      • entityNames (array of strings): Names of entities to delete
    • Returns: Success confirmation
🔗 Relation Management Tools
  • create_relations

    • Create multiple new relations between entities
    • Input:
      • relations: Array of objects with:
        • source (string): Name of source entity
        • target (string): Name of target entity
        • relationType (string): Type of relation
    • Returns: Created relations
  • delete_relations

    • Delete multiple relations from the graph
    • Input:
      • relations: Array of objects with same schema as create_relations
    • Returns: Success confirmation
📝 Observation Management Tools
  • add_observations

    • Add new observations to existing entities
    • Input:
      • observations: Array of objects with:
        • entityName (string): Entity to add to
        • contents (array of strings): Observations to add
    • Returns: Added observation details
  • delete_observations

    • Delete specific observations from entities
    • Input:
      • deletions: Array of objects with:
        • entityName (string): Entity to delete from
        • observations (array of strings): Observations to remove
    • Returns: Success confirmation

🔧 Usage with Claude Desktop

💾 Installation
pip install mcp-neo4j-memory
⚙️ Configuration

Add the server to your claude_desktop_config.json with configuration of:

"mcpServers": {
  "neo4j": {
    "command": "uvx",
    "args": [
      "mcp-neo4j-memory@0.4.5",
      "--db-url",
      "neo4j+s://xxxx.databases.neo4j.io",
      "--username",
      "<your-username>",
      "--password",
      "<your-password>"
    ]
  }
}

Alternatively, you can set environment variables:

"mcpServers": {
  "neo4j": {
    "command": "uvx",
    "args": [ "mcp-neo4j-memory@0.4.5" ],
    "env": {
      "NEO4J_URL": "neo4j+s://xxxx.databases.neo4j.io",
      "NEO4J_USERNAME": "<your-username>",
      "NEO4J_PASSWORD": "<your-password>"
    }
  }
}
Namespacing

For multi-tenant deployments, add --namespace to prefix tool names:

"args": [ "mcp-neo4j-memory@0.4.5", "--namespace", "myapp", "--db-url", "..." ]

Tools become: myapp-read_graph, myapp-create_entities, etc.

Can also use NEO4J_NAMESPACE environment variable.

🌐 HTTP Transport Mode

The server supports HTTP transport for web-based deployments and microservices:

# Basic HTTP mode (defaults: host=127.0.0.1, port=8000, path=/mcp/)
mcp-neo4j-memory --transport http

# Custom HTTP configuration
mcp-neo4j-memory --transport http --host 127.0.0.1 --port 8080 --path /mcp/

Environment variables for HTTP configuration:

export NEO4J_TRANSPORT=http
export NEO4J_MCP_SERVER_HOST=127.0.0.1
export NEO4J_MCP_SERVER_PORT=8080
export NEO4J_MCP_SERVER_PATH=/mcp/
export NEO4J_NAMESPACE=myapp
mcp-neo4j-memory
🔄 Transport Modes

The server supports three transport modes:

  • STDIO (default): Standard input/output for local tools and Claude Desktop
  • SSE: Server-Sent Events for web-based deployments
  • HTTP: Streamable HTTP for modern web deployments and microservices
🐳 Using with Docker
"mcpServers": {
  "neo4j": {
    "command": "docker",
    "args": [
      "run",
      "--rm",
      "-e", "NEO4J_URL=neo4j+s://xxxx.databases.neo4j.io",
      "-e", "NEO4J_USERNAME=<your-username>",
      "-e", "NEO4J_PASSWORD=<your-password>",
      "mcp/neo4j-memory:0.4.5"
    ]
  }
}

🔒 Security Protection

The server includes comprehensive security protection with secure defaults that protect against common web-based attacks while preserving full MCP functionality when using HTTP transport.

🛡️ DNS Rebinding Protection

TrustedHost Middleware validates Host headers to prevent DNS rebinding attacks:

Secure by Default:

  • Only localhost and 127.0.0.1 hosts are allowed by default

Environment Variable:

export NEO4J_MCP_SERVER_ALLOWED_HOSTS="example.com,www.example.com"
🌐 CORS Protection

Cross-Origin Resource Sharing (CORS) protection blocks browser-based requests by default:

Environment Variable:

export NEO4J_MCP_SERVER_ALLOW_ORIGINS="https://example.com,https://app.example.com"
🔧 Complete Security Configuration

Development Setup:

mcp-neo4j-memory --transport http \
  --allowed-hosts "localhost,127.0.0.1" \
  --allow-origins "http://localhost:3000"

Production Setup:

mcp-neo4j-memory --transport http \
  --allowed-hosts "example.com,www.example.com" \
  --allow-origins "https://example.com,https://app.example.com"
🚨 Security Best Practices

For allow_origins:

  • Be specific: ["https://example.com", "https://example.com"]
  • Never use "*" in production with credentials
  • Use HTTPS origins in production

For allowed_hosts:

  • Include your actual domain: ["example.com", "www.example.com"]
  • Include localhost only for development
  • Never use "*" unless you understand the risks

🐳 Docker Deployment

The Neo4j Memory MCP server can be deployed using Docker for remote deployments. Docker deployment should use HTTP transport for web accessibility. In order to integrate this deployment with applications like Claude Desktop, you will have to use a proxy in your MCP configuration such as mcp-remote.

📦 Using Your Built Image

After building locally with docker build -t mcp-neo4j-memory:latest .:

# Run with http transport (default for Docker)
docker run --rm -p 8000:8000 \
  -e NEO4J_URI="bolt://host.docker.internal:7687" \
  -e NEO4J_USERNAME="neo4j" \
  -e NEO4J_PASSWORD="password" \
  -e NEO4J_DATABASE="neo4j" \
  -e NEO4J_TRANSPORT="http" \
  -e NEO4J_MCP_SERVER_HOST="0.0.0.0" \
  -e NEO4J_MCP_SERVER_PORT="8000" \
  -e NEO4J_MCP_SERVER_PATH="/mcp/" \
  mcp/neo4j-memory:latest

# Run with security middleware for production
docker run --rm -p 8000:8000 \
  -e NEO4J_URI="bolt://host.docker.internal:7687" \
  -e NEO4J_USERNAME="neo4j" \
  -e NEO4J_PASSWORD="password" \
  -e NEO4J_DATABASE="neo4j" \
  -e NEO4J_TRANSPORT="http" \
  -e NEO4J_MCP_SERVER_HOST="0.0.0.0" \
  -e NEO4J_MCP_SERVER_PORT="8000" \
  -e NEO4J_MCP_SERVER_PATH="/mcp/" \
  -e NEO4J_MCP_SERVER_ALLOWED_HOSTS="example.com,www.example.com" \
  -e NEO4J_MCP_SERVER_ALLOW_ORIGINS="https://example.com" \
  mcp/neo4j-memory:latest
🔧 Environment Variables
Variable Default Description
NEO4J_URI bolt://localhost:7687 Neo4j connection URI
NEO4J_USERNAME neo4j Neo4j username
NEO4J_PASSWORD password Neo4j password
NEO4J_DATABASE neo4j Neo4j database name
NEO4J_TRANSPORT stdio (local), http (remote) Transport protocol (stdio, http, or sse)
NEO4J_MCP_SERVER_HOST 127.0.0.1 (local) Host to bind to
NEO4J_MCP_SERVER_PORT 8000 Port for HTTP/SSE transport
NEO4J_MCP_SERVER_PATH /mcp/ Path for accessing MCP server
NEO4J_MCP_SERVER_ALLOW_ORIGINS (empty - secure by default) Comma-separated list of allowed CORS origins
NEO4J_MCP_SERVER_ALLOWED_HOSTS localhost,127.0.0.1 Comma-separated list of allowed hosts (DNS rebinding protection)
NEO4J_NAMESPACE (empty - no prefix) Namespace prefix for tool names (e.g., myapp-read_graph)
🌐 SSE Transport for Legacy Web Access

When using SSE transport (for legacy web clients), the server exposes an HTTP endpoint:

# Start the server with SSE transport
docker run -d -p 8000:8000 \
  -e NEO4J_URI="neo4j+s://demo.neo4jlabs.com" \
  -e NEO4J_USERNAME="recommendations" \
  -e NEO4J_PASSWORD="recommendations" \
  -e NEO4J_DATABASE="neo4j" \
  -e NEO4J_TRANSPORT="sse" \
  -e NEO4J_MCP_SERVER_HOST="0.0.0.0" \
  -e NEO4J_MCP_SERVER_PORT="8000" \
  --name neo4j-memory-mcp-server \
  mcp-neo4j-memory:latest

# Test the SSE endpoint
curl http://localhost:8000/sse

# Use with MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:8000/sse

🚀 Development

📦 Prerequisites
  1. Install uv (Universal Virtualenv):
# Using pip
pip install uv

# Using Homebrew on macOS
brew install uv

# Using cargo (Rust package manager)
cargo install uv
  1. Clone the repository and set up development environment:
# Clone the repository
git clone https://github.com/yourusername/mcp-neo4j-memory.git
cd mcp-neo4j-memory

# Create and activate virtual environment using uv
uv venv
source .venv/bin/activate  # On Unix/macOS
.venv\Scripts\activate     # On Windows

# Install dependencies including dev dependencies
uv pip install -e ".[dev]"
🐳 Docker

Build and run the Docker container:

# Build the image
docker build -t mcp/neo4j-memory:latest .

# Run the container
docker run -e NEO4J_URL="neo4j+s://xxxx.databases.neo4j.io" \
          -e NEO4J_USERNAME="your-username" \
          -e NEO4J_PASSWORD="your-password" \
          mcp/neo4j-memory:latest

📄 License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Questions about Neo4j Memory

What is the Neo4j Memory MCP server?

MCP Neo4j Knowledge Graph Memory Server. Neo4j Memory is maintained by neo4j-contrib on GitHub at neo4j-contrib/mcp-neo4j, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Neo4j Memory MCP server?

Add Neo4j Memory to your AI app's MCP config with the command uvx mcp-neo4j-memory==0.4.2. In Claude Code, run claude mcp add --transport stdio neo4j-contrib-mcp-neo4j-memory -- uvx mcp-neo4j-memory==0.4.2. To run Neo4j Memory this way you need uv installed.

Does Neo4j Memory need an API key?

Yes. Neo4j Memory expects NEO4J_URI, NEO4J_USERNAME and NEO4J_PASSWORD to be set. Create the key for Neo4j Memory in the connected service's own settings, give it the smallest permissions the job needs, and keep it out of shared config files.

Is Neo4j Memory an official MCP server?

No. Neo4j Memory is a community server maintained by neo4j-contrib. Community servers can be excellent; read the code and the open issues before you give Neo4j Memory access to company data.

What license is Neo4j Memory under?

Neo4j Memory is released under the MIT license, according to its GitHub repository. The license covers the code of Neo4j Memory; the service it connects to has its own terms.