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
Visit Server

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured