TheGraph MCP Server
Servidor MCP de TheGraph
Un servidor MCP que alimenta a los agentes de IA con datos de blockchain indexados de The Graph .
Herramientas disponibles
1. obtenerEsquemaDeSubgrafo
Obtiene el esquema de un subgráfico específico y proporciona a los agentes de IA el contexto necesario para generar consultas GraphQL.
Parámetros:
subgraphId: El ID del subgráfico (por ejemplo, "QmZBQcF...")asText: Indicador de formato de salidatrue: Devuelve un esquema GraphQL legible para humanosfalse: devuelve el esquema JSON (predeterminado)
2. consultaSubgrafo
Ejecuta consultas GraphQL en un subgrafo específico. Aunque las consultas suelen ser generadas por IA, también puedes crearlas manualmente.
Parámetros:
subgraphId: El ID del subgrafoquery: cadena de consulta GraphQL
Related MCP server: Subgraph Registry MCP
Instalación
Clonar el repositorio
git clone https://github.com/kukapay/thegraph-mcp.gitConfiguración del cliente
{ "mcpServers": { "thegraph-mcp": { "command": "uv", "args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"], "env": { "THEGRAPH_API_KEY": "your_api_key_here" } } } }
Ejemplos de indicaciones
A continuación se muestran algunas indicaciones en lenguaje natural para activar las herramientas:
Consultas de esquema
"Muéstrame el esquema del subgrafo QmZBQcF... en un formato legible"
¿Cuál es la estructura del subgrafo QmZBQcF...? Por favor, muéstrelo en formato GraphQL.
"Necesito comprender el modelo de datos del subgrafo QmZBQcF..., ¿puedes obtener su esquema?"
Consultas de datos
Encuentra los 5 tokens más importantes por volumen de operaciones en las últimas 24 horas del subgráfico QmZBQcF.
"Muéstrame todos los pares con liquidez superior a 1 millón de USD en el subgrafo QmZBQcF..."
Obtenga los últimos 10 eventos de intercambio del subgrafo QmZBQcF..., incluyendo símbolos y montos de tokens.
Tareas de análisis
Analice el volumen de negociación de los pares USDT durante la última semana utilizando el subgráfico QmZBQcF.
Comparar la liquidez de los pares ETH y USDC en el subgráfico QmZBQcF.
Encuentre patrones de trading inusuales en las últimas 24 horas en el subgráfico QmZBQcF.
Tareas combinadas
Primero, obtén el esquema de QmZBQcF... y luego ayúdame a escribir una consulta para encontrar transacciones de alto valor.
"Consulta el esquema de QmZBQcF... y dime qué campos están disponibles para consultar los precios de los tokens".
Utilizando el subgrafo QmZBQcF..., analice el impacto en el mercado de las grandes operaciones, primero comprendiendo el esquema y luego consultando los eventos relevantes.
Licencia
Este proyecto está licenciado bajo la Licencia MIT. Consulte el archivo de LICENCIA para más detalles.
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