spice-mcp 0.1.2__py3-none-any.whl → 0.1.4__py3-none-any.whl
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.
Potentially problematic release.
This version of spice-mcp might be problematic. Click here for more details.
- spice_mcp/adapters/dune/__init__.py +4 -2
- spice_mcp/adapters/dune/cache.py +2 -34
- spice_mcp/adapters/dune/client.py +9 -4
- spice_mcp/adapters/dune/extract.py +79 -633
- spice_mcp/adapters/dune/query_wrapper.py +86 -0
- spice_mcp/adapters/dune/user_agent.py +9 -0
- spice_mcp/adapters/spellbook/__init__.py +6 -0
- spice_mcp/adapters/spellbook/explorer.py +313 -0
- spice_mcp/config.py +1 -1
- spice_mcp/core/models.py +0 -8
- spice_mcp/core/ports.py +0 -15
- spice_mcp/mcp/server.py +407 -137
- spice_mcp/mcp/tools/base.py +1 -1
- spice_mcp/mcp/tools/execute_query.py +32 -63
- spice_mcp-0.1.4.dist-info/METADATA +121 -0
- {spice_mcp-0.1.2.dist-info → spice_mcp-0.1.4.dist-info}/RECORD +19 -17
- spice_mcp/mcp/tools/sui_package_overview.py +0 -56
- spice_mcp/service_layer/sui_service.py +0 -131
- spice_mcp-0.1.2.dist-info/METADATA +0 -193
- {spice_mcp-0.1.2.dist-info → spice_mcp-0.1.4.dist-info}/WHEEL +0 -0
- {spice_mcp-0.1.2.dist-info → spice_mcp-0.1.4.dist-info}/entry_points.txt +0 -0
- {spice_mcp-0.1.2.dist-info → spice_mcp-0.1.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: spice-mcp
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: MCP server for Dune Analytics data access
|
|
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
|
-
spice-mcp is an MCP server for [Dune](https://dune.com/) Analytics. It wraps a curated subset of the original Spice client inside a clean architecture (`core` models/ports → `adapters.dune` → service layer → FastMCP tools) and adds agent-friendly workflows for discovery and Sui package exploration. Results are Polars-first in Python and compact, token-efficient in MCP responses.
|
|
25
|
-
|
|
26
|
-
Requirements: Python 3.13+
|
|
27
|
-
|
|
28
|
-
This project uses FastMCP for typed, decorator-registered tools and resources.
|
|
29
|
-
|
|
30
|
-
## Highlights
|
|
31
|
-
- Polars LazyFrame-first pipeline: results stay lazy until explicitly materialized
|
|
32
|
-
- Ports/adapters layering for maintainable integrations ([docs/architecture.md](docs/architecture.md))
|
|
33
|
-
- Discovery utilities (find schemas/tables, describe columns)
|
|
34
|
-
- Sui package workflows (events/transactions/objects) with safe defaults
|
|
35
|
-
- JSONL query history + SQL artifacts (SHA-256) for reproducibility
|
|
36
|
-
- Rich MCP surface: query info/run, discovery, health, Sui, and Dune admin (create/update/fork)
|
|
37
|
-
|
|
38
|
-
## What is Dune?
|
|
39
|
-
[Dune](https://dune.com/) is a crypto data platform providing curated blockchain datasets and a public API to run and fetch query results. See the [Dune Docs](https://dune.com/docs) and [Dune API](https://dune.com/docs/api/) for full details.
|
|
40
|
-
|
|
41
|
-
## Quick Start
|
|
42
|
-
- Export `DUNE_API_KEY` in your shell (the server can also load a local `.env`; set `SPICE_MCP_SKIP_DOTENV=1` to skip during tests).
|
|
43
|
-
- Install dependencies (`uv sync` or `pip install -e .`).
|
|
44
|
-
- Start the FastMCP stdio server:
|
|
45
|
-
- `python -m spice_mcp.mcp.server --env PYTHONPATH=$(pwd)/src`
|
|
46
|
-
- or install the console script via `uv tool install .` and run `spice-mcp`.
|
|
47
|
-
|
|
48
|
-
## Cursor IDE Setup
|
|
49
|
-
|
|
50
|
-
To use spice-mcp with Cursor IDE:
|
|
51
|
-
|
|
52
|
-
1. **Install the MCP Server**:
|
|
53
|
-
```bash
|
|
54
|
-
# Install dependencies and package
|
|
55
|
-
uv sync
|
|
56
|
-
pip install -e .
|
|
57
|
-
|
|
58
|
-
# Or install via uv tool (creates console script)
|
|
59
|
-
uv tool install .
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
2. **Configure Cursor**:
|
|
63
|
-
- Open Cursor Settings → MCP Servers
|
|
64
|
-
- Add new MCP server configuration:
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"name": "spice-mcp",
|
|
68
|
-
"command": "spice-mcp",
|
|
69
|
-
"env": {
|
|
70
|
-
"DUNE_API_KEY": "your-dune-api-key-here"
|
|
71
|
-
},
|
|
72
|
-
"disabled": false
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
Alternatively, if you prefer running from source:
|
|
76
|
-
```json
|
|
77
|
-
{
|
|
78
|
-
"name": "spice-mcp",
|
|
79
|
-
"command": "python",
|
|
80
|
-
"args": ["-m", "spice_mcp.mcp.server"],
|
|
81
|
-
"env": {
|
|
82
|
-
"PYTHONPATH": "/path/to/your/spice-mcp/src",
|
|
83
|
-
"DUNE_API_KEY": "your-dune-api-key-here"
|
|
84
|
-
},
|
|
85
|
-
"disabled": false
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
3. **Restart Cursor** to load the MCP server
|
|
90
|
-
|
|
91
|
-
4. **Verify Connection**:
|
|
92
|
-
- Open Cursor and use the command palette (Cmd/Ctrl + Shift + P)
|
|
93
|
-
- Search for "MCP" or "spice" commands
|
|
94
|
-
- Test with `dune_health_check` to verify the connection
|
|
95
|
-
|
|
96
|
-
5. **Available Tools in Cursor**:
|
|
97
|
-
- `dune_query`: Run Dune queries by ID, URL, or raw SQL
|
|
98
|
-
- `dune_find_tables`: Search schemas and list tables
|
|
99
|
-
- `dune_describe_table`: Get column metadata
|
|
100
|
-
- `sui_package_overview`: Analyze Sui packages
|
|
101
|
-
- `dune_health_check`: Verify API connection
|
|
102
|
-
|
|
103
|
-
**Tip**: Create a `.env` file in your project root with `DUNE_API_KEY=your-key-here` for easier configuration.
|
|
104
|
-
|
|
105
|
-
## MCP Tools and Features
|
|
106
|
-
|
|
107
|
-
All tools expose typed parameters, titles, and tags; failures return a consistent error envelope.
|
|
108
|
-
|
|
109
|
-
- `dune_query_info` (Query Info, tags: dune, query)
|
|
110
|
-
- Fetch saved-query metadata by ID/URL (name, parameters, tags, SQL, version).
|
|
111
|
-
|
|
112
|
-
- `dune_query` (Run Dune Query, tags: dune, query)
|
|
113
|
-
- Execute by ID/URL/raw SQL with parameters. Supports `refresh`, `max_age`, `limit/offset`, `sample_count`, `sort_by`, `columns`, and `format` = `preview|raw|metadata|poll`; accepts `timeout_seconds`.
|
|
114
|
-
|
|
115
|
-
- `dune_health_check` (Health Check, tag: health)
|
|
116
|
-
- Checks API key presence, query-history path, logging enabled; best-effort template check when configured.
|
|
117
|
-
|
|
118
|
-
- `dune_find_tables` (Find Tables, tags: dune, schema)
|
|
119
|
-
- Search schemas by keyword and/or list tables in a schema (`limit`).
|
|
120
|
-
|
|
121
|
-
- `dune_describe_table` (Describe Table, tags: dune, schema)
|
|
122
|
-
- Column metadata for `schema.table` (Dune types + Polars inferred dtypes when available).
|
|
123
|
-
|
|
124
|
-
- `sui_package_overview` (Sui Package Overview, tag: sui)
|
|
125
|
-
- Compact Sui activity overview for `packages[]` with `hours` (default 72) and `timeout_seconds`.
|
|
126
|
-
|
|
127
|
-
- Dune Admin tools (tags: dune, admin)
|
|
128
|
-
- `dune_query_create(name, query_sql, description?, tags?, parameters?)`
|
|
129
|
-
- `dune_query_update(query_id, name?, query_sql?, description?, tags?, parameters?)`
|
|
130
|
-
- `dune_query_fork(source_query_id, name?)`
|
|
131
|
-
|
|
132
|
-
### Resources
|
|
133
|
-
- `spice:history/tail/{n}` — tail last N lines of query history (1..1000)
|
|
134
|
-
- `spice:artifact/{sha}` — fetch stored SQL by 64-hex SHA-256
|
|
135
|
-
- `spice:sui/events_preview/{hours}/{limit}/{packages}` — Sui events preview (JSON)
|
|
136
|
-
- `spice:sui/package_overview/{hours}/{timeout_seconds}/{packages}` — Sui overview (JSON)
|
|
137
|
-
|
|
138
|
-
## Resources
|
|
139
|
-
|
|
140
|
-
- `spice:history/tail/{n}`
|
|
141
|
-
- Last `n` lines from the query-history JSONL, clamped to [1, 1000]
|
|
142
|
-
|
|
143
|
-
- `spice:artifact/{sha}`
|
|
144
|
-
- Returns stored SQL for the SHA-256 (validated as 64 lowercase hex)
|
|
145
|
-
|
|
146
|
-
Tests
|
|
147
|
-
- Offline/unit tests (no network) live under `tests/offline/` and `tests/http_stubbed/`.
|
|
148
|
-
- Live tests under `tests/live/` are skipped by default; enable with `SPICE_TEST_LIVE=1` and a valid `DUNE_API_KEY`.
|
|
149
|
-
- Comprehensive scripted runner (tiered):
|
|
150
|
-
- Run all tiers: `python tests/scripts/comprehensive_test_runner.py`
|
|
151
|
-
- Select tiers: `python tests/scripts/comprehensive_test_runner.py -t 1 -t 3`
|
|
152
|
-
- Stop on first failure: `python tests/scripts/comprehensive_test_runner.py --stop`
|
|
153
|
-
- Optional JUnit export: `python tests/scripts/comprehensive_test_runner.py --junit tests/scripts/report.xml`
|
|
154
|
-
- Pytest directly (offline/default): `uv run pytest -q -m "not live" --cov=src/spice_mcp --cov-report=term-missing`
|
|
155
|
-
|
|
156
|
-
Core Tools (with parameters)
|
|
157
|
-
- `dune_query`
|
|
158
|
-
- Use: Preview/query results by ID, URL, or raw SQL (Polars preview + Dune metadata/pagination).
|
|
159
|
-
- Params: `query` (string), `parameters?` (object), `performance?` ('medium'|'large'), `limit?` (int), `offset?` (int), `sort_by?` (string), `columns?` (string[]), `sample_count?` (int), `refresh?` (bool), `max_age?` (number), `timeout_seconds?` (number), `format?` ('preview'|'raw'|'metadata').
|
|
160
|
-
- Output: `type`, `rowcount`, `columns`, `data_preview`, `execution_id`, `duration_ms`, `metadata?`, `next_uri?`, `next_offset?`.
|
|
161
|
-
- `dune_find_tables`
|
|
162
|
-
- Use: Search schemas by keyword and/or list tables for a schema.
|
|
163
|
-
- Params: `keyword?` (string), `schema?` (string), `limit?` (int)
|
|
164
|
-
- Output: `schemas?` (string[]), `tables?` (string[])
|
|
165
|
-
- `dune_describe_table`
|
|
166
|
-
- Use: Column descriptions for `schema.table` via SHOW + fallback to 1-row sample inference.
|
|
167
|
-
- Params: `schema` (string), `table` (string)
|
|
168
|
-
- Output: `columns` ([{ name, dune_type?, polars_dtype?, extra?, comment? }])
|
|
169
|
-
- `sui_package_overview`
|
|
170
|
-
- Use: Small-window overview for Sui packages (events/transactions/objects) with timeout handling.
|
|
171
|
-
- Params: `packages` (string[]), `hours?` (int, default 72), `timeout_seconds?` (number, default 30)
|
|
172
|
-
- Output: best-effort counts and previews; may include `*_timeout`/`*_error`
|
|
173
|
-
- `dune_health_check`
|
|
174
|
-
- Use: Verify API key presence and logging paths
|
|
175
|
-
- Output: `api_key_present`, `query_history_path`, `logging_enabled`, `status`
|
|
176
|
-
|
|
177
|
-
## Docs
|
|
178
|
-
- See [docs/index.md](docs/index.md) for full documentation:
|
|
179
|
-
- Dune API structure and capabilities: [docs/dune_api.md](docs/dune_api.md)
|
|
180
|
-
- Discovery patterns and examples: [docs/discovery.md](docs/discovery.md)
|
|
181
|
-
- Sui package workflows: [docs/sui_packages.md](docs/sui_packages.md)
|
|
182
|
-
- Tool reference and schemas: [docs/tools.md](docs/tools.md)
|
|
183
|
-
- Codex CLI + tooling integration: [docs/codex_cli.md](docs/codex_cli.md), [docs/codex_cli_tools.md](docs/codex_cli_tools.md)
|
|
184
|
-
- Architecture overview: [docs/architecture.md](docs/architecture.md)
|
|
185
|
-
- Installation and configuration: [docs/installation.md](docs/installation.md), [docs/config.md](docs/config.md)
|
|
186
|
-
- Development and linting: [docs/development.md](docs/development.md)
|
|
187
|
-
|
|
188
|
-
Notes
|
|
189
|
-
- Legacy Spice code now lives under `src/spice_mcp/adapters/dune` (extract, cache, urls, types).
|
|
190
|
-
- Ports and models live in `src/spice_mcp/core`; services consume ports and are exercised by FastMCP tools.
|
|
191
|
-
- Query history and SQL artefacts are always-on (see `src/spice_mcp/logging/query_history.py`).
|
|
192
|
-
- To bypass dot-env loading during tests/CI, export `SPICE_MCP_SKIP_DOTENV=1`.
|
|
193
|
-
- LazyFrames everywhere: eager `.collect()` or `pl.DataFrame` usage outside dedicated helpers is blocked by `tests/style/test_polars_lazy.py`; materialization helpers live in `src/spice_mcp/polars_utils.py`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|