TheGraph MCP Server

TheGraph MCP Server

Empowering AI agents with indexed blockchain data from The Graph

7
Stars
12
Forks
7
Watchers
4
Issues
TheGraph MCP Server provides AI agents with seamless access to indexed blockchain data through The Graph protocol. It offers tools for fetching subgraph schemas and executing custom GraphQL queries, making blockchain data exploration efficient for AI-powered applications. The server is tailored for easy integration as a Model Context Protocol (MCP) server, enabling intelligent context-aware data retrieval.

Key Features

Fetches GraphQL schemas for specified subgraphs
Executes custom GraphQL queries on blockchain data
Enables AI-driven or manual data exploration
Supports human-readable and JSON schema outputs
Integrates with The Graph API via API key
Provides example natural language prompts for tool invocation
Customizable through environment configuration
Available as a server for MCP-compatible clients
Facilitates analysis of DeFi and trading activity
MIT licensed open source project

Use Cases

Retrieving blockchain subgraph schemas for AI-driven query generation
Running analytics on DeFi protocol data indexed by The Graph
Enabling AI agents to build and execute context-aware data queries
Comparing token liquidity and trading volumes programmatically
Identifying unusual blockchain trading patterns via AI workflows
Generating human-readable data models for rapid schema inspection
Automating search and analysis for tokens, pairs, and liquidity events
Supporting downstream AI tasks with up-to-date blockchain contexts
Assisting developers in building custom analytics for subgraphs
Facilitating combined schema inspection and data retrieval pipelines

README

TheGraph MCP Server

An MCP server that powers AI agents with indexed blockchain data from The Graph.

GitHub License GitHub Last Commit Python Version

Available Tools

1. getSubgraphSchema

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 schema
    • false: Returns JSON schema (default)

2. querySubgraph

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 ID
  • query: GraphQL query string

Installation

  1. Clone the Repository
    bash
    git clone https://github.com/kukapay/thegraph-mcp.git
    
  2. Client Configuration
    json
    {
      "mcpServers": {
        "thegraph-mcp": {
          "command": "uv",
          "args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"],
          "env": {
            "THEGRAPH_API_KEY": "your_api_key_here"
          }
        }
      }
    }
    

Example Prompts

Here are some natural language prompts to trigger the tools:

Schema Queries

  • "Show me the schema for subgraph QmZBQcF... in a readable format"
  • "What's the structure of the QmZBQcF... subgraph? Please display it in GraphQL format"
  • "I need to understand the data model of subgraph QmZBQcF..., can you fetch its schema?"

Data Queries

  • "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, including token symbols and amounts"

Analysis Tasks

  • "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..."

Combined Tasks

  • "First get the schema of QmZBQcF..., then help me write a query to find high-value transactions"
  • "Check the schema of QmZBQcF... and tell me what fields are available for querying token prices"
  • "Using subgraph QmZBQcF..., analyze the market impact of large trades by first understanding the schema and then querying relevant events"

License

This project is licensed under the MIT License. See the LICENSE file for details.

Star History

Star History Chart

Repository Owner

kukapay
kukapay

User

Repository Details

Language Python
Default Branch main
Size 12 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Python
100%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • mcp-graphql

    mcp-graphql

    Enables LLMs to interact dynamically with GraphQL APIs via Model Context Protocol.

    mcp-graphql provides a Model Context Protocol (MCP) server that allows large language models to discover and interact with GraphQL APIs. The implementation facilitates schema introspection, exposes the GraphQL schema as a resource, and enables secure query and mutation execution based on configuration. It supports configuration through environment variables, automated or manual installation options, and offers flexibility in using local or remote schema files. By default, mutation operations are disabled for security, but can be enabled if required.

    • 319
    • MCP
    • blurrah/mcp-graphql
  • Catalysis Hub MCP Server

    Catalysis Hub MCP Server

    MCP-compliant server for accessing catalysis research data via GraphQL.

    Catalysis Hub MCP Server provides a Model Context Protocol interface to the Catalysis Hub's GraphQL API, enabling seamless programmatic access to catalyst research datasets. It allows users to execute flexible and complex GraphQL queries to retrieve reaction, material, and publication data. The server supports robust error handling, parameterized queries, and is designed for interoperability with AI agents in scientific workflows.

    • 1
    • MCP
    • QuentinCody/catalysishub-mcp-server
  • mcp-graphql-forge

    mcp-graphql-forge

    Configuration-driven MCP server exposing modular GraphQL queries as tools.

    mcp-graphql-forge provides a lightweight, easily configurable Model Context Protocol (MCP) server that transforms any GraphQL endpoint into a set of modular API tools. Tools, defined in YAML, specify GraphQL queries and parameters to enable curated interactions via a standardized protocol. Written in Go, it emphasizes modularity, security, and extensibility without requiring code changes, and offers ready-to-run binaries for all major platforms.

    • 3
    • MCP
    • UnitVectorY-Labs/mcp-graphql-forge
  • GitHub GraphQL MCP Server

    GitHub GraphQL MCP Server

    A Model Context Protocol server for executing arbitrary GraphQL queries on GitHub's API.

    GitHub GraphQL MCP Server is a Model Context Protocol (MCP) server that enables interaction with GitHub's GraphQL API. It allows users to execute any GraphQL queries and mutations against GitHub, supporting variable injection and error handling. The server is designed to integrate with Claude for Desktop, providing tooling for AI environments to access or manipulate GitHub data. Detailed documentation and configuration examples are provided for rapid setup and use.

    • 9
    • MCP
    • QuentinCody/github-graphql-mcp-server
  • Blockchain MCP powered by Tatum

    Blockchain MCP powered by Tatum

    MCP server for universal blockchain data access across 130+ networks.

    Blockchain MCP powered by Tatum is a Model Context Protocol (MCP) server that enables large language models (LLMs) to read and write blockchain data across more than 130 networks. It provides unified access to both the Tatum Blockchain Data API and direct RPC gateways, supporting tools for retrieving balances, portfolios, transactions, and more. The platform is designed for seamless integration via API key and configurable MCP client setups, making it easier to build blockchain-aware AI solutions. Comprehensive documentation and extensive network compatibility facilitate robust development and scalability.

    • 12
    • MCP
    • tatumio/blockchain-mcp
  • gqai

    gqai

    Expose GraphQL operations as Model Context Protocol (MCP) tools for AI models.

    gqai is a lightweight proxy that converts GraphQL operations into MCP-compatible tools, enabling integration with AI systems such as ChatGPT, Claude, and Cursor. It automatically discovers and exposes GraphQL queries and mutations as callable tools via an MCP server, powered by your existing GraphQL backend. Configuration is managed via standard .graphqlrc.yml and .graphql files, with support for dynamic endpoints and environment variables.

    • 21
    • MCP
    • fotoetienne/gqai
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results