spice-mcp 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spice_mcp-0.1.8/.git +1 -0
- spice_mcp-0.1.8/.gitignore +28 -0
- spice_mcp-0.1.8/.python-version +1 -0
- spice_mcp-0.1.8/CONTRIBUTING.md +27 -0
- spice_mcp-0.1.8/LICENSE +21 -0
- spice_mcp-0.1.8/PKG-INFO +136 -0
- spice_mcp-0.1.8/README.md +115 -0
- spice_mcp-0.1.8/data_catalogue/catalog.json +100981 -0
- spice_mcp-0.1.8/data_catalogue/catalog_summary.json +16 -0
- spice_mcp-0.1.8/docs/architecture.md +75 -0
- spice_mcp-0.1.8/docs/codex_cli.md +70 -0
- spice_mcp-0.1.8/docs/codex_cli_tools.md +63 -0
- spice_mcp-0.1.8/docs/config.md +23 -0
- spice_mcp-0.1.8/docs/development.md +43 -0
- spice_mcp-0.1.8/docs/discovery.md +34 -0
- spice_mcp-0.1.8/docs/dune_api.md +42 -0
- spice_mcp-0.1.8/docs/index.md +14 -0
- spice_mcp-0.1.8/docs/installation.md +21 -0
- spice_mcp-0.1.8/docs/tools.md +132 -0
- spice_mcp-0.1.8/pyproject.toml +125 -0
- spice_mcp-0.1.8/pytest.ini +11 -0
- spice_mcp-0.1.8/src/spice_mcp/__init__.py +2 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/__init__.py +0 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/__init__.py +12 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/admin.py +116 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/cache.py +153 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/client.py +244 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/extract.py +912 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/helpers.py +11 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/query_wrapper.py +86 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/transport.py +70 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/types.py +52 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/typing_utils.py +19 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/urls.py +128 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/dune/user_agent.py +9 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/http_client.py +156 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/spellbook/__init__.py +6 -0
- spice_mcp-0.1.8/src/spice_mcp/adapters/spellbook/explorer.py +393 -0
- spice_mcp-0.1.8/src/spice_mcp/config.py +81 -0
- spice_mcp-0.1.8/src/spice_mcp/core/__init__.py +0 -0
- spice_mcp-0.1.8/src/spice_mcp/core/errors.py +101 -0
- spice_mcp-0.1.8/src/spice_mcp/core/models.py +80 -0
- spice_mcp-0.1.8/src/spice_mcp/core/ports.py +60 -0
- spice_mcp-0.1.8/src/spice_mcp/logging/query_history.py +133 -0
- spice_mcp-0.1.8/src/spice_mcp/mcp/__init__.py +1 -0
- spice_mcp-0.1.8/src/spice_mcp/mcp/server.py +1000 -0
- spice_mcp-0.1.8/src/spice_mcp/mcp/tools/__init__.py +1 -0
- spice_mcp-0.1.8/src/spice_mcp/mcp/tools/base.py +41 -0
- spice_mcp-0.1.8/src/spice_mcp/mcp/tools/execute_query.py +408 -0
- spice_mcp-0.1.8/src/spice_mcp/observability/__init__.py +0 -0
- spice_mcp-0.1.8/src/spice_mcp/observability/logging.py +18 -0
- spice_mcp-0.1.8/src/spice_mcp/polars_utils.py +15 -0
- spice_mcp-0.1.8/src/spice_mcp/py.typed +1 -0
- spice_mcp-0.1.8/src/spice_mcp/service_layer/__init__.py +0 -0
- spice_mcp-0.1.8/src/spice_mcp/service_layer/discovery_service.py +20 -0
- spice_mcp-0.1.8/src/spice_mcp/service_layer/query_admin_service.py +32 -0
- spice_mcp-0.1.8/src/spice_mcp/service_layer/query_service.py +118 -0
- spice_mcp-0.1.8/src/spice_mcp/service_layer/verification_service.py +185 -0
- spice_mcp-0.1.8/tests/cassettes/.gitkeep +1 -0
- spice_mcp-0.1.8/tests/config/environments.yaml +91 -0
- spice_mcp-0.1.8/tests/config/test_queries.yaml +259 -0
- spice_mcp-0.1.8/tests/conftest.py +13 -0
- spice_mcp-0.1.8/tests/fastmcp/test_dune_query_schema_validation.py +139 -0
- spice_mcp-0.1.8/tests/fastmcp/test_resources_and_validation.py +58 -0
- spice_mcp-0.1.8/tests/fastmcp/test_server_fastmcp.py +128 -0
- spice_mcp-0.1.8/tests/fastmcp/test_server_mcp_extras.py +39 -0
- spice_mcp-0.1.8/tests/http_stubbed/test_age.py +28 -0
- spice_mcp-0.1.8/tests/http_stubbed/test_errors.py +75 -0
- spice_mcp-0.1.8/tests/http_stubbed/test_pagination.py +57 -0
- spice_mcp-0.1.8/tests/integration/__init__.py +2 -0
- spice_mcp-0.1.8/tests/integration/test_dune_table_names.py +48 -0
- spice_mcp-0.1.8/tests/integration/test_spellbook_discovery.py +289 -0
- spice_mcp-0.1.8/tests/integration/test_user_journeys.py +328 -0
- spice_mcp-0.1.8/tests/live/test_live_basic.py +18 -0
- spice_mcp-0.1.8/tests/live/test_live_sui.py +18 -0
- spice_mcp-0.1.8/tests/mcp/conftest.py +98 -0
- spice_mcp-0.1.8/tests/mcp/test_tool_contracts.py +40 -0
- spice_mcp-0.1.8/tests/offline/test_admin_adapter.py +119 -0
- spice_mcp-0.1.8/tests/offline/test_cache.py +132 -0
- spice_mcp-0.1.8/tests/offline/test_cache_consistency.py +253 -0
- spice_mcp-0.1.8/tests/offline/test_discovery.py +79 -0
- spice_mcp-0.1.8/tests/offline/test_dune_adapter.py +115 -0
- spice_mcp-0.1.8/tests/offline/test_edge_cases.py +256 -0
- spice_mcp-0.1.8/tests/offline/test_parsing.py +46 -0
- spice_mcp-0.1.8/tests/offline/test_query_history.py +54 -0
- spice_mcp-0.1.8/tests/offline/test_show_rewrite.py +37 -0
- spice_mcp-0.1.8/tests/offline/test_timeout.py +42 -0
- spice_mcp-0.1.8/tests/offline/test_typing_utils.py +60 -0
- spice_mcp-0.1.8/tests/offline/test_urls.py +49 -0
- spice_mcp-0.1.8/tests/property/__init__.py +2 -0
- spice_mcp-0.1.8/tests/property/test_property_based.py +195 -0
- spice_mcp-0.1.8/tests/style/test_polars_lazy.py +53 -0
- spice_mcp-0.1.8/tests/support/api_client.py +231 -0
- spice_mcp-0.1.8/tests/support/helpers.py +345 -0
- spice_mcp-0.1.8/tests/support/query_factory.py +195 -0
- spice_mcp-0.1.8/tests/support/test_data.py +224 -0
- spice_mcp-0.1.8/tests/tools/test_additional_mcp_tools.py +121 -0
- spice_mcp-0.1.8/tests/tools/test_dbt_config_verification.py +169 -0
- spice_mcp-0.1.8/tests/tools/test_execute_query_tool.py +121 -0
- spice_mcp-0.1.8/tests/tools/test_health_tool.py +21 -0
- spice_mcp-0.1.8/tests/tools/test_query_service.py +55 -0
- spice_mcp-0.1.8/tests/tools/test_schemas.py +36 -0
- spice_mcp-0.1.8/tests/tools/test_unified_discover.py +253 -0
- spice_mcp-0.1.8/tests/validation/__init__.py +2 -0
- spice_mcp-0.1.8/tests/validation/test_error_messages.py +206 -0
- spice_mcp-0.1.8/uv.lock +1908 -0
spice_mcp-0.1.8/.git
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitdir: /Users/evandekim/Documents/spice_mcp/.git/worktrees/fbR9c
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# python generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# venv
|
|
10
|
+
.venv
|
|
11
|
+
.env
|
|
12
|
+
logs/*
|
|
13
|
+
notes/*
|
|
14
|
+
.claude/*
|
|
15
|
+
.pytest_cache/*
|
|
16
|
+
tests/scripts/test_report.txt
|
|
17
|
+
coverage*
|
|
18
|
+
|
|
19
|
+
# Development tools and directories
|
|
20
|
+
bin/
|
|
21
|
+
.github/
|
|
22
|
+
.factory/
|
|
23
|
+
debug_api.py
|
|
24
|
+
|
|
25
|
+
# Local testing environment
|
|
26
|
+
test_spice_mcp/
|
|
27
|
+
scripts/
|
|
28
|
+
test_mcp_cursor/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13.1
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## Contributing to spice-mcp
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing! This is a lightweight guide to get you productive quickly.
|
|
4
|
+
|
|
5
|
+
### Setup
|
|
6
|
+
- Python 3.13+
|
|
7
|
+
- Install dependencies:
|
|
8
|
+
- Using uv: `uv sync`
|
|
9
|
+
- Or pip: `pip install -e . && pip install -r <(python - <<'PY'\nimport tomllib,sys;print('\n'.join(tomllib.load(open('pyproject.toml','rb'))['tool']['rye']['dev-dependencies']))\nPY\n)`
|
|
10
|
+
|
|
11
|
+
### Running the server
|
|
12
|
+
- `python -m spice_mcp.mcp.server --env PYTHONPATH=$(pwd)/src`
|
|
13
|
+
- Or `spice-mcp` if installed as a console script
|
|
14
|
+
|
|
15
|
+
### Tests
|
|
16
|
+
- Tiered runner: `python tests/scripts/comprehensive_test_runner.py [-t 1 -t 3] [--stop] [--junit out.xml]`
|
|
17
|
+
- Pytest quick run (offline): `uv run pytest -q -m "not live"`
|
|
18
|
+
- Live tests: `export SPICE_TEST_LIVE=1 DUNE_API_KEY=...` then run as above
|
|
19
|
+
|
|
20
|
+
### Linting / Type checks
|
|
21
|
+
- Ruff: `uv run ruff check . && uv run ruff format .`
|
|
22
|
+
- MyPy (optional relaxed config): `uv run mypy`
|
|
23
|
+
|
|
24
|
+
### Pull requests
|
|
25
|
+
- Keep changes focused, add/adjust tests when possible
|
|
26
|
+
- Ensure no secrets are committed (`.env` is ignored and required for keys)
|
|
27
|
+
- Follow existing code style and patterns; avoid gratuitous new deps
|
spice_mcp-0.1.8/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Spice MCP contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
spice_mcp-0.1.8/PKG-INFO
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spice-mcp
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: mcp server built ontop of dune api endpoint
|
|
5
|
+
Author-email: Evan-Kim2028 <ekcopersonal@gmail.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Typing :: Typed
|
|
12
|
+
Requires-Python: >=3.13
|
|
13
|
+
Requires-Dist: aiohttp>=3.9.5
|
|
14
|
+
Requires-Dist: fastmcp>=0.3.0
|
|
15
|
+
Requires-Dist: mcp>=0.9.0
|
|
16
|
+
Requires-Dist: polars>=1.35.1
|
|
17
|
+
Requires-Dist: requests>=2.31.0
|
|
18
|
+
Requires-Dist: rich-argparse>=1.5.2
|
|
19
|
+
Requires-Dist: rich>=13.3.3
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# spice-mcp
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/spice-mcp/)
|
|
25
|
+
<a href="https://glama.ai/mcp/servers/@Evan-Kim2028/spice-mcp">
|
|
26
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Evan-Kim2028/spice-mcp/badge" alt="Spice MCP server" />
|
|
27
|
+
</a>
|
|
28
|
+
|
|
29
|
+
An MCP server that provides AI agents with direct access to [Dune Analytics](https://dune.com/) data. Execute queries, discover schemas and tables, and manage saved queries—all through a clean, type-safe interface optimized for AI workflows.
|
|
30
|
+
|
|
31
|
+
**Discover High-Quality Tables**: Leverages [Dune Spellbook](https://github.com/duneanalytics/spellbook), Dune's official GitHub repository of curated dbt models, to surface verified, production-ready tables with rich metadata.
|
|
32
|
+
|
|
33
|
+
## Why spice-mcp?
|
|
34
|
+
|
|
35
|
+
- **Agent-friendly**: Designed for AI agents using the Model Context Protocol (MCP)
|
|
36
|
+
- **High-Quality Discovery**: Leverages Dune Spellbook's GitHub repository to find verified, production-ready tables with rich metadata
|
|
37
|
+
- **Efficient**: Polars-first pipeline keeps data lazy until needed, reducing memory usage
|
|
38
|
+
- **Discovery**: Built-in tools to explore Dune's extensive blockchain datasets from both Dune API and Spellbook
|
|
39
|
+
- **Type-safe**: Fully typed parameters and responses with FastMCP
|
|
40
|
+
- **Reproducible**: Automatic query history logging and SQL artifact storage
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
1. **Install**:
|
|
45
|
+
```bash
|
|
46
|
+
uv pip install spice-mcp
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. **Set API key** (choose one method):
|
|
50
|
+
- **Option A**: Create a `.env` file in your project root:
|
|
51
|
+
```bash
|
|
52
|
+
echo "DUNE_API_KEY=your-api-key-here" > .env
|
|
53
|
+
```
|
|
54
|
+
- **Option B**: Export in your shell:
|
|
55
|
+
```bash
|
|
56
|
+
export DUNE_API_KEY=your-api-key-here
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Use with Cursor IDE**:
|
|
60
|
+
Add to Cursor Settings → MCP Servers:
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"name": "spice-mcp",
|
|
64
|
+
"command": "spice-mcp",
|
|
65
|
+
"env": {
|
|
66
|
+
"DUNE_API_KEY": "your-dune-api-key-here"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**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.
|
|
72
|
+
Admin operations (create/update/fork/archive/unarchive) are logged with `action_type="admin_action"` and include `query_id` for traceability.
|
|
73
|
+
|
|
74
|
+
## Core Tools
|
|
75
|
+
|
|
76
|
+
| Tool | Description | Key Parameters |
|
|
77
|
+
|------|-------------|----------------|
|
|
78
|
+
| `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) |
|
|
79
|
+
| `dune_query_info` | Get metadata for a saved query | `query` (str - ID or URL) |
|
|
80
|
+
| `dune_discover` | Unified discovery across Dune API and Spellbook (returns verified tables only). **Leverages Dune Spellbook GitHub repository** for high-quality, curated tables. | `keyword` (str\|list), `schema` (str), `limit` (int), `source` (`dune\|spellbook\|both`), `include_columns` (bool) |
|
|
81
|
+
| `dune_describe_table` | Get column metadata for a table | `schema` (str), `table` (str) |
|
|
82
|
+
| `dune_health_check` | Verify API key and configuration | (no parameters) |
|
|
83
|
+
| `dune_query_create` | Create a new saved query | `name` (str), `query_sql` (str), `description` (str), `tags` (list), `parameters` (list) |
|
|
84
|
+
| `dune_query_update` | Update an existing saved query | `query_id` (int), `name` (str), `query_sql` (str), `description` (str), `tags` (list), `parameters` (list) |
|
|
85
|
+
| `dune_query_fork` | Fork an existing saved query | `source_query_id` (int), `name` (str) |
|
|
86
|
+
| `dune_query_archive` | Archive a saved query | `query_id` (int) |
|
|
87
|
+
| `dune_query_unarchive` | Unarchive a saved query | `query_id` (int) |
|
|
88
|
+
|
|
89
|
+
## Resources
|
|
90
|
+
|
|
91
|
+
- `spice:history/tail/{n}` — View last N lines of query history (1-1000)
|
|
92
|
+
- `spice:artifact/{sha}` — Retrieve stored SQL by SHA-256 hash
|
|
93
|
+
|
|
94
|
+
## What is Dune?
|
|
95
|
+
|
|
96
|
+
[Dune](https://dune.com/) 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](https://dune.com/docs) for more information.
|
|
97
|
+
|
|
98
|
+
## What is Dune Spellbook?
|
|
99
|
+
|
|
100
|
+
[Dune Spellbook](https://github.com/duneanalytics/spellbook) is Dune's official GitHub repository containing thousands of curated dbt models. These models represent high-quality, production-ready tables that are:
|
|
101
|
+
|
|
102
|
+
- **Verified**: All tables are verified to exist in Dune before being returned
|
|
103
|
+
- **Well-documented**: Rich metadata including column descriptions and types
|
|
104
|
+
- **Maintained**: Regularly updated by the Dune community and team
|
|
105
|
+
- **Production-ready**: Used by analysts and dashboards across the ecosystem
|
|
106
|
+
|
|
107
|
+
spice-mcp automatically clones and parses the Spellbook repository to discover these high-quality tables, parsing dbt config blocks to resolve actual Dune table names and verifying their existence before returning them to you.
|
|
108
|
+
|
|
109
|
+
## Installation
|
|
110
|
+
|
|
111
|
+
**From PyPI** (recommended):
|
|
112
|
+
```bash
|
|
113
|
+
uv pip install spice-mcp
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**From source**:
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/Evan-Kim2028/spice-mcp.git
|
|
119
|
+
cd spice-mcp
|
|
120
|
+
uv sync
|
|
121
|
+
uv pip install -e .
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Requirements**: Python 3.13+
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
- [Tool Reference](docs/tools.md) — Complete tool documentation with parameters
|
|
129
|
+
- [Architecture](docs/architecture.md) — Code structure and design patterns
|
|
130
|
+
- [Discovery Guide](docs/discovery.md) — How to explore Dune schemas and tables
|
|
131
|
+
- [Dune API Guide](docs/dune_api.md) — Understanding Dune's data structure
|
|
132
|
+
- [Configuration](docs/config.md) — Environment variables and settings
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
See [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# spice-mcp
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/spice-mcp/)
|
|
4
|
+
<a href="https://glama.ai/mcp/servers/@Evan-Kim2028/spice-mcp">
|
|
5
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Evan-Kim2028/spice-mcp/badge" alt="Spice MCP server" />
|
|
6
|
+
</a>
|
|
7
|
+
|
|
8
|
+
An MCP server that provides AI agents with direct access to [Dune Analytics](https://dune.com/) data. Execute queries, discover schemas and tables, and manage saved queries—all through a clean, type-safe interface optimized for AI workflows.
|
|
9
|
+
|
|
10
|
+
**Discover High-Quality Tables**: Leverages [Dune Spellbook](https://github.com/duneanalytics/spellbook), Dune's official GitHub repository of curated dbt models, to surface verified, production-ready tables with rich metadata.
|
|
11
|
+
|
|
12
|
+
## Why spice-mcp?
|
|
13
|
+
|
|
14
|
+
- **Agent-friendly**: Designed for AI agents using the Model Context Protocol (MCP)
|
|
15
|
+
- **High-Quality Discovery**: Leverages Dune Spellbook's GitHub repository to find verified, production-ready tables with rich metadata
|
|
16
|
+
- **Efficient**: Polars-first pipeline keeps data lazy until needed, reducing memory usage
|
|
17
|
+
- **Discovery**: Built-in tools to explore Dune's extensive blockchain datasets from both Dune API and Spellbook
|
|
18
|
+
- **Type-safe**: Fully typed parameters and responses with FastMCP
|
|
19
|
+
- **Reproducible**: Automatic query history logging and SQL artifact storage
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
1. **Install**:
|
|
24
|
+
```bash
|
|
25
|
+
uv pip install spice-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. **Set API key** (choose one method):
|
|
29
|
+
- **Option A**: Create a `.env` file in your project root:
|
|
30
|
+
```bash
|
|
31
|
+
echo "DUNE_API_KEY=your-api-key-here" > .env
|
|
32
|
+
```
|
|
33
|
+
- **Option B**: Export in your shell:
|
|
34
|
+
```bash
|
|
35
|
+
export DUNE_API_KEY=your-api-key-here
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. **Use with Cursor IDE**:
|
|
39
|
+
Add to Cursor Settings → MCP Servers:
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"name": "spice-mcp",
|
|
43
|
+
"command": "spice-mcp",
|
|
44
|
+
"env": {
|
|
45
|
+
"DUNE_API_KEY": "your-dune-api-key-here"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**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.
|
|
51
|
+
Admin operations (create/update/fork/archive/unarchive) are logged with `action_type="admin_action"` and include `query_id` for traceability.
|
|
52
|
+
|
|
53
|
+
## Core Tools
|
|
54
|
+
|
|
55
|
+
| Tool | Description | Key Parameters |
|
|
56
|
+
|------|-------------|----------------|
|
|
57
|
+
| `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) |
|
|
58
|
+
| `dune_query_info` | Get metadata for a saved query | `query` (str - ID or URL) |
|
|
59
|
+
| `dune_discover` | Unified discovery across Dune API and Spellbook (returns verified tables only). **Leverages Dune Spellbook GitHub repository** for high-quality, curated tables. | `keyword` (str\|list), `schema` (str), `limit` (int), `source` (`dune\|spellbook\|both`), `include_columns` (bool) |
|
|
60
|
+
| `dune_describe_table` | Get column metadata for a table | `schema` (str), `table` (str) |
|
|
61
|
+
| `dune_health_check` | Verify API key and configuration | (no parameters) |
|
|
62
|
+
| `dune_query_create` | Create a new saved query | `name` (str), `query_sql` (str), `description` (str), `tags` (list), `parameters` (list) |
|
|
63
|
+
| `dune_query_update` | Update an existing saved query | `query_id` (int), `name` (str), `query_sql` (str), `description` (str), `tags` (list), `parameters` (list) |
|
|
64
|
+
| `dune_query_fork` | Fork an existing saved query | `source_query_id` (int), `name` (str) |
|
|
65
|
+
| `dune_query_archive` | Archive a saved query | `query_id` (int) |
|
|
66
|
+
| `dune_query_unarchive` | Unarchive a saved query | `query_id` (int) |
|
|
67
|
+
|
|
68
|
+
## Resources
|
|
69
|
+
|
|
70
|
+
- `spice:history/tail/{n}` — View last N lines of query history (1-1000)
|
|
71
|
+
- `spice:artifact/{sha}` — Retrieve stored SQL by SHA-256 hash
|
|
72
|
+
|
|
73
|
+
## What is Dune?
|
|
74
|
+
|
|
75
|
+
[Dune](https://dune.com/) 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](https://dune.com/docs) for more information.
|
|
76
|
+
|
|
77
|
+
## What is Dune Spellbook?
|
|
78
|
+
|
|
79
|
+
[Dune Spellbook](https://github.com/duneanalytics/spellbook) is Dune's official GitHub repository containing thousands of curated dbt models. These models represent high-quality, production-ready tables that are:
|
|
80
|
+
|
|
81
|
+
- **Verified**: All tables are verified to exist in Dune before being returned
|
|
82
|
+
- **Well-documented**: Rich metadata including column descriptions and types
|
|
83
|
+
- **Maintained**: Regularly updated by the Dune community and team
|
|
84
|
+
- **Production-ready**: Used by analysts and dashboards across the ecosystem
|
|
85
|
+
|
|
86
|
+
spice-mcp automatically clones and parses the Spellbook repository to discover these high-quality tables, parsing dbt config blocks to resolve actual Dune table names and verifying their existence before returning them to you.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
**From PyPI** (recommended):
|
|
91
|
+
```bash
|
|
92
|
+
uv pip install spice-mcp
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**From source**:
|
|
96
|
+
```bash
|
|
97
|
+
git clone https://github.com/Evan-Kim2028/spice-mcp.git
|
|
98
|
+
cd spice-mcp
|
|
99
|
+
uv sync
|
|
100
|
+
uv pip install -e .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Requirements**: Python 3.13+
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
- [Tool Reference](docs/tools.md) — Complete tool documentation with parameters
|
|
108
|
+
- [Architecture](docs/architecture.md) — Code structure and design patterns
|
|
109
|
+
- [Discovery Guide](docs/discovery.md) — How to explore Dune schemas and tables
|
|
110
|
+
- [Dune API Guide](docs/dune_api.md) — Understanding Dune's data structure
|
|
111
|
+
- [Configuration](docs/config.md) — Environment variables and settings
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
See [LICENSE](LICENSE) file for details.
|