@smallwebco/tinypivot-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.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "tinypivot",
3
- "version": "0.6.0",
3
+ "displayName": "TinyPivot",
4
+ "version": "0.6.1",
4
5
  "description": "Data analysis studio inside Claude — turn CSV, TSV, JSON, JSONL, API/MCP outputs, and SQL results from any database into interactive charts, deterministic pivot tables, data grids, screenshot-ready terminal cards, and Excel exports.",
5
6
  "author": {
6
7
  "name": "Small Web, LLC",
@@ -8,7 +9,7 @@
8
9
  },
9
10
  "homepage": "https://tiny-pivot.com/mcp",
10
11
  "repository": "https://github.com/Small-Web-Co/tinypivot",
11
- "license": "MIT",
12
+ "license": "SEE LICENSE IN LICENSE.md",
12
13
  "keywords": [
13
14
  "tinypivot",
14
15
  "mcp",
@@ -24,5 +25,23 @@
24
25
  "snowflake",
25
26
  "postgres",
26
27
  "excel"
27
- ]
28
+ ],
29
+ "icon": "./assets/icon.png",
30
+ "documentationUrl": "https://tiny-pivot.com/mcp",
31
+ "supportUrl": "https://github.com/Small-Web-Co/tinypivot/issues",
32
+ "privacyPolicyUrl": "https://tiny-pivot.com/privacy",
33
+ "termsOfServiceUrl": "https://tiny-pivot.com/terms",
34
+ "channels": [
35
+ {
36
+ "server": "tinypivot",
37
+ "displayName": "TinyPivot Studio"
38
+ }
39
+ ],
40
+ "network": {
41
+ "hosts": [
42
+ "registry.npmjs.org",
43
+ "tiny-pivot.com",
44
+ "www.tiny-pivot.com"
45
+ ]
46
+ }
28
47
  }
package/.mcp.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@smallwebco/tinypivot-mcp@latest"
7
+ "@smallwebco/tinypivot-mcp@0.6.1"
8
8
  ]
9
9
  }
10
10
  }
package/LICENSE.md CHANGED
@@ -1,78 +1,58 @@
1
1
  # TinyPivot License
2
2
 
3
- ## Free Tier (MIT License)
3
+ Copyright (c) 2024–2026 Small Web, LLC
4
4
 
5
- Copyright (c) 2024 TinyPivot
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of the Free Tier features of this software and associated documentation files
9
- (the "Software"), to deal in the Software without restriction, including without
10
- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
- and/or sell copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- ### Free Tier Features Include:
15
- - Basic data grid display with sorting
16
- - Column filtering with unique values
17
- - Keyboard navigation and cell selection
18
- - Copy/paste support
19
- - Row striping and hover states
20
- - Responsive column widths
21
- - Cell number formatting
22
-
23
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
5
+ TinyPivot is **dual-licensed (source-available)**: the Free Tier features are licensed under the **MIT License**, while Pro and Team features require a **Commercial License** from Small Web, LLC.
26
6
 
27
7
  ---
28
8
 
29
- ## Pro License (Commercial)
9
+ ## 1. Free Tier (MIT License)
30
10
 
31
- The following features require a Pro license:
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of the **Free Tier features** of this software and associated documentation files (the "Free Tier Software"), to deal in the Free Tier Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Free Tier Software, and to permit persons to whom the Free Tier Software is furnished to do so, subject to the following conditions:
32
12
 
33
- ### Pro Features:
34
- - **Pivot Table**: Full pivot table functionality with drag-and-drop configuration
35
- - **Advanced Aggregations**: Sum, Count, Average, Min, Max, Count Distinct
36
- - **Row/Column Totals**: Automatic total calculations
37
- - **Percentage Mode**: View data as % of row, column, or grand total
38
- - **Column/Row Grouping**: Multi-level grouping for pivot tables
39
- - **Session Persistence**: Auto-save and restore pivot configuration
40
- - **Priority Support**: Direct email support and issue prioritization
13
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Free Tier Software.
41
14
 
42
- ### Pricing:
43
- - **Single Project**: $49 one-time payment
44
- - **Unlimited Projects**: $149 one-time payment
45
- - **Team License (up to 10 devs)**: $399 one-time payment
46
-
47
- ### How to Purchase:
48
- Visit https://tiny-pivot.com/#pricing to purchase a license.
15
+ ### Free Tier Features Include:
16
+ - **TinyPivot UI (`@smallwebco/tinypivot-core`, `-vue`, `-react`):**
17
+ - Data grid display with sorting, column filtering, keyboard navigation, cell selection, copy/paste, column resizing, and formatting
18
+ - Free pivot tables (`sum` aggregation, totals, and calculated fields) with TinyPivot attribution visible
19
+ - **TinyPivot Studio / MCP (`@smallwebco/tinypivot-mcp`):**
20
+ - Datasets up to **2,500 rows** (explicitly flagged if a source file exceeds 2,500 rows)
21
+ - Core charts (`bar`, `stackedBar`, `line`, `area`, `pie`, `donut`), basic `sum` pivot tables, data grid, local read-only DuckDB SQL over files, Studio trace & local pull history, terminal cards, and the `Code` theme, with TinyPivot attribution visible
49
22
 
50
- After purchase, you'll receive a license key to unlock Pro features:
23
+ THE FREE TIER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
24
 
