@smallwebco/tinypivot-mcp 0.6.0 → 0.7.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 +30 -3
- package/.mcp.json +5 -2
- package/LICENSE.md +37 -57
- package/README.md +22 -3
- package/dist/app/index.html +128 -128
- package/dist/{chunk-2DF4I43A.js → chunk-EWLFVFBK.js} +1869 -263
- package/dist/cli.js +18 -2
- package/dist/index.d.ts +91 -38
- package/dist/index.js +1 -1
- package/package.json +6 -5
- package/server.json +2 -2
- package/skills/tinypivot/SKILL.md +13 -7
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
CHART_THEME_IDS,
|
|
4
4
|
DatasetStore,
|
|
5
5
|
FREE_TIER_ROW_LIMIT,
|
|
6
|
+
STUDIO_IDLE_STOP_MS,
|
|
6
7
|
Studio,
|
|
7
8
|
TERMINAL_PALETTES,
|
|
8
9
|
createTinyPivotMcpServer,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
runTuiCommand,
|
|
20
21
|
saveVisualThemePreference,
|
|
21
22
|
startCompanionServer
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-EWLFVFBK.js";
|
|
23
24
|
import "./chunk-2ESYSVXG.js";
|
|
24
25
|
|
|
25
26
|
// src/cli.ts
|
|
@@ -271,6 +272,11 @@ Options:
|
|
|
271
272
|
--name=<title> Dataset title for piped stdin / loaded files
|
|
272
273
|
`.trim());
|
|
273
274
|
}
|
|
275
|
+
function studioIdleStopMs() {
|
|
276
|
+
const raw = process.env.TINYPIVOT_STUDIO_IDLE_MINUTES?.trim();
|
|
277
|
+
const minutes = raw ? Number(raw) : Number.NaN;
|
|
278
|
+
return Number.isFinite(minutes) && minutes >= 0 ? minutes * 6e4 : STUDIO_IDLE_STOP_MS;
|
|
279
|
+
}
|
|
274
280
|
async function main() {
|
|
275
281
|
const args = process.argv.slice(2);
|
|
276
282
|
if (args[0] === "-h" || args[0] === "--help") {
|
|
@@ -333,13 +339,21 @@ async function main() {
|
|
|
333
339
|
let companion;
|
|
334
340
|
let companionPromise = null;
|
|
335
341
|
const studio = new Studio(store);
|
|
342
|
+
let studioWasStopped = false;
|
|
336
343
|
const startCompanion = (onPort) => startCompanionServer({
|
|
337
344
|
store,
|
|
338
345
|
studio,
|
|
339
346
|
loadHtml: () => loadAppHtml(appHtmlPath),
|
|
340
347
|
licenseKey,
|
|
341
348
|
demoToken,
|
|
342
|
-
port: onPort
|
|
349
|
+
port: onPort,
|
|
350
|
+
idleStopMs: studioIdleStopMs(),
|
|
351
|
+
onStopped: (reason) => {
|
|
352
|
+
console.error(`[tinypivot-mcp] TinyPivot Studio stopped (${reason === "idle" ? "no tab open" : "Stop pressed"}); the next TinyPivot call starts it again.`);
|
|
353
|
+
companion = void 0;
|
|
354
|
+
companionPromise = null;
|
|
355
|
+
studioWasStopped = true;
|
|
356
|
+
}
|
|
343
357
|
});
|
|
344
358
|
const openStudioIfNoTab = (handle) => {
|
|
345
359
|
setTimeout(() => {
|
|
@@ -360,6 +374,8 @@ async function main() {
|
|
|
360
374
|
}).then((handle) => {
|
|
361
375
|
companion = handle;
|
|
362
376
|
console.error(`[tinypivot-mcp] TinyPivot Studio ready at ${handle.url}`);
|
|
377
|
+
if (studioWasStopped)
|
|
378
|
+
return handle;
|
|
363
379
|
if (autoOpen)
|
|
364
380
|
openInBrowser(handle.url);
|
|
365
381
|
else if (openStudio)
|
package/dist/index.d.ts
CHANGED
|
@@ -189,7 +189,9 @@ declare class HistoryStore {
|
|
|
189
189
|
/** Full path of an entry's saved rows, for reading back or querying with SQL. */
|
|
190
190
|
rowsPath(entry: HistoryEntry): string | undefined;
|
|
191
191
|
readRows(entry: HistoryEntry): Record<string, unknown>[];
|
|
192
|
-
/**
|
|
192
|
+
/** Removes conversation traces last written before `cutoff`, and the old trace every session shared. */
|
|
193
|
+
private pruneTraces;
|
|
194
|
+
/** Deletes entries and conversation traces older than the retention window. Returns how many entries were removed. */
|
|
193
195
|
prune(now?: Date): number;
|
|
194
196
|
}
|
|
195
197
|
|
|
@@ -221,46 +223,78 @@ interface TraceStep {
|
|
|
221
223
|
chartConfig?: Partial<ChartConfig>;
|
|
222
224
|
pivotConfig?: Partial<PivotConfig>;
|
|
223
225
|
historyId?: string;
|
|
226
|
+
/** The user's request this step serves, in their words, when the agent passed it along. */
|
|
227
|
+
ask?: string;
|
|
228
|
+
/** Column names of the result. */
|
|
229
|
+
columns?: string[];
|
|
230
|
+
/** The result's size and content hash (row order ignored), so a rerun can show it reproduces. */
|
|
231
|
+
fingerprint?: Fingerprint;
|
|
232
|
+
/** For a load from a file: the file as it was then, so the Studio can tell whether it changed. */
|
|
233
|
+
source?: SourceFile;
|
|
234
|
+
/** For an answer: each number it quotes and whether the data backs it. */
|
|
235
|
+
claims?: Claim[];
|
|
236
|
+
}
|
|
237
|
+
interface Fingerprint {
|
|
238
|
+
rows: number;
|
|
239
|
+
hash: string;
|
|
240
|
+
}
|
|
241
|
+
interface SourceFile {
|
|
242
|
+
file: string;
|
|
243
|
+
bytes: number;
|
|
244
|
+
modifiedAt: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A number quoted in an answer. `found`: a cell, total or share in the data rounds to it.
|
|
248
|
+
* `not-found`: nothing does. `unchecked`: a percentage that is not a share, such as a growth rate.
|
|
249
|
+
*/
|
|
250
|
+
interface Claim {
|
|
251
|
+
text: string;
|
|
252
|
+
status: 'found' | 'not-found' | 'unchecked';
|
|
253
|
+
where?: string;
|
|
254
|
+
}
|
|
255
|
+
/** The result of re-checking a step: did the source stay put, and does the SQL give the same rows again. */
|
|
256
|
+
interface StepCheck {
|
|
257
|
+
kind: 'source' | 'rerun';
|
|
258
|
+
ok: boolean;
|
|
259
|
+
detail: string;
|
|
224
260
|
}
|
|
225
261
|
/** Data the user sends along with a message: a selected row, a drilled-into slice, a view. */
|
|
226
262
|
interface NoteAttachment {
|
|
227
263
|
label: string;
|
|
228
264
|
text: string;
|
|
229
265
|
}
|
|
266
|
+
/** A message from the Studio, sent straight into the agent's conversation. */
|
|
230
267
|
interface StudioNote {
|
|
231
268
|
id: string;
|
|
232
269
|
at: string;
|
|
233
270
|
text: string;
|
|
234
271
|
stepId?: string;
|
|
235
272
|
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';
|
|
238
273
|
}
|
|
239
|
-
/**
|
|
274
|
+
/** How the user can make their agent take Studio messages live: a sentence, and a command to copy if there is one. */
|
|
275
|
+
interface AgentHint {
|
|
276
|
+
text: string;
|
|
277
|
+
command?: string;
|
|
278
|
+
}
|
|
279
|
+
/** What the browser Studio shows: the trace, saved pulls and how to reach the agent. */
|
|
240
280
|
interface StudioSnapshot {
|
|
241
281
|
/** Each step, with the SQL that reproduces it when there is one (file loads included). */
|
|
242
282
|
steps: Array<TraceStep & {
|
|
243
283
|
editableSql?: string;
|
|
244
284
|
}>;
|
|
245
|
-
notes: StudioNote[];
|
|
246
285
|
history: HistoryEntry[];
|
|
247
286
|
historyEnabled: boolean;
|
|
248
287
|
/** Ids of the datasets loaded right now, so a step can open its dataset directly. */
|
|
249
288
|
loadedIds: string[];
|
|
250
|
-
/** The agent the Studio talks to, and the ways it reaches it live right now (empty
|
|
289
|
+
/** The agent the Studio talks to, and the ways it reaches it live right now (empty: the Studio cannot message it). */
|
|
251
290
|
agent: {
|
|
252
291
|
name?: string;
|
|
253
292
|
live: string[];
|
|
254
293
|
busy: boolean;
|
|
255
|
-
hint?:
|
|
294
|
+
hint?: AgentHint;
|
|
256
295
|
};
|
|
257
296
|
}
|
|
258
297
|
|
|
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
298
|
interface AgentConnector {
|
|
265
299
|
/** Shown to the user, e.g. "pi" or "Claude Code channel". */
|
|
266
300
|
name: string;
|
|
@@ -313,6 +347,7 @@ interface StudioQueryInput {
|
|
|
313
347
|
name?: string;
|
|
314
348
|
actor: StepActor;
|
|
315
349
|
why?: string;
|
|
350
|
+
ask?: string;
|
|
316
351
|
sessionKey?: string;
|
|
317
352
|
keepExisting?: boolean;
|
|
318
353
|
viewMode?: DataGridViewMode;
|
|
@@ -330,7 +365,6 @@ declare class Studio {
|
|
|
330
365
|
readonly history: HistoryStore;
|
|
331
366
|
readonly duck: DuckDbRunner;
|
|
332
367
|
private steps;
|
|
333
|
-
private notes;
|
|
334
368
|
private readonly pullsByDataset;
|
|
335
369
|
private readonly listeners;
|
|
336
370
|
private changeQueued;
|
|
@@ -339,16 +373,22 @@ declare class Studio {
|
|
|
339
373
|
private agentName?;
|
|
340
374
|
private agentBusy;
|
|
341
375
|
private agentHint?;
|
|
376
|
+
/**
|
|
377
|
+
* Which conversation this Studio belongs to. Each server process is one conversation, so its
|
|
378
|
+
* trace is its own: other sessions, harnesses and tools running on the machine never show up here.
|
|
379
|
+
*/
|
|
380
|
+
readonly sessionId: string;
|
|
342
381
|
constructor(store: DatasetStore, options?: {
|
|
343
382
|
history?: HistoryStore;
|
|
344
383
|
duck?: DuckDbRunner;
|
|
384
|
+
sessionId?: string;
|
|
345
385
|
});
|
|
346
386
|
/** Calls `listener` (once per tick at most) whenever the trace or the notes change. */
|
|
347
387
|
subscribe(listener: () => void): () => void;
|
|
348
388
|
private changed;
|
|
349
389
|
snapshot(sessionKey?: string): StudioSnapshot;
|
|
350
390
|
/** What would let this agent receive Studio messages live, shown while it cannot. */
|
|
351
|
-
setAgentHint(hint:
|
|
391
|
+
setAgentHint(hint: AgentHint | undefined): void;
|
|
352
392
|
/** Whether the agent is in the middle of a turn, as its extension reports it. */
|
|
353
393
|
setAgentBusy(busy: boolean): void;
|
|
354
394
|
/** The MCP client's name, e.g. `claude-code`, shown in the Studio. */
|
|
@@ -358,13 +398,17 @@ declare class Studio {
|
|
|
358
398
|
private appendToTraceFile;
|
|
359
399
|
/** Adds a step to the trace and returns it. */
|
|
360
400
|
record(step: Omit<TraceStep, 'id' | 'at'>): TraceStep;
|
|
361
|
-
/** Records a step about a dataset, filling in its name, size, view and saved pull. */
|
|
362
|
-
recordDatasetStep(dataset: StoredDataset, step: Pick<TraceStep, 'actor' | 'tool' | 'why' | 'sql' | 'file' | 'where'>): TraceStep;
|
|
401
|
+
/** Records a step about a dataset, filling in its name, size, columns, fingerprint, view and saved pull. */
|
|
402
|
+
recordDatasetStep(dataset: StoredDataset, step: Pick<TraceStep, 'actor' | 'tool' | 'why' | 'ask' | 'sql' | 'file' | 'where'>): TraceStep;
|
|
363
403
|
/**
|
|
364
404
|
* Shows a step's dataset as it was right after the step, reopening it from history when it is
|
|
365
|
-
* no longer loaded. Looking is not a step, so
|
|
405
|
+
* no longer loaded; `viewMode` shows it another way, e.g. its rows. Looking is not a step, so
|
|
406
|
+
* nothing is recorded.
|
|
366
407
|
*/
|
|
367
|
-
showStep(stepId: string,
|
|
408
|
+
showStep(stepId: string, options?: {
|
|
409
|
+
viewMode?: DataGridViewMode;
|
|
410
|
+
sessionKey?: string;
|
|
411
|
+
}): Promise<StoredDataset>;
|
|
368
412
|
recentSteps(limit?: number): TraceStep[];
|
|
369
413
|
/** Saves a pull to history and remembers which entry backs the dataset. */
|
|
370
414
|
remember(dataset: StoredDataset, input: RecordInput): HistoryEntry | null;
|
|
@@ -388,27 +432,29 @@ declare class Studio {
|
|
|
388
432
|
record?: boolean;
|
|
389
433
|
}): Promise<StoredDataset>;
|
|
390
434
|
/**
|
|
391
|
-
* Sends the user's message
|
|
392
|
-
* takes it
|
|
435
|
+
* Sends the user's message straight into the agent's conversation. Throws when no live
|
|
436
|
+
* connector takes it: the Studio only offers to send when the agent can receive.
|
|
393
437
|
*/
|
|
394
438
|
addNote(text: string, options?: {
|
|
395
439
|
stepId?: string;
|
|
396
440
|
attachment?: NoteAttachment;
|
|
397
441
|
}): StudioNote;
|
|
442
|
+
/** How a message reads to the agent: where it came from, the text, the step it is about, and any attached data. */
|
|
443
|
+
describeNote(note: StudioNote): string;
|
|
444
|
+
/**
|
|
445
|
+
* The agent's answer to a Studio message, recorded where the user reads it, with each number it
|
|
446
|
+
* quotes checked against the data loaded since the user last asked something.
|
|
447
|
+
*/
|
|
448
|
+
reply(text: string, sessionKey?: string): TraceStep;
|
|
449
|
+
/** The datasets the current question has used and that are still loaded, newest first. */
|
|
450
|
+
private datasetsSinceLastAsk;
|
|
398
451
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
452
|
+
* Re-checks a step: whether its source file is unchanged, and whether running its SQL again gives
|
|
453
|
+
* the same rows. Results of queries are compared value by value (row order ignored); a file load
|
|
454
|
+
* is compared by row count, since the file reader and SQL may type the same column differently.
|
|
401
455
|
*/
|
|
402
|
-
|
|
403
|
-
|
|
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;
|
|
407
|
-
/** Drops a queued note the user no longer wants sent. */
|
|
408
|
-
removeNote(id: string): boolean;
|
|
409
|
-
pendingNotes(): StudioNote[];
|
|
410
|
-
/** The queued notes as text for the agent, emptying the queue. Empty when there are none. */
|
|
411
|
-
takeNotes(): string;
|
|
456
|
+
verifyStep(stepId: string, sessionKey?: string): Promise<StepCheck[]>;
|
|
457
|
+
private checkRerun;
|
|
412
458
|
}
|
|
413
459
|
|
|
414
460
|
interface CompanionServerHandle {
|
|
@@ -427,6 +473,13 @@ interface StartCompanionOptions {
|
|
|
427
473
|
port?: number;
|
|
428
474
|
/** Trace, notes and history shown in the Studio; without one the Studio routes answer 404. */
|
|
429
475
|
studio?: Studio;
|
|
476
|
+
/**
|
|
477
|
+
* How long the server stays up after the last Studio tab closes. Only counts once a tab has
|
|
478
|
+
* connected, so a Live link printed in a card keeps working until someone opens it. 0 keeps it up.
|
|
479
|
+
*/
|
|
480
|
+
idleStopMs?: number;
|
|
481
|
+
/** Called once the server has closed itself: the user pressed Stop, or every tab stayed closed. */
|
|
482
|
+
onStopped?: (reason: 'stopped' | 'idle') => void;
|
|
430
483
|
}
|
|
431
484
|
/**
|
|
432
485
|
* Localhost companion HTTP + SSE server so terminal-first harnesses
|
|
@@ -435,11 +488,6 @@ interface StartCompanionOptions {
|
|
|
435
488
|
*/
|
|
436
489
|
declare function startCompanionServer(options: StartCompanionOptions): Promise<CompanionServerHandle>;
|
|
437
490
|
|
|
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
491
|
/**
|
|
444
492
|
* Generates a self-contained pi coding-agent extension (`~/.pi/agent/extensions/tinypivot.ts`)
|
|
445
493
|
* installed automatically by `tinypivot-mcp init`.
|
|
@@ -455,6 +503,11 @@ declare function runInitCommand(args: string[]): Promise<void>;
|
|
|
455
503
|
*/
|
|
456
504
|
declare function buildPiExtensionSource(): string;
|
|
457
505
|
|
|
506
|
+
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 -->";
|
|
507
|
+
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 -->";
|
|
508
|
+
declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
|
|
509
|
+
declare function runInitCommand(args: string[]): Promise<void>;
|
|
510
|
+
|
|
458
511
|
interface PostgresConfig {
|
|
459
512
|
connectionString: string;
|
|
460
513
|
allowedTables?: string[];
|
|
@@ -518,4 +571,4 @@ declare function isProcessAlive(pid: number): boolean;
|
|
|
518
571
|
declare function resolveCompanionUrl(explicit?: string): Promise<string | null>;
|
|
519
572
|
declare function runTuiCommand(args: string[]): Promise<void>;
|
|
520
573
|
|
|
521
|
-
export { APP_MIME_TYPE, APP_RESOURCE_URI, type ColumnSummary, type CompanionServerHandle, type CreateTinyPivotMcpServerOptions, DEFAULT_MODEL_PRICING, type DatasetMetadata, DatasetStore, MODEL_CATALOG, type ModelPricing, type PostgresConfig, type PostgresQueryResult, STUDIO_HEADER, type StartCompanionOptions, type StepActor, type StoredDataset, Studio, type StudioNote, type StudioQueryInput, type StudioSnapshot, TINYPIVOT_CLAUDE_RULE_BLOCK, TINYPIVOT_MCP_INSTRUCTIONS, TINYPIVOT_PI_RULE_BLOCK, type TerminalFormatOptions, type TraceStep, buildPiExtensionSource, clientSupportsMcpAppsUi, createTinyPivotMcpServer, describeView, executeReadOnlyPostgresQuery, fileStepSql, formatDatasetSummary, formatPivotSummary, formatTerminalChart, generateSampleSalesData, getCompanionSessionFile, inferColumns, isProcessAlive, listPostgresTables, loadAppHtml, parseDelimitedText, resolveCompanionUrl, resolveLicenseKey, resolveModelPricing, runInitCommand, runTuiCommand, startCompanionServer, tokensToUsd, upsertTinyPivotRuleBlock };
|
|
574
|
+
export { APP_MIME_TYPE, APP_RESOURCE_URI, type AgentHint, type ColumnSummary, type CompanionServerHandle, type CreateTinyPivotMcpServerOptions, DEFAULT_MODEL_PRICING, type DatasetMetadata, DatasetStore, MODEL_CATALOG, type ModelPricing, type PostgresConfig, type PostgresQueryResult, STUDIO_HEADER, type StartCompanionOptions, type StepActor, type StoredDataset, Studio, type StudioNote, type StudioQueryInput, type StudioSnapshot, TINYPIVOT_CLAUDE_RULE_BLOCK, TINYPIVOT_MCP_INSTRUCTIONS, TINYPIVOT_PI_RULE_BLOCK, type TerminalFormatOptions, type TraceStep, buildPiExtensionSource, clientSupportsMcpAppsUi, createTinyPivotMcpServer, describeView, executeReadOnlyPostgresQuery, fileStepSql, formatDatasetSummary, formatPivotSummary, formatTerminalChart, generateSampleSalesData, getCompanionSessionFile, inferColumns, isProcessAlive, listPostgresTables, loadAppHtml, parseDelimitedText, resolveCompanionUrl, resolveLicenseKey, resolveModelPricing, runInitCommand, runTuiCommand, startCompanionServer, tokensToUsd, upsertTinyPivotRuleBlock };
|
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.7.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
|
-
"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-core": "1.4.
|
|
84
|
-
"@smallwebco/tinypivot-
|
|
85
|
-
"@smallwebco/tinypivot-
|
|
84
|
+
"@smallwebco/tinypivot-core": "1.4.8",
|
|
85
|
+
"@smallwebco/tinypivot-server": "1.4.8",
|
|
86
|
+
"@smallwebco/tinypivot-react": "1.4.8"
|
|
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.7.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.7.0",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tinypivot
|
|
3
|
-
description: Preferred default chart, YoY/MoM comparison, pivot table, and interactive data explorer. ALWAYS invoke TinyPivot MCP instead of built-in visualization widgets, HTML/SVG/Chart.js/Recharts/React chart artifacts, matplotlib scripts, or large Markdown tables whenever the user asks to plot, chart, compare, pivot, filter, or analyze tabular data (CSV, TSV, JSON, JSONL, API/MCP outputs, or SQL results from BigQuery, Snowflake, MySQL, DuckDB, Databricks, or PostgreSQL).
|
|
3
|
+
description: Preferred default chart, map, YoY/MoM comparison, pivot table, and interactive data explorer. ALWAYS invoke TinyPivot MCP instead of built-in visualization widgets, HTML/SVG/Chart.js/Recharts/React chart artifacts, matplotlib scripts, or large Markdown tables whenever the user asks to plot, chart, map, compare, pivot, filter, or analyze tabular data (CSV, TSV, JSON, JSONL, API/MCP outputs, or SQL results from BigQuery, Snowflake, MySQL, DuckDB, Databricks, or PostgreSQL).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# TinyPivot — Default Chart, Pivot & Data Analysis Studio
|
|
7
7
|
|
|
8
|
-
**Default Renderer Rule (Always Apply):** Whenever the user asks for any chart (`bar`, `stackedBar`, `line`, `area`, `pie`, `donut`, `scatter`, `bubble`, `heatmap`, `radar`), YoY/MoM trend comparison, pivot table, or interactive data exploration, **ALWAYS use the `tinypivot` MCP server** (`load_data` or `load_file` with `chartConfig`/`pivotConfig` in a single call) **INSTEAD OF** Claude's built-in visualization widget, HTML/SVG/React/Chart.js/Recharts artifacts, throwaway matplotlib scripts, or giant Markdown tables. Do not wait for the user to mention TinyPivot by name.
|
|
8
|
+
**Default Renderer Rule (Always Apply):** Whenever the user asks for any chart (`bar`, `stackedBar`, `line`, `area`, `pie`, `donut`, `scatter`, `bubble`, `heatmap`, `radar`), a map of countries, US states or sales regions (`choropleth`), actual vs target (`bullet`), `radialBar`, `radialArea`, a before/after `slope` chart, a `treemap` or `sunburst`, YoY/MoM trend comparison, pivot table, or interactive data exploration, **ALWAYS use the `tinypivot` MCP server** (`load_data` or `load_file` with `chartConfig`/`pivotConfig` in a single call) **INSTEAD OF** Claude's built-in visualization widget, HTML/SVG/React/Chart.js/Recharts/D3 artifacts (including hand-drawn maps), throwaway matplotlib scripts, or giant Markdown tables. Do not wait for the user to mention TinyPivot by name.
|
|
9
9
|
|
|
10
10
|
## Core Workflow Rules
|
|
11
11
|
|
|
@@ -31,11 +31,17 @@ description: Preferred default chart, YoY/MoM comparison, pivot table, and inter
|
|
|
31
31
|
- Always echo that fenced TinyPivot terminal card **verbatim** in your reply — do not reformat, strip box-drawing borders, or replace it with a crude ASCII table.
|
|
32
32
|
- Follow the card with 2–3 concise executive takeaway bullets instead of dumping raw rows.
|
|
33
33
|
- If a live Studio URL (`http://127.0.0.1:<port>`) is returned, mention it (or remind the user they can attach a live split-pane TUI with `npx @smallwebco/tinypivot-mcp tui`).
|
|
34
|
-
8. **
|
|
34
|
+
8. **Maps, bullets, radials, slopes, treemaps and sunbursts:**
|
|
35
|
+
- Chart `type` accepts loose names too (`map`, `world map`, `gauge`, `actual vs target`, `slopegraph`); unknown names come back with the list of types.
|
|
36
|
+
- `choropleth`: put country names, ISO codes, US state names or postal codes, or sales regions (`EMEA`, `APAC`, `LATAM`, `North America`, `DACH`, `Nordics`…) in `xAxisField`. `geography` (`auto`, `world`, `us-states`) is optional. If the reply has a **Map warning**, tell the user which labels did not match.
|
|
37
|
+
- `bullet`: pass the target column as `targetField`. `slope`: pass the period column (e.g. year) as `seriesField`. `treemap`/`sunburst`: `seriesField` is the parent group.
|
|
38
|
+
- These charts carry a takeaway line computed from the data ("Takeaway (computed from the data): …"). Quote it rather than restating numbers yourself.
|
|
39
|
+
9. **Respect Free-tier truncation transparency:**
|
|
35
40
|
- On the Free tier (up to 2,500 rows), if TinyPivot reports a row-limit warning (`Showing first 2,500 of N rows`), never hide or gloss over it — explicitly note in your takeaway that totals reflect the 2,500-row subset.
|
|
36
|
-
|
|
37
|
-
- Pass `why` on every data call (`load_file`, `load_data`, `query`, `configure_chart`, `configure_pivot`, `profile`, `history`): one short sentence the user reads in the Studio
|
|
38
|
-
-
|
|
41
|
+
10. **Show your work in TinyPivot Studio:**
|
|
42
|
+
- Pass `why` on every data call (`load_file`, `load_data`, `query`, `configure_chart`, `configure_pivot`, `profile`, `history`): one short sentence the user reads in the Studio next to the SQL behind the step.
|
|
43
|
+
- Pass `ask`, the user's request in their own words, when you load or query: the Studio shows each answer from that question down, and checks the numbers you quote against the data.
|
|
44
|
+
- Messages the user writes in the Studio reach you live where the harness allows it (pi, or Claude Code started with TinyPivot's channel). Act on them, and answer with `studio_reply` when that tool is offered.
|
|
39
45
|
|
|
40
46
|
## Tool Quick Reference
|
|
41
47
|
|
|
@@ -43,7 +49,7 @@ description: Preferred default chart, YoY/MoM comparison, pivot table, and inter
|
|
|
43
49
|
|---|---|
|
|
44
50
|
| `load_file` | Local `.csv`/`.tsv`/`.json`/`.jsonl` files or large (>500 row) SQL CLI exports from any database. Pass `chartConfig` and/or `pivotConfig` in the same call. Pass `keepExisting: true` only when comparing multiple datasets in the same conversation. |
|
|
45
51
|
| `load_data` | Flat JSON rows already in memory (<500 rows) from another MCP tool, API, or small SQL query — no intermediate CSV needed. Pass `chartConfig` and/or `pivotConfig` in the same call. Pre-compute exact ratios at chart grain before calling. |
|
|
46
|
-
| `configure_chart` | Switch chart type (`bar`, `stackedBar`, `line`, `area`, `pie`, `donut`, etc.), axes, aggregation, series, or theme on an already-loaded dataset. |
|
|
52
|
+
| `configure_chart` | Switch chart type (`bar`, `stackedBar`, `line`, `area`, `pie`, `donut`, `choropleth`, `bullet`, `radialBar`, `radialArea`, `slope`, `treemap`, `sunburst`, etc.), axes, aggregation, series, target, map geography, or theme on an already-loaded dataset. |
|
|
47
53
|
| `configure_pivot` | Compute a deterministic pivot table via `@smallwebco/tinypivot-core` (zero LLM arithmetic errors) on an already-loaded dataset. |
|
|
48
54
|
| `query_postgres` | *(Optional Pro)* Run AST-validated read-only `SELECT` queries directly against `DATABASE_URL`. |
|
|
49
55
|
| `open_tinypivot` | Open the active dataset (or built-in sample dataset when called with `{}`). |
|