Labsco
chen9z logo

Graphiti MCP Server

from chen9z

A framework for building and querying temporally-aware knowledge graphs for AI agents.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

Graphiti MCP Server

Graphiti is a framework for building and querying temporally-aware knowledge graphs, specifically tailored for AI agents operating in dynamic environments. Unlike traditional retrieval-augmented generation (RAG) methods, Graphiti continuously integrates user interactions, structured and unstructured enterprise data, and external information into a coherent, queryable graph. The framework supports incremental data updates, efficient retrieval, and precise historical queries without requiring complete graph recomputation, making it suitable for developing interactive, context-aware AI applications.

This is an experimental Model Context Protocol (MCP) server implementation for Graphiti. The MCP server exposes Graphiti's key functionality through the MCP protocol, allowing AI assistants to interact with Graphiti's knowledge graph capabilities.

Features

The Graphiti MCP server exposes the following key high-level functions of Graphiti:

  • Episode Management: Add, retrieve, and delete episodes (text, messages, or JSON data)
  • Entity Management: Search and manage entity nodes and relationships in the knowledge graph
  • Search Capabilities: Search for facts (edges) and node summaries using semantic and hybrid search
  • Group Management: Organize and manage groups of related data with group_id filtering
  • Graph Maintenance: Clear the graph and rebuild indices

Integrating with MCP Clients

Configuration

To use the Graphiti MCP server with an MCP-compatible client, configure it to connect to the server:

[!IMPORTANT] You will need the Python package manager, uv installed. Please refer to the uv install instructions.

Ensure that you set the full path to the uv binary and your Graphiti project folder.

{
  "mcpServers": {
    "graphiti-memory": {
      "transport": "stdio",
      "command": "/Users/<user>/.local/bin/uv",
      "args": [
        "run",
        "--isolated",
        "--directory",
        "/Users/<user>>/dev/zep/graphiti/mcp_server",
        "--project",
        ".",
        "graphiti_mcp_server.py",
        "--transport",
        "stdio"
      ],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USER": "neo4j",
        "NEO4J_PASSWORD": "password",
        "OPENAI_API_KEY": "sk-XXXXXXXX",
        "MODEL_NAME": "gpt-4.1-mini"
      }
    }
  }
}

For SSE transport (HTTP-based), you can use this configuration:

{
  "mcpServers": {
    "graphiti-memory": {
      "transport": "sse",
      "url": "http://localhost:8000/sse"
    }
  }
}

Available Tools

The Graphiti MCP server exposes the following tools:

  • add_episode: Add an episode to the knowledge graph (supports text, JSON, and message formats)
  • search_nodes: Search the knowledge graph for relevant node summaries
  • search_facts: Search the knowledge graph for relevant facts (edges between entities)
  • delete_entity_edge: Delete an entity edge from the knowledge graph
  • delete_episode: Delete an episode from the knowledge graph
  • get_entity_edge: Get an entity edge by its UUID
  • get_episodes: Get the most recent episodes for a specific group
  • clear_graph: Clear all data from the knowledge graph and rebuild indices
  • get_status: Get the status of the Graphiti MCP server and Neo4j connection

Working with JSON Data

The Graphiti MCP server can process structured JSON data through the add_episode tool with source="json". This allows you to automatically extract entities and relationships from structured data:


add_episode(
name="Customer Profile",
episode_body="{\"company\": {\"name\": \"Acme Technologies\"}, \"products\": [{\"id\": \"P001\", \"name\": \"CloudSync\"}, {\"id\": \"P002\", \"name\": \"DataMiner\"}]}",
source="json",
source_description="CRM data"
)

Integrating with the Cursor IDE

To integrate the Graphiti MCP Server with the Cursor IDE, follow these steps:

  1. Run the Graphiti MCP server using the SSE transport:
python graphiti_mcp_server.py --transport sse --use-custom-entities --group-id <your_group_id>

Hint: specify a group_id to namespace graph data. If you do not specify a group_id, the server will use "default" as the group_id.

or

docker compose up
  1. Configure Cursor to connect to the Graphiti MCP server.
{
  "mcpServers": {
    "graphiti-memory": {
      "url": "http://localhost:8000/sse"
    }
  }
}
  1. Add the Graphiti rules to Cursor's User Rules. See cursor_rules.md for details.

  2. Kick off an agent session in Cursor.

The integration enables AI assistants in Cursor to maintain persistent memory through Graphiti's knowledge graph capabilities.

Integrating with Claude Desktop (Docker MCP Server)

The Graphiti MCP Server container uses the SSE MCP transport. Claude Desktop does not natively support SSE, so you'll need to use a gateway like mcp-remote.

  1. Run the Graphiti MCP server using SSE transport:

    docker compose up
  2. (Optional) Install mcp-remote globally: If you prefer to have mcp-remote installed globally, or if you encounter issues with npx fetching the package, you can install it globally. Otherwise, npx (used in the next step) will handle it for you.

    npm install -g mcp-remote
  3. Configure Claude Desktop: Open your Claude Desktop configuration file (usually claude_desktop_config.json) and add or modify the mcpServers section as follows:

    {
      "mcpServers": {
        "graphiti-memory": {
          // You can choose a different name if you prefer
          "command": "npx", // Or the full path to mcp-remote if npx is not in your PATH
          "args": [
            "mcp-remote",
            "http://localhost:8000/sse" // Ensure this matches your Graphiti server's SSE endpoint
          ]
        }
      }
    }

    If you already have an mcpServers entry, add graphiti-memory (or your chosen name) as a new key within it.

  4. Restart Claude Desktop for the changes to take effect.