52
- ```typescript
53
- import { DataGrid, setLicenseKey } from 'tinypivot'
25
+ ---
54
26
 
55
- setLicenseKey('YOUR_LICENSE_KEY')
56
- ```
27
+ ## 2. Pro & Team Features (Commercial License)
57
28
 
58
- ### License Validation:
59
- - License keys are validated locally (no network calls)
60
- - Keys are tied to your npm username or organization
61
- - Licenses are perpetual with 1 year of updates included
29
+ The source code for Pro and Team features is included in this repository for transparency, security inspection, and local auditing, **not** under the MIT License. Using any Pro or Team feature in development, production, or commercial workflows requires a valid paid license key issued by Small Web, LLC.
62
30
 
63
- ---
31
+ ### Commercial Features Include:
32
+ - **TinyPivot Studio / MCP Pro & Team (`TP-MCPP-*` / `TP-MCPT-*`):**
33
+ - Unlimited dataset rows (beyond the 2,500-row Free Tier limit)
34
+ - All visual themes beyond `Code`
35
+ - Double-click Drill-Through
36
+ - Advanced aggregations (`countDistinct`, `median`, `stdDev`, `percentOfTotal`, etc.)
37
+ - Styled `.xlsx` Excel export
38
+ - AST-validated read-only PostgreSQL connector (`query_postgres`)
39
+ - Watermark / branding removal and multi-seat Team licensing
40
+ - **TinyPivot UI Pro / Unlimited / Team (`TP-PRO*`):**
41
+ - Pro charts, advanced aggregations, double-click Drill-Through, `.xlsx` export, AI Data Analyst, and watermark removal
64
42
 
65
- ## Terms
43
+ ### Purchasing & Verification
44
+ - Current plans and pricing are listed at https://tiny-pivot.com/pricing.
45
+ - License keys are cryptographically signed (ECDSA P-256) by Small Web, LLC and verified locally with no network call required.
66
46
 
67
- 1. **No Removal of Attribution**: Free tier users must keep the "Powered by TinyPivot"
68
- watermark visible. Pro license removes this requirement.
47
+ ---
69
48
 
70
- 2. **No Redistribution**: You may not redistribute this library as part of another
71
- component library or framework.
49
+ ## 3. Commercial Terms & Restrictions
72
50
 
73
- 3. **No Sub-licensing**: Licenses cannot be transferred or sub-licensed.
51
+ 1. **No License Bypass:** You may not modify, patch, circumvent, disable, or remove license key verification, row-limit enforcement, or feature gating to access Pro or Team features without a valid commercial license.
52
+ 2. **No Removal of Attribution on Free Tier:** Free Tier users must keep TinyPivot attribution/branding intact. A valid Pro or Team license removes this requirement.
53
+ 3. **No Redistribution of Pro Features:** You may not redistribute, repackage, or offer TinyPivot's Pro or Team features as part of another component library, SDK, MCP server, or hosted service without prior written consent from Small Web, LLC.
54
+ 4. **No Sub-licensing or Unauthorized Sharing:** Commercial license keys are non-transferable and may not be shared beyond the licensed number of applications or seats.
74
55
 
75
56
  ---
76
57
 
77
- For questions about licensing, contact: license@tiny-pivot.com
78
-
58
+ For licensing inquiries or enterprise terms, contact: **license@tiny-pivot.com**
package/README.md CHANGED
@@ -17,7 +17,8 @@ How a message reaches your agent depends on the harness. The Studio shows which
17
17
  | Agent | How Studio messages arrive |
18
18
  |---|---|
19
19
  | pi | Live: TinyPivot's pi extension starts a turn, and the answer comes back to the Studio's trace. `init` installs the extension, and TinyPivot keeps it up to date (restart pi after an update). Its cards are drawn in full colour, each series in its own. |
20
- | Claude Code | Live when started with `claude --dangerously-load-development-channels server:tinypivot` (Claude Code channels, a research preview). The agent answers with `studio_reply`. Otherwise, with its next TinyPivot reply. |
20
+ | OpenCode | Live: TinyPivot's OpenCode plugin (`~/.config/opencode/plugins/tinypivot.js`) sends the message as a prompt to the session that last used TinyPivot, and the answer comes back to the Studio's trace. `init` installs the plugin, and TinyPivot keeps it up to date (restart OpenCode after an update). Tested with OpenCode 1.19; OpenCode 2's new plugin API is not supported yet. |
21
+ | Claude Code | Live when started with `claude --dangerously-load-development-channels server:tinypivot`, or `plugin:tinypivot@tinypivot` when installed as a plugin (Claude Code channels, a research preview). The agent answers with `studio_reply`. Otherwise, with its next TinyPivot reply. Once TinyPivot is on Anthropic's channel allowlist, `claude --channels plugin:tinypivot@<marketplace>` will work without the development flag. |
21
22
  | Others | With the agent's next TinyPivot reply. **Copy as prompt** puts the message, the step, its SQL and the data on your clipboard to paste now. |
22
23
 
23
24
  In desktop and IDE hosts that show TinyPivot inline (Claude Desktop, VS Code, Cursor), click a row or drill into a pivot cell, then **Send to chat** to post it to the conversation with your comment.
@@ -46,7 +47,7 @@ Options:
46
47
 
