by kukapay
An MCP server that powers AI agents with indexed blockchain data from The Graph.
TheGraph MCP Server is an MCP (Multi-Chain Protocol) server designed to empower AI agents with access to indexed blockchain data from The Graph. It acts as a bridge, allowing AI to understand and interact with vast amounts of on-chain information.
git clone https://https://github.com/kukapay/thegraph-mcp.git
thegraph-mcp
by adding the following to your client configuration, adjusting the path/to/thegraph-mcp
to your cloned repository location and replacing your_api_key_here
with your actual The Graph API key:
{
"mcpServers": {
"thegraph-mcp": {
"command": "uv",
"args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"],
"env": {
"THEGRAPH_API_KEY": "your_api_key_here"
}
}
}
}
getSubgraphSchema
Tool: Fetches the schema of a specified subgraph, providing AI agents with the necessary context to generate accurate GraphQL queries. It supports both human-readable GraphQL schema and JSON schema output.querySubgraph
Tool: Executes GraphQL queries against a specified subgraph. This allows AI agents to retrieve specific blockchain data, and also supports manual query crafting.Q: What is an MCP server? A: An MCP (Multi-Chain Protocol) server facilitates communication and data exchange across different blockchain networks or data sources, in this case, providing blockchain data to AI agents.
Q: Do I need an API key for The Graph?
A: Yes, you will need a The Graph API key, which should be set as an environment variable (THEGRAPH_API_KEY
) in your client configuration.
Q: Can I manually write GraphQL queries?
A: Yes, while the server is designed for AI-generated queries, you can also manually craft and execute your own GraphQL queries using the querySubgraph
tool.
Q: What kind of data can AI agents access? A: AI agents can access any indexed blockchain data available through The Graph subgraphs, including but not limited to trading volumes, liquidity, token information, and transaction details.
Q: Is this project open source? A: Yes, TheGraph MCP Server is open-source and licensed under the MIT License.
An MCP server that powers AI agents with indexed blockchain data from The Graph.
Fetches the schema of a specified subgraph, providing AI agents with the context needed to generate GraphQL queries.
Parameters:
subgraphId
: The subgraph ID (e.g., "QmZBQcF...")asText
: Output format flag
true
: Returns human-readable GraphQL schemafalse
: Returns JSON schema (default)Executes GraphQL queries against a specified subgraph. While queries are typically generated by AI, you can also manually craft your own.
Parameters:
subgraphId
: The subgraph IDquery
: GraphQL query stringgit clone https://github.com/kukapay/thegraph-mcp.git
{
"mcpServers": {
"thegraph-mcp": {
"command": "uv",
"args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"],
"env": {
"THEGRAPH_API_KEY": "your_api_key_here"
}
}
}
}
Here are some natural language prompts to trigger the tools:
This project is licensed under the MIT License. See the LICENSE file for details.
Please log in to share your review and rating for this MCP.