@kanunilabs/mcp 0.0.0-stage → 1.0.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/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@kanunilabs/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "MCP server that gives AI coding assistants the KanuniLabs DataGrid and PivotGrid documentation and API reference. Runs locally over stdio; the docs ship inside the package, nothing is fetched.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "author": "KanuniLabs <hello@kanunilabs.com> (https://www.kanunilabs.com)",
7
+ "homepage": "https://kanunilabs.com/docs/datagrid/ai-assistants",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kanunilabsdev/support.git"
11
+ },
12
+ "bugs": {
13
+ "email": "hello@kanunilabs.com",
14
+ "url": "https://github.com/kanunilabsdev/support/issues"
15
+ },
16
+ "type": "module",
17
+ "bin": {
18
+ "kanunilabs-mcp": "./dist/cli.js"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "data",
23
+ "skill",
24
+ "LICENSE"
25
+ ],
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "devDependencies": {
33
+ "@modelcontextprotocol/sdk": "1.30.1",
34
+ "zod": "4.6.5"
35
+ },
36
+ "keywords": [
37
+ "mcp",
38
+ "model-context-protocol",
39
+ "ai",
40
+ "datagrid",
41
+ "pivotgrid",
42
+ "documentation",
43
+ "kanunilabs"
44
+ ],
45
+ "scripts": {
46
+ "build": "tsup",
47
+ "corpus": "node scripts/build-corpus.mjs",
48
+ "lint": "tsc --noEmit",
49
+ "build:check": "tsc --noEmit",
50
+ "test": "vitest run"
51
+ }
6
52
  }
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: kanunilabs-grids
3
+ description: Use when writing or changing code that uses the KanuniLabs DataGrid or PivotGrid (any @kanunilabs/* package) — choosing the package, installing it, setting props and options, the Enterprise licence key, the Web Worker and Content-Security-Policy, Next.js, and upgrading between versions.
4
+ ---
5
+
6
+ # KanuniLabs DataGrid and PivotGrid
7
+
8
+ Two data components for React and for plain JavaScript. Sorting, filtering and
9
+ aggregation run in a Web Worker that is compiled into the package.
10
+
11
+ ## Look names up, do not guess them
12
+
13
+ A prop or option name that looks right but does not exist does nothing at
14
+ runtime and raises no error (TypeScript catches some, not untyped objects).
15
+ Before you write one, check it:
16
+
17
+ - With the `kanunilabs` MCP server connected (`npx -y @kanunilabs/mcp`): call
18
+ `get_api` with `Symbol` or `Symbol.member` (`DataGridProps.columns`,
19
+ `PivotLayoutState.showColumnTotals`), `search_docs` for a question in words,
20
+ `get_doc` to read a guide, `get_changes` before an upgrade.
21
+ - Without it: https://www.kanunilabs.com/llms.txt (index) and
22
+ https://www.kanunilabs.com/llms-full.txt (every guide in one file); the API
23
+ reference is at `/docs/datagrid/api` and `/docs/pivotgrid/api`.
24
+
25
+ ## Pick the package
26
+
27
+ | Need | DataGrid | PivotGrid |
28
+ |---|---|---|
29
+ | React, free | `@kanunilabs/datagrid-react` | `@kanunilabs/pivotgrid-react` |
30
+ | Plain JavaScript, free | `@kanunilabs/datagrid` (`createGrid()`) | `@kanunilabs/pivotgrid` (`createPivotGrid()`) |
31
+ | React, paid | `@kanunilabs/datagrid-react-enterprise` | `@kanunilabs/pivotgrid-react-enterprise` |
32
+ | Plain JavaScript, paid | `@kanunilabs/datagrid-enterprise` (`createEnterpriseGrid()`) | `@kanunilabs/pivotgrid-enterprise` (`createEnterprisePivotGrid()`) |
33
+
34
+ - The free (Community) packages are on public npm and need no key. A
35
+ renderer pulls in its core (`…-core`); there is no need to install it.
36
+ - The paid (Enterprise) packages are NOT on public npm. They install from
37
+ `https://registry.kanunilabs.com/` with the `.npmrc` the buyer receives. Do
38
+ not tell someone without a licence to `npm i` one; it will fail.
39
+ - When you use an Enterprise feature, say that it needs the paid package. The
40
+ Enterprise component takes the place of the free one: `EnterpriseDataGrid`
41
+ for `DataGrid` (same props, plus its own), `EnterprisePivotGrid` for
42
+ `BasePivotGrid`.
43
+ - One licence key covers both products.
44
+
45
+ ## Minimal setup
46
+
47
+ DataGrid (React):
48
+
49
+ ```tsx
50
+ import { DataGrid, type ReactGridColumnDef } from '@kanunilabs/datagrid-react';
51
+ import '@kanunilabs/datagrid-react/styles.css';
52
+
53
+ const columns: ReactGridColumnDef<Sale>[] = [
54
+ { field: 'id', headerName: 'ID', dataType: 'number', width: 80 },
55
+ { field: 'product', headerName: 'Product' },
56
+ { field: 'revenue', headerName: 'Revenue', dataType: 'number' },
57
+ ];
58
+
59
+ <DataGrid gridId="sales" dataSource={rows} rowKey="id" columns={columns} style={{ height: 600 }} />;
60
+ ```
61
+
62
+ - `rowKey` is required: selection and focus follow row identity.
63
+ - Give the grid a height (as above); rows are virtualized inside it.
64
+
65
+ PivotGrid (React):
66
+
67
+ ```tsx
68
+ import { BasePivotGrid, type PivotField } from '@kanunilabs/pivotgrid-react';
69
+ import '@kanunilabs/pivotgrid-react/styles.css';
70
+
71
+ const fields: PivotField<Row>[] = [
72
+ { id: 'region', dataField: 'region', caption: 'Region', dataType: 'string', area: 'row' },
73
+ { id: 'quarter', dataField: 'quarter', caption: 'Quarter', dataType: 'string', area: 'column' },
74
+ { id: 'revenue', dataField: 'revenue', caption: 'Revenue', dataType: 'number', area: 'data', summaryType: 'sum' },
75
+ ];
76
+
77
+ <BasePivotGrid gridId="sales" data={rows} initialFields={fields} />;
78
+ ```
79
+
80
+ - `area` is `'row' | 'column' | 'data' | 'filter'`; measures need a `summaryType`.
81
+ - The grid fills its container. Give the container a height for a grid that
82
+ scrolls inside; without one it is as tall as its content.
83
+ - The React package has peer dependencies `@dnd-kit/core`, `lucide-react` and
84
+ `zustand` (npm 7+ installs them).
85
+
86
+ Import each stylesheet once, near the app root. With an Enterprise package,
87
+ import its stylesheet too, after the free one:
88
+
89
+ ```ts
90
+ import '@kanunilabs/datagrid-react/styles.css';
91
+ import '@kanunilabs/datagrid-react-enterprise/styles.css';
92
+ ```
93
+
94
+ ## Licence key (Enterprise only)
95
+
96
+ Set it once at startup, before the first grid renders (React):
97
+
98
+ ```tsx
99
+ import { LicenseManager } from '@kanunilabs/datagrid-react-enterprise';
100
+ // or from '@kanunilabs/pivotgrid-react-enterprise'
101
+ LicenseManager.setLicenseKey(key); // keys start with "KLAB1."
102
+ ```
103
+
104
+ - Never put a real key in code you show or commit. Read it from the app's
105
+ configuration.
106
+ - Without a valid key the grid still works and shows a watermark badge saying
107
+ why. Do not treat the badge as a crash.
108
+ - `localhost` still needs the key; only the domain check is skipped there.
109
+ - To react to the licence state in code, read `reasonCode` (from
110
+ `useLicenseGuard()`, exported by both React Enterprise packages) rather than
111
+ parsing the `reason` text.
112
+
113
+ ## Worker and Content-Security-Policy
114
+
115
+ Nothing to configure: the worker starts from a `blob:` URL in every bundler
116
+ (Vite, webpack, Next.js, Parcel). Do not add a copy-the-worker step.
117
+
118
+ Only under a Content-Security-Policy, allow it with
119
+ `worker-src 'self' blob:`. If the policy cannot change, serve the worker file
120
+ from the app's own origin (PivotGrid first tries the packaged file by itself):
121
+
122
+ - DataGrid: `node_modules/@kanunilabs/datagrid-core/dist/datagrid.worker.js`,
123
+ passed as `worker={{ url: '/datagrid.worker.js' }}`.
124
+ - PivotGrid: `node_modules/@kanunilabs/pivotgrid-core/dist/pivot.worker.js`,
125
+ passed as `workerUrl="/pivot.worker.js"`.
126
+
127
+ A copied worker must be copied again on every upgrade (a `postinstall` script
128
+ does it). With Vite, import it as `…/dist/datagrid.worker.js?url` instead.
129
+
130
+ ## Next.js
131
+
132
+ - DataGrid renders on the server and hydrates: mark the file that renders it
133
+ `'use client'`; no `ssr: false` needed.
134
+ - PivotGrid renders on the client only: load the component that renders it
135
+ with `dynamic(() => import('./MyGrid'), { ssr: false })` from a
136
+ `'use client'` file.
137
+
138
+ ## Export
139
+
140
+ - DataGrid: CSV export is free and needs nothing. Excel and PDF export are
141
+ Enterprise; `.xlsx` also needs the optional peer `exceljs` (`npm i exceljs`),
142
+ loaded only when an export runs.
143
+ - PivotGrid: `excel-list`, `excel-pivot` and `pdf` need the Enterprise
144
+ package; CSV, JSON, XML, print and clipboard are free.
145
+
146
+ ## Upgrading
147
+
148
+ - Upgrade every `@kanunilabs/<product>*` package the app lists in one command,
149
+ to the versions of one release. The Enterprise packages pin an exact
150
+ version of the free ones; a package left behind installs a second copy of
151
+ the engine, and a licence key set through one copy is not seen by the other.
152
+ Check with `npm ls @kanunilabs/datagrid-core` (or `pivotgrid-core`): one
153
+ version is right.
154
+ - Read what each version asks of an app before upgrading: the `get_changes`
155
+ tool, or `/docs/datagrid/upgrading` and `/docs/pivotgrid/upgrading`.