47
48
  This package ships as a self-contained Claude plugin bundle containing:
48
49
 
49
- - `.claude-plugin/plugin.json` — plugin manifest
50
+ - `.claude-plugin/plugin.json` — plugin manifest, which also declares the TinyPivot Studio channel
50
51
  - `.mcp.json` — registers `mcpServers.tinypivot` (`npx -y @smallwebco/tinypivot-mcp@latest`)
51
52
  - `skills/tinypivot/SKILL.md` — teaches Claude when to invoke TinyPivot automatically, how to render in 1 tool call, when to use `load_data` vs `load_file`, and to echo TinyPivot terminal cards verbatim
52
53
 
@@ -79,6 +80,18 @@ Or copy the bundled `.mcp.json` server block directly into Claude Desktop's `cla
79
80
  >
80
81
  > `Always use the tinypivot MCP server (load_data or load_file with chartConfig/pivotConfig in one call) instead of built-in visualization widgets, HTML/SVG/React chart artifacts, or large Markdown tables whenever I ask for charts, YoY/MoM comparisons, pivot tables, or tabular data analysis.`
81
82
 
83
+ ### Option 3: Plugins for Other Agents
84
+
85
+ The same folder is also a plugin for other agents' plugin systems. Each one starts the same `npx -y @smallwebco/tinypivot-mcp@latest` server:
86
+
87
+ | Agent | Install | Files |
88
+ |---|---|---|
89
+ | Gemini CLI | `gemini extensions install https://github.com/Small-Web-Co/tinypivot` | `gemini-extension.json` (repo root) |
90
+ | Antigravity | `agy plugin install ./packages/mcp` from a clone of this repository | `plugin.json`, `mcp_config.json` |
91
+ | Cursor | Cursor marketplace (once listed), or a team marketplace that imports this repository | `.cursor-plugin/plugin.json`, `mcp.json`, `.cursor-plugin/marketplace.json` (repo root) |
92
+ | Codex | `codex plugin marketplace add Small-Web-Co/tinypivot` | `.codex-plugin/plugin.json`, `.agents/plugins/marketplace.json` (repo root) |
93
+ | OpenCode | `npx @smallwebco/tinypivot-mcp@latest init --targets=opencode` | registers the server and installs the Studio plugin |
94
+
82
95
  ## Terminal Cards, Stdin Piping & Live Ghostty TUI
83
96
 
84
97
  In terminal-first harnesses (**Claude Code, Ghostty, OpenCode, pi, Codex CLI**), TinyPivot delivers three complementary ways to inspect your data without leaving your terminal:
@@ -167,7 +180,13 @@ Data tools take an optional `why`: one sentence the agent writes about each step
167
180
 
168
181
  ## Privacy & Telemetry
169
182
 
183
+ Full policy: [tiny-pivot.com/privacy](https://tiny-pivot.com/privacy). Terms: [tiny-pivot.com/terms](https://tiny-pivot.com/terms).
184
+
170
185
  TinyPivot MCP sends minimal, **zero-PII** anonymous usage pings (`event`, `tool`, `rowBucket`, `client`, `tier`, `truncated`, `version`, `os`, and a random local UUID) to help us improve harness compatibility and reliability.
171
186
 
172
187
  - **Never collected:** row data, column names, SQL queries, file paths, hostnames, or user identities.
173
188
  - **Opt out anytime:** set `TINYPIVOT_TELEMETRY=0` or `DO_NOT_TRACK=1` in your environment or MCP server `env` block.
189
+
190
+ ## License
191
+
192
+ TinyPivot is **source-available (dual-licensed)**: Free Tier features are licensed under MIT, and Pro / Team features require a commercial license from Small Web, LLC. See [LICENSE.md](./LICENSE.md) for full terms.
@@ -10654,11 +10654,41 @@ data: ${JSON.stringify(studio.snapshot())}
10654
10654
  };
10655
10655
  }
10656
10656
 
10657
+ // src/agent-bridge.ts
10658
+ var EXTENSION_HEADER = "// Auto-installed by @smallwebco/tinypivot-mcp init";
10659
+ var AgentBridge = class {
10660
+ constructor(onChange) {
10661
+ this.onChange = onChange;
10662
+ }
10663
+ connectors = /* @__PURE__ */ new Set();
10664
+ /** Adds a way to reach the agent; the returned function removes it. */
10665
+ connect(connector) {
10666
+ this.connectors.add(connector);
10667
+ this.onChange();
10668
+ return () => {
10669
+ if (this.connectors.delete(connector))
10670
+ this.onChange();
10671
+ };
10672
+ }
10673
+ /** Names of the ways that reach the agent right now. */
10674
+ live() {
10675
+ return [...this.connectors].map((connector) => connector.name);
10676
+ }
10677
+ /** Delivers into the conversation through the first connector that takes it. */
10678
+ push(note, text) {
10679
+ for (const connector of this.connectors) {
10680
+ if (connector.push(note, text))
10681
+ return connector.name;
10682
+ }
10683
+ return void 0;
10684
+ }
10685
+ };
10686
+
10657
10687
  // src/pi-extension.ts
