GraphRAG MCP

GraphRAG MCP

Enables enterprise document retrieval using graph-based reasoning and knowledge graphs. Allows agents to search and extract information from scattered documents through structured entity and relationship extraction.

Category
Visit Server

README

Why GraphRAG MCP

To improve information retrieval efficiency within enterprises, there is a need for an Agent capable of extracting user-relevant information from scattered documents. By building enterprise document retrieval as an MCP (Model Context Protocol), other agents within the organization can simply connect to this MCP whenever document retrieval is required. This approach centralizes document search capabilities, making it easier to integrate and scale intelligent agents across the enterprise.

How to Run

  1. Fill in the required environment variables in both .env files located in the project root and in the graphrag/ directory.

  2. Open your terminal and navigate to the project root directory.

  3. Run the following command to start the GraphRAG MCP:

    uv run rag_client.py rag_server.py
    

After these steps, the GraphRAG MCP will be up and running.

Code Structure

.
├── main.py
├── rag_client.py # MCP client for graphrag
├── rag_server.py # MCP server for graphrag
├── pyproject.toml
├── .env 
├── .gitignore
├── .python-version
├── README.md
└── graphrag/
    ├── .env
    ├── settings.yaml
    ├── cache/
    │   ├── community_reporting/
    │   ├── extract_graph/
    │   ├── summarize_descriptions/
    │   └── text_embedding/
    ├── input/ 
    │   └── test.txt # knowledge base
    ├── logs/
    ├── output/
    │   ├── context.json
    │   ├── stats.json
    │   └── lancedb/
    └── prompts/
        ├── basic_search_system_prompt.txt
        ├── community_report_graph.txt
        ├── community_report_text.txt
        ├── drift_reduce_prompt.txt
        ├── drift_search_system_prompt.txt
        ├── extract_claims.txt
        ├── extract_graph.txt
        └── ...

Folder and File Descriptions

  • rag_client.py: Client for interacting with the RAG server.
  • rag_server.py: Server providing RAG-based tools.
  • pyproject.toml: Python project configuration.
  • .env, .gitignore, .python-version: Environment and versioning files.

graphrag/

  • .env, settings.yaml: Environment and configuration for GraphRAG.
  • cache/: Stores intermediate results for various pipeline stages.
    • community_reporting/: Caches community report data.
    • extract_graph/: Caches graph extraction results.
    • summarize_descriptions/: Caches description summaries.
    • text_embedding/: Caches text embeddings for retrieval.
  • input/: Contains input data files.
  • logs/: Stores log files generated during runs.
  • output/: Stores output data such as context and statistics.
    • context.json: Output context data.
    • stats.json: Output statistics.
    • lancedb/: Database files for vector storage.
  • prompts/: Contains prompt templates for different tasks.
    • basic_search_system_prompt.txt: Prompt for basic search.
    • community_report_graph.txt: Prompt for graph-based community reports.
    • community_report_text.txt: Prompt for text-based community reports.
    • drift_reduce_prompt.txt, drift_search_system_prompt.txt: Prompts for drift analysis.
    • extract_claims.txt, extract_graph.txt: Prompts for claim and graph extraction.

Core Technology: GraphRAG

GraphRAG is a Retrieval-Augmented Generation (RAG) framework that integrates graph-based reasoning with large language models. It enhances traditional RAG by representing entities, relationships, and claims as a knowledge graph, enabling more structured and context-aware retrieval.

How GraphRAG Works

  1. Data Ingestion: Raw text and tabular data are processed to extract entities, relationships, and claims, which are stored in a graph structure.
  2. Prompting: Custom prompts guide the language model to generate responses grounded in the graph data.
  3. Retrieval: When a query is received, relevant nodes and edges from the graph are retrieved using semantic search and graph traversal.
  4. Generation: The language model synthesizes answers using both the retrieved graph context and prompt templates, ensuring responses are accurate and well-grounded.
  5. Caching and Output: Intermediate and final results are cached for efficiency and stored for further analysis.

This approach allows for more explainable, reliable, and context-rich answers compared to standard RAG pipelines.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured