GraphRAG MCP server

Combines Neo4j graph database and Qdrant vector database for powerful document search with semantic relevance and structural context expansion through relationship following
Back to servers
Provider
Riley Lemm
Release date
Apr 04, 2025
Language
Python
Stats
25 stars

GraphRAG MCP is a server that implements the Model Context Protocol, combining Neo4j (graph database) and Qdrant (vector database) to enable powerful document retrieval through semantic search and graph relationships. It integrates with large language models to provide enhanced context retrieval capabilities.

Prerequisites

  • Python 3.12+
  • Neo4j running on localhost:7687 (default configuration)
  • Qdrant running on localhost:6333 (default configuration)
  • Document data indexed in both databases

Installation

Quick Start

  1. Clone the repository:

    git clone https://github.com/rileylemm/graphrag_mcp.git
    cd graphrag_mcp
    
  2. Install dependencies with uv:

    uv install
    
  3. Configure your database connections in the .env file:

    # Neo4j Configuration
    NEO4J_URI=bolt://localhost:7687
    NEO4J_USER=neo4j
    NEO4J_PASSWORD=password
    
    # Qdrant Configuration
    QDRANT_HOST=localhost
    QDRANT_PORT=6333
    QDRANT_COLLECTION=document_chunks
    
  4. Run the server:

    uv run main.py
    

Setting up Neo4j and Qdrant

  1. Install and start Neo4j:

    # Using Docker
    docker run \
      --name neo4j \
      -p 7474:7474 -p 7687:7687 \
      -e NEO4J_AUTH=neo4j/password \
      -v $HOME/neo4j/data:/data \
      -v $HOME/neo4j/logs:/logs \
      -v $HOME/neo4j/import:/import \
      -v $HOME/neo4j/plugins:/plugins \
      neo4j:latest
    
  2. Install and start Qdrant:

    # Using Docker
    docker run -p 6333:6333 -p 6334:6334 \
      -v $HOME/qdrant/storage:/qdrant/storage \
      qdrant/qdrant
    

Integration with MCP Clients

Claude Desktop / Cursor Integration

  1. Make the run script executable:

    chmod +x run_server.sh
    
  2. Add the server to your MCP configuration file (~/.cursor/mcp.json or Claude Desktop equivalent):

    {
      "mcpServers": {
        "GraphRAG": {
          "command": "/path/to/graphrag_mcp/run_server.sh",
          "args": []
        }
      }
    }
    
  3. Restart your MCP client (Cursor, Claude Desktop, etc.)

Usage

MCP Tools

This server provides the following tools for LLM use:

  1. search_documentation - Search for information using semantic search

    # Example usage in MCP context
    result = search_documentation(
        query="How does graph context expansion work?",
        limit=5,
        category="technical"
    )
    
  2. hybrid_search - Search using both semantic and graph-based approaches

    # Example usage in MCP context
    result = hybrid_search(
        query="Vector similarity with graph relationships",
        limit=10,
        category=None,
        expand_context=True
    )
    

MCP Resources

The server provides the following resources:

  1. https://graphrag.db/schema/neo4j - Information about the Neo4j graph schema
  2. https://graphrag.db/collection/qdrant - Information about the Qdrant vector collection

Troubleshooting

  • Connection issues: Ensure Neo4j and Qdrant are running and accessible
  • Empty results: Check that your document collection is properly indexed
  • Missing dependencies: Run uv install to ensure all packages are installed
  • Database authentication: Verify credentials in your .env file

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later