hyperdb-mcp 0.2.1 → 0.2.3

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 +7 -7
package/README.md CHANGED
@@ -1,6 +1,6 @@
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.
3
+ > **Note:** This crate was vibe-engineered with heavy use of AI coding assistants. The 0.2.x line may still undergo large breaking changes; the public API won't settle until the 1.0.0 release.
4
4
 
5
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.
6
6
 
@@ -373,12 +373,27 @@ query(sql: 'SELECT c.name, SUM(o.amount) FROM orders o JOIN customers c ON o.cus
373
373
 
374
374
  #### `execute`
375
375
 
376
- Execute a **mutating** SQL statement: `CREATE TABLE`, `INSERT`, `UPDATE`, `DELETE`, `DROP TABLE`, `ALTER`, `COPY`, etc. Returns the affected row count. Disabled in read-only mode.
376
+ Execute one or more **mutating** SQL statements as an atomic batch: `CREATE TABLE`, `INSERT`, `UPDATE`, `DELETE`, `DROP TABLE`, `ALTER`, `COPY`, etc. `sql` is an array of statements; multi-element batches run inside a transaction (all commit or all roll back). Single-element batches auto-commit, same as a one-off statement. Returns the per-statement affected row counts plus a total. Disabled in read-only mode.
377
377
 
378
378
  ```
379
- execute(sql: 'CREATE TABLE archived_orders AS SELECT * FROM orders WHERE year < 2024')
379
+ // Single statement (auto-commit)
380
+ execute(sql: ['CREATE TABLE archived_orders AS SELECT * FROM orders WHERE year < 2024'])
381
+
382
+ // Atomic upsert — both run or neither runs
383
+ execute(sql: [
384
+ "UPDATE settings SET value = 'dark' WHERE key = 'theme'",
385
+ "INSERT INTO settings (key, value) SELECT 'theme', 'dark' \
386
+ WHERE NOT EXISTS (SELECT 1 FROM settings WHERE key = 'theme')"
387
+ ])
380
388
  ```
381
389
 
390
+ Validation rules enforced before any SQL hits the server:
391
+ - Array must be non-empty; no element may be empty / whitespace-only / comment-only.
392
+ - No element may be read-only — use `query` for SELECT/WITH/EXPLAIN.
393
+ - DDL and DML cannot be mixed in one batch (Hyper aborts mixed transactions with SQLSTATE 0A000).
394
+ - Multi-element all-DDL batches are rejected because Hyper auto-commits CREATE/DROP/ALTER even inside a transaction; issue each DDL in its own `execute` call.
395
+ - Explicit transaction-control statements (`BEGIN` / `COMMIT` / `ROLLBACK` / `SAVEPOINT`) in batch elements are rejected — the tool manages the transaction for you, and a user-issued COMMIT mid-batch would defeat atomicity.
396
+
382
397
  #### `describe`
383
398
 
384
399
  List all workspace tables with their schemas, column types, and row counts.
@@ -741,6 +756,31 @@ Semantics:
741
756
 
742
757
  Hyper uses the Salesforce Data Cloud SQL dialect (PostgreSQL-compatible with extensions). Supports `SELECT`, JOINs, subqueries, CTEs, window functions, aggregations, DDL, DML, and `COPY FROM`.
743
758
 
759
+ ### Upserts (INSERT or UPDATE)
760
+
761
+ Hyper does **not** support `ON CONFLICT` or `INSERT ... ON DUPLICATE KEY`. Use the `execute` tool's atomic batch shape instead:
762
+
763
+ ```
764
+ execute(sql: [
765
+ "UPDATE settings SET value = 'dark' WHERE key = 'theme'",
766
+ "INSERT INTO settings (key, value) SELECT 'theme', 'dark' \
767
+ WHERE NOT EXISTS (SELECT 1 FROM settings WHERE key = 'theme')"
768
+ ])
769
+ ```
770
+
771
+ Both statements run inside a single Hyper transaction — they commit together or both roll back. No race window between them.
772
+
773
+ > **Tip:** For file-based upserts (merging updated data from a CSV/JSON file into an existing table), use `load_file` with `mode: "merge"` and a `merge_key` instead of writing manual SQL — it handles the UPDATE/INSERT logic automatically and also auto-adds new columns.
774
+
775
+ ### Transactions
776
+
777
+ The Hyper Rust API supports `BEGIN` / `COMMIT` / `ROLLBACK` plus an RAII `Transaction` guard (see [`docs/TRANSACTIONS.md`](../docs/TRANSACTIONS.md)). The MCP `execute` tool surfaces this as the `sql` array shape: pass multiple statements and they run atomically.
778
+
779
+ Hyper-specific limits worth remembering when batching:
780
+ - **DDL after DML in the same transaction is rejected** with SQLSTATE 0A000. The `execute` tool catches this up front — mixing CREATE/DROP/ALTER with INSERT/UPDATE/DELETE in one batch is rejected with an actionable error.
781
+ - **DDL is auto-committed** even inside a transaction. `execute` rejects multi-element all-DDL batches because the "atomic" promise can't be honored — issue each DDL call as its own one-element array.
782
+ - **After any error inside a transaction**, the connection enters aborted state and only ROLLBACK is accepted next. The `execute` tool handles this for you — on any per-statement failure the wrapper issues ROLLBACK before surfacing the error.
783
+
744
784
  Full reference: [Data Cloud SQL Reference](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/data-cloud-sql-context.html)
745
785
 
746
786
  ---
package/package.json CHANGED
@@ -1,15 +1,9 @@
1
1
  {
2
2
  "name": "hyperdb-mcp",
3
- "version": "0.2.1",
4
3
  "description": "HyperDB MCP server — instant SQL analytics for LLM workflows",
5
4
  "bin": {
6
5
  "hyperdb-mcp": "bin.js"
7
6
  },
8
- "optionalDependencies": {
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
- },
13
7
  "files": [
14
8
  "bin.js",
15
9
  "README.md"
@@ -28,11 +22,17 @@
28
22
  },
29
23
  "repository": {
30
24
  "type": "git",
31
- "url": "https://github.com/tableau/hyper-api-rust.git",
25
+ "url": "git+https://github.com/tableau/hyper-api-rust.git",
32
26
  "directory": "hyperdb-mcp"
33
27
  },
34
28
  "license": "MIT OR Apache-2.0",
35
29
  "engines": {
36
30
  "node": ">= 21"
31
+ },
32
+ "version": "0.2.3",
33
+ "optionalDependencies": {
34
+ "hyperdb-mcp-darwin-arm64": "0.2.3",
35
+ "hyperdb-mcp-linux-x64-gnu": "0.2.3",
36
+ "hyperdb-mcp-win32-x64-msvc": "0.2.3"
37
37
  }
38
38
  }