hyperdb-mcp 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/README.md +43 -3
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -25,6 +25,8 @@ This means an LLM can:
25
25
 
26
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
27
 
28
+ **Table or key-value store?** For a handful of small facts, notes, or flags, prefer the built-in key-value store (`kv_set` with `persist: true`) over `CREATE TABLE` + `load_data` — it needs no schema and no DDL. Reach for a real table when you need typed columns, JOINs, or aggregation. See [Working with both databases](#working-with-both-databases) for the `persist` / `database` mechanics that apply to both paths.
29
+
28
30
  ---
29
31
 
30
32
  ## Features
@@ -48,6 +50,7 @@ The ephemeral database is scratch space (think: a whiteboard). The persistent da
48
50
  - **Partial schema overrides** — supply just the columns you want to correct (e.g. `{"population":"BIGINT"}`) — the rest keep their inferred type
49
51
  - **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
50
52
  - **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`
53
+ - **Key-value scratchpad** — lightweight `kv_set` / `kv_get` / `kv_list` / `kv_delete` / `kv_pop` / `kv_size` / `kv_clear` / `kv_list_stores` store for small notes and state without a `CREATE TABLE`. Ephemeral by default (lost on restart); pass `persist: true` (or `database: "persistent"`) to make a store durable across sessions
51
54
  - **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
52
55
 
53
56
  ---
@@ -270,7 +273,7 @@ If hyperd repeatedly fails to start (3 attempts within 60 seconds — e.g., misc
270
273
 
271
274
  | Flag | Behavior |
272
275
  |---|---|
273
- | `--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). |
276
+ | `--read-only` | Disables `execute`, `load_data`, `load_file`, `watch_directory`, `save_query`, `delete_query`, and the KV mutators (`kv_set`, `kv_delete`, `kv_pop`, `kv_clear`). Export (including `.hyper`) stays allowed — it's a read-only file copy. See [Read-Only Mode](#read-only-mode). |
274
277
 
275
278
  ---
276
279
 
@@ -507,6 +510,42 @@ delete_query(name: 'top_5_customers')
507
510
  Returns `{ "deleted": true }` when the query existed, `{ "deleted": false }`
508
511
  when it did not (no error on unknown names). Disabled in read-only mode.
509
512
 
513
+ ### Key-Value Store
514
+
515
+ Lightweight named scratchpad for stashing a value under `store` + `key` and
516
+ recalling it later — remember a variable, a summary, a JSON config, or a
517
+ work-queue entry without creating a table or running `load_data`.
518
+
519
+ > **Stores default to the EPHEMERAL database and are LOST on server restart.**
520
+ > Pass `database="persistent"` (or `persist=true`) to make a store durable
521
+ > across restarts, or an attached alias to target that database. Each database
522
+ > has its own isolated set of stores; a store in one database is invisible from
523
+ > another.
524
+
525
+ Eight tools cover the surface:
526
+
527
+ | Tool | Purpose | Parameters |
528
+ |---|---|---|
529
+ | `kv_set` | Write/overwrite a value (upsert) | `store`, `key`, `value`, `database`, `persist` |
530
+ | `kv_get` | Read a value by store + key (`value` is null when absent, not an error) | `store`, `key`, `database`, `persist` |
531
+ | `kv_delete` | Remove one key (`{deleted: true/false}`, no error on unknown key) | `store`, `key`, `database`, `persist` |
532
+ | `kv_list` | List all keys in a store, sorted ascending | `store`, `database`, `persist` |
533
+ | `kv_list_stores` | List store namespaces that currently hold data | `database`, `persist` |
534
+ | `kv_size` | Count keys in a store | `store`, `database`, `persist` |
535
+ | `kv_pop` | Destructively read-and-remove the lowest-keyed entry (atomic) | `store`, `database`, `persist` |
536
+ | `kv_clear` | Delete all keys in a store (returns count removed) | `store`, `database`, `persist` |
537
+
538
+ ```
539
+ kv_set(store: 'session', key: 'last_report', value: '{"rows": 4210}', database: 'persistent')
540
+ kv_get(store: 'session', key: 'last_report')
541
+ ```
542
+
543
+ Key properties:
544
+ - **Read-only mode** — the four mutators (`kv_set`, `kv_delete`, `kv_pop`, `kv_clear`) are disabled and return `READ_ONLY_VIOLATION`; the four readers (`kv_get`, `kv_list`, `kv_size`, `kv_list_stores`) always work.
545
+ - **Pop order** — `kv_pop` removes and returns the **lowest-keyed** entry in lexicographic key order (not insertion order), making a store usable as a simple work queue.
546
+ - **No store registry** — a store that becomes empty simply **drops out** of `kv_list_stores`; there is no separate registry of store names.
547
+ - **Backing table** — values live in `_hyperdb_kv_store(store_name, key, value)`, which is indexless (Hyper has no indexes) and hidden from `describe` by its `_hyperdb_` prefix, but is directly queryable — e.g. `LEFT JOIN` it to enrich an analytical table (always filter on `kv.store_name`). Uniqueness of `(store_name, key)` is enforced by the tool layer's upsert, atomic within a single server process. See the `hyper://schema/kv` resource for the schema and join pattern.
548
+
510
549
  ### Export Tools
