MCP server for Dune Analytics data access
Project description
spice-mcp
An MCP server that provides AI agents with direct access to Dune Analytics data. Execute queries, discover schemas and tables, and manage saved queries—all through a clean, type-safe interface optimized for AI workflows.
Why spice-mcp?
- Agent-friendly: Designed for AI agents using the Model Context Protocol (MCP)
- Efficient: Polars-first pipeline keeps data lazy until needed, reducing memory usage
- Discovery: Built-in tools to explore Dune's extensive blockchain datasets
- Type-safe: Fully typed parameters and responses with FastMCP
- Reproducible: Automatic query history logging and SQL artifact storage
Quick Start
-
Install:
uv pip install spice-mcp
-
Set API key (choose one method):
- Option A: Create a
.envfile in your project root:echo "DUNE_API_KEY=your-api-key-here" > .env
- Option B: Export in your shell:
export DUNE_API_KEY=your-api-key-here
- Option A: Create a
-
Use with Cursor IDE: Add to Cursor Settings → MCP Servers:
{ "name": "spice-mcp", "command": "spice-mcp", "env": { "DUNE_API_KEY": "your-dune-api-key-here" } }
Note: Query history logging is enabled by default. Logs are saved to logs/queries.jsonl (or ~/.spice_mcp/logs/queries.jsonl if not in a project directory). To customize paths, set SPICE_QUERY_HISTORY and SPICE_ARTIFACT_ROOT environment variables.
Core Tools
| Tool | Description | Key Parameters |
|---|---|---|
dune_query |
Execute queries by ID, URL, or raw SQL | query (str), parameters (object), limit (int), offset (int), format (preview|raw|metadata|poll), refresh (bool), timeout_seconds (float) |
dune_query_info |
Get metadata for a saved query | query (str - ID or URL) |
dune_discover |
Unified discovery across Dune API and Spellbook | keyword (str|list), schema (str), limit (int), source (dune|spellbook|both), include_columns (bool) |
dune_find_tables |
Search schemas and list tables | keyword (str), schema (str), limit (int) |
dune_describe_table |
Get column metadata for a table | schema (str), table (str) |
spellbook_find_models |
Search Spellbook dbt models | keyword (str|list), schema (str), limit (int), include_columns (bool) |
dune_health_check |
Verify API key and configuration | (no parameters) |
dune_query_create |
Create a new saved query | name (str), query_sql (str), description (str), tags (list), parameters (list) |
dune_query_update |
Update an existing saved query | query_id (int), name (str), query_sql (str), description (str), tags (list), parameters (list) |
dune_query_fork |
Fork an existing saved query | source_query_id (int), name (str) |
Resources
spice:history/tail/{n}— View last N lines of query history (1-1000)spice:artifact/{sha}— Retrieve stored SQL by SHA-256 hash
What is Dune?
Dune is a crypto data platform providing curated blockchain datasets and a public API. It aggregates on-chain data from Ethereum, Solana, Polygon, and other chains into queryable SQL tables. See the Dune Docs for more information.
Installation
From PyPI (recommended):
uv pip install spice-mcp
From source:
git clone https://github.com/Evan-Kim2028/spice-mcp.git
cd spice-mcp
uv sync
uv pip install -e .
Requirements: Python 3.13+
Documentation
- Tool Reference — Complete tool documentation with parameters
- Architecture — Code structure and design patterns
- Discovery Guide — How to explore Dune schemas and tables
- Dune API Guide — Understanding Dune's data structure
- Configuration — Environment variables and settings
License
See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spice_mcp-0.1.4.tar.gz.
File metadata
- Download URL: spice_mcp-0.1.4.tar.gz
- Upload date:
- Size: 221.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ad2ca0969594f46b7590a0b4e9f00dff9fad4c76e3a0394e13b619c40337d0
|
|
| MD5 |
00bbb1d74b34822d6a464211e11e128c
|
|
| BLAKE2b-256 |
cf1e070a0513fe5f1bcc5bcbd62a14bc7996c63a11f9a98e562398bcb1855cf5
|
File details
Details for the file spice_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: spice_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 48.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6aefeb4870f2d54401e11edfe41f70d3d1288009aa8abc633783d83afce5008
|
|
| MD5 |
f6ca6446cd52725c64f3e180f27fe229
|
|
| BLAKE2b-256 |
496f66a811344c91f29706f9c8dba156afa83f70ebc4f04d5d296b73fc2b982c
|