hyperdb-mcp 0.1.3 → 0.2.1
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.
- package/README.md +149 -15
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# hyperdb-mcp
|
|
2
2
|
|
|
3
|
+
> **Note:** This crate was vibe-engineered with heavy use of AI coding assistants. The 0.1.x line may still undergo large breaking changes; the public API won't settle until the 1.0.0 release.
|
|
4
|
+
|
|
3
5
|
An MCP (Model Context Protocol) server that turns the Hyper columnar database into an instant SQL analytics engine. Data flows in from other MCP plugins or files, lands in Hyper automatically, and becomes queryable with SQL — no setup, no schema files, no database management.
|
|
4
6
|
|
|
5
7
|
Built on the pure-Rust [`hyperdb-api`](../hyperdb-api/) crate for maximum performance: 22M+ rows/sec inserts, 18M+ rows/sec queries, constant memory for billion-row results.
|
|
@@ -10,16 +12,31 @@ Built on the pure-Rust [`hyperdb-api`](../hyperdb-api/) crate for maximum perfor
|
|
|
10
12
|
|
|
11
13
|
LLMs are powerful at reasoning but cannot natively crunch millions of rows. This plugin bridges that gap: another MCP tool produces data, the LLM passes it to `hyperdb-mcp`, Hyper ingests it and makes it SQL-queryable, the LLM runs analytical SQL, and results come back as JSON. Optionally export to CSV, Parquet, Apache Iceberg, Arrow IPC, or `.hyper` (opens directly in **Tableau Desktop**).
|
|
12
14
|
|
|
15
|
+
### Queryable Memory for AI
|
|
16
|
+
|
|
17
|
+
Unlike flat-text memory systems that store blobs and retrieve by similarity search, HyperDB gives LLMs **structured, queryable long-term memory**. The persistent database survives across sessions — anything the LLM stores there can be JOINed, filtered, aggregated, and reasoned over with full SQL in any future conversation.
|
|
18
|
+
|
|
19
|
+
This means an LLM can:
|
|
20
|
+
- **Accumulate knowledge over time** — store reference tables, project decisions, user preferences, learned facts
|
|
21
|
+
- **Cross-reference across sessions** — JOIN today's analysis against historical data from last week
|
|
22
|
+
- **Answer complex recall questions** — "Which projects had budget overruns in Q1?" is a SQL query, not a fuzzy text search
|
|
23
|
+
- **Build on prior work** — load yesterday's cleaned dataset and extend it without re-processing from scratch
|
|
24
|
+
- **Maintain structured context** — store relationship graphs, timelines, or decision logs as proper tables with typed columns
|
|
25
|
+
|
|
26
|
+
The ephemeral database is scratch space (think: a whiteboard). The persistent database is long-term memory (think: a filing cabinet you can query). Multiple AI clients sharing the same daemon see the same persistent data — so Claude Code, Cursor, and VS Code Copilot can all read from and contribute to the same knowledge base.
|
|
27
|
+
|
|
13
28
|
---
|
|
14
29
|
|
|
15
30
|
## Features
|
|
16
31
|
|
|
17
32
|
- **Zero setup** — `HyperProcess` auto-starts the Hyper server
|
|
33
|
+
- **Shared `hyperd` daemon** — one Hyper process per user, shared across all MCP clients (Claude Code, Cursor, VS Code, etc.) for reduced memory overhead and concurrent access to the same persistent databases
|
|
34
|
+
- **Queryable long-term memory** — persistent database survives across sessions; LLMs can store, recall, JOIN, and aggregate structured knowledge over time — not just retrieve text blobs, but reason over them with SQL
|
|
18
35
|
- **Any data in** — JSON, CSV, Parquet, Arrow IPC, Apache Iceberg; schema inferred or exact
|
|
19
36
|
- **SQL at scale** — thousands to billions of rows
|
|
20
37
|
- **Data out** — export to CSV, Parquet, Apache Iceberg, Arrow IPC, or `.hyper` (Tableau Desktop-ready)
|
|
21
38
|
- **One-shot queries** — `query_file("/tmp/sales.csv", "SELECT ...")` — single call, zero management
|
|
22
|
-
- **
|
|
39
|
+
- **Cross-session continuity** — load multiple tables, JOIN across them, persist across sessions; pick up exactly where you left off
|
|
23
40
|
- **Read-only safe mode** — `--read-only` flag for safe deployment
|
|
24
41
|
- **Schema resources** — auto-discover table schemas via `resources/list`
|
|
25
42
|
- **Guided prompts** — `analyze-table`, `compare-tables`, `data-quality`, `suggest-queries`
|
|
@@ -30,7 +47,7 @@ LLMs are powerful at reasoning but cannot natively crunch millions of rows. This
|
|
|
30
47
|
- **Pre-ingest file inspection** — `inspect_file` dry-runs the same inference without touching Hyper so LLMs can build safe schema overrides in one shot
|
|
31
48
|
- **Partial schema overrides** — supply just the columns you want to correct (e.g. `{"population":"BIGINT"}`) — the rest keep their inferred type
|
|
32
49
|
- **Rich resource surface** — workspace readme, per-table JSON and CSV samples, and one JSON + one CSV resource per table so LLMs can orient themselves via `resources/list` without any tool calls
|
|
33
|
-
- **Saved queries** — register named read-only SQL with `save_query`; each query becomes `hyper://queries/{name}/definition` (metadata) + `hyper://queries/{name}/result` (live re-run). Persisted in
|
|
50
|
+
- **Saved queries** — register named read-only SQL with `save_query`; each query becomes `hyper://queries/{name}/definition` (metadata) + `hyper://queries/{name}/result` (live re-run). Persisted in the persistent attachment, session-only when `--ephemeral-only`
|
|
34
51
|
- **Live resource-update notifications** — MCP clients can `resources/subscribe` to any `hyper://...` URI; the server fires `notifications/resources/updated` after every ingest, DDL, watcher event, or saved-query mutation
|
|
35
52
|
|
|
36
53
|
---
|
|
@@ -131,11 +148,12 @@ Or if you built from source:
|
|
|
131
148
|
}
|
|
132
149
|
```
|
|
133
150
|
|
|
134
|
-
|
|
151
|
+
By default, persistent storage lives at the platform data dir (`~/Library/Application Support/hyperdb/workspace.hyper` on macOS, `~/.local/share/hyperdb/workspace.hyper` on Linux, `%APPDATA%\hyperdb\workspace.hyper` on Windows). To use a custom path:
|
|
135
152
|
```json
|
|
136
|
-
"args": ["--
|
|
153
|
+
"args": ["--persistent-db", "/path/to/my-project.hyper"]
|
|
137
154
|
```
|
|
138
|
-
|
|
155
|
+
|
|
156
|
+
Multiple MCP clients can point at the **same** persistent file simultaneously — they all connect through the shared `hyperd` daemon and use Hyper's MVCC transaction isolation. See [Operating Modes](#operating-modes) below.
|
|
139
157
|
|
|
140
158
|
#### Claude Code / AI Suite
|
|
141
159
|
|
|
@@ -159,6 +177,97 @@ Any tool that supports the MCP stdio transport can use this server. Point it at
|
|
|
159
177
|
|
|
160
178
|
---
|
|
161
179
|
|
|
180
|
+
## Operating Modes
|
|
181
|
+
|
|
182
|
+
Each session has **two databases**: an ephemeral primary (scratch space — always created fresh per session, deleted on exit) and a persistent database (queryable long-term memory — stored at the platform-default location or a path you supply, survives indefinitely). Unqualified SQL targets the ephemeral primary; the persistent database is reachable as the `"persistent"` alias.
|
|
183
|
+
|
|
184
|
+
### Hyper engine
|
|
185
|
+
|
|
186
|
+
| Mode | Flag | Behavior |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| **Shared daemon** *(default)* | *(none)* | One `hyperd` process per user, shared across all MCP clients. The first client auto-spawns the daemon; subsequent clients discover and reuse it. Idle for 30 minutes → daemon shuts itself down; the next client spawns a fresh one. |
|
|
189
|
+
| **Private hyperd** | `--no-daemon` | Each MCP client spawns its own `hyperd` (legacy behavior, one per session). |
|
|
190
|
+
|
|
191
|
+
The shared daemon is the bigger win for users running multiple AI clients (Claude Code + Cursor + VS Code) — they all share one Hyper engine instead of spawning three.
|
|
192
|
+
|
|
193
|
+
### Database storage
|
|
194
|
+
|
|
195
|
+
| Mode | Flag | Behavior |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| **Default** | *(none)* | Ephemeral primary in `$TMPDIR/hyperdb-mcp-<pid>-<n>/scratch.hyper` + persistent attachment at the platform data dir (e.g. `~/Library/Application Support/hyperdb/workspace.hyper` on macOS). |
|
|
198
|
+
| **Custom persistent path** | `--persistent-db <PATH>` | Same as default but the persistent file lives at `<PATH>`. The deprecated `--workspace <PATH>` is accepted as an alias with a stderr warning. |
|
|
199
|
+
| **Ephemeral-only** | `--ephemeral-only` | No persistent attachment; the session has only the ephemeral primary plus any user-attached databases via `attach_database`. Saved queries fall back to in-memory storage and disappear when the session ends. |
|
|
200
|
+
|
|
201
|
+
`HYPERDB_PERSISTENT_DB` overrides the default persistent path the same way `--persistent-db` does.
|
|
202
|
+
|
|
203
|
+
### Working with both databases
|
|
204
|
+
|
|
205
|
+
Tool calls default to the ephemeral primary — that's the LLM's scratch space for exploratory work that doesn't need to outlive the session. To store data in long-term memory (the persistent database), there are two ways to reach it:
|
|
206
|
+
|
|
207
|
+
**1. Per-tool `database` parameter** (preferred for ergonomic LLM workflows):
|
|
208
|
+
|
|
209
|
+
```jsonc
|
|
210
|
+
// Save a useful table to the persistent database
|
|
211
|
+
load_data({ table: "customers", data: "[...]", persist: true })
|
|
212
|
+
// ↑ shorthand for `database: "persistent"`
|
|
213
|
+
|
|
214
|
+
// Query from persistent
|
|
215
|
+
query({ sql: "SELECT * FROM customers", database: "persistent" })
|
|
216
|
+
|
|
217
|
+
// Inspect persistent tables
|
|
218
|
+
describe({ database: "persistent" })
|
|
219
|
+
sample({ table: "customers", database: "persistent" })
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The `database` parameter is available on `query`, `execute`, `load_data`, `load_file`, `load_files`, `watch_directory`, `describe`, `sample`, `chart`, `export`, and `set_table_metadata`. The shorthand `persist: true` (sugar for `database: "persistent"`) is available on `load_data`, `load_file`, `load_files`, and `watch_directory`. Pass any user-attached writable alias (created via `attach_database`) to target a custom database.
|
|
223
|
+
|
|
224
|
+
(`query_data` and `query_file` are one-shot tools that materialize the inline data into their own temp table and query it — they do not accept a `database` parameter because the data isn't in a persisted database to begin with.)
|
|
225
|
+
|
|
226
|
+
**2. Fully-qualified SQL** (for power users or complex multi-DB joins):
|
|
227
|
+
|
|
228
|
+
```sql
|
|
229
|
+
-- Read from persistent
|
|
230
|
+
SELECT * FROM "persistent"."public"."customers";
|
|
231
|
+
|
|
232
|
+
-- Write to persistent
|
|
233
|
+
CREATE TABLE "persistent"."public"."revenue_2026" AS
|
|
234
|
+
SELECT region, SUM(amount) FROM scratch_orders GROUP BY region;
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Per-database `_table_catalog`:** every writable database — persistent and any user-attached writable file — gets its own `_table_catalog` lazily seeded on first ingest. MCP-managed metadata (load tool, params, timestamps, prose fields set via `set_table_metadata`) lives alongside the data file, so opening a `.hyper` file later as a primary workspace finds the catalog ready. If you want a pristine `.hyper` file for export with no MCP bookkeeping, run `DROP TABLE "<alias>"."public"."_table_catalog"` once and subsequent sessions opening that file will leave it dropped.
|
|
238
|
+
|
|
239
|
+
**Detach safety:** `detach_database` rejects with `InvalidArgument` if any active watcher targets the alias — call `unwatch_directory` first. This prevents the watcher's pool from silently writing into a now-detached file (or worse, the wrong file if the alias is later re-attached to a different path).
|
|
240
|
+
|
|
241
|
+
### Daemon management
|
|
242
|
+
|
|
243
|
+
The daemon is normally invisible — it auto-spawns and idle-times-out on its own. For diagnostics:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
hyperdb-mcp daemon status # Show running daemon (PID, endpoint, started_at, version)
|
|
247
|
+
hyperdb-mcp daemon stop # Gracefully shut down the daemon
|
|
248
|
+
hyperdb-mcp daemon # Run as a daemon explicitly (rarely needed)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
State files live at `~/.hyperdb/` by default (override with `HYPERDB_STATE_DIR`).
|
|
252
|
+
|
|
253
|
+
### Recovery from hyperd crashes
|
|
254
|
+
|
|
255
|
+
The daemon polls `hyperd` every 5 seconds. If the process has exited (crashed, OOM, killed), the daemon spawns a replacement, atomically updates `~/.hyperdb/daemon.json` with the new endpoint, and continues serving clients. Clients see one failed tool call (the request that was in flight when hyperd died); the next tool call transparently reconnects to the new hyperd via the same recovery path used for normal connection drops.
|
|
256
|
+
|
|
257
|
+
If a client itself notices hyperd is unreachable before the next polling tick, it sends a fast-path `REPORT_HYPERD_ERROR` signal to the daemon so the restart kicks off without waiting for the timer.
|
|
258
|
+
|
|
259
|
+
If hyperd repeatedly fails to start (3 attempts within 60 seconds — e.g., misconfigured `HYPERD_PATH`, port exhaustion, broken binary), the daemon shuts itself down and removes the discovery file. The next MCP client to start up will then spawn a fresh daemon, surfacing any persistent failure clearly to the user rather than spinning silently.
|
|
260
|
+
|
|
261
|
+
**Known limitation:** if hyperd hangs (alive at the OS level but unresponsive to queries), the daemon's polling can't detect it and your tool call may stall indefinitely. The recovery path is `hyperdb-mcp daemon stop` followed by reconnecting from your MCP client.
|
|
262
|
+
|
|
263
|
+
### Other behavioral flags
|
|
264
|
+
|
|
265
|
+
| Flag | Behavior |
|
|
266
|
+
|---|---|
|
|
267
|
+
| `--read-only` | Disables `execute`, `load_data`, `load_file`, `watch_directory`, `save_query`, `delete_query`, and Hyper-format export. See [Read-Only Mode](#read-only-mode). |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
162
271
|
## MCP Tools
|
|
163
272
|
|
|
164
273
|
### One-Shot Tools
|
|
@@ -343,10 +452,10 @@ Each saved query produces **two** resources:
|
|
|
343
452
|
- `hyper://queries/{name}/result` — re-runs the SQL on every read and
|
|
344
453
|
returns `{ name, result: [...], stats: {...} }`.
|
|
345
454
|
|
|
346
|
-
**Persistence:**
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
for the lifetime of the server process.
|
|
455
|
+
**Persistence:** saved queries land in the persistent attachment's
|
|
456
|
+
`_hyperdb_saved_queries` meta-table (`"persistent"."public"."_hyperdb_saved_queries"`)
|
|
457
|
+
and survive server restarts. In `--ephemeral-only` sessions they live
|
|
458
|
+
only for the lifetime of the server process.
|
|
350
459
|
|
|
351
460
|
#### `save_query`
|
|
352
461
|
|
|
@@ -533,7 +642,7 @@ Four guided analytical workflows registered as MCP **Prompts**.
|
|
|
533
642
|
## Read-Only Mode
|
|
534
643
|
|
|
535
644
|
```bash
|
|
536
|
-
hyperdb-mcp --
|
|
645
|
+
hyperdb-mcp --persistent-db ~/analytics.hyper --read-only
|
|
537
646
|
```
|
|
538
647
|
|
|
539
648
|
- **Allowed:** `query`, `query_data`, `query_file`, `describe`, `sample`, `inspect_file`, `status`, `export`
|
|
@@ -639,15 +748,40 @@ Full reference: [Data Cloud SQL Reference](https://developer.salesforce.com/docs
|
|
|
639
748
|
## CLI Reference
|
|
640
749
|
|
|
641
750
|
```
|
|
642
|
-
hyperdb-mcp [OPTIONS]
|
|
751
|
+
hyperdb-mcp [OPTIONS] [COMMAND]
|
|
752
|
+
|
|
753
|
+
Commands:
|
|
754
|
+
daemon Run as a background daemon managing a shared hyperd process
|
|
643
755
|
|
|
644
756
|
Options:
|
|
645
|
-
--
|
|
646
|
-
|
|
647
|
-
|
|
757
|
+
--persistent-db <PATH> Path to the persistent .hyper file. Defaults to the platform
|
|
758
|
+
data dir (~/Library/Application Support/hyperdb/workspace.hyper
|
|
759
|
+
on macOS, ~/.local/share/hyperdb/workspace.hyper on Linux,
|
|
760
|
+
%APPDATA%\hyperdb\workspace.hyper on Windows). Override via
|
|
761
|
+
the HYPERDB_PERSISTENT_DB env var.
|
|
762
|
+
--ephemeral-only Skip the persistent attachment entirely. Disables save_query
|
|
763
|
+
persistence (queries fall back to session storage).
|
|
764
|
+
--read-only Disable mutating tools (execute, load_data, load_file,
|
|
765
|
+
save_query, delete_query, watch_directory)
|
|
766
|
+
--no-daemon Disable the shared daemon and spawn a private hyperd
|
|
767
|
+
|
|
768
|
+
Deprecated:
|
|
769
|
+
--workspace <PATH> Old name for --persistent-db. Still accepted, emits a
|
|
770
|
+
stderr warning, and will be removed in a future release.
|
|
771
|
+
|
|
772
|
+
Daemon subcommand:
|
|
773
|
+
hyperdb-mcp daemon Start the daemon (usually auto-spawned)
|
|
774
|
+
hyperdb-mcp daemon stop Gracefully stop the running daemon
|
|
775
|
+
hyperdb-mcp daemon status Show running daemon info
|
|
776
|
+
hyperdb-mcp daemon --port <PORT> Override the health/lock port (default 7484)
|
|
777
|
+
hyperdb-mcp daemon --idle-timeout <SECS> Override idle timeout (default 1800 = 30 min)
|
|
648
778
|
|
|
649
779
|
Environment:
|
|
650
|
-
HYPERD_PATH
|
|
780
|
+
HYPERD_PATH Path to hyperd binary (auto-detected if on PATH)
|
|
781
|
+
HYPERDB_PERSISTENT_DB Override the default persistent-db path
|
|
782
|
+
HYPERDB_STATE_DIR Override daemon state directory (default ~/.hyperdb/)
|
|
783
|
+
HYPERDB_DAEMON_PORT Override daemon health/lock port (default 7484)
|
|
784
|
+
HYPERDB_DAEMON_IDLE_TIMEOUT Override daemon idle timeout in seconds (default 1800)
|
|
651
785
|
```
|
|
652
786
|
|
|
653
787
|
---
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperdb-mcp",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "HyperDB MCP server — instant SQL analytics for LLM workflows",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hyperdb-mcp": "bin.js"
|
|
7
7
|
},
|
|
8
8
|
"optionalDependencies": {
|
|
9
|
-
"hyperdb-mcp-darwin-arm64": "0.1
|
|
10
|
-
"hyperdb-mcp-linux-x64-gnu": "0.1
|
|
11
|
-
"hyperdb-mcp-win32-x64-msvc": "0.1
|
|
9
|
+
"hyperdb-mcp-darwin-arm64": "0.2.1",
|
|
10
|
+
"hyperdb-mcp-linux-x64-gnu": "0.2.1",
|
|
11
|
+
"hyperdb-mcp-win32-x64-msvc": "0.2.1"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"bin.js",
|