dune-mcp-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dune MCP Skill

Dune MCP Skill

Use this skill to run Dune MCP operations through
uxc
.
Reuse the
uxc
skill for shared protocol discovery, output parsing, and generic auth/binding flows.
通过
uxc
使用此技能来运行Dune MCP操作。
复用
uxc
技能以实现共享协议发现、输出解析以及通用身份验证/绑定流程。

Prerequisites

前提条件

  • uxc
    is installed and available in
    PATH
    .
  • Network access to
    https://api.dune.com/mcp/v1
    .
  • Dune API key is available for authenticated calls.
  • uxc
    已安装且可在
    PATH
    中访问。
  • 可访问
    https://api.dune.com/mcp/v1
    的网络权限。
  • 拥有用于认证调用的Dune API密钥。

Core Workflow

核心工作流

  1. Confirm endpoint and protocol with help-first probing:
    • uxc https://api.dune.com/mcp/v1 -h
  2. Configure credential/binding for repeatable auth:
    • uxc auth credential set dune-mcp --auth-type api_key --header "x-dune-api-key={{secret}}" --secret-env DUNE_API_KEY
    • uxc auth credential set dune-mcp --auth-type api_key --header "x-dune-api-key={{secret}}" --secret-op op://Engineering/dune/api-key
    • uxc auth binding add --id dune-mcp --host api.dune.com --path-prefix /mcp/v1 --scheme https --credential dune-mcp --priority 100
  3. Use fixed link command by default:
    • command -v dune-mcp-cli
    • If missing, create it:
      uxc link dune-mcp-cli https://api.dune.com/mcp/v1
    • dune-mcp-cli -h
  4. Inspect operation schema before execution:
    • dune-mcp-cli searchTables -h
    • dune-mcp-cli searchTablesByContractAddress -h
    • dune-mcp-cli createDuneQuery -h
    • dune-mcp-cli executeQueryById -h
    • dune-mcp-cli getExecutionResults -h
  5. Prefer read/discovery operations first, then query creation or credit-consuming execution.
  1. 通过优先提供帮助的探测确认端点和协议:
    • uxc https://api.dune.com/mcp/v1 -h
  2. 配置凭证/绑定以实现可重复的身份验证:
    • uxc auth credential set dune-mcp --auth-type api_key --header "x-dune-api-key={{secret}}" --secret-env DUNE_API_KEY
    • uxc auth credential set dune-mcp --auth-type api_key --header "x-dune-api-key={{secret}}" --secret-op op://Engineering/dune/api-key
    • uxc auth binding add --id dune-mcp --host api.dune.com --path-prefix /mcp/v1 --scheme https --credential dune-mcp --priority 100
  3. 默认使用固定链接命令:
    • command -v dune-mcp-cli
    • 若缺失,创建链接:
      uxc link dune-mcp-cli https://api.dune.com/mcp/v1
    • dune-mcp-cli -h
  4. 执行前检查操作模式:
    • dune-mcp-cli searchTables -h
    • dune-mcp-cli searchTablesByContractAddress -h
    • dune-mcp-cli createDuneQuery -h
    • dune-mcp-cli executeQueryById -h
    • dune-mcp-cli getExecutionResults -h
  5. 优先执行读取/发现操作,再进行查询创建或消耗积分的执行操作。

Capability Map

功能映射

  • Discovery:
    • searchDocs
    • searchTables
    • listBlockchains
    • searchTablesByContractAddress
  • Query lifecycle:
    • createDuneQuery
    • getDuneQuery
    • updateDuneQuery
    • executeQueryById
    • getExecutionResults
  • Analysis helpers:
    • generateVisualization
    • getTableSize
    • getUsage
  • 发现:
    • searchDocs
    • searchTables
    • listBlockchains
    • searchTablesByContractAddress
  • 查询生命周期:
    • createDuneQuery
    • getDuneQuery
    • updateDuneQuery
    • executeQueryById
    • getExecutionResults
  • 分析辅助工具:
    • generateVisualization
    • getTableSize
    • getUsage

Recommended Usage Pattern

推荐使用模式

  1. Find the right table first:
    • dune-mcp-cli searchTables query='uniswap swaps'
    • dune-mcp-cli searchTablesByContractAddress contractAddress=0x...
  2. Prefer higher-level
    spell
    tables when they already expose the metrics you need.
  3. Keep SQL partition-aware:
    • use
      block_date
      ,
      evt_block_date
      , or another partition/date column in
      WHERE
  4. Create a temporary query only after confirming table choice and date range.
  5. Execute and fetch results by execution ID.
  1. 先找到合适的表:
    • dune-mcp-cli searchTables query='uniswap swaps'
    • dune-mcp-cli searchTablesByContractAddress contractAddress=0x...
  2. 若已有暴露所需指标的高阶
    spell
    表,优先使用。
  3. 保持SQL的分区感知:
    • WHERE
      子句中使用
      block_date
      evt_block_date
      或其他分区/日期列
  4. 确认表选择和日期范围后,再创建临时查询。
  5. 通过执行ID获取执行结果。

