Neo4j Model Context Protocol (MCP) Servers

repository·main·Indexed 21 days ago

https://github.com/neo4j-contrib/mcp-neo4j

A collection of MCP servers by Neo4j Labs that enable LLMs to interact with Neo4j databases. Includes mcp-neo4j-cypher for natural language to Cypher queries, mcp-neo4j-memory for knowledge graph memory, mcp-neo4j-cloud-aura-api (mcp-neo4j-aura-manager) for managing Aura cloud instances, and mcp-neo4j-data-modeling for graph visualization. Supports STDIO, SSE, and HTTP transport modes for local and cloud deployments.

Tokens
29.5K
Snippets
86
Records
127
Agent score
74%

What's inside mcp-neo4j

  1. Overview of Neo4j Knowledge Graph Memory MCP Server

    main

    The mcp-neo4j-memory server is a Model Context Protocol (MCP) implementation that provides persistent memory capabilities using a Neo4j graph database. It allows LLMs to store and retrieve complex relationships between entities as a long-term knowledge base.

    Graph Schema

    • Memory: A node representing an entity with a name, type, and observations.
    • Relationship: A connection between two entities with a type.
  2. Overview of Neo4j Data Modeling MCP Server

    main

    The mcp-neo4j-data-modeling server (mcp-name: io.github.neo4j-contrib/mcp-neo4j-data-modeling) is a Model Context Protocol (MCP) implementation designed for creating, visualizing, and managing Neo4j graph data models.

    It allows developers and AI agents to:

    • Define nodes, relationships, and properties.
    • Design graph database schemas.
    • Visualize models interactively using Mermaid.
    • Validate data model structures.
    • Export/Import models between formats like Arrows JSON, OWL Turtle, and Pydantic models.
    • Generate Cypher queries for data ingestion.
  3. Overview of Neo4j Labs MCP Servers

    main

    Neo4j Labs provides a suite of Model Context Protocol (MCP) servers that allow LLM clients (like Claude Desktop, VS Code, Cursor, Windsurf, or Gemini CLI) to interact with Neo4j databases and services using natural language.

    These servers enable tasks such as:

    • Querying graph data using natural language to Cypher.
    • Managing Neo4j Aura cloud instances.
    • Storing and retrieving personal knowledge graph memory.
    • Modeling and visualizing graph data structures.
  4. Configure MCP Server Transport Modes

    main

    All Neo4j MCP servers support three transport modes:

    1. STDIO (Default): Used for local tools and integration with Claude Desktop.
    2. SSE: Server-Sent Events, intended for web-based deployments.
    3. HTTP: Streamable HTTP, designed for modern web deployments, microservices, and scalable cloud environments.
  5. Namespace tools in mcp-neo4j-data-modeling

    main

    To run multiple independent instances of the server within the same environment, use the --namespace flag. This prefixes all tools with the provided namespace (e.g., app1-validate_node), allowing multiple configurations to coexist without tool name collisions.

    "mcpServers": {
      "neo4j-data-modeling-app1": {
        "command": "uvx",
        "args": [ "mcp-neo4j-data-modeling@0.8.2", "--transport", "stdio", "--namespace", "app1" ]
      },
      "neo4j-data-modeling-app2": {
        "command": "uvx", 
        "args": [ "mcp-neo4j-data-modeling@0.8.2", "--transport", "stdio", "--namespace", "app2" ]
      }
    }
  6. Configure Namespacing for Multi-tenant Deployments

    main

    To prevent tool name collisions in multi-tenant environments, you can prefix all tool names using the --namespace flag or the NEO4J_NAMESPACE environment variable. For example, if the namespace is myapp, the tool read_graph becomes myapp-read_graph.

    "args": [ "mcp-neo4j-memory@0.4.5", "--namespace", "myapp", "--db-url", "..." ]
  7. Configure Namespacing for Multi-tenant Deployments

    main

    The server supports namespacing to prefix tool names. This is useful when running multiple instances of the server for different tenants. When a namespace (e.g., myapp) is provided, tools are prefixed accordingly (e.g., myapp-list_instances).

    CLI Usage:

    mcp-neo4j-aura-manager --client-id <id> --client-secret <secret> --namespace myapp

    Environment Variables: Set NEO4J_NAMESPACE to apply the prefix.

    export NEO4J_NAMESPACE=myapp
    mcp-neo4j-aura-manager
    "mcpServers": {
      "neo4j-aura-app1": {
        "command": "uvx",
        "args": [
          "mcp-neo4j-aura-manager@0.4.8",
          "--client-id", "<your-client-id>",
          "--client-secret", "<your-client-secret>",
          "--namespace", "app1"
        ]
      }
    }
  8. Secure HTTP Transport Configuration

    main

    When using HTTP transport, the server implements DNS Rebinding and CORS protection by default.

    Security Best Practices:

    • allow_origins: Be specific (e.g., ["https://example.com"]). Never use "*" in production.
    • allowed_hosts: Include your actual domain (e.g., ["example.com"]). Include localhost only for development. Never use "*" unless you understand the risks.
    # Production Setup
    mcp-neo4j-aura-manager --transport http \
      --allowed-hosts "example.com,www.example.com" \
      --allow-origins "https://example.com,https://example.com"
  9. Available Neo4j MCP Servers

    main

    The repository contains several specialized MCP servers:

    • mcp-neo4j-cypher: Converts natural language to Cypher queries. It can retrieve database schemas and execute both read and write queries. Requirement: The APOC plugin must be installed and enabled on the Neo4j instance for schema inspection.
    • mcp-neo4j-memory: Provides a knowledge graph memory system. It allows storing and retrieving entities and relationships in a local or remote Neo4j instance across different sessions and clients.
    • mcp-neo4j-cloud-aura-api: Manages Neo4j Aura cloud services. Use it to create, destroy, find, or scale Aura instances and enable specific features via chat.
    • mcp-neo4j-data-modeling: Facilitates interactive graph data modeling and visualization. It supports importing and exporting models from Arrows.app.