Skip to main content
Dune MCP is Dune’s official, hosted MCP server. It runs at https://api.dune.com/mcp/v1 over Streamable HTTP, so there is nothing to install. You sign in with your Dune account through OAuth 2.0; in headless and CI environments, you send a Dune API key in the x-dune-api-key header instead. With Dune MCP, any MCP-compatible AI client, such as Claude Code, Claude Desktop, Cursor, Codex, or OpenCode, can search Dune’s blockchain tables and docs, create and run DuneSQL queries, read query results, build visualizations and dashboards, manage materialized views, folders, and schedules, see and cancel your team’s query runs, and submit contracts for decoding. MCP (Model Context Protocol) is an open standard for connecting AI applications to external systems. Dune MCP gives your agent direct, structured access to Dune workflows, all in the same conversation. This is the fastest way to move from prompt to reliable onchain analysis. See also Agents on dune.com.

Quick start

  1. Add a server named dune with the URL https://api.dune.com/mcp/v1 to your AI client. See the steps for your client.
  2. Sign in to Dune in the browser window that opens, and choose the team that the connection uses. Queries run as that team and use its credits. You can choose only teams where you are an admin or editor. Teams where you are a viewer are shown but cannot be selected; use your personal account, or ask a team admin for editor access.
  3. Ask a question, for example: “Chart daily Ethereum transactions for the last 30 days.”
You do not need an API key, unless your agent cannot open a browser. See Headless and CI environments. To use another team later, sign out of the dune server in your client and sign in again. See Roles and view-only accounts for what each account can do. On dune.com, Connect > MCP & CLI shows the same setup.

Connect Dune to your AI client

Every client uses the same server URL, https://api.dune.com/mcp/v1, and the same Dune sign-in. Pick your client below.

Connect Dune to Claude Code

Run this command in your terminal:
Then run /mcp in Claude Code and select dune to sign in. Claude Code loads searchTables, createAndExecuteQuery, getDuneQuery, and getExecutionResults when the session starts. It finds the other Dune tools with tool search when it needs them.

Connect Dune to Claude Desktop

Add Dune as a custom connector:
  1. In Claude, click the + (Add) icon in the chat box and select Manage connectors.
  2. In Connectors, click Add, then select Add custom connector.
  3. Enter Dune as the name and https://api.dune.com/mcp/v1 as the URL, then click Add.
  4. Select the new Dune connector in the list and click Connect.
  5. Sign in to Dune in the browser window that opens, then select the team that the connector uses.
This walkthrough shows the same steps:

Connect Dune to OpenCode

  1. Run opencode mcp add and answer the prompts: OpenCode saves the server to ~/.config/opencode/opencode.json.
  2. Run opencode mcp auth Dune. OpenCode opens a browser window where you sign in to Dune.
opencode mcp add prompts with the Dune MCP server name, Remote type, and https://api.dune.com/mcp/v1 URL

Connect Dune to Codex

Run these commands in your terminal:
Known issue: “Transport closed” errors during long-running queriesCodex’s MCP client has a default tool timeout of 60 seconds. When getExecutionResults polls for a query that takes longer than this, Codex terminates the connection. Due to a known Codex bug, the MCP transport does not auto-reconnect after a timeout - all subsequent tool calls will fail with Transport closed until you start a new session.Workaround: Increase the Codex tool timeout in your config:

Connect Dune to Cursor

  1. Open the command palette and select Cursor Settings.
  2. In the left sidebar, go to Tools & MCP.
  3. Click Add Custom MCP. Cursor creates or opens your mcp.json file.
  4. Add this configuration and save the file:
  5. Sign in with your Dune account when Cursor asks.
This walkthrough shows the same steps:

Use Dune with ChatGPT

In ChatGPT on the web:
  1. Open Plugins, select +, then Add custom MCP server.
  2. Enter Dune as the name and https://api.dune.com/mcp/v1 as the server URL.
  3. Choose OAuth for authentication, accept the risk warning, and select Create as a plugin.
  4. Sign in to Dune when ChatGPT asks, then install the plugin.
  5. In a chat, type @ and select Dune.
In Business and Enterprise workspaces, only admins, and members that they allow, can add custom MCP servers. See Connecting custom MCP servers in ChatGPT.

Connect Dune to Gemini CLI