Guardrails

防护规则

  • Keep automation on JSON output envelope; do not rely on
    --text
    .
  • Parse stable fields first:
    ok
    ,
    kind
    ,
    protocol
    ,
    data
    ,
    error
    .
  • Use
    dune-mcp-cli
    as default command path.
  • dune-mcp-cli <operation> ...
    is equivalent to
    uxc https://api.dune.com/mcp/v1 <operation> ...
    .
  • Discovery operations are read-only:
    • searchDocs
    • searchTables
    • listBlockchains
    • searchTablesByContractAddress
    • getDuneQuery
    • getExecutionResults
    • getTableSize
    • getUsage
  • Require explicit user confirmation before credit-consuming or state-changing operations:
    • createDuneQuery
    • updateDuneQuery
    • executeQueryById
    • generateVisualization
  • Be careful with privacy:
    • confirm before switching a query from private to public
    • temporary queries can still be visible; inspect
      is_private
      and
      is_temp
  • key=value
    input now supports automatic type conversion for numeric MCP arguments.
  • Numeric IDs can be passed directly with
    key=value
    , for example:
    • query_id=6794106
    • queryId=6794106
  • Positional JSON is still useful for nested objects or when mixing string and numeric fields precisely:
    • {"executionId":"01...","timeout":90,"limit":20}
  • For SQL passed via
    key=value
    , wrap the whole SQL string in double quotes so inner SQL single quotes survive shell parsing.
  • If
    listBlockchains
    returns a Dune-side schema/facet error, fall back to
    searchTables
    with
    blockchains
    filters.
  • 自动化操作基于JSON输出包,不要依赖
    --text
    格式。
  • 优先解析稳定字段:
    ok
    kind
    protocol
    data
    error
  • 使用
    dune-mcp-cli
    作为默认命令路径。
  • dune-mcp-cli <operation> ...
    等效于
    uxc https://api.dune.com/mcp/v1 <operation> ...
  • 发现操作是只读的:
    • searchDocs
    • searchTables
    • listBlockchains
    • searchTablesByContractAddress
    • getDuneQuery
    • getExecutionResults
    • getTableSize
    • getUsage
  • 消耗积分或改变状态的操作需要用户明确确认:
    • createDuneQuery
    • updateDuneQuery
    • executeQueryById
    • generateVisualization
  • 注意隐私:
    • 将查询从私有切换为公开前需确认
    • 临时查询仍可能被可见;检查
      is_private
      is_temp
      字段
  • key=value
    输入现在支持对数值型MCP参数自动类型转换。
  • 数值ID可直接通过
    key=value
    传递,例如:
    • query_id=6794106
    • queryId=6794106
  • 位置JSON仍适用于嵌套对象或需要精确混合字符串和数值字段的场景:
    • {"executionId":"01...","timeout":90,"limit":20}
  • 对于通过
    key=value
    传递的SQL,需将整个SQL字符串用双引号包裹,以便内部的SQL单引号能在shell解析中保留。
  • listBlockchains
    返回Dune端的模式/分面错误, fallback到带
    blockchains
    过滤器的
    searchTables

Tested Real Scenario

已测试的真实场景

The following flow was exercised successfully through
uxc
:
  • discover table:
    uniswap.uniswapx_trades
  • create temporary query for Base daily volume
  • execute query
  • fetch results
The successful SQL shape was:
sql
SELECT block_date,
       ROUND(SUM(amount_usd), 2) AS daily_volume_usd,
       COUNT(*) AS trades
FROM uniswap.uniswapx_trades
WHERE blockchain = 'base'
  AND block_date >= date_add('day', -7, CURRENT_DATE)
GROUP BY 1
ORDER BY 1 DESC
LIMIT 7
以下流程已通过
uxc
成功执行:
  • 发现表:
    uniswap.uniswapx_trades
  • 创建针对Base日交易量的临时查询
  • 执行查询
  • 获取结果
成功的SQL语句如下:
sql
SELECT block_date,
       ROUND(SUM(amount_usd), 2) AS daily_volume_usd,
       COUNT(*) AS trades
FROM uniswap.uniswapx_trades
WHERE blockchain = 'base'
  AND block_date >= date_add('day', -7, CURRENT_DATE)
GROUP BY 1
ORDER BY 1 DESC
LIMIT 7

References

参考资料

  • Invocation patterns:
    • references/usage-patterns.md
  • 调用模式:
    • references/usage-patterns.md