@smallwebco/tinypivot-mcp 0.2.9 → 0.3.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 +6 -1
- package/dist/{chunk-3JPAVTJZ.js → chunk-AFGC2C4J.js} +631 -221
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +89 -2
- package/dist/index.js +1 -1
- package/package.json +3 -2
- package/server.json +2 -2
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DataGridViewMode, PivotConfig, ChartConfig, ChartThemePreset } from '@smallwebco/tinypivot-core';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import * as _duckdb_node_api from '@duckdb/node-api';
|
|
4
|
+
import { DuckDBConnection } from '@duckdb/node-api';
|
|
3
5
|
|
|
4
6
|
interface ModelPricing {
|
|
5
7
|
id: string;
|
|
@@ -147,8 +149,8 @@ interface StartCompanionOptions {
|
|
|
147
149
|
*/
|
|
148
150
|
declare function startCompanionServer(options: StartCompanionOptions): Promise<CompanionServerHandle>;
|
|
149
151
|
|
|
150
|
-
declare const TINYPIVOT_CLAUDE_RULE_BLOCK = "<!-- tinypivot:start -->\n##
|
|
151
|
-
declare const TINYPIVOT_PI_RULE_BLOCK = "<!-- tinypivot:start -->\n##
|
|
152
|
+
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 Data IDE link.\n<!-- tinypivot:end -->";
|
|
153
|
+
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 Data IDE link. `/tinypivot-theme` switches themes.\n<!-- tinypivot:end -->";
|
|
152
154
|
declare function upsertTinyPivotRuleBlock(existing: string, block?: string): string;
|
|
153
155
|
declare function runInitCommand(args: string[]): Promise<void>;
|
|
154
156
|
|
|
@@ -178,6 +180,79 @@ interface PostgresQueryResult {
|
|
|
178
180
|
declare function listPostgresTables(config: PostgresConfig): Promise<string[]>;
|
|
179
181
|
declare function executeReadOnlyPostgresQuery(config: PostgresConfig, sql: string): Promise<PostgresQueryResult>;
|
|
180
182
|
|
|
183
|
+
type DuckDbModule = typeof _duckdb_node_api;
|
|
184
|
+
/** A named table the query can use: an earlier pull, read back from its file. */
|
|
185
|
+
interface QueryView {
|
|
186
|
+
name: string;
|
|
187
|
+
/** A DuckDB table expression, e.g. `'orders.csv'` or `read_json_auto('…jsonl.gz')`. */
|
|
188
|
+
from: string;
|
|
189
|
+
}
|
|
190
|
+
interface QueryResult {
|
|
191
|
+
columns: string[];
|
|
192
|
+
rows: Record<string, unknown>[];
|
|
193
|
+
/** True when the result had more than QUERY_ROW_LIMIT rows and was cut there. */
|
|
194
|
+
truncated: boolean;
|
|
195
|
+
}
|
|
196
|
+
/** One DuckDB connection per server, locked down: no extension downloads, no setting changes. */
|
|
197
|
+
declare class DuckDbRunner {
|
|
198
|
+
private readonly load;
|
|
199
|
+
private connection?;
|
|
200
|
+
private duck?;
|
|
201
|
+
constructor(load?: () => Promise<DuckDbModule>);
|
|
202
|
+
/** Starts loading DuckDB (downloading it if needed) without waiting. */
|
|
203
|
+
prepare(): Promise<DuckDBConnection>;
|
|
204
|
+
run(sql: string, views: QueryView[], maxRows?: number): Promise<QueryResult>;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Every pull a session makes, kept on disk so it can be reopened later without re-querying or
|
|
209
|
+
* re-sending anything to the model. Local only, under the user's data folder.
|
|
210
|
+
*
|
|
211
|
+
* Files are remembered by path and filter, since the file is still there to re-read. Ephemeral
|
|
212
|
+
* pulls (rows passed in, query results, Postgres results) are saved with their rows.
|
|
213
|
+
*/
|
|
214
|
+
type HistoryKind = 'file' | 'data' | 'query' | 'postgres';
|
|
215
|
+
interface HistoryEntry {
|
|
216
|
+
id: string;
|
|
217
|
+
name: string;
|
|
218
|
+
kind: HistoryKind;
|
|
219
|
+
createdAt: string;
|
|
220
|
+
rows: number;
|
|
221
|
+
columns: string[];
|
|
222
|
+
/** File path for `file`, a source label for `data`, the SQL text for `query` and `postgres`. */
|
|
223
|
+
source: string;
|
|
224
|
+
where?: RowFilter[];
|
|
225
|
+
/** Saved rows, gzipped JSON lines, for pulls that cannot be re-read from a file. */
|
|
226
|
+
rowsFile?: string;
|
|
227
|
+
chartConfig?: Partial<ChartConfig>;
|
|
228
|
+
pivotConfig?: Partial<PivotConfig>;
|
|
229
|
+
}
|
|
230
|
+
interface RecordInput {
|
|
231
|
+
kind: HistoryKind;
|
|
232
|
+
source: string;
|
|
233
|
+
where?: RowFilter[];
|
|
234
|
+
}
|
|
235
|
+
declare class HistoryStore {
|
|
236
|
+
readonly dir: string;
|
|
237
|
+
readonly enabled: boolean;
|
|
238
|
+
private readonly retentionDays;
|
|
239
|
+
constructor(options?: {
|
|
240
|
+
dir?: string;
|
|
241
|
+
enabled?: boolean;
|
|
242
|
+
retentionDays?: number;
|
|
243
|
+
});
|
|
244
|
+
/** Saves a pull. Returns the entry, or null when history is off or the write failed. */
|
|
245
|
+
record(dataset: StoredDataset, input: RecordInput, now?: Date): HistoryEntry | null;
|
|
246
|
+
/** Newest first. */
|
|
247
|
+
list(limit?: number): HistoryEntry[];
|
|
248
|
+
get(id: string): HistoryEntry | undefined;
|
|
249
|
+
/** Full path of an entry's saved rows, for reading back or querying with SQL. */
|
|
250
|
+
rowsPath(entry: HistoryEntry): string | undefined;
|
|
251
|
+
readRows(entry: HistoryEntry): Record<string, unknown>[];
|
|
252
|
+
/** Deletes entries older than the retention window. Returns how many were removed. */
|
|
253
|
+
prune(now?: Date): number;
|
|
254
|
+
}
|
|
255
|
+
|
|
181
256
|
declare const APP_RESOURCE_URI = "ui://tinypivot/app.html";
|
|
182
257
|
declare const APP_MIME_TYPE = "text/html;profile=mcp-app";
|
|
183
258
|
declare const TINYPIVOT_MCP_INSTRUCTIONS: string;
|
|
@@ -191,6 +266,16 @@ interface CreateTinyPivotMcpServerOptions {
|
|
|
191
266
|
/** Lazily start and return the localhost Companion IDE URL on demand when a data tool runs in a non-MCP-Apps host */
|
|
192
267
|
ensureCompanion?: () => Promise<string | undefined>;
|
|
193
268
|
onStateChanged?: () => void;
|
|
269
|
+
/**
|
|
270
|
+
* Whether the model should reprint each chart card in a terminal. On by default, because
|
|
271
|
+
* otherwise most terminals hide the card. Off saves ~400 output tokens per question.
|
|
272
|
+
* Defaults to TINYPIVOT_REPRINT_CARDS, which turns it off with "0".
|
|
273
|
+
*/
|
|
274
|
+
reprintCards?: boolean;
|
|
275
|
+
/** Where pulls are saved; defaults to the user's data folder. */
|
|
276
|
+
history?: HistoryStore;
|
|
277
|
+
/** SQL engine for the query tool; defaults to an embedded DuckDB, downloaded on first use. */
|
|
278
|
+
duckdb?: DuckDbRunner;
|
|
194
279
|
}
|
|
195
280
|
declare function clientSupportsMcpAppsUi(capabilities?: {
|
|
196
281
|
extensions?: Record<string, unknown>;
|
|
@@ -213,6 +298,8 @@ interface TerminalFormatOptions {
|
|
|
213
298
|
colorTheme?: ChartThemePreset;
|
|
214
299
|
/** Omit Markdown ```text fences (for direct TTY CLI output) */
|
|
215
300
|
raw?: boolean;
|
|
301
|
+
/** Remind the model, in a terminal, to show the card to the user. Off when cards are not reprinted. */
|
|
302
|
+
reprintNote?: boolean;
|
|
216
303
|
}
|
|
217
304
|
/**
|
|
218
305
|
* Render a screenshot-ready framed Unicode/Braille chart card directly in terminal output
|
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.3.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",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"zod": "^4.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
+
"@duckdb/node-api": "2.0.1-r.1",
|
|
70
71
|
"@modelcontextprotocol/ext-apps": "^1.0.1",
|
|
71
72
|
"@types/node": "^20.19.41",
|
|
72
73
|
"@types/pg": "^8.11.6",
|
|
@@ -79,8 +80,8 @@
|
|
|
79
80
|
"typescript": "~5.6.2",
|
|
80
81
|
"vite": "^6.4.6",
|
|
81
82
|
"vite-plugin-singlefile": "^2.2.0",
|
|
82
|
-
"@smallwebco/tinypivot-core": "1.4.5",
|
|
83
83
|
"@smallwebco/tinypivot-react": "1.4.5",
|
|
84
|
+
"@smallwebco/tinypivot-core": "1.4.5",
|
|
84
85
|
"@smallwebco/tinypivot-server": "1.4.5"
|
|
85
86
|
},
|
|
86
87
|
"scripts": {
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.Small-Web-Co/tinypivot",
|
|
4
4
|
"title": "TinyPivot — Interactive Data IDE 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.3.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.3.0",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|