10658
10688
  function buildPiExtensionSource() {
10659
10689
  const palettesJson = JSON.stringify(TERMINAL_PALETTES, null, 2);
10660
10690
  const themeOrderJson = JSON.stringify(CHART_THEME_IDS);
10661
- return `// Auto-installed by @smallwebco/tinypivot-mcp init \u2014 do not edit by hand.
10691
+ return `${EXTENSION_HEADER} \u2014 do not edit by hand.
10662
10692
  // Renders TinyPivot charts & pivot tables in full 24-bit truecolor inside pi
10663
10693
  // and adds the /tinypivot-theme slash command.
10664
10694
 
@@ -11052,6 +11082,146 @@ import fs4 from "fs/promises";
11052
11082
  import os3 from "os";
11053
11083
  import path4 from "path";
11054
11084
  import { fileURLToPath } from "url";
11085
+
11086
+ // src/opencode-plugin.ts
11087
+ function buildOpenCodePluginSource() {
11088
+ return `${EXTENSION_HEADER} \u2014 do not edit by hand.
11089
+ // Connects this OpenCode session to TinyPivot Studio: messages sent from the Studio arrive here
11090
+ // as prompts, and the agent's answer goes back to the Studio.
11091
+
11092
+ // The Studio link TinyPivot puts in its replies ("Studio: \u2026" or a card's "Live: \u2026").
11093
+ const STUDIO_LINK = /(?:Studio|Live): (http:[/][/]127[.]0[.]0[.]1:[0-9]+)/;
11094
+ const STUDIO_HEADERS = { "Content-Type": "application/json", "x-tinypivot": "1" };
11095
+
11096
+ // OpenCode treats every exported function as a plugin, so only the plugin is exported.
11097
+
11098
+ /** The text of the newest assistant message, from \`client.session.messages\`. */
11099
+ function lastAssistantText(messages) {
11100
+ if (!Array.isArray(messages)) return "";
11101
+ for (let i = messages.length - 1; i >= 0; i--) {
11102
+ const message = messages[i];
11103
+ if (message?.info?.role !== "assistant") continue;
11104
+ return (message.parts ?? [])
11105
+ .filter(part => part?.type === "text" && !part.synthetic && !part.ignored)
11106
+ .map(part => part.text ?? "")
11107
+ .join("\\n")
11108
+ .trim();
11109
+ }
11110
+ return "";
11111
+ }
11112
+
11113
+ /** A tool's reply text: MCP tools hand over \`{ content: [{ type: "text", text }] }\`, built-in tools \`{ output }\`. */
11114
+ function toolText(output) {
11115
+ if (typeof output?.output === "string") return output.output;
11116
+ if (!Array.isArray(output?.content)) return "";
11117
+ return output.content.map(part => (part?.type === "text" ? part.text ?? "" : "")).join("\\n");
11118
+ }
11119
+
11120
+ export const TinyPivotStudio = async ({ client }) => {
11121
+ let studioUrl;
11122
+ let stream;
11123
+ /** The OpenCode session that called TinyPivot last: Studio messages go there. */
11124
+ let sessionID;
11125
+ /** Set while a turn that a Studio message started is running, so its answer goes back. */
11126
+ let awaiting = false;
11127
+
11128
+ function post(route, body) {
11129
+ if (!studioUrl) return Promise.resolve();
11130
+ return fetch(studioUrl + route, { method: "POST", headers: STUDIO_HEADERS, body: JSON.stringify(body) }).catch(() => {});
11131
+ }
11132
+
11133
+ async function deliver(text) {
11134
+ if (!sessionID) return;
11135
+ awaiting = true;
11136
+ try {
11137
+ await client.session.promptAsync({ path: { id: sessionID }, body: { parts: [{ type: "text", text }] } });
11138
+ } catch (error) {
11139
+ awaiting = false;
11140
+ console.error("[tinypivot] Could not send the Studio message to OpenCode:", error);
11141
+ }
11142
+ }
11143
+
11144
+ function handleFrame(frame) {
11145
+ if (!frame.startsWith("event: message")) return;
11146
+ const data = frame.split("\\n").find(line => line.startsWith("data: "));
11147
+ if (!data) return;
11148
+ const message = JSON.parse(data.slice(6));
11149
+ if (typeof message?.text === "string") void deliver(message.text);
11150
+ }
11151
+
11152
+ async function listen(url, signal) {
11153
+ let delay = 1000;
11154
+ while (!signal.aborted) {
11155
+ try {
11156
+ const res = await fetch(url + "/api/studio/agent-stream?agent=opencode", { headers: STUDIO_HEADERS, signal });
11157
+ if (!res.ok || !res.body) throw new Error("Studio stream " + res.status);
11158
+ delay = 1000;
11159
+ const reader = res.body.getReader();
11160
+ const decoder = new TextDecoder();
11161
+ let buffer = "";
11162
+ for (;;) {
11163
+ const { value, done } = await reader.read();
11164
+ if (done) break;
11165
+ buffer += decoder.decode(value, { stream: true });
11166
+ let end = buffer.indexOf("\\n\\n");
11167
+ while (end >= 0) {
11168
+ handleFrame(buffer.slice(0, end));
11169
+ buffer = buffer.slice(end + 2);
11170
+ end = buffer.indexOf("\\n\\n");
11171
+ }
11172
+ }
11173
+ } catch {
11174
+ // The Studio restarted or closed; try again after a pause.
11175
+ }
11176
+ if (signal.aborted) return;
11177
+ await new Promise(resolve => setTimeout(resolve, delay));
11178
+ delay = Math.min(delay * 2, 30000);
11179
+ }
11180
+ }
11181
+
11182
+ /** Starts listening to the Studio named in a TinyPivot tool reply. */
11183
+ function noticeToolText(text) {
11184
+ const url = STUDIO_LINK.exec(text)?.[1];
11185
+ if (!url || url === studioUrl) return;
11186
+ stream?.abort();
11187
+ studioUrl = url;
11188
+ stream = new AbortController();
11189
+ void listen(url, stream.signal);
11190
+ }
11191
+
11192
+ async function sendAnswer() {
11193
+ if (!awaiting || !sessionID) return;
11194
+ awaiting = false;
11195
+ try {
11196
+ const res = await client.session.messages({ path: { id: sessionID } });
11197
+ const text = lastAssistantText(res?.data);
11198
+ if (text) await post("/api/studio/reply", { text });
11199
+ } catch (error) {
11200
+ console.error("[tinypivot] Could not read OpenCode's answer for the Studio:", error);
11201
+ }
11202
+ }
11203
+
11204
+ return {
11205
+ "tool.execute.after": async (input, output) => {
11206
+ if (!String(input?.tool ?? "").toLowerCase().includes("tinypivot")) return;
11207
+ sessionID = input.sessionID;
11208
+ noticeToolText(toolText(output));
11209
+ },
11210
+ event: async ({ event }) => {
11211
+ if (!sessionID || event?.properties?.sessionID !== sessionID) return;
11212
+ // Tells the Studio whether OpenCode is working, so it can show progress.
11213
+ if (event.type === "session.status") await post("/api/studio/agent-status", { busy: event.properties.status?.type === "busy" });
11214
+ if (event.type === "session.idle") {
11215
+ await post("/api/studio/agent-status", { busy: false });
11216
+ await sendAnswer();
11217
+ }
11218
+ },
11219
+ };
11220
+ };
11221
+ `;
11222
+ }
11223
+
11224
+ // src/init.ts
11055
11225
  var MCP_NPX_SPEC = "@smallwebco/tinypivot-mcp@latest";
11056
11226
  var RULE_START = "<!-- tinypivot:start -->";
11057
11227
  var RULE_END = "<!-- tinypivot:end -->";
@@ -11399,63 +11569,56 @@ async function upsertRuleFile(targetId, ruleId, label, detectDir, ruleFilePath,
11399
11569
  };
11400
11570
  }
