home / mcp / graphiti mcp server

Graphiti MCP Server

Provides memory-backed tool discovery and context synthesis for AI agents via a graph database.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "apexneural-hansika-graphiti_mcp": {
      "url": "http://localhost:8000/sse",
      "headers": {
        "NEO4J_URI": "neo4j+s://xxxxx.databases.neo4j.io",
        "MODEL_NAME": "openai/gpt-4o-mini",
        "NEO4J_PASSWORD": "your_password",
        "OPENAI_API_KEY": "sk-...",
        "OPEN_ROUTER_API_KEY": "sk-..."
      }
    }
  }
}

You can run a Graphiti-based MCP server that enables AI agents hosted on Cursor and Claude to discover tools, access persistent memories, and maintain context across sessions. This server stores memories and relationships in a graph database and exposes tools to store, retrieve, and synthesize context, making AI interactions more coherent and capable over time.

How to use

You connect your MCP clients to the Graphiti MCP Server to enable dynamic tool discovery and memory-enabled responses. Start the server locally and choose between the HTTP (SSE) transport for Cursor or the stdio transport for Claude. Use memory tools to store memories, retrieve related memories, create relationships, get synthesized context, and perform graph searches to query stored knowledge.

Operational flow: start the server, ensure your Neo4j connection details are configured, and then configure your MCP client with the provided endpoints. Once connected, your AI agents can store memories, retrieve relevant context, and receive context-informed responses that reflect past interactions.

How to install

Prerequisites: you need Python 3.10 or higher, the uv package manager (recommended) or pip, and a Neo4j database. You also need an OpenRouter API key or an OpenAI API key.

Install dependencies using the recommended uv method or via pip, then install the Python package in editable mode or install the dependencies directly.

python -m venv venv
source venv/bin/activate  # on macOS/Linux
venv\Scripts\activate     # on Windows

# Install via uv (recommended)
uv sync

# Or install via pip in editable mode
pip install -e .

# Or install dependencies directly
pip install mcp neo4j openai python-dotenv

# Optional: install all dependencies in one line
pip install mcp neo4j openai python-dotenv

Configuration and startup notes

Prepare environment variables before starting the server. Copy the example environment file, then edit it with your credentials.

cp .env.example .env

In the environment, include your Neo4j connection details and API keys. Neo4j should be accessible via the URI you provide, and you should have a password for the database. Provide an API key for OpenRouter or a direct OpenAI API key.

Important: you can use a free Neo4j Aura instance or any Neo4j instance. For Neo4j Aura, use a secure URI in the form neo4j+s://xxxxx.databases.neo4j.io.

Run the MCP server

Choose the transport that matches your MCP client. For Cursor (SSE transport) run the server on a specific port. For Claude (stdio transport) start the server in stdio mode.

# Simple, recommended startup via script
# Windows
.\run-server.ps1

# Or run directly (SSE)
uv run graphiti_mcp_server.py --transport sse --port 8000

# Alternatively, with Python directly
python graphiti_mcp_server.py --transport sse --port 8000

# Claude (stdio transport)
uv run graphiti_mcp_server.py --transport stdio

Web UI and integration examples

A web-based interface is available to interact with the Graphiti MCP Server. Start the web UI and open it in your browser to manage memories, view context, and run graph queries.

# Start the Web UI
.\run-web-ui.ps1  # Windows

# Or run directly
python web_ui_server.py

# Open in browser
http://localhost:8081

Integrations with MCP clients

Configure your MCP clients to connect to the Graphiti server. The Cursor client connects via SSE to the HTTP endpoint, while Claude connects via stdio to the local process.

Cursor example endpoint configuration (SSE): set your mcp.json to include the Graphiti server with the SSE URL.

Example usage and tools

The Graphiti MCP Server exposes a set of tools to work with memories and context.

Available tools

store_memory

Store a memory or context in the graph database for future retrieval.

retrieve_memories

Retrieve relevant memories from the graph database based on a query or semantic similarity.

create_relationship

Create relationships between memories or entities to build a knowledge graph.

get_context

Get contextual information for a given query by synthesizing memories.

search_graph

Execute a Cypher query to search the graph database.