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.
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
-
Fill in the required environment variables in both
.envfiles located in the project root and in thegraphrag/directory. -
Open your terminal and navigate to the project root directory.
-
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
- Data Ingestion: Raw text and tabular data are processed to extract entities, relationships, and claims, which are stored in a graph structure.
- Prompting: Custom prompts guide the language model to generate responses grounded in the graph data.
- Retrieval: When a query is received, relevant nodes and edges from the graph are retrieved using semantic search and graph traversal.
- Generation: The language model synthesizes answers using both the retrieved graph context and prompt templates, ensuring responses are accurate and well-grounded.
- 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。