TheGraph MCP Server - MCP服务,MCP服务器,MCP教程

基本能力

产品定位

TheGraph MCP Server 是一个为AI代理提供索引区块链数据的MCP服务器,基于The Graph项目构建。

核心功能

  1. getSubgraphSchema: 获取指定子图的模式,为AI代理提供生成GraphQL查询所需的上下文。
  2. 参数: subgraphId (子图ID), asText (输出格式标志)
  3. querySubgraph: 对指定子图执行GraphQL查询。
  4. 参数: subgraphId (子图ID), query (GraphQL查询字符串)

适用场景

  • 区块链数据分析
  • 智能合约开发
  • 加密货币市场分析
  • 区块链数据可视化

工具列表

  1. getSubgraphSchema: 获取子图的模式,支持JSON和人类可读的GraphQL格式。
  2. querySubgraph: 执行GraphQL查询,支持手动或AI生成的查询。

常见问题解答

  • 如何获取API密钥?需要在环境变量中设置THEGRAPH_API_KEY
  • 如何输出人类可读的模式?设置asText参数为true

使用教程

使用依赖

  • Python 3.10+

安装教程

  1. 克隆仓库
    bash
    git clone https://github.com/kukapay/thegraph-mcp.git
  2. 客户端配置
    json
    {
    "mcpServers": {
    "thegraph-mcp": {
    "command": "uv",
    "args": ["--directory", "path/to/thegraph-mcp", "run", "main.py"],
    "env": {
    "THEGRAPH_API_KEY": "your_api_key_here"
    }
    }
    }
    }

调试方式

  • 确保THEGRAPH_API_KEY已正确设置。
  • 使用示例提示测试工具功能。

示例提示

模式查询

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

数据查询

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

分析任务

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

组合任务

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

点击访问

搜索工具

Brasil API MCP - MCP服务,MCP服务器,MCP教程

2025-4-29 16:54:41

搜索工具

🤖 nostr-code-snippet-mcp - MCP服务,MCP服务器,MCP教程

2025-4-29 16:54:55

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索