511
550
 
512
551
  #### `export`
@@ -601,6 +640,7 @@ can route it appropriately (LLM context vs. file download vs. chart).
601
640
  | `hyper://tables/{name}/csv-sample` | `text/csv` | First 20 rows of a table as CSV, header-first |
602
641
  | `hyper://queries/{name}/definition` | `application/json` | Stored SQL + metadata for a saved query |
603
642
  | `hyper://queries/{name}/result` | `application/json` | Live result of a saved query — re-runs on every read |
643
+ | `hyper://schema/kv` | `text/plain` | KV scratchpad schema: the `_hyperdb_kv_store(store_name, key, value)` backing table, its indexless shape, the ephemeral-vs-persistent durability rule, and the `LEFT JOIN` enrichment pattern |
604
644
 
605
645
  Resource templates (discoverable via `resources/templates/list`):
606
646
 
@@ -666,8 +706,8 @@ Four guided analytical workflows registered as MCP **Prompts**.
666
706
  hyperdb-mcp --persistent-db ~/analytics.hyper --read-only
667
707
  ```
668
708
 
669
- - **Allowed:** `query`, `query_data`, `query_file`, `describe`, `sample`, `inspect_file`, `status`, `export`
670
- - **Blocked:** `execute`, `load_data`, `load_file`, `watch_directory`, `save_query`, `delete_query` — return `READ_ONLY_VIOLATION`
709
+ - **Allowed:** `query`, `query_data`, `query_file`, `describe`, `sample`, `inspect_file`, `status`, `export`, and the KV readers `kv_get`, `kv_list`, `kv_size`, `kv_list_stores`
710
+ - **Blocked:** `execute`, `load_data`, `load_file`, `watch_directory`, `save_query`, `delete_query`, and the KV mutators `kv_set`, `kv_delete`, `kv_pop`, `kv_clear` — return `READ_ONLY_VIOLATION`
671
711
  - **Resources, prompts, and resource subscriptions** work normally — read-only clients can still subscribe to `hyper://...` URIs and receive notifications when other (non-read-only) connections mutate state
672
712
 
673
713
  The `query` tool also enforces read-only at the SQL level — only `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`VALUES` are accepted.
package/package.json CHANGED
@@ -29,10 +29,10 @@
29
29
  "engines": {
30
30
  "node": ">= 21"
31
31
  },
32
- "version": "0.6.0",
32
+ "version": "0.6.1",
33
33
  "optionalDependencies": {
34
- "hyperdb-mcp-darwin-arm64": "0.6.0",
35
- "hyperdb-mcp-linux-x64-gnu": "0.6.0",
36
- "hyperdb-mcp-win32-x64-msvc": "0.6.0"
34
+ "hyperdb-mcp-darwin-arm64": "0.6.1",
35
+ "hyperdb-mcp-linux-x64-gnu": "0.6.1",
36
+ "hyperdb-mcp-win32-x64-msvc": "0.6.1"
37
37
  }
38
38
  }