home / mcp / dune analytics mcp server
A mcp server that bridges Dune Analytics data to AI agents.
Configuration
View docs{
"mcpServers": {
"kukapay-dune-analytics-mcp": {
"command": "mcp",
"args": [
"dev",
"main.py"
],
"env": {
"DUNE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Dune Analytics MCP Server bridges Dune Analytics data to AI agents. It exposes tools that fetch or run Dune queries and returns results as CSV strings for easy downstream processing.
You interact with the Dune Analytics MCP Server through an MCP client. The server provides two core tools that return results as CSV text, making it straightforward to feed data into agents or pipelines: the get_latest_result tool and the run_query tool.
Prerequisites you need before running the server:
- Python 3.10+
- A valid Dune Analytics API key (you obtain this from Dune Analytics)
Install via MCP client (CLI) to run the server in Claude Desktop or similar environments.
mcp dev main.pyInstall for Claude Desktop as a service
mcp install main.py --name "Dune Analytics"Create an environment file at the project root or set an environment variable for the Dune API key.
DUNE_API_KEY=your_api_key_hereThe server exposes two main tools. Use them by calling the tool names with the required query IDs. Each tool returns a CSV-formatted string.
1) get_latest_result(query_id) retrieves the latest results for a given Dune query.
2) run_query(query_id) executes a Dune query and returns the results.
get_latest_result(query_id=4853921)run_query(query_id=1215383)You could say commands in natural language such as: "Get latest results for dune query 1215383" or "Run dune query 1215383" to trigger the corresponding MCP tool.
Fetches the latest results of a specified Dune query by its ID and returns the data as a CSV-formatted string.
Executes a Dune query by its ID and returns the results as a CSV-formatted string.