TheGraph MCP Server
TheGraph MCP サーバー
The Graphのインデックス化されたブロックチェーン データを使用して AI エージェントを強化する MCP サーバー。
利用可能なツール
1. getSubgraphSchema
指定されたサブグラフのスキーマを取得し、GraphQL クエリの生成に必要なコンテキストを AI エージェントに提供します。
パラメータ:
subgraphId: サブグラフ ID (例: "QmZBQcF...")asText: 出力形式フラグtrue: 人間が読めるGraphQLスキーマを返すfalse: JSONスキーマを返します(デフォルト)
2. クエリサブグラフ
指定されたサブグラフに対してGraphQLクエリを実行します。クエリは通常AIによって生成されますが、手動で独自のクエリを作成することもできます。
パラメータ:
subgraphId: サブグラフIDquery: GraphQLクエリ文字列
Related MCP server: Subgraph Registry MCP
インストール
リポジトリのクローンを作成する
git 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" } } } }
プロンプトの例
ツールを起動するための自然言語プロンプトをいくつか示します。
スキーマクエリ
「サブグラフ QmZBQcF... のスキーマを読み取り可能な形式で表示してください」
「QmZBQcF...サブグラフの構造は何ですか?GraphQL形式で表示してください。」
「サブグラフ QmZBQcF... のデータ モデルを理解する必要がありますが、そのスキーマを取得できますか?」
データクエリ
「サブグラフ QmZBQcF から過去 24 時間の取引量上位 5 つのトークンを見つけます...」
「サブグラフ QmZBQcF で流動性が 100 万ドルを超えるすべてのペアを表示してください...」
「QmZBQcF...サブグラフからトークンシンボルと金額を含む最新の10件のスワップイベントを取得します」
分析タスク
「サブグラフ QmZBQcF を使用して、過去 1 週間の USDT ペアの取引量を分析します...」
「サブグラフ QmZBQcF 内の ETH と USDC のペアの流動性を比較します...」
「サブグラフ QmZBQcF から過去 24 時間の異常な取引パターンを見つけます...」
複合タスク
「まずQmZBQcFのスキーマを取得してください...、次に高価値の取引を見つけるためのクエリの作成を手伝ってください」
「QmZBQcF のスキーマを確認してください...トークン価格を照会するために使用できるフィールドを教えてください」
「サブグラフQmZBQcF...を使用して、まずスキーマを理解し、次に関連イベントをクエリすることで、大規模な取引の市場への影響を分析します。」
ライセンス
このプロジェクトはMITライセンスの下で提供されています。詳細はLICENSEファイルをご覧ください。
Available Tools
2 toolsgetSubgraphSchemaA
Fetch the schema of a specified subgraph using GraphQL introspection.
Args: subgraphId (str): The ID of the subgraph to query. asText (bool): If True, return schema as GraphQL text; otherwise, return JSON.
Returns: str: Schema in JSON or GraphQL text format, or an error message.
| Name | Required | Description | Default |
|---|---|---|---|
| subgraphId | Yes | ||
| asText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It discloses the return format options (JSON or GraphQL text) and mentions error messages, but lacks details about authentication requirements, rate limits, or what happens with invalid subgraph IDs.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear purpose statement followed by Args and Returns sections. It's appropriately sized, though the 'Args' and 'Returns' labels could be more integrated with the flow rather than section headers.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 2 parameters, no annotations, and no output schema, the description provides good coverage of purpose, parameters, and return behavior. It could be more complete by addressing authentication or error scenarios, but covers the essentials adequately.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description fully compensates by clearly explaining both parameters: 'subgraphId' specifies which subgraph to query, and 'asText' controls the return format (text vs JSON). This adds essential meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Fetch the schema') and resource ('specified subgraph using GraphQL introspection'), distinguishing it from the sibling 'querySubgraph' which presumably executes queries rather than fetching schema metadata.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for obtaining schema information via introspection, but does not explicitly state when to use this tool versus the sibling 'querySubgraph' or provide any exclusions or prerequisites for usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
querySubgraphA
Execute a GraphQL query against a specified subgraph.
Args: subgraphId (str): The ID of the subgraph to query. query (str): The GraphQL query string to execute.
Returns: str: Query result in JSON format, or an error message.
| Name | Required | Description | Default |
|---|---|---|---|
| subgraphId | Yes | ||
| query | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool executes queries and returns results or errors, which covers basic functionality. However, it doesn't mention authentication requirements, rate limits, timeout behavior, or whether queries are read-only or can mutate data. The description adds some value but lacks comprehensive behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly structured with a clear purpose statement followed by well-organized sections for Args and Returns. Every sentence earns its place, with no redundant information. The formatting with clear headings makes it easy to parse while remaining extremely concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of GraphQL query execution and the lack of both annotations and output schema, the description provides adequate but minimal information. It covers the basic purpose and parameters but doesn't explain the format of query results beyond 'JSON format', nor does it address error handling, authentication, or other operational considerations that would be helpful for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description must compensate for the lack of parameter documentation in the schema. It clearly explains that 'subgraphId' identifies which subgraph to query and 'query' is the GraphQL query string to execute, providing essential semantic meaning beyond the bare schema. However, it doesn't specify format requirements or constraints for these parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Execute a GraphQL query') and resource ('against a specified subgraph'), distinguishing it from the sibling tool 'getSubgraphSchema' which presumably retrieves schema information rather than executing queries. The verb+resource combination is precise and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by specifying it's for executing GraphQL queries against subgraphs, but doesn't explicitly state when to use this tool versus alternatives like 'getSubgraphSchema' or other query methods. It provides clear context but lacks explicit comparison or exclusion guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
- First observed
getSubgraphSchema - First observed
querySubgraph
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: getSubgraphSchema retrieves schema information via introspection, while querySubgraph executes actual GraphQL queries. There is no overlap in functionality, making it easy for an agent to select the correct tool based on the need for metadata versus data retrieval.
Both tools follow a consistent verb_noun pattern (getSubgraphSchema, querySubgraph) using camelCase, which is predictable and readable. The naming convention is uniform across all tools, with no deviations or mixed styles.
With only 2 tools, the server feels thin for interacting with The Graph protocol, which typically involves more operations like listing subgraphs, managing deployments, or handling subscriptions. This limited set may restrict agents from performing comprehensive tasks in the domain.
The tool surface is severely incomplete for a The Graph server, lacking essential operations such as listing available subgraphs, creating or updating subgraphs, and handling mutations or subscriptions. Agents will face dead ends when trying to perform basic lifecycle management or discover subgraphs beyond a known ID.
Maintenance
Related MCP Connectors
Pay-per-call Base and Polygon onchain data over x402 for AI agents.
Market and on-chain crypto data for AI agents. Pay per call in USDC on Base (x402).
Provide AI agents and automation tools with contextual access to blockchain data including balance…
Agent-native scoring, search and routing for tokenized real-world assets across multi-chain.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that powers AI agents with indexed blockchain data from The Graph.3MIT
- AlicenseAqualityAmaintenanceAgent-friendly semantic classification of all subgraphs on The Graph Network. Pre-computed index of 15,500+ subgraphs with domain classification, protocol type detection, schema fingerprinting, canonical entity mapping, and composite reliability scoring.4146 npmMIT
- AlicenseBqualityDmaintenanceEnables AI assistants to execute GraphQL queries and retrieve schema information from any GraphQL endpoint.2141 npm8MIT
- AlicenseAqualityDmaintenanceProvides comprehensive GraphQL introspection, filtering, and query/mutation execution with safety controls. Enables AI agents to explore and interact with GraphQL APIs through natural language.76 npm1MIT