Start gemini. It opens the Dune sign-in page the first time it connects. Run /mcp auth dune to sign in again.

Other MCP clients

Any client that supports remote MCP servers over Streamable HTTP can connect. Use Dune as the name and https://api.dune.com/mcp/v1 as the URL, then sign in with your Dune account. If the client cannot open a browser, see Headless and CI environments.

Headless and CI environments

Use this only when your agent runs where it cannot sign in with a browser, for example in CI. In all other cases, sign in with your Dune account as shown above. Send a Dune API key with the Read/Write scope in the x-dune-api-key header. Create the key on dune.com under Connect > API keys. The MCP then works as the key’s owner and uses its credits. Do not put the key in the URL. A key with the Read scope cannot use Dune MCP, not even its read tools, because MCP tools can also edit and delete content. The server answers 403 with {"error":"Not authorized"}, and most clients show this as a failed connection. See API key scopes.
For clients that use a JSON config:

Using Dune MCP

Ask in plain language; the agent chooses the tools. A typical session:
  1. Find data. searchTables, searchTablesByContractAddress, and searchDocs find tables, columns, and DuneSQL syntax.
  2. Query. createAndExecuteQuery saves a query, runs it, and returns the first rows. getExecutionResults pages, filters, sorts, or samples the rest.
  3. Chart. generateVisualization adds a chart, counter, or table. In Claude and ChatGPT, renderVisualization shows it in the chat.
  4. Build a dashboard. createDashboard adds charts and text. updateDashboardWidget moves or resizes one widget, and getDashboardImage shows the result.
  5. Keep it current. setSchedule reruns a query on a schedule, setQueryAlert notifies you when a scheduled run returns rows, and createMaterializedView saves results as a table.
Good to know:
  • Running a query uses credits. To read a saved query’s last result without running it again, ask for its latest result (getLatestQueryResult). getUsage shows the credits used.
  • New queries and dashboards are public unless you ask for them to be private, or your team makes them private by default.
  • Dune MCP never makes content public without asking you. When a team whose privacy setting is Private by default has used all its private queries or dashboards, creating one fails and nothing is created. The agent then asks you whether to create it as public, and creates it only if you say yes. Teams whose privacy setting is Private only never get public content, and a dashboard that shows a chart from a private query is never made public.
  • listTeamExecutions shows what your team is running, and cancelTeamExecution stops a run.
  • Results from licensed datasets, such as Kalshi and Polymarket, are not returned to AI clients. The tool links to the query on dune.com instead.

Roles and view-only accounts

What Dune MCP can do depends on how you connect and on your account:
  • Team viewers. Only team admins and editors can sign in to Dune MCP as a team. If you are a viewer in a team, sign in with your personal account.
  • Read API keys. API keys need the Read/Write scope. A Read key gets 403 (see Headless and CI environments).
  • View-only accounts. A team with view-only Free access, for example after its trial ends, can read but not write. Its MCP connection lists only these tools: searchDocs, searchTables, listBlockchains, searchTablesByContractAddress, getDuneQuery, searchDuneQueries, getExecutionResults, getLatestQueryResult, getUsage, listQueryVisualizations, getVisualization, renderVisualization, getDashboard, getDashboardImage, searchDuneDashboards, listDuneFolders, getDuneFolder, getMaterializedView, listMaterializedViews, listSchedules, listContractSubmissions, listTeamExecutions, and submit_feedback. Every tool that creates, changes, or deletes content is hidden, and so are the tools that run queries (createAndExecuteQuery, executeQueryById, getTableSize) and cancelTeamExecution. A call to a hidden tool fails because the server does not have that tool. Through the API, and through CLI commands that use the REST API, writes from a view-only account fail with 403 and Your account is read-only. Upgrade to create content or run queries. Upgrade the plan to write again.

Tools and Resources Inventory

Tools

Dune MCP has 49 tools. The Access column comes from the annotations that the server sends with each tool:
  • Read: reads data and changes nothing.
  • Write: creates content, moves it, or starts a query execution. Executions use credits.
  • Destructive: can overwrite, archive, or delete existing content.

Toolsets

