@alaarab/ogrid-mcp 2.16.0 → 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.
@@ -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.16.0",
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"