# Dune Analytics MCP for AI Agents AI Agent Connect

> Dune Analytics MCP lets your AI agent pull real-time blockchain data using SQL. It connects to datasets for Ethereum, Solana, and Polygon so you can track DeFi metrics, NFT trends, and DAO activity directly in your chat. You can trigger queries, monitor their progress, and grab the results for immediate analysis.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_eJSVmM35oPb3EQRWNnqipzpD87HbivFnslURw8ia/ai-agent-connect
- **Tags:** web3, sql, blockchain-data, ethereum, crypto-analytics

## Description

This Connector connects your Dune Analytics account to your AI agent so you can pull on-chain data using SQL. Instead of jumping between browser tabs to find results and copying them into spreadsheets, you can just ask your agent to find specific metrics. You'll get real-time data from networks like Ethereum, Solana, and Polygon directly into your workspace. It handles the heavy lifting of query execution, letting you focus on the analysis. Whether you're hunting for whale movements, tracking NFT volume, or checking protocol health, this connection makes the data accessible in plain English. You can find this among the 4,000+ options in the Vinkius catalog to get your Web3 data flowing into your workflow.

## Tools

### execute_query
Trigger a specific Dune query ID with custom parameters. This starts the data pull and provides an execution ID for tracking.

### get_execution_results
Retrieve the rows from a finished query. Use this to bring the actual data into your agent for analysis.

### get_execution_status
Check if a query is pending, failed, or finished. This helps you know exactly when the data is ready to be pulled.

### cancel_execution
Stop an ongoing query immediately. Use this to kill processes that are taking too long or were started with wrong parameters.

## Prompt Examples

**Prompt:** 
```
Run Dune query 123456 and give me the last 30 days of volume.
```

**Response:** 
```
I've started the execution for query 123456. The execution ID is `01J8X9Z...`. I'll monitor the status and let you know as soon as the data is ready.
```

**Prompt:** 
```
Is my Dune query 01J8X... finished yet?
```

**Response:** 
```
The execution `01J8X9Z...` is currently **QUERY_STATE_COMPLETED**. Would you like me to fetch the results now?
```

**Prompt:** 
```
Get the results for query 01J8X... and tell me the top 3 whale addresses.
```

**Response:** 
```
I've retrieved the data. Here are the top 3 holders:

| Address | Balance |
| :--- | :--- |
| `0xabc...` | 500 ETH |
| `0xdef...` | 450 ETH |
| `0xghi...` | 300 ETH
```

## Capabilities

### Run SQL queries on blockchain data
Trigger specific Dune query IDs with custom parameters to fetch on-chain information.

### Monitor query progress in real-time
Check the status of your active queries to see when the data is ready.

### Pull large datasets into your chat
Retrieve finished query results directly into your AI client for immediate use.

### Stop long-running queries
Cancel ongoing executions to save on your Dune API credits and optimize usage.

## Use Cases

### Finding whale movements
A researcher asks the agent to run a Dune query for specific wallet addresses and summarize the top movements in a table.

### Verifying protocol health
A developer uses the Connector to pull the latest on-chain state of a smart contract to check for errors or successes.

### Automating weekly reports
An analyst fetches 7 days of volume data across multiple chains to generate a market trend report automatically.

### Correcting query errors
A user realizes they passed the wrong date range and uses the Connector to stop the query before it wastes credits.

## Benefits

- Get real-time DeFi metrics without leaving your editor by using execute_query.
- Save on API costs by stopping unnecessary queries with cancel_execution.
- Pull large datasets into your chat for immediate analysis using get_execution_results.
- Track the progress of long queries instantly with get_execution_status.
- Connect to Ethereum, Solana, and Polygon data sets through a single interface.

## How It Works

The bottom line is you get SQL-powered blockchain data in your chat without leaving your current app.

1. Subscribe to the Connector and enter your Dune API Key.
2. Ask your agent to run a specific Dune query ID with your custom parameters.
3. Receive the execution ID and wait for the status to hit 'completed' before fetching the results.

## Frequently Asked Questions

**What can I do with the Dune Analytics MCP?**
I'll use the Dune Analytics MCP to pull real-time blockchain data into my AI chat. It lets me run SQL queries on networks like Ethereum and Solana without leaving my workspace.

**Can the Dune Analytics MCP query multiple blockchains?**
Yes, it connects to data across Ethereum, Solana, Polygon, and other major networks. You can pull metrics from any of these chains using your existing Dune query IDs.

**How do I use the Dune Analytics MCP for DeFi research?**
You can ask your agent to pull specific DeFi metrics, like total value locked or volume. The Connector handles the SQL execution and brings the data straight to you for analysis.

**Does the Dune Analytics MCP support custom SQL parameters?**
Yes, it lets you pass custom parameters to your Dune queries. This means you can filter by dates, specific tokens, or other variables while still using your saved queries.

**How does the Dune Analytics MCP help save on API costs?**
You can use the cancel_execution tool to stop queries that are taking too long or were run with mistakes. This prevents wasting your Dune credits on unnecessary data pulls.

**Can I use the Dune Analytics MCP in Cursor or Claude?**
Yes, it works with any MCP-compatible client including Claude, Cursor, and Windsurf. Just connect the Connector and start querying blockchain data with your agent.

**How do I retrieve the actual data rows from a query?**
First, use `execute_query` to start the process and get an `execution_id`. Once `get_execution_status` shows the state is completed, use `get_execution_results` with that ID to fetch the data.

**Can I stop a query that is taking too long to run?**
Yes. You can use the `cancel_execution` tool by providing the active `execution_id`. This will immediately interrupt the ongoing query on Dune's servers.

**How do I pass parameters like dates or addresses to my Dune query?**
When calling `execute_query`, use the `query_parameters` field. It accepts a JSON string (e.g., '{"address": "0x...", "limit": 10}'). The agent will parse this and apply it to your SQL execution.