dune-mcp

dune-mcp

Dune MCP Server connects your AI assistant to Dune Analytics, the leading platform for blockchain data. Execute SQL queries across Ethereum, Solana, and 20+ chains to analyze DEX trades, token transfers, NFT sales, and wallet activity. Manage saved queries, upload custom datasets, and access curate

Category
访问服务器

README

Dune MCP Server

A comprehensive MCP (Model Context Protocol) server for interacting with Dune Analytics - the leading platform for blockchain data analysis.

Features

Tools

This server exposes all major Dune Analytics API endpoints as MCP tools:

SQL Execution

  • execute_sql - Execute raw SQL queries against Dune's data engine
  • get_execution_status - Check query execution status
  • get_execution_results - Retrieve query results (JSON)
  • get_execution_results_csv - Retrieve query results (CSV)
  • cancel_execution - Cancel a running query

Saved Query Management

  • execute_query - Execute a saved query by ID
  • get_query - Get query details
  • get_query_results - Get latest cached results without re-executing
  • get_query_results_csv - Get latest results as CSV
  • create_query - Create and save a new query
  • update_query - Update an existing query
  • archive_query - Archive a query
  • make_query_private / make_query_public - Change query visibility

Data Upload

  • upload_csv - Upload CSV data to create/update a table
  • create_table - Create a new table with schema
  • insert_table_rows - Insert rows into an existing table
  • clear_table - Clear all data from a table
  • delete_table - Permanently delete a table

Resources

The server exposes comprehensive documentation as MCP resources to help LLMs write valid DuneSQL queries:

Resource URI Description
dune://guide/sql-syntax DuneSQL (Trino) syntax reference, data types, functions
dune://guide/tables Available tables: dex.trades, prices.usd, chain-specific tables
dune://guide/query-patterns Common analytics patterns: volume, holders, whales, gas
dune://guide/parameters How to use query parameters
dune://guide/errors Common errors and troubleshooting

Installation

cd dune-mcp
pip install -e .

Configuration

Set your Dune API key as an environment variable:

export DUNE_API_KEY="your-api-key-here"

Get your API key from Dune Settings.

Usage

Running the Server

# Direct execution
python server.py

# Or via installed script
dune-mcp

Claude Desktop Configuration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "dune": {
      "command": "python",
      "args": ["/path/to/dune-mcp/server.py"],
      "env": {
        "DUNE_API_KEY": "your-api-key-here"
      }
    }
  }
}

Or using uv:

{
  "mcpServers": {
    "dune": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/dune-mcp", "python", "server.py"],
      "env": {
        "DUNE_API_KEY": "your-api-key-here"
      }
    }
  }
}

Example Queries

Simple DEX Volume Query

# Using execute_sql tool
result = await execute_sql(
    sql="""
    SELECT 
        project,
        SUM(amount_usd) as volume
    FROM dex.trades
    WHERE block_time > now() - interval '24' hour
    GROUP BY 1
    ORDER BY 2 DESC
    LIMIT 10
    """,
    performance="medium"
)

Cross-Chain Analysis

result = await execute_sql(
    sql="""
    SELECT 
        blockchain,
        COUNT(*) as tx_count,
        SUM(amount_usd) as volume_usd
    FROM dex.trades
    WHERE block_time > now() - interval '7' day
    GROUP BY 1
    ORDER BY 3 DESC
    """
)

Create Parameterized Query

result = await create_query(
    name="Token Volume Analysis",
    query_sql="""
    SELECT 
        DATE_TRUNC('day', block_time) as day,
        SUM(amount_usd) as volume
    FROM dex.trades
    WHERE token_bought_symbol = '{{token}}'
        AND block_time > now() - interval '{{days}}' day
    GROUP BY 1
    ORDER BY 1
    """,
    parameters=[
        {"key": "token", "value": "UNI", "type": "text"},
        {"key": "days", "value": "30", "type": "number"}
    ]
)

Available Tables

Curated (Cross-Chain)

  • dex.trades - DEX trades across all EVM chains
  • dex_solana.trades - Solana DEX trades
  • nft.trades - NFT trades
  • prices.usd - Token prices
  • tokens.erc20 - ERC20 token metadata

Chain-Specific

  • ethereum.transactions, ethereum.logs, ethereum.traces
  • polygon.transactions, polygon.logs, etc.
  • arbitrum.transactions, optimism.transactions, base.transactions

Decoded Protocol Tables

  • uniswap_v3_ethereum.Pair_evt_Swap
  • aave_v3_ethereum.Pool_evt_Supply
  • And many more...

API Reference

See Dune API Documentation for complete API details.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选