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.
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.
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.
Capability Map
-
searchDocs
-
searchTables
-
listBlockchains
-
searchTablesByContractAddress
-
createDuneQuery
-
getDuneQuery
-
updateDuneQuery
-
executeQueryById
-
getExecutionResults
-
generateVisualization
-
getTableSize
- INLINECODE28
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. - 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.
- Execute and fetch results by execution 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. - INLINECODE42 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.
Tested Real Scenario
The following flow was exercised successfully through uxc:
- - discover table: INLINECODE68
- create temporary query for Base daily volume
- execute query
- fetch results
The successful SQL shape was:
CODEBLOCK0
References
- INLINECODE69
Dune MCP 技能
使用此技能通过 uxc 运行 Dune MCP 操作。
复用 uxc 技能进行共享协议发现、输出解析以及通用认证/绑定流程。
前置条件
- - uxc 已安装并可在 PATH 中使用。
- 可访问 https://api.dune.com/mcp/v1 的网络连接。
- 拥有 Dune API 密钥用于认证调用。
核心工作流
- 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 DUNEAPI_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. 优先执行读取/发现操作,然后进行查询创建或消耗积分的执行。
能力映射
- searchDocs
- searchTables
- listBlockchains
- searchTablesByContractAddress
- createDuneQuery
- getDuneQuery
- updateDuneQuery
- executeQueryById
- getExecutionResults
- generateVisualization
- getTableSize
- getUsage
推荐使用模式
- 1. 首先找到正确的表:
- dune-mcp-cli searchTables query=uniswap swaps
- dune-mcp-cli searchTablesByContractAddress contractAddress=0x...
- 2. 当高级 spell 表已暴露所需指标时,优先使用它们。
- 保持 SQL 分区感知:
- 在 WHERE 中使用 block
date、evtblock_date 或其他分区/日期列
- 4. 仅在确认表选择和日期范围后创建临时查询。
- 通过执行 ID 执行并获取结果。
防护措施
- - 保持自动化使用 JSON 输出格式;不要依赖 --text。
- 首先解析稳定字段:ok、kind、protocol、data、error。
- 使用 dune-mcp-cli 作为默认命令路径。
- dune-mcp-cli ... 等同于 uxc https://api.dune.com/mcp/v1 ...。
- 发现操作为只读:
- searchDocs
- searchTables
- listBlockchains
- searchTablesByContractAddress
- getDuneQuery
- getExecutionResults
- getTableSize
- getUsage
- - 在消耗积分或改变状态的操作前需要明确的用户确认:
- createDuneQuery
- updateDuneQuery
- executeQueryById
- generateVisualization
- 在将查询从私有切换为公开前进行确认
- 临时查询仍然可见;检查 is
private 和 istemp
- - 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 端的模式/方面错误,回退到使用 blockchains 过滤器的 searchTables。
已验证的真实场景
以下流程已通过 uxc 成功执行:
- - 发现表:uniswap.uniswapx_trades
- 创建 Base 每日交易量的临时查询
- 执行查询
- 获取结果
成功的 SQL 格式如下:
sql
SELECT block_date,
ROUND(SUM(amountusd), 2) AS dailyvolume_usd,
COUNT(*) AS trades
FROM uniswap.uniswapx_trades
WHERE blockchain = base
AND blockdate >= dateadd(day, -7, CURRENT_DATE)
GROUP BY 1
ORDER BY 1 DESC
LIMIT 7
参考
- references/usage-patterns.md