Fetches the schema of a specified subgraph, providing AI agents with the context needed to generate GraphQL queries
Executes GraphQL queries against a specified subgraph to retrieve blockchain data
TheGraph MCP provides AI agents with seamless access to indexed blockchain data through The Graph protocol. It enables querying subgraph schemas and executing GraphQL queries against specific subgraphs, allowing AI to analyze on-chain data, track transactions, monitor DeFi metrics, and gain insights from blockchain networks without requiring deep blockchain expertise.
TheGraph MCP serves as a bridge between AI agents and blockchain data indexed by The Graph protocol. This integration allows AI to access structured blockchain data through GraphQL queries, enabling powerful analytics and insights without requiring specialized blockchain knowledge.
To set up TheGraph MCP:
git clone https://github.com/kukapay/thegraph-mcp.git
cd thegraph-mcp
uv install
{
"mcpServers": {
"thegraph-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/thegraph-mcp", "run", "main.py"],
"env": {
"THEGRAPH_API_KEY": "your_api_key_here"
}
}
}
}
Replace /path/to/thegraph-mcp
with the actual path to the cloned repository and your_api_key_here
with your Graph API key if required.
TheGraph MCP provides two main tools that can be used through natural language prompts:
You can request the schema of any subgraph to understand its data structure:
Once you understand the schema, you can request specific data:
You can also request more complex analysis:
The MCP will handle translating these requests into appropriate GraphQL queries and return the results in a structured format.