@smallwebco/tinypivot-mcp 0.5.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.
- package/.claude-plugin/plugin.json +22 -3
- package/.mcp.json +1 -1
- package/LICENSE.md +37 -57
- package/README.md +22 -5
- package/dist/app/index.html +89 -89
- package/dist/{chunk-E6DYPT62.js → chunk-4AG4LXY4.js} +889 -572
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +33 -55
- package/dist/index.js +1 -1
- package/package.json +6 -5
- package/server.json +2 -2
package/dist/cli.js
CHANGED
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;
|
|
@@ -216,8 +231,6 @@ interface StudioNote {
|
|
|
216
231
|
id: string;
|
|
217
232
|
at: string;
|
|
218
233
|
text: string;
|
|
219
|
-
/** A note asks the agent to do something; a question is from the AI Analyst and expects an answer. */
|
|
220
|
-
kind: 'note' | 'question';
|
|
221
234
|
stepId?: string;
|
|
222
235
|
attachment?: NoteAttachment;
|
|
223
236
|
/** `live` when it went straight into the agent's conversation, `queued` when it waits for the next reply. */
|
|
@@ -239,43 +252,26 @@ interface StudioSnapshot {
|
|
|
239
252
|
name?: string;
|
|
240
253
|
live: string[];
|
|
241
254
|
busy: boolean;
|
|
255
|
+
hint?: string;
|
|
242
256
|
};
|
|
243
257
|
}
|
|
244
258
|
|
|
245
|
-
/**
|
|
246
|
-
* How the Studio reaches the user's own agent. Each harness offers something different:
|
|
247
|
-
* pi's extension and Claude Code's channels put a message into the live conversation, MCP sampling
|
|
248
|
-
* answers with the agent's model outside it, and every other agent gets Studio messages with its
|
|
249
|
-
* next TinyPivot reply. The bridge keeps whichever ways are connected and waits for answers.
|
|
250
|
-
*/
|
|
251
|
-
interface ChatTurn {
|
|
252
|
-
role: 'user' | 'assistant';
|
|
253
|
-
content: string;
|
|
254
|
-
}
|
|
255
259
|
interface AgentConnector {
|
|
256
260
|
/** Shown to the user, e.g. "pi" or "Claude Code channel". */
|
|
257
261
|
name: string;
|
|
258
262
|
/** Puts a message into the agent's conversation now. Returns false when it could not. */
|
|
259
|
-
push
|
|
260
|
-
/** Answers with the agent's own model, outside the conversation (MCP sampling). */
|
|
261
|
-
complete?: (turns: ChatTurn[]) => Promise<string>;
|
|
263
|
+
push: (note: StudioNote, text: string) => boolean;
|
|
262
264
|
}
|
|
263
265
|
declare class AgentBridge {
|
|
264
266
|
private readonly onChange;
|
|
265
267
|
private readonly connectors;
|
|
266
|
-
private readonly waiters;
|
|
267
268
|
constructor(onChange: () => void);
|
|
268
269
|
/** Adds a way to reach the agent; the returned function removes it. */
|
|
269
270
|
connect(connector: AgentConnector): () => void;
|
|
270
271
|
/** Names of the ways that reach the agent right now. */
|
|
271
272
|
live(): string[];
|
|
272
|
-
/** Delivers into the conversation through the first connector that
|
|
273
|
+
/** Delivers into the conversation through the first connector that takes it. */
|
|
273
274
|
push(note: StudioNote, text: string): string | undefined;
|
|
274
|
-
completer(): AgentConnector['complete'];
|
|
275
|
-
/** Resolves with the agent's answer to `id`, or undefined after `ms`. */
|
|
276
|
-
waitForReply(id: string, ms: number): Promise<string | undefined>;
|
|
277
|
-
/** Hands an answer to whoever waits for `re`, or to the oldest waiter when `re` is unknown. */
|
|
278
|
-
answer(text: string, re?: string): boolean;
|
|
279
275
|
}
|
|
280
276
|
|
|
281
277
|
type DuckDbModule = typeof _duckdb_node_api;
|
|
@@ -333,10 +329,11 @@ declare class Studio {
|
|
|
333
329
|
private readonly pullsByDataset;
|
|
334
330
|
private readonly listeners;
|
|
335
331
|
private changeQueued;
|
|
336
|
-
/** Ways to reach the user's agent
|
|
332
|
+
/** Ways to reach the user's agent live; without one, notes wait for its next TinyPivot reply. */
|
|
337
333
|
readonly agent: AgentBridge;
|
|
338
334
|
private agentName?;
|
|
339
335
|
private agentBusy;
|
|
336
|
+
private agentHint?;
|
|
340
337
|
constructor(store: DatasetStore, options?: {
|
|
341
338
|
history?: HistoryStore;
|
|
342
339
|
duck?: DuckDbRunner;
|
|
@@ -345,6 +342,8 @@ declare class Studio {
|
|
|
345
342
|
subscribe(listener: () => void): () => void;
|
|
346
343
|
private changed;
|
|
347
344
|
snapshot(sessionKey?: string): StudioSnapshot;
|
|
345
|
+
/** What would let this agent receive Studio messages live, shown while it cannot. */
|
|
346
|
+
setAgentHint(hint: string | undefined): void;
|
|
348
347
|
/** Whether the agent is in the middle of a turn, as its extension reports it. */
|
|
349
348
|
setAgentBusy(busy: boolean): void;
|
|
350
349
|
/** The MCP client's name, e.g. `claude-code`, shown in the Studio. */
|
|
@@ -390,7 +389,6 @@ declare class Studio {
|
|
|
390
389
|
addNote(text: string, options?: {
|
|
391
390
|
stepId?: string;
|
|
392
391
|
attachment?: NoteAttachment;
|
|
393
|
-
kind?: StudioNote['kind'];
|
|
394
392
|
}): StudioNote;
|
|
395
393
|
/**
|
|
396
394
|
* How a message reads to the agent: the text, the step it is about, and any attached data.
|
|
@@ -399,17 +397,8 @@ declare class Studio {
|
|
|
399
397
|
describeNote(note: StudioNote, { withSource }?: {
|
|
400
398
|
withSource?: boolean | undefined;
|
|
401
399
|
}): string;
|
|
402
|
-
/**
|
|
403
|
-
|
|
404
|
-
* offers sampling, otherwise through its conversation, waiting for the reply.
|
|
405
|
-
*/
|
|
406
|
-
ask(question: string, options?: {
|
|
407
|
-
turns?: ChatTurn[];
|
|
408
|
-
attachment?: NoteAttachment;
|
|
409
|
-
waitMs?: number;
|
|
410
|
-
}): Promise<string>;
|
|
411
|
-
/** The agent's answer to a Studio message: recorded in the trace and handed to whoever waits for it. */
|
|
412
|
-
reply(text: string, re?: string): TraceStep;
|
|
400
|
+
/** The agent's answer to a Studio message, recorded in the trace where the user reads it. */
|
|
401
|
+
reply(text: string): TraceStep;
|
|
413
402
|
/** Drops a queued note the user no longer wants sent. */
|
|
414
403
|
removeNote(id: string): boolean;
|
|
415
404
|
pendingNotes(): StudioNote[];
|
|
@@ -441,11 +430,6 @@ interface StartCompanionOptions {
|
|
|
441
430
|
*/
|
|
442
431
|
declare function startCompanionServer(options: StartCompanionOptions): Promise<CompanionServerHandle>;
|
|
443
432
|
|
|
444
|
-
declare const TINYPIVOT_CLAUDE_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nUse the `tinypivot` MCP server for charts, pivot tables and data exploration instead of drawing them yourself. In a terminal, show its `text` card verbatim with the Studio link.\n<!-- tinypivot:end -->";
|
|
445
|
-
declare const TINYPIVOT_PI_RULE_BLOCK = "<!-- tinypivot:start -->\n## Charts & pivot tables (TinyPivot MCP)\nUse the `tinypivot` MCP server for charts, pivot tables and data exploration instead of drawing them 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 -->";
|
|
446
|
-
declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
|
|
447
|
-
declare function runInitCommand(args: string[]): Promise<void>;
|
|
448
|
-
|
|
449
433
|
/**
|
|
450
434
|
* Generates a self-contained pi coding-agent extension (`~/.pi/agent/extensions/tinypivot.ts`)
|
|
451
435
|
* installed automatically by `tinypivot-mcp init`.
|
|
@@ -461,6 +445,11 @@ declare function runInitCommand(args: string[]): Promise<void>;
|
|
|
461
445
|
*/
|
|
462
446
|
declare function buildPiExtensionSource(): string;
|
|
463
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
|
+
|
|
464
453
|
interface PostgresConfig {
|
|
465
454
|
connectionString: string;
|
|
466
455
|
allowedTables?: string[];
|
|
@@ -510,25 +499,14 @@ declare function createTinyPivotMcpServer(options?: CreateTinyPivotMcpServerOpti
|
|
|
510
499
|
store: DatasetStore;
|
|
511
500
|
};
|
|
512
501
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/** Live local Studio URL to embed inside the card footer */
|
|
517
|
-
companionUrl?: string;
|
|
518
|
-
/** Optional 24-bit ANSI truecolor palette for direct TTY CLI output (omit for LLM Markdown) */
|
|
519
|
-
colorTheme?: ChartThemePreset;
|
|
520
|
-
/** Omit Markdown ```text fences (for direct TTY CLI output) */
|
|
521
|
-
raw?: boolean;
|
|
522
|
-
/** Remind the model, in a terminal, to show the card to the user. Off when cards are not reprinted. */
|
|
523
|
-
reprintNote?: boolean;
|
|
524
|
-
}
|
|
502
|
+
declare function formatDatasetSummary(dataset: StoredDataset, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
503
|
+
declare function formatPivotSummary(dataset: StoredDataset, config: PivotConfig, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
504
|
+
|
|
525
505
|
/**
|
|
526
506
|
* Render a screenshot-ready framed Unicode/Braille chart card directly in terminal output
|
|
527
507
|
* so CLI harnesses (Claude Code, OpenCode, pi, Codex, Ghostty) get an immediate, shareable visual.
|
|
528
508
|
*/
|
|
529
509
|
declare function formatTerminalChart(dataset: StoredDataset, chartConfig?: Partial<ChartConfig>, options?: TerminalFormatOptions): string;
|
|
530
|
-
declare function formatDatasetSummary(dataset: StoredDataset, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
531
|
-
declare function formatPivotSummary(dataset: StoredDataset, config: PivotConfig, companionUrl?: string, options?: TerminalFormatOptions): string;
|
|
532
510
|
|
|
533
511
|
declare function getCompanionSessionFile(): string;
|
|
534
512
|
declare function isProcessAlive(pid: number): boolean;
|
package/dist/index.js
CHANGED
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.
|
|
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": "
|
|
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-react": "1.4.
|
|
84
|
-
"@smallwebco/tinypivot-
|
|
85
|
-
"@smallwebco/tinypivot-
|
|
84
|
+
"@smallwebco/tinypivot-react": "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
|
+
"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.
|
|
17
|
+
"version": "0.6.1",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|