Back to MCP Catalog

TheGraph MCP Server

BlockchainPython
Access and query blockchain data indexed by The Graph protocol
Available Tools

getSubgraphSchema

Fetches the schema of a specified subgraph, providing AI agents with the context needed to generate GraphQL queries

subgraphIdasText

querySubgraph

Executes GraphQL queries against a specified subgraph to retrieve blockchain data

subgraphIdquery

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.

Overview

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.

Installation

To set up TheGraph MCP:

  1. Clone the repository:
git clone https://github.com/kukapay/thegraph-mcp.git
  1. Navigate to the project directory:
cd thegraph-mcp
  1. Install dependencies using UV (or pip):
uv install
  1. Configure your client by adding the following to your configuration:
{
  "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.

Usage

TheGraph MCP provides two main tools that can be used through natural language prompts:

Working with Subgraph Schemas

You can request the schema of any subgraph to understand its data structure:

  • "Show me the schema for subgraph QmZBQcF..."
  • "What's the structure of the QmZBQcF... subgraph?"
  • "I need to understand the data model of subgraph QmZBQcF..."

Querying Subgraph Data

Once you understand the schema, you can request specific data:

  • "Find the top 5 tokens by trading volume in the last 24 hours from subgraph QmZBQcF..."
  • "Show me all pairs with liquidity greater than 1 million USD in subgraph QmZBQcF..."
  • "Get the latest 10 swap events from the QmZBQcF... subgraph"

Analysis Tasks

You can also request more complex analysis:

  • "Analyze the trading volume of USDT pairs in the last week using subgraph QmZBQcF..."
  • "Compare the liquidity of ETH and USDC pairs in subgraph QmZBQcF..."
  • "Find unusual trading patterns in the last 24 hours from subgraph QmZBQcF..."

The MCP will handle translating these requests into appropriate GraphQL queries and return the results in a structured format.

Related MCPs

No related MCPs found

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.