GraphRAG MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GraphRAG MCP ServerExplain graph retrieval strategies for LLM reasoning."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GraphRAG MCP Server
A comprehensive Model Context Protocol (MCP) server providing structured access to knowledge about Knowledge Graph Construction & Retrieval Strategies for LLM Reasoning. This server enables AI agents to access detailed research findings, implementation patterns, and best practices for building graph-enhanced retrieval-augmented generation systems.
๐ฏ What This Server Provides
This MCP server offers hierarchical access to 59 pages of comprehensive research covering:
7 Knowledge Graph Construction Patterns for LLM reasoning
5 Embedding Fusion Strategies combining semantic and structural representations
6 Retrieval & Search Strategies for graph+vector hybrid systems
Architectural Trade-offs analysis (LPG, RDF/OWL, hypergraphs, factor graphs)
Recent Research & Industry Landscape (2022-present)
Technology Stacks & Frameworks survey
Consolidated Pattern Catalog with implementation guidance
The server provides multiple access methods:
25 Knowledge Resources - Hierarchical content from overview to specific techniques
4 Specialized Prompts - Domain-specific analysis and guidance
10 MCP Tools - Direct access for Claude Code agents and programmatic use
Content is organized into 3 hierarchical levels:
Overview - High-level summaries and abstracts
Main Knowledge Areas - Detailed coverage of each topic
Specific Techniques - Implementation details for individual patterns
Related MCP server: GraphRAG MCP
๐ Project Structure
graphragmcp/
โโโ README.md # This file
โโโ requirements.txt # Python dependencies
โโโ environment.yml # Conda environment specification
โโโ setup.py # Python package setup
โโโ .gitignore # Git ignore rules
โโโ src/
โ โโโ main.py # Main entry point (new modular architecture)
โ โโโ server.py # Legacy monolithic server (for compatibility)
โ โโโ graphrag_mcp/ # Modular architecture package
โ โโโ __init__.py # Package exports
โ โโโ server.py # Main server class
โ โโโ config.py # Configuration management
โ โโโ resources/ # Resource management
โ โ โโโ __init__.py
โ โ โโโ definitions.py # Resource definitions
โ โ โโโ registry.py # Resource registry
โ โโโ prompts/ # Prompt management
โ โ โโโ __init__.py
โ โ โโโ definitions.py # Prompt definitions
โ โ โโโ registry.py # Prompt registry
โ โ โโโ generators.py # Prompt generators
โ โโโ content/ # Content generation
โ โ โโโ __init__.py
โ โ โโโ loader.py # Content loader from original
โ โโโ utils/ # Utilities and exceptions
โ โโโ __init__.py
โ โโโ exceptions.py # Custom exceptions
โโโ agents/
โ โโโ graphrag_specialist.md # Specialized GraphRAG agent for Claude Code
โโโ docs/
โ โโโ Knowledge Graph Construction & Retrieval Strategies for LLM Reasoning.pdf
โโโ examples/
โ โโโ test_client.py # Test client to verify server functionality
โ โโโ claude_desktop_config.json # Configuration for Claude Desktop
โ โโโ .claude/agents/ # Example Claude Code project structure
โ โโโ graphrag_specialist.md # Agent configuration example
โโโ tests/ # Future test files๐ Quick Start
Option 1: Using uv (Recommended - Modern Python)
Install uv (if not already installed):
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Or with pip pip install uvInstall and run the server:
cd graphragmcp # Install dependencies and run (uv handles everything) uv run src/main.py # Or install as a package and run uv pip install -e . uv run graphrag-mcp
Option 2: Using Conda
Install Conda (if not already installed):
Create and activate the environment:
cd graphragmcp conda env create -f environment.yml conda activate graphragmcpRun the server:
# New modular architecture (recommended) python src/main.py # Or legacy server (for compatibility) python src/server.py
Option 3: Using pip + venv
Create a virtual environment:
cd graphragmcp python -m venv venv # Activate on macOS/Linux: source venv/bin/activate # Activate on Windows: venv\\Scripts\\activateInstall dependencies:
pip install -r requirements.txt # Or install as editable package pip install -e .Run the server:
# New modular architecture (recommended) python src/main.py # Or as installed package graphrag-mcp # Or legacy server (for compatibility) python src/server.py
๐ง Configuration
For Claude Desktop
Locate your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\\Claude\\claude_desktop_config.json
Choose your configuration method:
Option A: Using uv (Recommended - Best compatibility)
{ "mcpServers": { "graphrag-mcp": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/graphragmcp", "run", "src/main.py" ] } } }Option B: Using uv with installed package
{ "mcpServers": { "graphrag-mcp": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/graphragmcp", "run", "graphrag-mcp" ] } } }Option C: Using Python directly
{ "mcpServers": { "graphrag-mcp": { "command": "python", "args": ["/ABSOLUTE/PATH/TO/graphragmcp/src/main.py"] } } }Option D: Using Conda environment
{ "mcpServers": { "graphrag-mcp": { "command": "conda", "args": [ "run", "-n", "graphragmcp", "python", "/ABSOLUTE/PATH/TO/graphragmcp/src/main.py" ] } } }โ ๏ธ Important:
Replace
/ABSOLUTE/PATH/TO/graphragmcpwith your actual project pathUse absolute paths only - relative paths will not work
For Windows, use forward slashes or escaped backslashes in paths
๐ง Troubleshooting uv path issues: If you get
spawn uv ENOENTerrors, use the full path to uv:# Find where uv is installed which uvThen use the full path in your config:
{ "mcpServers": { "graphrag-mcp": { "command": "/Users/YOUR_USERNAME/.local/bin/uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/graphragmcp", "run", "src/main.py" ] } } }Restart Claude Desktop to load the server.
Verify the server is working:
Look for GraphRAG resources in Claude Desktop
Check that you can ask GraphRAG-related questions
If issues occur, check Claude Desktop's logs
For Claude Code Integration
Once configured in Claude Desktop, you can import the server into Claude Code:
Import from Claude Desktop (macOS/WSL only):
claude mcp add-from-claude-desktopThen select the
graphrag-mcpserver when prompted.Verify the import:
claude mcp listYou should see
graphrag-mcpin the list.Manual configuration (if automatic import doesn't work): Add to your Claude Code configuration:
claude mcp add graphrag-mcp --command python --args "/ABSOLUTE/PATH/TO/graphragmcp/src/main.py"
For Other MCP Clients
The server follows the MCP standard and should work with any compatible client. Use:
Command:
pythonArgs:
["/path/to/graphragmcp/src/main.py"](recommended) or["/path/to/graphragmcp/src/server.py"](legacy)
๐ค GraphRAG Specialist Agent Integration
This project includes a specialized GraphRAG agent designed to work with Claude Code, providing expert-level assistance with Knowledge Graph Construction & Retrieval strategies.
๐ฏ Agent Capabilities
The GraphRAG Specialist Agent provides:
๐๏ธ Knowledge Graph Construction: Expert guidance on LLM-assisted entity extraction, event reification, layered architectures, provenance tracking, temporal modeling, and hybrid symbolic-vector integration
๐ Embedding & Representation Strategies: Advanced techniques for node, edge, path, and subgraph embeddings with multi-modal fusion
๐ Retrieval & Search Orchestration: Implementation guidance for global-first, local-first, U-shaped hybrid, query decomposition, temporal, and constraint-guided retrieval strategies
๐๏ธ Architecture & Technology Stacks: Comprehensive knowledge of graph databases, vector databases, frameworks, and cloud platform optimization
๐ ๏ธ Implementation Guidance: Step-by-step roadmaps, code examples, performance optimization, and production deployment strategies
๐ Setup Instructions
Option 1: Using Claude Code with MCP Integration (Recommended)
Configure the MCP server in Claude Desktop (see configuration section above)
Import the MCP server into Claude Code:
# Import from Claude Desktop (macOS/WSL only) claude mcp add-from-claude-desktop # Select graphrag-mcp when prompted # Or add manually claude mcp add graphrag-mcp --command python --args "/ABSOLUTE/PATH/TO/graphragmcp/src/main.py"Verify MCP server is available:
claude mcp list # Should show graphrag-mcp in the listAdd the GraphRAG Specialist Agent:
# Create the agents directory in your project mkdir -p .claude/agents # Copy the agent configuration cp agents/graphrag_specialist.md .claude/agents/Or manually place
graphrag_specialist.mdin your project's.claude/agents/directory.Start using the integrated system:
The agent will be automatically available in Claude Code
Reference it with
@graphrag-specialistor by asking GraphRAG-related questionsThe agent will automatically use the MCP server to provide comprehensive, research-backed answers
Claude Code will have direct access to all 25 GraphRAG resources and 4 specialized prompts
Option 2: Global Agent Installation
To make the agent available across all Claude Code projects:
Install globally:
# Create global agents directory mkdir -p ~/.claude/agents # Copy the agent configuration cp agents/graphrag_specialist.md ~/.claude/agents/The agent will be available in all Claude Code projects
Option 3: Custom Agent Configuration
If you want to customize the agent:
Copy and modify the agent file:
cp agents/graphrag_specialist.md .claude/agents/my-custom-graphrag-agent.mdEdit the YAML frontmatter:
Change the
namefield to your custom nameModify the
descriptionfor different specializationAdjust the system prompt as needed
Ensure MCP server accessibility:
The agent relies on the GraphRAG MCP server for detailed knowledge
Make sure the server is running and accessible
๐ Using the GraphRAG Agent
Once configured, you can interact with the GraphRAG Specialist Agent for:
๐ฏ Use Case Analysis
@graphrag-specialist I need to build a knowledge graph for a healthcare application that processes patient records and medical literature. What GraphRAG patterns should I use?๐ ๏ธ Implementation Guidance
@graphrag-specialist How do I implement a U-shaped hybrid retrieval strategy using Neo4j and Pinecone?๐ Architecture Decisions
@graphrag-specialist Should I use LPG or RDF for a financial compliance knowledge graph with 50M entities?๐ง Technology Stack Recommendations
@graphrag-specialist What's the best technology stack for a scalable GraphRAG system on AWS?๐ Performance Optimization
@graphrag-specialist How can I optimize my GraphRAG system's query performance for real-time applications?๐ Agent + MCP Server Workflow
The GraphRAG specialist agent uses MCP tools to provide research-backed guidance:
Analyzes your question to understand GraphRAG requirements
Executes relevant MCP tools to access specific knowledge resources:
get_construction_patternsfor pattern recommendationsanalyze_graphrag_patternfor use case-specific analysisquery_graphrag_resourcefor detailed technical contentcompare_architecturesfor technology decisions
Combines multiple tool results for comprehensive analysis
Provides evidence-based recommendations with source references
Includes implementation guidance and code examples
Suggests evaluation metrics and optimization strategies
Cites specific tools and resources used for transparency
๐ก Example Interaction
User: "I need to implement GraphRAG for a legal document analysis system. The system needs to handle complex multi-party contracts and regulatory relationships."
GraphRAG Agent Response:
Uses
get_construction_patternstool to access all available patternsExecutes
analyze_graphrag_patterntool with legal domain contextCalls
query_graphrag_resourcefor detailed Event Reification patternUses
compare_architecturestool to recommend Neo4j + Pinecone stackProvides implementation roadmap with specific phases and reasoning
Includes code examples from pattern-specific resources
Recommends evaluation metrics based on research findings
Cites all tools used: Shows transparency in knowledge sources
๐ก๏ธ Best Practices
Start with requirements analysis: The agent will help you identify the best patterns
Ask for implementation details: Get specific code examples and architectural guidance
Request performance considerations: Understand scaling and optimization strategies
Validate recommendations: The agent provides research-backed suggestions you can verify
๐งช Testing the Server
Basic Functionality Test
Run the included test client to verify everything works:
cd examples
python test_client.pyThis will:
Connect to the server
List available resources
Read sample content from key resources
Display available prompts
Manual Testing
You can also test the server manually using MCP tools or by examining the server output when it starts.
๐ Available Resources
The server provides 27 knowledge resources organized hierarchically:
Level 1: Overview
graphrag://overview- Comprehensive overview of GraphRAG research
Level 2: Main Knowledge Areas
graphrag://construction-patterns- 7 key construction patternsgraphrag://embedding-strategies- 5 embedding fusion strategiesgraphrag://retrieval-strategies- 6 retrieval orchestration strategiesgraphrag://architectural-tradeoffs- Graph model architecture analysisgraphrag://literature-landscape- Recent research & industry practicegraphrag://technology-stacks- Frameworks & technology surveygraphrag://pattern-catalog- Consolidated design patterns
Level 3: Detailed Techniques
Construction Patterns: LLM-assisted extraction, event reification, layered graphs, provenance layering, temporal modeling, hybrid symbolic-vector
Embedding Strategies: Node embeddings, edge embeddings, path embeddings, subgraph embeddings, joint representation fusion
Retrieval Strategies: Global-first, local-first, U-shaped hybrid, query decomposition, temporal retrieval, constraint-guided filtering
๐ค Available Prompts
The server includes 4 specialized prompts for GraphRAG analysis:
analyze-graphrag-pattern- Analyze best patterns for specific use casesdesign-knowledge-graph- Get design guidance for knowledge graphsimplement-retrieval-strategy- Implementation guidance for retrieval strategiescompare-architectures- Compare different graph architectures
๐ง Available MCP Tools
The server provides 10 MCP tools that enable Claude Code agents to access the knowledge base:
๐ฏ Generic Resource Access
query_graphrag_resource- Query any of the 25 GraphRAG knowledge resources by URI
๐ Direct Knowledge Access Tools
get_construction_patterns- Get the 7 knowledge graph construction patternsget_embedding_strategies- Get the 5 embedding fusion strategiesget_retrieval_strategies- Get the 6 retrieval and search strategiesget_architectural_tradeoffs- Get analysis of graph model architecturesget_technology_stacks- Get comprehensive framework and platform survey
๐ค Specialized Analysis Tools
analyze_graphrag_pattern- Analyze which pattern fits a specific use casecompare_architectures- Compare graph architectures for a use casedesign_knowledge_graph- Get design guidance for knowledge graphsimplement_retrieval_strategy- Get implementation guidance for retrieval strategies
๐ Tool Usage Examples
Generic Resource Query:
# Access any resource directly
await query_graphrag_resource({"resource_uri": "graphrag://construction-patterns"})Direct Knowledge Access:
# Get specific knowledge areas
await get_construction_patterns({})
await get_embedding_strategies({})
await get_retrieval_strategies({})Specialized Analysis:
# Analyze patterns for your use case
await analyze_graphrag_pattern({
"use_case": "healthcare patient records",
"requirements": "HIPAA compliance, temporal data",
"data_types": "clinical notes, lab results"
})
# Compare architectures
await compare_architectures({
"use_case": "financial compliance knowledge graph",
"scale": "50M entities",
"performance_requirements": "real-time queries"
})Knowledge Graph Design:
# Get design guidance
await design_knowledge_graph({
"domain": "healthcare",
"data_sources": "EHR systems, medical literature",
"integration_requirements": "HL7 FHIR compliance"
})๐ก Usage Examples
With Claude Desktop
Once configured, you can ask Claude questions like:
"What are the main GraphRAG construction patterns and when should I use each?"
"Compare LPG vs RDF for healthcare knowledge graphs"
"Show me the technology stack options for implementing GraphRAG"
"What are the recent developments in GraphRAG research?"
Programmatic Access
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def query_graphrag():
server_params = StdioServerParameters(
command="python",
args=["src/server.py"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Get overview
content = await session.read_resource("graphrag://overview")
print(content)
# Use a prompt
result = await session.get_prompt(
"analyze-graphrag-pattern",
{"use_case": "Healthcare patient records analysis"}
)
print(result.messages[0].content.text)
asyncio.run(query_graphrag())๐๏ธ Architecture Highlights
This project features a distinguished engineer-ready modular architecture:
๐ง Modular Design
Separation of Concerns: Resources, prompts, content, and configuration are cleanly separated
Resource Registry: Centralized management of all knowledge resources
Prompt Registry: Structured prompt management with generators
Content Factory: Efficient content generation and caching
Configuration Management: Centralized configuration with logging setup
๐ก๏ธ Robust Error Handling
Custom Exception Hierarchy: Specific exceptions for different error types
Comprehensive Logging: Detailed logging throughout all components
Graceful Degradation: Fallback mechanisms when content loading fails
Input Validation: Proper validation of resource URIs and prompt arguments
โก Performance Optimizations
Lazy Loading: Content generated on-demand for efficiency
Registry Pattern: Fast resource and prompt lookup
Content Length Limits: Configurable limits to prevent memory issues
Efficient Imports: Modular imports reduce startup time
๐ Key Features
๐ Comprehensive Knowledge Base: 59 pages of research distilled into 25 structured resources
๐๏ธ Hierarchical Organization: 3-level structure for different detail needs
๐ง MCP Tools Integration: 10 tools enabling direct access for Claude Code agents
๐ง AI-Optimized: Designed specifically for AI agent consumption with tool-based access
โก Fast Access: Efficient resource and tool execution with minimal latency
๐ Standard Compliant: Full MCP protocol compliance (resources, prompts, and tools)
๐ฏ Specialized Prompts: 4 domain-specific prompts for GraphRAG analysis
๐ Complete Fidelity: 100% faithful to original research content
๐ง Enterprise-Ready: Modular, maintainable, and extensible architecture
๐ค Specialized Agent: Pre-configured GraphRAG expert agent with full MCP tool access
๐ ๏ธ Development
Adding New Resources
To extend the server with additional resources:
Add resource definition in
handle_list_resources()Implement content function following the pattern
async def _get_content()Add URI handling in
handle_read_resource()
Testing
# Install development dependencies
pip install pytest pytest-asyncio black mypy
# Run basic server test
python examples/test_client.py
# Format code
black src/
# Type checking
mypy src/๐ Requirements
Python: 3.11+
Core Dependency:
mcp>=1.0.0Optional: Development and testing tools
๐ค Contributing
This server is based on comprehensive GraphRAG research. When making changes:
Maintain Fidelity: Keep content faithful to original research
Follow MCP Standards: Ensure compatibility with MCP protocol
Test Thoroughly: Verify all resources and prompts work correctly
Document Changes: Update README for any new features
๐ License
This project packages and structures existing research for MCP access. Please refer to the original research document for licensing and attribution requirements.
๐ Troubleshooting
Common Issues
"Server not found" in Claude Desktop:
Verify the full path in your config is correct
Ensure Python is in your PATH
Try using absolute path to Python executable
Import errors:
Ensure you've activated the correct conda environment or virtual environment
Verify all dependencies are installed:
pip listorconda list
Server won't start:
Check Python version:
python --version(should be 3.11+)Try running directly:
python src/main.pyorpython src/server.pyCheck for any error messages in the terminal
Claude Desktop not showing resources:
Restart Claude Desktop after config changes
Check Claude Desktop's logs for connection errors
Verify the server starts without errors
Agent not working with MCP server:
Ensure the MCP server is running and accessible
Verify the agent configuration file is in the correct location
Check that Claude Code can access the MCP server configuration
Test the MCP server independently before using with the agent
Agent not providing detailed responses:
Verify the MCP server is properly configured and responding
Check that the agent has access to all 27 knowledge resources
Ensure the specialized prompts are working (test with MCP client)
Try asking more specific questions about GraphRAG patterns
Getting Help
Check Error Messages: Run the server directly to see detailed error output
Test with Example Client: Use
python examples/test_client.pyto isolate issuesVerify Dependencies: Ensure all required packages are installed
Check File Paths: Ensure all paths in configs are correct and accessible
Test Agent Separately: Try the MCP server directly before integrating with the agent
๐ Performance Notes
Resource Loading: Resources are generated on-demand for efficiency
Memory Usage: Approximately 10-20MB for the full knowledge base
Response Time: Typical response times under 100ms for resource access
Scalability: Designed to handle multiple concurrent client connections
Built with โค๏ธ for the GraphRAG community
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lyndonkl/graphragmcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server