By default, a connection lists every tool. The tool definitions take about 120 KB of the model’s context. Clients that load every tool at the start, such as ChatGPT, Cursor, VS Code, and Windsurf, send all of this in each conversation. To list fewer tools, name the toolsets that you need in the X-MCP-Toolsets header, separated by commas. Clients that cannot send headers can use the toolsets query parameter instead. The connection then lists the query toolset and the toolsets that you name. For example, to work only with queries, charts, and dashboards:
A client that cannot send headers can use the URL https://api.dune.com/mcp/v1?toolsets=visualizations,dashboards. Do not use toolsets in Claude’s custom connectors (claude.ai and Claude Desktop). They take only a URL, and Claude needs the URL to be exactly https://api.dune.com/mcp/v1, or charts do not load (see Charts in the conversation).

Resources

Charts in the conversation

In clients that support MCP Apps, such as Claude and ChatGPT, renderVisualization shows a Dune chart, counter, or table in the conversation. The view loads an existing visualization and the results of the execution that you give, or of the latest successful execution of the query. It only shows results that exist. It does not run, save, or change anything. If the query has no completed execution, the view shows an error. In clients that do not support MCP Apps, use the links that generateVisualization, getVisualization, and updateVisualization return: interactiveChartUrl opens the chart on dune.com, and chartJpegUrl is a static image of it. In Claude, add the server with exactly https://api.dune.com/mcp/v1, with no trailing slash. Claude ties the chart view to the server URL that you entered, so the chart does not load if the URL is different.

Server Details

  • Server name: dune
  • Remote MCP URL: https://api.dune.com/mcp/v1
  • Tagline: Query, analyze, and visualize onchain data from Dune directly inside your MCP-compatible AI client.
  • Primary use cases:
    • Discover datasets and docs relevant to a protocol, contract, or chain
    • Create, update, execute, and troubleshoot Dune SQL queries
    • Turn query results into charts/tables/counters without leaving your chat
    • Create and manage full dashboards from natural language prompts
    • Materialize query results into reusable tables and keep them fresh on a schedule
    • Submit contracts for decoding and track the status of the submissions
    • Track account credit usage while iterating on analysis
    • See what your team is running and stop runs that you no longer need

Prompt Examples

Try prompts like these in your MCP-enabled client:
  1. “Find the best Dune table for tracking Uniswap v3 swap volume on Ethereum, then create and run a daily volume query for the last 90 days.”
  2. “I have contract 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48. Find decoded tables, build a weekly transfer count query, execute it, and show the top 20 recipient wallets.”
  3. “Review query 1234567, optimize it for lower scan cost, update it in place, run it, and summarize result quality and execution credits used.”
  4. “Generate a visualization from my latest execution results: a line chart of daily active addresses and a counter for total unique users.”
  5. “Create a dashboard showing Ethereum activity in the past 30 days — include daily transactions, active addresses, and gas usage.”
  6. “Update my existing dashboard to add a new chart showing weekly DEX volume by protocol.”
  7. “Materialize my daily active addresses query into a table and refresh it every hour, then list my materialized views to confirm.”
  8. “Email me every hour when query 1234567 returns rows.”
  9. “What is my team running on Dune right now? Cancel my runs that have been going for more than 30 minutes.”
  10. “Move the counter to the top of my dashboard, then show me an image of the new layout.”

Connection Details

Transport

  • Protocol: Remote MCP over Streamable HTTP
  • Endpoint: https://api.dune.com/mcp/v1
  • Interaction pattern:
    • POST /mcp/v1 for MCP requests
    • GET /mcp/v1 for stream resumption/event replay

OAuth 2.0 details

  • Authorization server issuer: https://dune.com/oauth/mcp
  • Protected resource metadata: https://api.dune.com/.well-known/oauth-protected-resource/mcp/v1 (the WWW-Authenticate header of a 401 from /mcp/v1 points to it)
  • Discovery metadata: https://dune.com/.well-known/oauth-authorization-server/oauth/mcp
  • Authorization endpoint: https://dune.com/oauth/mcp/authorize
  • Token endpoint: https://dune.com/oauth/mcp/token
  • Dynamic client registration endpoint: https://dune.com/oauth/mcp/register
  • Client ID metadata documents: supported
  • JWKS endpoint: https://dune.com/oauth/mcp/jwks.json
  • Grant types: authorization_code, refresh_token
  • Client auth at token endpoint: none (public clients)
  • PKCE: required (S256)
  • Scope: mcp:dune:full
  • Resource parameter for authorization requests: https://api.dune.com/mcp/v1 (https://api.dune.com is also accepted)

