@smallwebco/tinypivot-mcp 0.4.0 → 0.6.0
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/.claude-plugin/plugin.json +1 -1
- package/README.md +13 -2
- package/dist/app/index.html +82 -80
- package/dist/{chunk-ZZOVYGIU.js → chunk-2DF4I43A.js} +1010 -397
- package/dist/cli.js +2 -3
- package/dist/index.d.ts +91 -19
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/server.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
runTuiCommand,
|
|
20
20
|
saveVisualThemePreference,
|
|
21
21
|
startCompanionServer
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2DF4I43A.js";
|
|
23
23
|
import "./chunk-2ESYSVXG.js";
|
|
24
24
|
|
|
25
25
|
// src/cli.ts
|
|
@@ -355,8 +355,7 @@ async function main() {
|
|
|
355
355
|
if (companionPromise)
|
|
356
356
|
return companionPromise;
|
|
357
357
|
companionPromise = startCompanion(port).catch((err) => {
|
|
358
|
-
|
|
359
|
-
throw err;
|
|
358
|
+
console.error(`[tinypivot-mcp] Port ${port} is taken (${err instanceof Error ? err.message : err}); using a free port for the Studio.`);
|
|
360
359
|
return startCompanion(0);
|
|
361
360
|
}).then((handle) => {
|
|
362
361
|
companion = handle;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import { DataGridViewMode, PivotConfig, ChartConfig
|
|
1
|
+
import { ChartThemePreset, DataGridViewMode, PivotConfig, ChartConfig } from '@smallwebco/tinypivot-core';
|
|
2
2
|
import * as _duckdb_node_api from '@duckdb/node-api';
|
|
3
3
|
import { DuckDBConnection } from '@duckdb/node-api';
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
5
|
|
|
6
|
+
interface TerminalFormatOptions {
|
|
7
|
+
/** Show subtle tiny-pivot.com card signature (true on Free tier, false on Pro) */
|
|
8
|
+
showBranding?: boolean;
|
|
9
|
+
/** Live local Studio URL to embed inside the card footer */
|
|
10
|
+
companionUrl?: string;
|
|
11
|
+
/** Optional 24-bit ANSI truecolor palette for direct TTY CLI output (omit for LLM Markdown) */
|
|
12
|
+
colorTheme?: ChartThemePreset;
|
|
13
|
+
/** Omit Markdown ```text fences (for direct TTY CLI output) */
|
|
14
|
+
raw?: boolean;
|
|
15
|
+
/** Remind the model, in a terminal, to show the card to the user. Off when cards are not reprinted. */
|
|
16
|
+
reprintNote?: boolean;
|
|
17
|
+
/** The host shows TinyPivot's own view in the chat, so the model is told not to repeat the card. */
|
|
18
|
+
shownInWidget?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
interface ModelPricing {
|
|
7
22
|
id: string;
|
|
8
23
|
name: string;
|
|
@@ -207,11 +222,19 @@ interface TraceStep {
|
|
|
207
222
|
pivotConfig?: Partial<PivotConfig>;
|
|
208
223
|
historyId?: string;
|
|
209
224
|
}
|
|
225
|
+
/** Data the user sends along with a message: a selected row, a drilled-into slice, a view. */
|
|
226
|
+
interface NoteAttachment {
|
|
227
|
+
label: string;
|
|
228
|
+
text: string;
|
|
229
|
+
}
|
|
210
230
|
interface StudioNote {
|
|
211
231
|
id: string;
|
|
212
232
|
at: string;
|
|
213
233
|
text: string;
|
|
214
234
|
stepId?: string;
|
|
235
|
+
attachment?: NoteAttachment;
|
|
236
|
+
/** `live` when it went straight into the agent's conversation, `queued` when it waits for the next reply. */
|
|
237
|
+
delivery: 'live' | 'queued';
|
|
215
238
|
}
|
|
216
239
|
/** What the browser Studio shows: the trace, notes not yet delivered, and saved pulls. */
|
|
217
240
|
interface StudioSnapshot {
|
|
@@ -224,6 +247,36 @@ interface StudioSnapshot {
|
|
|
224
247
|
historyEnabled: boolean;
|
|
225
248
|
/** Ids of the datasets loaded right now, so a step can open its dataset directly. */
|
|
226
249
|
loadedIds: string[];
|
|
250
|
+
/** The agent the Studio talks to, and the ways it reaches it live right now (empty when only queued). */
|
|
251
|
+
agent: {
|
|
252
|
+
name?: string;
|
|
253
|
+
live: string[];
|
|
254
|
+
busy: boolean;
|
|
255
|
+
hint?: string;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
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
|
+
interface AgentConnector {
|
|
265
|
+
/** Shown to the user, e.g. "pi" or "Claude Code channel". */
|
|
266
|
+
name: string;
|
|
267
|
+
/** Puts a message into the agent's conversation now. Returns false when it could not. */
|
|
268
|
+
push: (note: StudioNote, text: string) => boolean;
|
|
269
|
+
}
|
|
270
|
+
declare class AgentBridge {
|
|
271
|
+
private readonly onChange;
|
|
272
|
+
private readonly connectors;
|
|
273
|
+
constructor(onChange: () => void);
|
|
274
|
+
/** Adds a way to reach the agent; the returned function removes it. */
|
|
275
|
+
connect(connector: AgentConnector): () => void;
|
|
276
|
+
/** Names of the ways that reach the agent right now. */
|
|
277
|
+
live(): string[];
|
|
278
|
+
/** Delivers into the conversation through the first connector that takes it. */
|
|
279
|
+
push(note: StudioNote, text: string): string | undefined;
|
|
227
280
|
}
|
|
228
281
|
|
|
229
282
|
type DuckDbModule = typeof _duckdb_node_api;
|
|
@@ -281,6 +334,11 @@ declare class Studio {
|
|
|
281
334
|
private readonly pullsByDataset;
|
|
282
335
|
private readonly listeners;
|
|
283
336
|
private changeQueued;
|
|
337
|
+
/** Ways to reach the user's agent live; without one, notes wait for its next TinyPivot reply. */
|
|
338
|
+
readonly agent: AgentBridge;
|
|
339
|
+
private agentName?;
|
|
340
|
+
private agentBusy;
|
|
341
|
+
private agentHint?;
|
|
284
342
|
constructor(store: DatasetStore, options?: {
|
|
285
343
|
history?: HistoryStore;
|
|
286
344
|
duck?: DuckDbRunner;
|
|
@@ -289,6 +347,12 @@ declare class Studio {
|
|
|
289
347
|
subscribe(listener: () => void): () => void;
|
|
290
348
|
private changed;
|
|
291
349
|
snapshot(sessionKey?: string): StudioSnapshot;
|
|
350
|
+
/** What would let this agent receive Studio messages live, shown while it cannot. */
|
|
351
|
+
setAgentHint(hint: string | undefined): void;
|
|
352
|
+
/** Whether the agent is in the middle of a turn, as its extension reports it. */
|
|
353
|
+
setAgentBusy(busy: boolean): void;
|
|
354
|
+
/** The MCP client's name, e.g. `claude-code`, shown in the Studio. */
|
|
355
|
+
setAgentName(name: string | undefined): void;
|
|
292
356
|
private get traceFile();
|
|
293
357
|
private readTraceFile;
|
|
294
358
|
private appendToTraceFile;
|
|
@@ -323,8 +387,23 @@ declare class Studio {
|
|
|
323
387
|
sessionKey?: string;
|
|
324
388
|
record?: boolean;
|
|
325
389
|
}): Promise<StoredDataset>;
|
|
326
|
-
/**
|
|
327
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Sends the user's message to the agent: straight into its conversation when a live connector
|
|
392
|
+
* takes it, otherwise queued for its next TinyPivot reply.
|
|
393
|
+
*/
|
|
394
|
+
addNote(text: string, options?: {
|
|
395
|
+
stepId?: string;
|
|
396
|
+
attachment?: NoteAttachment;
|
|
397
|
+
}): StudioNote;
|
|
398
|
+
/**
|
|
399
|
+
* How a message reads to the agent: the text, the step it is about, and any attached data.
|
|
400
|
+
* `withSource` says where it came from, for messages that arrive on their own in the conversation.
|
|
401
|
+
*/
|
|
402
|
+
describeNote(note: StudioNote, { withSource }?: {
|
|
403
|
+
withSource?: boolean | undefined;
|
|
404
|
+
}): string;
|
|
405
|
+
/** The agent's answer to a Studio message, recorded in the trace where the user reads it. */
|
|
406
|
+
reply(text: string): TraceStep;
|
|
328
407
|
/** Drops a queued note the user no longer wants sent. */
|
|
329
408
|
removeNote(id: string): boolean;
|
|
330
409
|
pendingNotes(): StudioNote[];
|
|
@@ -356,8 +435,8 @@ interface StartCompanionOptions {
|
|
|
356
435
|
*/
|
|
357
436
|
declare function startCompanionServer(options: StartCompanionOptions): Promise<CompanionServerHandle>;
|
|
358
437
|
|
|
359
|
-
declare const TINYPIVOT_CLAUDE_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\
|
|
360
|
-
declare const TINYPIVOT_PI_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\
|
|
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 -->";
|
|
361
440
|
declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
|
|
362
441
|
declare function runInitCommand(args: string[]): Promise<void>;
|
|
363
442
|
|
|
@@ -369,6 +448,8 @@ declare function runInitCommand(args: string[]): Promise<void>;
|
|
|
369
448
|
* - Intercepts TinyPivot MCP tool outputs (including nested codemode calls) on `tool_execution_end`
|
|
370
449
|
* and renders framed charts & pivot tables directly in pi's TUI in full 24-bit ANSI truecolor
|
|
371
450
|
* using TinyPivot's unified theme palettes (zero extra LLM context tokens).
|
|
451
|
+
* - Connects pi to TinyPivot Studio: Studio messages start a turn here, and the agent's answer
|
|
452
|
+
* goes back to the Studio.
|
|
372
453
|
* - Registers `/tinypivot-theme [theme-id]` inside pi for instant interactive theme switching
|
|
373
454
|
* persisted to `~/.config/tinypivot/preferences.json` and synced to the live Studio.
|
|
374
455
|
*/
|
|
@@ -408,6 +489,8 @@ interface CreateTinyPivotMcpServerOptions {
|
|
|
408
489
|
reprintCards?: boolean;
|
|
409
490
|
/** The shared trace, history and SQL engine; the CLI passes the same one to the Studio page. */
|
|
410
491
|
studio?: Studio;
|
|
492
|
+
/** Offer Claude Code channels; defaults to whether Claude Code was started with this server's channel flag. */
|
|
493
|
+
claudeChannel?: boolean;
|
|
411
494
|
}
|
|
412
495
|
declare function clientSupportsMcpAppsUi(capabilities?: {
|
|
413
496
|
extensions?: Record<string, unknown>;
|
|
@@ -421,25 +504,14 @@ declare function createTinyPivotMcpServer(options?: CreateTinyPivotMcpServerOpti
|
|
|
421
504
|
store: DatasetStore;
|
|
422
505
|
};
|
|
423
506
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
/** Live local Studio URL to embed inside the card footer */
|
|
428
|
-
companionUrl?: string;
|
|
429
|
-
/** Optional 24-bit ANSI truecolor palette for direct TTY CLI output (omit for LLM Markdown) */
|
|
430
|
-
colorTheme?: ChartThemePreset;
|
|
431
|
-
/** Omit Markdown ```text fences (for direct TTY CLI output) */
|
|
432
|
-
raw?: boolean;
|
|
433
|
-
/** Remind the model, in a terminal, to show the card to the user. Off when cards are not reprinted. */
|
|
434
|
-
reprintNote?: boolean;
|
|
435
|
-
}
|
|
507
|
+
declare function formatDatasetSummary(dataset: StoredDataset, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
508
|
+
declare function formatPivotSummary(dataset: StoredDataset, config: PivotConfig, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
509
|
+
|
|
436
510
|
/**
|
|
437
511
|
* Render a screenshot-ready framed Unicode/Braille chart card directly in terminal output
|
|
438
512
|
* so CLI harnesses (Claude Code, OpenCode, pi, Codex, Ghostty) get an immediate, shareable visual.
|
|
439
513
|
*/
|
|
440
514
|
declare function formatTerminalChart(dataset: StoredDataset, chartConfig?: Partial<ChartConfig>, options?: TerminalFormatOptions): string;
|
|
441
|
-
declare function formatDatasetSummary(dataset: StoredDataset, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
442
|
-
declare function formatPivotSummary(dataset: StoredDataset, config: PivotConfig, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
443
515
|
|
|
444
516
|
declare function getCompanionSessionFile(): string;
|
|
445
517
|
declare function isProcessAlive(pid: number): boolean;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@smallwebco/tinypivot-mcp",
|
|
3
3
|
"mcpName": "io.github.Small-Web-Co/tinypivot",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.0",
|
|
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
8
|
"license": "MIT",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"typescript": "~5.6.2",
|
|
81
81
|
"vite": "^6.4.6",
|
|
82
82
|
"vite-plugin-singlefile": "^2.2.0",
|
|
83
|
-
"@smallwebco/tinypivot-core": "1.4.
|
|
84
|
-
"@smallwebco/tinypivot-react": "1.4.
|
|
85
|
-
"@smallwebco/tinypivot-server": "1.4.
|
|
83
|
+
"@smallwebco/tinypivot-core": "1.4.7",
|
|
84
|
+
"@smallwebco/tinypivot-react": "1.4.7",
|
|
85
|
+
"@smallwebco/tinypivot-server": "1.4.7"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"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
|
+
"version": "0.6.0",
|
|
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.
|
|
17
|
+
"version": "0.6.0",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|