thegraph-query-adapter
Interface for retrieving structured blockchain datasets via GraphQL endpoints hosted on The Graph protocol, facilitating data access for intelligent computational agents.
Author

lekt9
Quick Info
Actions
Tags
TheGraph Query Adapter Service
An MCP utility designed to furnish AI entities with curated, indexed ledger information sourced from The Graph's decentralized indexing network.
Exposed Functionalities
1. retrieveSubgraphSchema
Obtains the complete data definition (schema) for a designated subgraph, equipping agents with the necessary metadata for constructing valid GraphQL queries.
Arguments:
- subgraphId: The unique identifier of the target subgraph (e.g., "QmZBQcF...")
- asText: A boolean flag determining output verbosity
- true: Renders the schema in human-readable GraphQL Schema Definition Language (SDL)
- false: Outputs the schema representation in JSON format (default behavior)
2. executeSubgraphQuery
Dispatches GraphQL query requests against the specified data source. While optimized for AI-generated queries, users retain the option to supply bespoke query strings.
Arguments:
- subgraphId: The identifier for the subgraph endpoint
- query: The complete GraphQL query string intended for execution
Deployment Instructions
Automated Integration via Smithery
To integrate thegraph-query-adapter into your Claude environment seamlessly using Smithery:
npx -y @smithery/cli install @lekt9/thegraph-mcp --client claude
Manual Setup Procedure
- Source Code Retrieval
bash git clone https://github.com/kukapay/thegraph-mcp.git - Configuration File Adjustment
Modify your local configuration structure:
json { "mcpServers": { "thegraph-query-adapter": { "command": "uv", "args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"], "env": { "THEGRAPH_API_KEY": "your_secret_key_here" } } } }
Illustrative Natural Language Prompts
These examples show how natural language can invoke the defined capabilities:
Schema Discovery
- "Display the structural definition for subgraph QmZBQcF... utilizing a human-readable presentation."
- "What data fields are exposed by the QmZBQcF... index? Provide the output as SDL."
- "I require documentation on subgraph QmZBQcF...'s underlying data schema; please fetch and present it."
Data Extraction
- "Query subgraph QmZBQcF... to ascertain the top 5 assets based on transaction volume over the preceding day."
- "Retrieve all asset pairs within QmZBQcF... that possess a deposited value exceeding one million USD."
- "Fetch the most recent 10 trade events from the QmZBQcF... index, ensuring token symbols and exchanged quantities are included."
Inferential Operations
- "Analyze the temporal changes in trading volume for USDT assets over the past seven days, referencing QmZBQcF... data."
- "Contrast the current total liquidity figures for ETH versus USDC pairs found in subgraph QmZBQcF..."
- "Identify any statistically atypical transaction sequences within the last 24 hours sourced from the QmZBQcF... index."
Multi-Step Workflows
- "First, map out the schema of QmZBQcF... and subsequently assist in formulating a query targeting high-magnitude transfers."
- "Examine the data structure of QmZBQcF... and articulate the precise fields available for querying asset valuation metrics."
- "Leveraging subgraph QmZBQcF..., perform a market effect analysis on substantial trades after first establishing the accessible query topology."
Legal Information
This repository is distributed under the permissive MIT License terms. Refer to the LICENSE file for comprehensive details.
