@alaarab/ogrid-mcp 2.15.3 → 2.17.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.
@@ -28,8 +28,8 @@ A pagination UI component that displays page navigation buttons, current page in
28
28
  | `pageSize` | `number` | **Required** | Number of items per page. |
29
29
  | `totalCount` | `number` | **Required** | Total number of items across all pages. |
30
30
  | `onPageChange` | `(page: number) => void` | **Required** | Callback when user navigates to a different page. |
31
- | `onPageSizeChange` | `(pageSize: number) => void` | **Required** | Callback when user changes the page size. |
32
- | `pageSizeOptions` | `number[]` | `[10, 20, 50, 100]` | Available page size options in the dropdown. |
31
+ | `onPageSizeChange` | `(pageSize: number \| 'all') => void` | **Required** | Callback when user changes the page size. |
32
+ | `pageSizeOptions` | `(number \| 'all')[]` | `[10, 20, 50, 100]` | Available page size options in the dropdown. `'all'` renders as "All" and shows every row on one page. |
33
33
  | `entityLabelPlural` | `string` | `'rows'` | Plural label for items (e.g., `'products'`, `'users'`). |
34
34
  | `className` | `string` | `undefined` | Additional CSS class for the root element. |
35
35
 
@@ -49,9 +49,9 @@ Complete reference for `IOGridProps<T>`, the props accepted by the `OGrid` compo
49
49
  | `page` | `number` | `undefined` | Controlled current page (1-based). |
50
50
  | `pageSize` | `number` | `undefined` | Controlled page size. |
51
51
  | `onPageChange` | `(page: number) => void` | `undefined` | Callback fired when the user navigates to a different page. |
52
- | `onPageSizeChange` | `(size: number) => void` | `undefined` | Callback fired when the user changes the page size. |
53
- | `defaultPageSize` | `number` | `25` | Initial page size in uncontrolled mode. |
54
- | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Options shown in the page size dropdown. The active page size is auto-inserted if missing. |
52
+ | `onPageSizeChange` | `(size: number \| 'all') => void` | `undefined` | Callback fired when the user changes the page size. |
53
+ | `defaultPageSize` | `number \| 'all'` | `25` | Initial page size in uncontrolled mode. `'all'` shows every row on one page. |
54
+ | `pageSizeOptions` | `(number \| 'all')[]` | `[10, 25, 50, 100]` | Options shown in the page size dropdown. Include `'all'` to offer an "All" entry that shows every filtered row on one page. The active page size is auto-inserted if missing. |
55
55
 
56
56
  ## Column Visibility and Order
57
57
 
