Skip to main content
Glama

Dune Query MCP

by olaxbt

Version Python

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

Overview

DuneLink 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

ToolDescriptionUse Case
get_latest_resultRetrieves pre-computed query resultsQuick access to existing data
run_queryExecutes a query on-demandReal-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.git cd dunelink
  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

DuneLink 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 DuneLink 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
EndpointMethodDescription
/dune/healthGETService health check
/dune/query/{query_id}/latestGETRetrieve latest results
/dune/query/{query_id}/executePOSTRun a query

Example REST Call:

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

Architecture

dunelink/ ├── 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

VariablePurposeDefault
DUNE_API_KEYAuthentication for Dune APINone (Required)
PORTServer port8000

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:

ProblemSolution
API Key errorsEnsure .env file exists with valid key
Timeout errorsIncrease timeout for complex queries
CSV parsing issuesCheck 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

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

通过模型控制协议将 Dune Analytics 区块链数据连接到 AI 应用程序的桥梁,允许 LLM 通过自然语言交互访问链上数据。

  1. 概述
    1. 核心能力
      1. 数据检索工具
      2. 数据格式
    2. 入门
      1. 系统要求
      2. 快速设置
    3. 用法
      1. 运行服务
      2. 与应用程序集成
    4. 建筑学
      1. 高级配置
        1. 环境变量
        2. 性能调优
      2. 故障排除
        1. 贡献
          1. 执照
            1. 致谢

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                A mcp server that bridges Dune Analytics data to AI agents.
                Last updated -
                23
                Python
                MIT License
              • A
                security
                F
                license
                A
                quality
                Implements the Model Context Protocol to allow AI models to access and interact with blockchain data, including reading contract states, retrieving events, and accessing transaction information across various networks.
                Last updated -
                10
                621
                60
                TypeScript
              • A
                security
                A
                license
                A
                quality
                Connects AI agents and developers to structured blockchain data across multiple networks through Nodit's Web3 infrastructure, enabling easy querying, analysis and interaction with blockchain ecosystems without specialized development expertise.
                Last updated -
                9
                627
                13
                TypeScript
                Apache 2.0
                • Apple
              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol server that connects AI agents to Dune Analytics data, providing access to DEX metrics, EigenLayer statistics, and Solana token balances through structured tools.
                Last updated -
                2
                TypeScript
                MIT License
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/olaxbt/dune-query-mcp'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server