Troubleshooting

  • OAuth invalid_request on authorize: Verify required params (client_id, redirect_uri, state, code_challenge, code_challenge_method=S256). If you send resource, use https://api.dune.com/mcp/v1 or https://api.dune.com.
  • OAuth unsupported_grant_type on token: Use only authorization_code or refresh_token.
  • OAuth invalid_grant on token exchange: Ensure your code_verifier matches the original PKCE challenge and redirect_uri exactly matches the authorize request.
  • Unauthorized from MCP endpoint: Sign in again with your Dune account. In a headless environment, check that the x-dune-api-key header has a valid key.
  • 403 Not authorized from MCP endpoint, or the client cannot connect with an API key: The key has the Read scope. Create a key with the Read/Write scope under Connect > API keys.
  • A team cannot be selected at sign-in: You are a viewer in that team. Sign in with your personal account, or ask a team admin for editor access.
  • Write tools are missing, or calls to them fail as unknown tools: The account has view-only Free access. See Roles and view-only accounts.
  • The chart does not load in Claude: Add the server again with exactly https://api.dune.com/mcp/v1, with no trailing slash.
  • A query run fails because of credits: The error says which credit limit stopped the run and when the credits renew. Use getUsage to see the credits used in this billing period. An admin of the account can change the extra credits limit in the plan settings on dune.com. dune.com/pricing describes the plans. Do not retry the run until the credits renew or the limit changes.
  • Codex Transport closed during long polls: Increase MCP tool timeout (for example tool_timeout_sec = 300) and restart the session if the transport already closed.

Frequently asked questions

Yes. Dune MCP at https://api.dune.com/mcp/v1 is built, hosted, and supported by Dune. It supports Dune sign-in and the full set of tools listed in Tools and Resources Inventory.MCP servers for Dune that third parties publish are community projects. Dune does not maintain or support them.Dune Docs also has a separate MCP server at https://docs.dune.com/mcp. It only searches this documentation. To query data, use https://api.dune.com/mcp/v1.
Any MCP client that supports remote MCP servers over Streamable HTTP. This page has setup steps for Claude Code, Claude Desktop, Cursor, Codex, and OpenCode. Dune MCP also supports OAuth sign-in for ChatGPT.
No. You sign in with your Dune account through OAuth 2.0 when you add the server. Use an API key only when your agent runs where it cannot open a browser, such as CI. Send the key in the x-dune-api-key header, not in the URL. See Headless and CI environments.
Dune MCP works with the same data and content that you can use on dune.com with your account:
  • Dune’s blockchain tables, such as raw, decoded, and curated tables. Use listBlockchains to see the indexed blockchains and searchTables or searchTablesByContractAddress to find tables.
  • Queries, visualizations, dashboards, folders, materialized views, and schedules that belong to the team you selected when you signed in.
  • Dune docs, through searchDocs.
Query executions run on Dune’s query engine and use credits from the account you signed in with. Use getUsage to check your credit usage.
Some MCP clients stop a tool call after a fixed timeout. Codex, for example, has a default tool timeout of 60 seconds and does not reconnect after a timeout. To fix this in Codex, set tool_timeout_sec = 300 for the dune server in your Codex config and start a new session. See the Codex setup.In other clients, increase the tool timeout if the client lets you. Dune runs queries asynchronously, so a timed-out getExecutionResults call does not stop the query. Your agent can call getExecutionResults again with the same execution ID to get the results.
Use Dune MCP when your AI client supports MCP and you want to sign in with your Dune account. Use the Dune CLI and Agent Skills for terminal-native coding agents and scripts that work with an API key. The two cover the same work: you can do what every Dune MCP tool except renderVisualization and submit_feedback does with the CLI, and the CLI command tables name the MCP tool for each command.

Dune CLI & Skills Docs

Learn how to use the Dune CLI and Agent Skills as an alternative to MCP for terminal-native AI workflows.

Dune Skills Repository

Agent Skills for Dune — portable instruction packages that teach AI agents how to work with blockchain data using the Dune CLI.

Data API

Execute queries and manage Dune content programmatically over REST.

Agents on dune.com

How AI agents work with Dune data.

Privacy and Support