Dune Query MCP

Dune Query MCP

A bridge that connects Dune Analytics blockchain data to AI applications through Model Control Protocol, allowing LLMs to access on-chain data via natural language interactions.

Category
Visit Server

README

Dune Query MCP

Version Python

A modern bridge connecting Dune Analytics data to intelligent agents through Model Control Protocol (MCP).

Overview

dune-query-mcp enables seamless integration of blockchain data analytics into your AI applications. By leveraging Dune Analytics' powerful query capabilities with the Model Control Protocol, this service allows LLMs and other AI systems to access on-chain data through simple, natural language interactions.

Core Capabilities

Data Retrieval Tools

Tool Description Use Case
get_latest_result Retrieves pre-computed query results Quick access to existing data
run_query Executes a query on-demand Real-time data analysis

Data Format

All data is returned in CSV format, providing:

  • Universal compatibility
  • Easy parsing by most data analysis tools
  • Human-readable output

Getting Started

System Requirements

Quick Setup

  1. Clone & Navigate

    git clone https://github.com/olaxbt/dune-query-mcp-mcp.git
    cd dune-query-mcp
    
  2. Environment Setup

    # Create virtual environment
    python -m venv .venv
    
    # Activate it
    source .venv/bin/activate  # Linux/Mac
    # or
    .venv\Scripts\activate     # Windows
    
    # Install dependencies
    pip install -r requirements.txt
    
  3. Configure API Access

    # Copy example config
    cp .env.example .env
    
    # Edit with your API key
    echo "DUNE_API_KEY=your_key_here" > .env
    

Usage

Running the Service

dune-query-mcp offers two ways to run:

As MCP Service

python run.py

This starts the MCP service on default port 8000.

As Web Server

python flask_app.py

This provides access to the web interface and REST API endpoints.

Integrating with Applications

MCP Client Integration

from mcp.client import Client

# Connect to Dune-query-mcp
client = Client("http://localhost:8000")

# Get latest results for a query
csv_data = client.call("get_latest_result", query_id=1234567)

# Execute a query
query_results = client.call("run_query", query_id=1234567)

REST API

Endpoint Method Description
/dune/health GET Service health check
/dune/query/{query_id}/latest GET Retrieve latest results
/dune/query/{query_id}/execute POST Run a query

Example REST Call:

curl -X GET http://localhost:5000/dune/query/1234567/latest

Architecture

dune-query-mcp/
├── app/                       # Application core
│   ├── __init__.py            # Flask & MCP setup
│   ├── routes/                # API endpoint definitions
│   │   └── dune_routes/       # Dune Analytics routes
│   │   └── templates/             # Web interface
│   └── templates/             # Web interface
├── config/                    # Configuration files
├── logs/                      # Runtime logs
├── flask_app.py               # Web server entry point
├── run.py                     # MCP server entry point
└── requirements.txt           # Dependencies

Advanced Configuration

Environment Variables

Variable Purpose Default
DUNE_API_KEY Authentication for Dune API None (Required)
PORT Server port 8000

Performance Tuning

For high-volume query execution:

# Set a higher timeout for long-running queries
export DUNE_QUERY_TIMEOUT=600  # 10 minutes in seconds

Troubleshooting

Common issues and solutions:

Problem Solution
API Key errors Ensure .env file exists with valid key
Timeout errors Increase timeout for complex queries
CSV parsing issues Check query returns proper tabular data

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -am 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

This project is released under the MIT License. See LICENSE file for details.

Acknowledgments

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