@@ -126,12 +126,12 @@ function App() {
126
126
 
127
127
  | Prop | Type | Default | Description |
128
128
  |------|------|---------|-------------|
129
- | `defaultPageSize` | `number` | `25` | Initial page size (uncontrolled mode). |
130
- | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Options shown in the page size dropdown. If the active page size isn't in the list, it's auto-inserted. |
129
+ | `defaultPageSize` | `number \| 'all'` | `25` | Initial page size (uncontrolled mode). `'all'` shows every row on one page. |
130
+ | `pageSizeOptions` | `(number \| 'all')[]` | `[10, 25, 50, 100]` | Options shown in the page size dropdown. Include `'all'` for an "All" entry that shows every filtered row on one page (e.g. `[50, 250, 500, 'all']`). If the active page size isn't in the list, it's auto-inserted. |
131
131
  | `page` | `number` | -- | Current page number (controlled mode, 1-indexed). |
132
- | `pageSize` | `number` | -- | Rows per page (controlled mode). |
132
+ | `pageSize` | `number \| 'all'` | -- | Rows per page (controlled mode). |
133
133
  | `onPageChange` | `(page: number) => void` | -- | Called when page changes. |
134
- | `onPageSizeChange` | `(size: number) => void` | -- | Called when page size changes. |
134
+ | `onPageSizeChange` | `(size: number \| 'all') => void` | -- | Called when page size changes. |
135
135
  | `entityLabelPlural` | `string` | `'items'` | Label used in the row count summary (e.g., "Showing 1-25 of 100 **projects**"). |
136
136
 
137
137
  ## Related
@@ -25,18 +25,18 @@
25
25
  *
26
26
  * This module contains NO Node.js-specific imports - safe to bundle in browsers.
27
27
  */
28
- interface BridgeColumnInfo {
28
+ export interface BridgeColumnInfo {
29
29
  columnId: string;
30
30
  headerName?: string;
31
31
  type?: string;
32
32
  }
33
- interface BridgeCommand {
33
+ export interface BridgeCommand {
34
34
  id: string;
35
35
  type: 'update_cell' | 'set_filter' | 'clear_filters' | 'set_sort' | 'go_to_page';
36
36
  payload: Record<string, unknown>;
37
37
  }
38
38
  /** Minimal subset of IOGridApi used by the bridge. */
39
- interface BridgeGridApi {
39
+ export interface BridgeGridApi {
40
40
  updateSort?: (model: Array<{
41
41
  columnId: string;
42
42
  direction: 'asc' | 'desc';
@@ -46,7 +46,7 @@ interface BridgeGridApi {
46
46
  goToPage?: (page: number) => void;
47
47
  getSelectedRows?: () => unknown[];
48
48
  }
49
- interface ConnectGridOptions {
49
+ export interface ConnectGridOptions {
50
50
  /** Unique identifier for this grid instance (shown in list_grids). */
51
51
  gridId: string;
52
52
  /** Returns the currently displayed rows. Called on every state push. */
@@ -76,12 +76,10 @@ interface ConnectGridOptions {
76
76
  /** How often to push state and poll commands (ms, default: 500). */
77
77
  pollIntervalMs?: number;
78
78
  }
79
- interface BridgeConnection {
79
+ export interface BridgeConnection {
80
80
  /** Stop polling and disconnect. */
81
81
  disconnect: () => void;
82
82
  /** Manually push current state immediately. */
83
83
  push: () => Promise<void>;
84
84
  }
85
- declare function connectGridToBridge(options: ConnectGridOptions): BridgeConnection;
86
-
87
- export { type BridgeColumnInfo, type BridgeCommand, type BridgeConnection, type BridgeGridApi, type ConnectGridOptions, connectGridToBridge };
85
+ export declare function connectGridToBridge(options: ConnectGridOptions): BridgeConnection;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * OGrid Live Testing Bridge
3
+ *
4
+ * An HTTP server (default port 7890) that running OGrid instances connect to.
5
+ * The MCP server holds a BridgeStore in-process and queries it directly when
6
+ * tools like list_grids / get_grid_state / send_grid_command are invoked.
7
+ *
8
+ * Protocol (used by bridge-client.ts in the browser):
9
+ * POST /grids/connect - register / heartbeat
10
+ * PUT /grids/:id/state - push current grid state
11
+ * GET /grids/:id/commands - poll for pending commands
12
+ * POST /grids/:id/commands/:cmdId/result - post command result
13
+ *
14
+ * Internal (used by MCP tools via BridgeStore directly):
15
+ * bridgeStore.listGrids()
16
+ * bridgeStore.getState(gridId)
17
+ * bridgeStore.enqueueCommand(gridId, cmd)
18
+ * bridgeStore.waitForResult(cmdId, timeoutMs)
19
+ */
20
+ export interface GridColumnInfo {
21
+ columnId: string;
22
+ headerName?: string;
23
+ type?: string;
24
+ }
25
+ export interface GridStateSnapshot {
26
+ gridId: string;
27
+ connectedAt: number;
28
+ lastSeen: number;
29
+ rowCount: number;
30
+ totalCount: number;
31
+ page: number;
32
+ pageSize: number;
33
+ pageCount: number;
34
+ data: unknown[];
35
+ columns: GridColumnInfo[];
36
+ sortModel: Array<{
37
+ columnId: string;
38
+ direction: 'asc' | 'desc';
39
+ }>;
40
+ filterModel: Record<string, unknown>;
41
+ selectedRowIndices: number[];
42
+ }
43
+ export type GridCommandType = 'update_cell' | 'set_filter' | 'clear_filters' | 'set_sort' | 'go_to_page';
44
+ export interface GridCommand {
45
+ id: string;
46
+ type: GridCommandType;
47
+ payload: Record<string, unknown>;
48
+ createdAt: number;
49
+ status: 'pending' | 'completed' | 'error';
50
+ result?: unknown;
51
+ error?: string;
52
+ }
53
+ export declare class BridgeStore {
54
+ private readonly grids;
55
+ private readonly commandQueues;
56
+ private readonly commandResults;
57
+ private cmdSeq;
58
+ upsertGrid(gridId: string, partial: Partial<GridStateSnapshot>): void;
59
+ popPendingCommands(gridId: string): GridCommand[];
60
+ resolveCommand(cmdId: string, result: unknown, error?: string): void;
61
+ listGrids(): GridStateSnapshot[];
62
+ getState(gridId: string): GridStateSnapshot | undefined;
63
+ enqueueCommand(gridId: string, type: GridCommandType, payload: Record<string, unknown>): GridCommand | null;
64
+ waitForResult(cmdId: string, timeoutMs?: number): Promise<GridCommand>;
65
+ }
66
+ export declare function startBridgeServer(store: BridgeStore, port?: number): Promise<() => Promise<void>>;
@@ -0,0 +1,24 @@
1
+ export interface CodeBlock {
2
+ language: string;
3
+ code: string;
4
+ framework?: string;
5
+ }
6
+ export interface DocEntry {
7
+ path: string;
8
+ title: string;
9
+ description: string;
10
+ category: string;
11
+ content: string;
12
+ codeBlocks: CodeBlock[];
13
+ }
14
+ export interface DocsIndex {
15
+ entries: DocEntry[];
16
+ search(query: string, limit?: number): DocEntry[];
17
+ getByPath(path: string): DocEntry | undefined;
18
+ getByCategory(category: string): DocEntry[];
19
+ getCodeExamples(query: string, framework?: string): Array<{
20
+ entry: DocEntry;
21
+ block: CodeBlock;
22
+ }>;
23
+ }
24
+ export declare function loadDocsIndex(docsDir: string): DocsIndex;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { DocsIndex } from './docsLoader.js';
3
+ import type { BridgeStore } from './bridge.js';
4
+ export declare function createOGridMcpServer(index: DocsIndex, bridge?: BridgeStore): McpServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-mcp",
3
- "version": "2.15.3",
3
+ "version": "2.17.0",
4
4
  "description": "MCP server for OGrid documentation",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,18 +28,18 @@
28
28
  ],
29
29
  "scripts": {
30
30
  "prebuild": "node scripts/bundle-docs.mjs",
31
- "build": "tsup",
31
+ "build": "tsup && tsc -p tsconfig.json --emitDeclarationOnly --outDir dist/esm",
32
32
  "dev": "tsup --watch",
33
33
  "typecheck": "tsc -p tsconfig.json --noEmit",
34
34
  "test": "bun test --preload ../../bun-test.setup.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@modelcontextprotocol/sdk": "^1.29.0",
38
- "zod": "^4.4.3"
37
+ "@modelcontextprotocol/sdk": "^1.30.0",
38
+ "zod": "^4.5.4"
39
39
  },
40
40
  "devDependencies": {
41
41
  "tsup": "^8.5.1",
42
- "typescript": "^6.0.3"
42
+ "typescript": "^7.0.2"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=18"