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
- Add a server named
dunewith the URLhttps://api.dune.com/mcp/v1to your AI client. See the steps for your client. - 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.
- Ask a question, for example: “Chart daily Ethereum transactions for the last 30 days.”
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:/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:- In Claude, click the + (Add) icon in the chat box and select Manage connectors.
- In Connectors, click Add, then select Add custom connector.
- Enter
Duneas the name andhttps://api.dune.com/mcp/v1as the URL, then click Add. - Select the new Dune connector in the list and click Connect.
- Sign in to Dune in the browser window that opens, then select the team that the connector uses.
Connect Dune to OpenCode
-
Run
opencode mcp addand answer the prompts:OpenCode saves the server to~/.config/opencode/opencode.json. -
Run
opencode mcp auth Dune. OpenCode opens a browser window where you sign in to Dune.

Connect Dune to Codex
Run these commands in your terminal:Connect Dune to Cursor
- Open the command palette and select Cursor Settings.
- In the left sidebar, go to Tools & MCP.
-
Click Add Custom MCP. Cursor creates or opens your
mcp.jsonfile. -
Add this configuration and save the file:
- Sign in with your Dune account when Cursor asks.
Use Dune with ChatGPT
In ChatGPT on the web:- Open Plugins, select +, then Add custom MCP server.
- Enter
Duneas the name andhttps://api.dune.com/mcp/v1as the server URL. - Choose OAuth for authentication, accept the risk warning, and select Create as a plugin.
- Sign in to Dune when ChatGPT asks, then install the plugin.
- In a chat, type
@and select Dune.
Connect Dune to Gemini CLI
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. UseDune 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 thex-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.
Using Dune MCP
Ask in plain language; the agent chooses the tools. A typical session:- Find data.
searchTables,searchTablesByContractAddress, andsearchDocsfind tables, columns, and DuneSQL syntax. - Query.
createAndExecuteQuerysaves a query, runs it, and returns the first rows.getExecutionResultspages, filters, sorts, or samples the rest. - Chart.
generateVisualizationadds a chart, counter, or table. In Claude and ChatGPT,renderVisualizationshows it in the chat. - Build a dashboard.
createDashboardadds charts and text.updateDashboardWidgetmoves or resizes one widget, andgetDashboardImageshows the result. - Keep it current.
setSchedulereruns a query on a schedule,setQueryAlertnotifies you when a scheduled run returns rows, andcreateMaterializedViewsaves results as a table.
- Running a query uses credits. To read a saved query’s last result without running it again, ask for its latest result (
getLatestQueryResult).getUsageshows 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.
listTeamExecutionsshows what your team is running, andcancelTeamExecutionstops 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, andsubmit_feedback. Every tool that creates, changes, or deletes content is hidden, and so are the tools that run queries (createAndExecuteQuery,executeQueryById,getTableSize) andcancelTeamExecution. 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 with403andYour 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 theX-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:
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:- “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.”
- “I have contract
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48. Find decoded tables, build a weekly transfer count query, execute it, and show the top 20 recipient wallets.” - “Review query
1234567, optimize it for lower scan cost, update it in place, run it, and summarize result quality and execution credits used.” - “Generate a visualization from my latest execution results: a line chart of daily active addresses and a counter for total unique users.”
- “Create a dashboard showing Ethereum activity in the past 30 days — include daily transactions, active addresses, and gas usage.”
- “Update my existing dashboard to add a new chart showing weekly DEX volume by protocol.”
- “Materialize my daily active addresses query into a table and refresh it every hour, then list my materialized views to confirm.”
- “Email me every hour when query
1234567returns rows.” - “What is my team running on Dune right now? Cancel my runs that have been going for more than 30 minutes.”
- “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/v1for MCP requestsGET /mcp/v1for 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(theWWW-Authenticateheader of a401from/mcp/v1points 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.comis also accepted)
Troubleshooting
- OAuth
invalid_requeston authorize: Verify required params (client_id,redirect_uri,state,code_challenge,code_challenge_method=S256). If you sendresource, usehttps://api.dune.com/mcp/v1orhttps://api.dune.com. - OAuth
unsupported_grant_typeon token: Use onlyauthorization_codeorrefresh_token. - OAuth
invalid_granton token exchange: Ensure yourcode_verifiermatches the original PKCE challenge andredirect_uriexactly matches the authorize request. Unauthorizedfrom MCP endpoint: Sign in again with your Dune account. In a headless environment, check that thex-dune-api-keyheader has a valid key.403Not authorizedfrom 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
getUsageto 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 closedduring long polls: Increase MCP tool timeout (for exampletool_timeout_sec = 300) and restart the session if the transport already closed.
Frequently asked questions
Is Dune MCP the official Dune MCP server?
Is Dune MCP the official Dune MCP server?
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.Which AI clients can use Dune MCP?
Which AI clients can use Dune MCP?
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.
Do I need a Dune API key to use Dune MCP?
Do I need a Dune API key to use Dune MCP?
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.What data can Dune MCP access?
What data can Dune MCP access?
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
listBlockchainsto see the indexed blockchains andsearchTablesorsearchTablesByContractAddressto 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.
getUsage to check your credit usage.Why do long-running queries time out or fail with Transport closed?
Why do long-running queries time out or fail with Transport closed?
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.Should I use Dune MCP or the Dune CLI and Skills?
Should I use Dune MCP or the Dune CLI and Skills?
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.Related Resources
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
- Privacy policy: https://dune.com/privacy
- Support: support@dune.com