• RAW DATA
  • ANALYSIS
  • REPORTING
  • HUMAN

How to query custom subgraphs with your AI

Connect The Graph to your AI client once. After that, you can pull specific on-chain data points using standard GraphQL syntax.

Ask AI about this page

Short answer

How can I run GraphQL queries through my AI?

You provide a subgraph ID and a GraphQL query string to your agent. It uses the connector to fetch the requested data from the decentralized network. You get the raw JSON results or a natural language summary of the on-chain state.

Data outcomes

Where your data lands.

What you get after your AI runs a query.

RAW DATA

Direct JSON results

The AI pulls the exact JSON response from the subgraph. You can copy this directly into your code or data analysis tools.

ANALYSIS

On-chain insights

Your agent interprets the queried data to answer questions about token balances, transaction counts, or liquidity pools.

REPORTING

Formatted summaries

The AI turns messy subgraph responses into clean tables or lists that are easy to read in your chat window.

HUMAN

Manual query tuning

If a query fails due to syntax errors, you'll need to refine the GraphQL string yourself before asking the AI to try again.

The workflow

What your AI does when a query arrives.

The AI handles the network communication so you don't have to write fetch requests.

  1. Identify the subgraph

    The AI identifies the specific subgraph ID you want to target from your prompt.

    query_subgraph
  2. Execute GraphQL

    The agent sends your raw GraphQL query to the network via the connector.

    query_subgraph
  3. Parse response

    The AI receives the JSON payload and maps it to your original question.

    query_subgraph
  4. Deliver answer

    The agent presents the data as a clear answer or a structured data block.

    query_subgraph

Try it

Copy these to start.

Use these prompts to begin querying on-chain data.

Starting points

Swap the subgraph ID and the query fields with your own specific requirements.

The Graph Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_lKCcPQtDzEbLkEyQdpLNknTGhTDgro8TIiVVYvos/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — The Graph capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "the-graph-web3-indexing-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_lKCcPQtDzEbLkEyQdpLNknTGhTDgro8TIiVVYvos/mcp"
    }
  }
}
Copy into chat04
  • Query subgraph '0x123...' for the last 10 transactions of this token.

  • Get the total volume for the Uniswap V3 subgraph using this query: { ... }

  • Find the current balance of the wallet address 0xabc... in this subgraph.

  • Use the subgraph ID '0x456...' to list all active liquidity providers.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect The Graph once, then ask.

Click the link to connect your client. Your credentials stay encrypted, and you can start querying immediately.

Connect The Graph to your AI

FAQ

How the task behaves

  • 01

    Can the AI change data on the blockchain?

    No. This connector is read-only. It can only fetch data from subgraphs; it cannot execute transactions or modify on-chain state.

  • 02

    Do I need to write the GraphQL myself?

    You can. If you provide a valid GraphQL query string, the AI will execute it exactly as written.

  • 03

    Can the AI fix my broken GraphQL syntax?

    The AI can suggest fixes for your syntax, but it cannot force the subgraph to return data if the query is logically impossible.

  • 04

    Can the AI create new subgraphs?

    No. The tool is limited to querying existing subgraphs via their unique IDs.

  • 05

    Does the AI store my subgraph IDs?

    The AI uses the IDs you provide in your prompts to perform the lookups.

  • More questions about The Graph? See everything the The Graph Connector can do

Connect The Graph to Claude, Cursor, ChatGPT & more