An MCP server that powers AI agents with indexed blockchain data from The Graph.
https://github.com/kukapay/thegraph-mcpGive your AI agents direct access to structured blockchain data without the complexity of raw chain queries.
Building AI agents that understand blockchain data usually means either parsing raw transaction logs or maintaining your own indexing infrastructure. TheGraph MCP server cuts through that complexity by connecting your agents directly to The Graph's indexed subgraphs—giving you clean, queryable data structures instead of hex dumps and gas estimation headaches.
Instant Schema Discovery: Your AI agent can inspect any subgraph's structure with getSubgraphSchema, understanding exactly what data is available and how it's organized. No more guessing at field names or data types.
Natural Language to GraphQL: Ask your agent to "find the top 5 tokens by trading volume in the last 24 hours" and it'll generate the appropriate GraphQL query using the schema context it discovered.
Real-time DeFi Intelligence: Query DEX trading pairs, liquidity pools, lending protocols, NFT collections—any data that's been indexed on The Graph network.
DeFi Analysis Agents: Build agents that monitor yield farming opportunities, track whale movements, or analyze market trends across multiple protocols without maintaining separate data pipelines.
Trading Strategy Bots: Your agent can analyze historical swap data, identify arbitrage opportunities, or monitor large liquidity changes—all through conversational prompts.
Portfolio Intelligence: Create agents that understand your DeFi positions across protocols, track performance, and suggest optimizations based on current market conditions.
Research and Analytics: Query complex cross-protocol data for research, compliance reporting, or market analysis without writing custom indexers.
The server provides two focused tools that work together seamlessly:
getSubgraphSchema: Returns the complete data model so your agent understands what's queryablequerySubgraph: Executes GraphQL queries against the indexed dataYour agent workflow becomes: understand the schema → generate appropriate queries → get structured results. No blockchain RPC complexity, no parsing transaction receipts, no maintaining sync state.
git clone https://github.com/kukapay/thegraph-mcp.git
cd thegraph-mcp
Add to your MCP client configuration:
{
"mcpServers": {
"thegraph-mcp": {
"command": "uv",
"args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"],
"env": {
"THEGRAPH_API_KEY": "your_api_key_here"
}
}
}
}
Now your AI agent can query any subgraph with natural language prompts like "Show me all Uniswap V3 pools with more than $1M liquidity" or "Find unusual trading patterns in the last 6 hours."
The Graph has already done the heavy lifting of indexing and structuring blockchain data. This MCP server makes that indexed intelligence immediately available to your AI agents through simple conversational interfaces, eliminating the need to build custom blockchain data pipelines or wrestle with raw RPC calls.
Your agents get the power of blockchain analytics without the infrastructure complexity.
Repository: kukapay/thegraph-mcp
License: MIT
Requirements: Python 3.10+