11401
11571
  }
11402
- function piExtensionPath(home = os3.homedir()) {
11403
- return path4.join(home, ".pi", "agent", "extensions", "tinypivot.ts");
11404
- }
11405
- var PI_EXTENSION_HEADER = "// Auto-installed by @smallwebco/tinypivot-mcp init";
11406
- async function refreshPiExtension(extPath = piExtensionPath()) {
11407
- const existing = await exists(extPath) ? await fs4.readFile(extPath, "utf8") : null;
11572
+ var AGENT_EXTENSIONS = {
11573
+ pi: {
11574
+ label: "pi Studio & UI",
11575
+ path: (home = os3.homedir()) => path4.join(home, ".pi", "agent", "extensions", "tinypivot.ts"),
11576
+ detectDir: (home = os3.homedir()) => path4.join(home, ".pi"),
11577
+ build: buildPiExtensionSource,
11578
+ installs: "Studio messages, 24-bit cards & /tinypivot-theme"
11579
+ },
11580
+ opencode: {
11581
+ label: "OpenCode Studio",
11582
+ path: (home = os3.homedir()) => path4.join(process.env.XDG_CONFIG_HOME || path4.join(home, ".config"), "opencode", "plugins", "tinypivot.js"),
11583
+ detectDir: (home = os3.homedir()) => path4.join(process.env.XDG_CONFIG_HOME || path4.join(home, ".config"), "opencode"),
11584
+ build: buildOpenCodePluginSource,
11585
+ installs: "live Studio messages plugin"
11586
+ }
11587
+ };
11588
+ async function refreshAgentExtension(agent, filePath = AGENT_EXTENSIONS[agent].path()) {
11589
+ const existing = await exists(filePath) ? await fs4.readFile(filePath, "utf8") : null;
11408
11590
  if (existing === null)
11409
11591
  return "absent";
11410
- if (!existing.startsWith(PI_EXTENSION_HEADER))
11592
+ if (!existing.startsWith(EXTENSION_HEADER))
11411
11593
  return "custom";
11412
- const next = buildPiExtensionSource();
11594
+ const next = AGENT_EXTENSIONS[agent].build();
11413
11595
  if (existing === next)
11414
11596
  return "current";
11415
- await fs4.writeFile(extPath, next, "utf8");
11597
+ await fs4.writeFile(filePath, next, "utf8");
11416
11598
  return "updated";
11417
11599
  }
11418
- async function upsertPiExtension(opts) {
11419
- const targeting = opts.targets ? opts.targets.has("pi") : true;
11420
- if (!targeting)
11600
+ async function upsertAgentExtension(agent, opts) {
11601
+ const spec = AGENT_EXTENSIONS[agent];
11602
+ const explicit = opts.targets?.has(agent) ?? false;
11603
+ if (opts.targets && !explicit)
11421
11604
  return null;
11422
11605
  const home = os3.homedir();
11423
- const piDir = path4.join(home, ".pi");
11424
- const extPath = piExtensionPath(home);
11425
- const explicit = opts.targets?.has("pi") ?? false;
11426
- if (!opts.all && !explicit && !await exists(piDir))
11606
+ const filePath = spec.path(home);
11607
+ if (!opts.all && !explicit && !await exists(spec.detectDir(home)))
11427
11608
  return null;
11609
+ const result = (status, detail) => ({ id: `${agent}-extension`, label: spec.label, configPath: filePath, status, detail });
11428
11610
  try {
11429
- const next = buildPiExtensionSource();
11430
- const existing = await exists(extPath) ? await fs4.readFile(extPath, "utf8") : "";
11431
- if (existing === next) {
11432
- return {
11433
- id: "pi-extension",
11434
- label: "pi Truecolor UI",
11435
- configPath: extPath,
11436
- status: "unchanged",
11437
- detail: "24-bit theme renderer & /tinypivot-theme already installed"
11438
- };
11439
- }
11611
+ const next = spec.build();
11612
+ const existing = await exists(filePath) ? await fs4.readFile(filePath, "utf8") : "";
11613
+ if (existing === next)
11614
+ return result("unchanged", `${spec.installs} already installed`);
11440
11615
  if (!opts.dryRun) {
11441
- await fs4.mkdir(path4.dirname(extPath), { recursive: true });
11442
- await fs4.writeFile(extPath, next, "utf8");
11616
+ await fs4.mkdir(path4.dirname(filePath), { recursive: true });
11617
+ await fs4.writeFile(filePath, next, "utf8");
11443
11618
  }
11444
- return {
11445
- id: "pi-extension",
11446
- label: "pi Truecolor UI",
11447
- configPath: extPath,
11448
- status: "updated",
11449
- detail: opts.dryRun ? "would install 24-bit theme renderer & /tinypivot-theme" : "installed 24-bit theme renderer & /tinypivot-theme"
11450
- };
11619
+ return result("updated", `${opts.dryRun ? "would install" : "installed"} ${spec.installs}`);
11451
11620
  } catch (err) {
11452
- return {
11453
- id: "pi-extension",
11454
- label: "pi Truecolor UI",
11455
- configPath: extPath,
11456
- status: "error",
11457
- detail: err instanceof Error ? err.message : String(err)
11458
- };
11621
+ return result("error", err instanceof Error ? err.message : String(err));
11459
11622
  }
11460
11623
  }
11461
11624
  async function upsertAllAgentRules(opts) {
@@ -11464,9 +11627,10 @@ async function upsertAllAgentRules(opts) {
11464
11627
  const candidates = await Promise.all([
11465
11628
  upsertRuleFile("claude", "claude-rules", "Claude Code Rules", path4.join(home, ".claude"), path4.join(home, ".claude", "CLAUDE.md"), opts),
11466
11629
  upsertRuleFile("pi", "pi-rules", "pi Rules", path4.join(home, ".pi"), path4.join(home, ".pi", "agent", "AGENTS.md"), opts, TINYPIVOT_PI_RULE_BLOCK),
11467
- upsertPiExtension(opts),
11630
+ upsertAgentExtension("pi", opts),
11468
11631
  upsertRuleFile("codex", "codex-rules", "Codex Rules", path4.join(home, ".codex"), path4.join(home, ".codex", "AGENTS.md"), opts),
11469
- upsertRuleFile("opencode", "opencode-rules", "OpenCode Rules", path4.join(xdg, "opencode"), path4.join(xdg, "opencode", "AGENTS.md"), opts)
11632
+ upsertRuleFile("opencode", "opencode-rules", "OpenCode Rules", path4.join(xdg, "opencode"), path4.join(xdg, "opencode", "AGENTS.md"), opts),
11633
+ upsertAgentExtension("opencode", opts)
11470
11634
  ]);
11471
11635
  return candidates.filter((r) => r !== null);
11472
11636
  }
@@ -11894,35 +12058,6 @@ async function executeReadOnlyPostgresQuery(config, sql) {
11894
12058
  import fs7 from "fs";
11895
12059
  import path7 from "path";
11896
12060
 
11897
- // src/agent-bridge.ts
11898
- var AgentBridge = class {
11899
- constructor(onChange) {
11900
- this.onChange = onChange;
11901
- }
11902
- connectors = /* @__PURE__ */ new Set();
11903
- /** Adds a way to reach the agent; the returned function removes it. */
11904
- connect(connector) {
11905
- this.connectors.add(connector);
11906
- this.onChange();
11907
- return () => {
11908
- if (this.connectors.delete(connector))
11909
- this.onChange();
11910
- };
11911
- }
11912
- /** Names of the ways that reach the agent right now. */
11913
- live() {
11914
- return [...this.connectors].map((connector) => connector.name);
11915
- }
11916
- /** Delivers into the conversation through the first connector that takes it. */
11917
- push(note, text) {
11918
- for (const connector of this.connectors) {
11919
- if (connector.push(note, text))
11920
- return connector.name;
11921
- }
11922
- return void 0;
11923
- }
11924
- };
11925
-
11926
12061
  // src/duckdb.ts
11927
12062
  import { spawn } from "child_process";
11928
12063
  import fs5 from "fs";
@@ -12639,7 +12774,7 @@ import fsSync2 from "fs";
12639
12774
  import os6 from "os";
12640
12775
  import path8 from "path";
12641
12776
  var DEFAULT_TELEMETRY_URL = "https://tiny-pivot.com/api/telemetry";
12642
- var PACKAGE_VERSION = "0.6.0";
12777
+ var PACKAGE_VERSION = "0.6.1";
12643
12778
  function isTelemetryEnabled() {
12644
12779
  if (process.env.TINYPIVOT_TELEMETRY === "0" || process.env.TINYPIVOT_TELEMETRY === "false")
12645
12780
  return false;
@@ -12813,12 +12948,14 @@ function normalizePivot(pivotConfig) {
12813
12948
  valueFields: pivotConfig.valueFields.map((v) => ({ field: v.field, aggregation: v.aggregation }))
12814
12949
  };
12815
12950
  }
12816
- var PI_HINTS = {
12817
- current: void 0,
12818
- custom: void 0,
12819
- updated: "TinyPivot's pi extension was just updated. Restart pi to send messages live.",
12820
- absent: "Run npx @smallwebco/tinypivot-mcp@latest init --targets=pi, then restart pi, to send messages live."
12821
- };
12951
+ function extensionHint(agent, status) {
12952
+ const name = agentLabel(agent);
12953
+ if (status === "updated")
12954
+ return `TinyPivot's ${name} extension was just updated. Restart ${name} to send messages live.`;
12955
+ if (status === "absent")
12956
+ return `Run npx @smallwebco/tinypivot-mcp@latest init --targets=${agent}, then restart ${name}, to send messages live.`;
12957
+ return void 0;
12958
+ }
12822
12959
  var whyParam = z.string().max(240).optional();
12823
12960
  var DUCKDB_WAIT_MS = 45e3;
12824
12961
  function toCoreChartConfig(input) {
@@ -12907,11 +13044,21 @@ function isMcpLicenseKey(key) {
12907
13044
  return false;
12908
13045
  return key.startsWith("TP-MCPP-") || key.startsWith("TP-MCPT-");
12909
13046
  }
13047
+ var LICENSE_KEY_ENV_VARS = ["TINYPIVOT_LICENSE_KEY", "CLAUDE_PLUGIN_OPTION_LICENSE_KEY"];
13048
+ function licenseKeyFromEnv() {
13049
+ for (const name of LICENSE_KEY_ENV_VARS) {
13050
+ const value2 = process.env[name]?.trim();
13051
+ if (value2 && !value2.startsWith("${"))
13052
+ return value2;
13053
+ }
13054
+ return void 0;
13055
+ }
12910
13056
  function resolveLicenseKey(explicit) {
12911
13057
  if (explicit?.trim())
12912
13058
  return explicit.trim();
12913
- if (process.env.TINYPIVOT_LICENSE_KEY?.trim())
12914
- return process.env.TINYPIVOT_LICENSE_KEY.trim();
13059
+ const fromEnv = licenseKeyFromEnv();
13060
+ if (fromEnv)
13061
+ return fromEnv;
12915
13062
  const here = path9.dirname(fileURLToPath2(import.meta.url));
12916
13063
  const candidates = [
12917
13064
  path9.resolve(here, "../.license"),
@@ -12952,7 +13099,7 @@ function createTinyPivotMcpServer(options = {}) {
12952
13099
  const server = new McpServer(
12953
13100
  {
12954
13101
  name: "tinypivot",
12955
- version: "0.6.0"
13102
+ version: "0.6.1"
12956
13103
  },
12957
13104
  {
12958
13105
  capabilities: {
@@ -13004,8 +13151,8 @@ function createTinyPivotMcpServer(options = {}) {
13004
13151
  const connectAgent = () => {
13005
13152
  const clientName = server.server.getClientVersion()?.name;
13006
13153
  studio.setAgentName(clientName);
13007
- if (clientName === "pi")
13008
- void refreshPiExtension().then((status) => studio.setAgentHint(PI_HINTS[status])).catch(() => {
13154
+ if (clientName === "pi" || clientName === "opencode")
13155
+ void refreshAgentExtension(clientName).then((status) => studio.setAgentHint(extensionHint(clientName, status))).catch(() => {
13009
13156
  });
13010
13157
  if (clientName === "claude-code" && !claudeChannel)
13011
13158
  studio.setAgentHint("Start Claude Code with --dangerously-load-development-channels server:tinypivot to send messages live.");
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  runTuiCommand,
20
20
  saveVisualThemePreference,
21
21
  startCompanionServer
22
- } from "./chunk-2DF4I43A.js";
22
+ } from "./chunk-4AG4LXY4.js";
23
23
  import "./chunk-2ESYSVXG.js";
24
24
 
25
25
  // src/cli.ts
package/dist/index.d.ts CHANGED
@@ -256,11 +256,6 @@ interface StudioSnapshot {
256
256
  };
257
257
  }
258
258
 
259
- /**
260
- * How the Studio reaches the user's own agent live. pi's extension and Claude Code's channels
261
- * put a message straight into the conversation; every other agent gets Studio messages with its
262
- * next TinyPivot reply. The bridge keeps whichever ways are connected right now.
263
- */
264
259
  interface AgentConnector {
265
260
  /** Shown to the user, e.g. "pi" or "Claude Code channel". */
266
261
  name: string;
@@ -435,11 +430,6 @@ interface StartCompanionOptions {
435
430
  */
436
431
  declare function startCompanionServer(options: StartCompanionOptions): Promise<CompanionServerHandle>;
437
432
 
438
- declare const TINYPIVOT_CLAUDE_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nWhenever an answer shows figures (a ranking, a breakdown by category, a comparison, a trend, a chart or a pivot), present them with the `tinypivot` MCP server instead of a Markdown table or a chart you draw yourself. In a terminal, show its `text` card verbatim with the Studio link.\n<!-- tinypivot:end -->";
439
- declare const TINYPIVOT_PI_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nWhenever an answer shows figures (a ranking, a breakdown by category, a comparison, a trend, a chart or a pivot), present them with the `tinypivot` MCP server instead of a Markdown table or a chart you draw yourself. The TinyPivot pi extension already shows each card, so reply with the takeaways and the Studio link. `/tinypivot-theme` switches themes.\n<!-- tinypivot:end -->";
440
- declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
441
- declare function runInitCommand(args: string[]): Promise<void>;
442
-
443
433
  /**
444
434
  * Generates a self-contained pi coding-agent extension (`~/.pi/agent/extensions/tinypivot.ts`)
445
435
  * installed automatically by `tinypivot-mcp init`.
@@ -455,6 +445,11 @@ declare function runInitCommand(args: string[]): Promise<void>;
455
445
  */
456
446
  declare function buildPiExtensionSource(): string;
457
447
 
448
+ declare const TINYPIVOT_CLAUDE_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nWhenever an answer shows figures (a ranking, a breakdown by category, a comparison, a trend, a chart or a pivot), present them with the `tinypivot` MCP server instead of a Markdown table or a chart you draw yourself. In a terminal, show its `text` card verbatim with the Studio link.\n<!-- tinypivot:end -->";
449
+ declare const TINYPIVOT_PI_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nWhenever an answer shows figures (a ranking, a breakdown by category, a comparison, a trend, a chart or a pivot), present them with the `tinypivot` MCP server instead of a Markdown table or a chart you draw yourself. The TinyPivot pi extension already shows each card, so reply with the takeaways and the Studio link. `/tinypivot-theme` switches themes.\n<!-- tinypivot:end -->";
450
+ declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
451
+ declare function runInitCommand(args: string[]): Promise<void>;
452
+
458
453
  interface PostgresConfig {
459
454
  connectionString: string;
460
455
  allowedTables?: string[];
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  startCompanionServer,
34
34
  tokensToUsd,
35
35
  upsertTinyPivotRuleBlock
36
- } from "./chunk-2DF4I43A.js";
36
+ } from "./chunk-4AG4LXY4.js";
37
37
  import "./chunk-2ESYSVXG.js";
38
38
  export {
39
39
  APP_MIME_TYPE,
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@smallwebco/tinypivot-mcp",
3
3
  "mcpName": "io.github.Small-Web-Co/tinypivot",
4
4
  "type": "module",
5
- "version": "0.6.0",
5
+ "version": "0.6.1",
6
6
  "description": "TinyPivot MCP Server, Interactive MCP App & Claude Plugin — turn CSV, JSON, API/MCP outputs, and queries from any database into interactive charts, pivot tables, terminal cards, live TUI, drill-through, and Excel exports inside AI agents.",
7
7
  "author": "Small Web, LLC",
8
- "license": "MIT",
8
+ "license": "SEE LICENSE IN LICENSE.md",
9
9
  "homepage": "https://tiny-pivot.com",
10
10
  "repository": {
11
11
  "type": "git",
@@ -48,6 +48,7 @@
48
48
  "files": [
49
49
  ".claude-plugin",
50
50
  ".mcp.json",
51
+ "LICENSE.md",
51
52
  "README.md",
52
53
  "dist",
53
54
  "rules",
@@ -80,9 +81,9 @@
80
81
  "typescript": "~5.6.2",
81
82
  "vite": "^6.4.6",
82
83
  "vite-plugin-singlefile": "^2.2.0",
83
- "@smallwebco/tinypivot-core": "1.4.7",
84
84
  "@smallwebco/tinypivot-react": "1.4.7",
85
- "@smallwebco/tinypivot-server": "1.4.7"
85
+ "@smallwebco/tinypivot-server": "1.4.7",
86
+ "@smallwebco/tinypivot-core": "1.4.7"
86
87
  },
87
88
  "scripts": {
88
89
  "build": "pnpm run build:server && pnpm run build:app",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.Small-Web-Co/tinypivot",
4
4
  "title": "TinyPivot — Data Analysis Studio for AI Agents",
5
5
  "description": "Interactive charts, pivot tables, terminal cards, live TUI, and Excel export inside AI agents.",
6
- "version": "0.6.0",
6
+ "version": "0.6.1",
7
7
  "websiteUrl": "https://tiny-pivot.com",
8
8
  "repository": {
9
9
  "url": "https://github.com/Small-Web-Co/tinypivot",
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "registryType": "npm",
16
16
  "identifier": "@smallwebco/tinypivot-mcp",
17
- "version": "0.6.0",
17
+ "version": "0.6.1",
18
18
  "transport": {
19
19
  "type": "stdio"
20
20
  },