dune analytics mcp

Local 2025-08-31 23:58:35 0

A mcp server that bridges Dune Analytics data to AI agents.


A mcp server that bridges Dune Analytics data to AI agents.

Features

  • Tools:
  • get_latest_result: Fetch the latest results of a Dune query by ID.
  • run_query: Execute a Dune query by ID and retrieve results.
  • CSV Output: All results are returned as CSV-formatted strings for easy processing.

Prerequisites

  • Python 3.10+
  • A valid Dune Analytics API key (get one from Dune Analytics)

Installation

  1. Clone the Repository:

    git clone https://github.com/kukapay/dune-analytics-mcp.git
    cd dune-analytics-mcp

  2. Set Up Environment Variables: Create a .env file in the project root:

    DUNE_API_KEY=your_api_key_here
    Alternatively, set it as a system environment variable:
    export DUNE_API_KEY="your_api_key_here"

Usage

Running the Server

  • Development Mode:

    mcp dev main.py
    This starts the server with hot reloading for development.

  • Install for Claude Desktop:

    mcp install main.py --name "Dune Analytics"
    Installs the server as a service for use with Claude Desktop.

Tool Usage

  1. get_latest_result(query_id)
  2. Description: Retrieves the latest results of a specified Dune query.
  3. Input: query_id (int) - The ID of the Dune query.
  4. Output: CSV-formatted string of the query results.
  5. Example:

    get_latest_result(query_id=4853921)

  6. run_query(query_id)

  7. Description: Executes a Dune query and returns the results.
  8. Input: query_id (int) - The ID of the Dune query to run.
  9. Output: CSV-formatted string of the query results.
  10. Example:
    run_query(query_id=1215383)

Example Commands in Claude Desktop

  • "Get latest results for dune query 1215383"
  • "Run dune query 1215383"

License

This project is licensed under the MIT License - see the LICENSE file for details.