thegraph-mcp-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseThe Graph MCP Skill
The Graph MCP 技能
Use this skill to run The Graph Subgraph MCP operations through using the native SSE MCP endpoint.
uxcReuse the skill for generic protocol discovery, envelope parsing, and error handling rules.
uxc使用本技能通过原生SSE MCP端点,借助执行The Graph Subgraph MCP操作。
uxc复用技能以实现通用协议发现、信封解析和错误处理规则。
uxcPrerequisites
前提条件
- is installed and available in
uxc.PATH - Network access to .
https://subgraphs.mcp.thegraph.com/sse - The Graph Gateway API key is available for authenticated calls.
- 已安装且可在
uxc中访问。PATH - 可访问网络地址。
https://subgraphs.mcp.thegraph.com/sse - 拥有The Graph Gateway API密钥,用于认证调用。
Core Workflow (The Graph-Specific)
核心工作流(The Graph 专属)
Endpoint candidate inputs before finalizing:
- Official remote MCP endpoint:
https://subgraphs.mcp.thegraph.com/sse
- Verify protocol/path from official source and probe:
- Official source:
https://thegraph.com/docs/en/ai-suite/subgraph-mcp/introduction/ - probe candidate endpoint with:
uxc https://subgraphs.mcp.thegraph.com/sse -h
- Confirm protocol is MCP (in envelope).
protocol == "mcp"
- Official source:
- Detect auth requirement explicitly:
- Run host help or a minimal read call and inspect envelope.
- This endpoint requires a The Graph Gateway API key sent as .
Authorization: Bearer <key>
- Register credential and use fixed link command by default:
uxc auth credential set thegraph --secret-env THEGRAPH_API_KEYuxc auth binding add --id thegraph-sse --host subgraphs.mcp.thegraph.com --path-prefix /sse --scheme https --credential thegraph --priority 100command -v thegraph-mcp-cli- If missing, create it:
uxc link thegraph-mcp-cli https://subgraphs.mcp.thegraph.com/sse
thegraph-mcp-cli -h- If command conflict is detected and cannot be safely reused, stop and ask skill maintainers to pick another fixed command name.
- Inspect operation schema before execution:
thegraph-mcp-cli -hthegraph-mcp-cli <operation> -h
- Prefer discovery/schema operations first:
- find candidate subgraphs or deployments
- inspect schema
- execute query only after identifier and schema are understood
确定最终端点前的候选输入:
- 官方远程MCP端点:
https://subgraphs.mcp.thegraph.com/sse
- 验证官方来源的协议/路径并进行探测:
- 官方来源:
https://thegraph.com/docs/en/ai-suite/subgraph-mcp/introduction/ - 使用以下命令探测候选端点:
uxc https://subgraphs.mcp.thegraph.com/sse -h
- 确认协议为MCP(信封中)。
protocol == "mcp"
- 官方来源:
- 显式检测认证要求:
- 运行主机帮助命令或最小化读取调用并检查信封。
- 此端点要求发送The Graph Gateway API密钥,格式为。
Authorization: Bearer <key>
- 注册凭证并默认使用固定链接命令:
uxc auth credential set thegraph --secret-env THEGRAPH_API_KEYuxc auth binding add --id thegraph-sse --host subgraphs.mcp.thegraph.com --path-prefix /sse --scheme https --credential thegraph --priority 100command -v thegraph-mcp-cli- 如果不存在,则创建:
uxc link thegraph-mcp-cli https://subgraphs.mcp.thegraph.com/sse
thegraph-mcp-cli -h- 如果检测到命令冲突且无法安全复用,请停止操作并请求技能维护者选择其他固定命令名称。
- 执行操作前检查操作模式:
thegraph-mcp-cli -hthegraph-mcp-cli <operation> -h
- 优先执行发现/模式操作:
- 查找候选子图或部署
- 检查模式
- 仅在了解标识符和模式后执行查询
Capability Map
功能映射
- Discovery:
- search subgraphs by keyword
- find top deployments for a contract
- inspect deployment popularity / 30-day query volume
- Schema:
- get schema by deployment ID
- get schema by subgraph ID
- get schema by IPFS hash
- Query execution:
- execute GraphQL query by deployment ID
- execute GraphQL query by subgraph ID
- execute GraphQL query by IPFS hash
- 发现:
- 按关键词搜索子图
- 查找合约的热门部署
- 检查部署的受欢迎程度/30天查询量
- 模式:
- 通过部署ID获取模式
- 通过子图ID获取模式
- 通过IPFS哈希获取模式
- 查询执行:
- 通过部署ID执行GraphQL查询
- 通过子图ID执行GraphQL查询
- 通过IPFS哈希执行GraphQL查询
Guardrails
防护规则
- Keep automation on JSON output envelope; do not rely on .
--text - Parse stable fields first: ,
ok,kind,protocol,data.error - Use as default command path.
thegraph-mcp-cli - is equivalent to
thegraph-mcp-cli <operation> ...when the same auth binding is configured.uxc https://subgraphs.mcp.thegraph.com/sse <operation> ... - Use direct only as temporary fallback when link setup is unavailable.
uxc "<endpoint>" ... - Prefer discovery and schema inspection before query execution.
- For production/stable workflows, prefer deployment-oriented selection over loosely changing latest-version references.
- Keep GraphQL query scope small on first pass:
- add filters
- add limits
- fetch only required fields
- If auth fails:
- confirm succeeds
uxc auth credential info thegraph - confirm resolves to
uxc auth binding match https://subgraphs.mcp.thegraph.com/ssethegraph - rerun
thegraph-mcp-cli -h
- confirm
- 自动化操作基于JSON输出信封;不要依赖参数。
--text - 优先解析稳定字段:,
ok,kind,protocol,data。error - 使用作为默认命令路径。
thegraph-mcp-cli - 当配置相同的认证绑定时,等价于
thegraph-mcp-cli <operation> ...。uxc https://subgraphs.mcp.thegraph.com/sse <operation> ... - 仅当链接设置不可用时,才使用直接作为临时回退方案。
uxc "<endpoint>" ... - 优先执行发现和模式检查,再执行查询。
- 对于生产/稳定工作流,优先选择基于部署的方式,而非频繁变化的最新版本引用。
- 首次执行时缩小GraphQL查询范围:
- 添加过滤器
- 添加限制条件
- 仅获取所需字段
- 如果认证失败:
- 确认执行成功
uxc auth credential info thegraph - 确认解析为
uxc auth binding match https://subgraphs.mcp.thegraph.com/ssethegraph - 重新运行
thegraph-mcp-cli -h
- 确认
Tested Real Scenario
已测试的真实场景
The following flow was exercised successfully through against the live endpoint:
uxc- search subgraphs
uniswap - compare candidates with
get_deployment_30day_query_counts - select the highest-volume candidate
- fetch schema for the chosen subgraph
- execute a minimal GraphQL query
_meta
The selected candidate in that run was:
- subgraph ID:
5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV - deployment IPFS hash:
QmTZ8ejXJxRo7vDBS4uwqBeGoxLSWbhaA7oXa1RvxunLy7
The minimal verified query shape was:
graphql
{
_meta {
deployment
hasIndexingErrors
}
}以下流程已通过针对实时端点成功执行:
uxc- 搜索子图
uniswap - 使用比较候选者
get_deployment_30day_query_counts - 选择查询量最高的候选者
- 获取所选子图的模式
- 执行最小化的GraphQL查询
_meta
该次运行中选择的候选者为:
- 子图ID:
5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV - 部署IPFS哈希:
QmTZ8ejXJxRo7vDBS4uwqBeGoxLSWbhaA7oXa1RvxunLy7
已验证的最小查询结构为:
graphql
{
_meta {
deployment
hasIndexingErrors
}
}References
参考资料
- Invocation patterns:
references/usage-patterns.md
- 调用模式:
references/usage-patterns.md