@cplace/mcp-server 1.9.0 → 1.9.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"low-code.d.ts","sourceRoot":"","sources":["../../src/plugins/low-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAkBpD,eAAO,MAAM,aAAa,EAAE,SAiB3B,CAAC"}
1
+ {"version":3,"file":"low-code.d.ts","sourceRoot":"","sources":["../../src/plugins/low-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAmBpD,eAAO,MAAM,aAAa,EAAE,SAkB3B,CAAC"}
@@ -9,6 +9,7 @@ import { registerLintingTools, LINTING_TOOL_DEFINITIONS } from '../tools/linting
9
9
  import { registerJobScriptsTools, JOB_SCRIPTS_TOOL_DEFINITIONS } from '../tools/job-scripts.js';
10
10
  import { registerJobScheduleTriggerTools, JOB_SCHEDULE_TRIGGER_TOOL_DEFINITIONS } from '../tools/job-schedule-trigger.js';
11
11
  import { registerWorkflowExecutionTools, WORKFLOW_EXECUTION_TOOL_DEFINITIONS } from '../tools/workflow-execution.js';
12
+ import { registerWidgetSimulationTools, WIDGET_SIMULATION_TOOL_DEFINITIONS } from '../tools/widget-simulation.js';
12
13
  import { fileURLToPath } from 'url';
13
14
  import { dirname } from 'path';
14
15
  const __filename = fileURLToPath(import.meta.url);
@@ -29,6 +30,7 @@ export const lowCodePlugin = {
29
30
  'job-scripts': { register: registerJobScriptsTools, toolDefinitions: JOB_SCRIPTS_TOOL_DEFINITIONS },
30
31
  'job-schedule-trigger': { register: registerJobScheduleTriggerTools, toolDefinitions: JOB_SCHEDULE_TRIGGER_TOOL_DEFINITIONS },
31
32
  'workflow-execution': { register: registerWorkflowExecutionTools, toolDefinitions: WORKFLOW_EXECUTION_TOOL_DEFINITIONS },
33
+ 'widget-simulation': { register: registerWidgetSimulationTools, toolDefinitions: WIDGET_SIMULATION_TOOL_DEFINITIONS },
32
34
  }
33
35
  };
34
36
  //# sourceMappingURL=low-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"low-code.js","sourceRoot":"","sources":["../../src/plugins/low-code.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,+BAA+B,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AAC1H,OAAO,EAAE,8BAA8B,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,UAAU;IAChB,OAA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QACzH,aAAa,EAAW,EAAE,QAAQ,EAAE,uBAAuB,EAAW,eAAe,EAAE,4BAA4B,EAAE;QACrH,QAAQ,EAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAe,eAAe,EAAE,uBAAuB,EAAE;QAChH,SAAS,EAAe,EAAE,QAAQ,EAAE,oBAAoB,EAAc,eAAe,EAAE,wBAAwB,EAAE;QACjH,aAAa,EAAW,EAAE,QAAQ,EAAE,uBAAuB,EAAW,eAAe,EAAE,4BAA4B,EAAE;QACrH,sBAAsB,EAAE,EAAE,QAAQ,EAAE,+BAA+B,EAAG,eAAe,EAAE,qCAAqC,EAAE;QAC9H,oBAAoB,EAAI,EAAE,QAAQ,EAAE,8BAA8B,EAAG,eAAe,EAAE,mCAAmC,EAAE;QAC3H,mBAAmB,EAAI,EAAE,QAAQ,EAAE,6BAA6B,EAAI,eAAe,EAAE,kCAAkC,EAAE;KAC1H;CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { CplaceApiClient } from '../api.js';
4
+ export declare const WIDGET_SIMULATION_TOOL_DEFINITIONS: {
5
+ readonly cplace_simulate_widget_script: {
6
+ readonly description: "Execute a widget script with real widget-runtime bindings for simulation.\n\nUnlike cplace_execute_script which runs scripts with only baseline bindings, this tool injects\nthe same bindings that the real widget runtime provides — most importantly `pages` as a\nSafeLazyIterable (not a plain Array). This catches binding-shape bugs (e.g., using .length or\nindex access on pages) that would otherwise only surface at widget render time.\n\n**Mode**: Read-only — matches real widget runtime (widgets cannot modify data)\n**Timeout**: 30 seconds maximum execution time\n\n**Injected Bindings** (beyond baseline cplace/Search/Filters):\n- `pages` — SafeLazyIterable<WrappedPage> from the search specified by typeName/workspaceId\n- `embeddingPage` — WrappedPage (if embeddingPageUid provided)\n\n**Return Value Restrictions**: Same as cplace_execute_script (primitives, flat arrays/objects only)\n\n**When to use**: For simulating widget scripts (scriptingHighcharts, scriptingLineChart, lowCodeText,\nlowCodeButton, dynamicCodeBlockWidget) before embedding them in layouts. Use cplace_execute_script\nfor non-widget simulation (wizard harnesses, workflow conditions, distribution probes).";
7
+ readonly inputSchema: {
8
+ readonly script: z.ZodString;
9
+ readonly typeName: z.ZodString;
10
+ readonly workspaceId: z.ZodOptional<z.ZodString>;
11
+ readonly embeddingPageUid: z.ZodOptional<z.ZodString>;
12
+ };
13
+ readonly annotations: {
14
+ readonly title: "Simulate Widget Script";
15
+ };
16
+ };
17
+ };
18
+ export declare function registerWidgetSimulationTools(server: McpServer, client: CplaceApiClient): void;
19
+ //# sourceMappingURL=widget-simulation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-simulation.d.ts","sourceRoot":"","sources":["../../src/tools/widget-simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;CAiCrC,CAAC;AAEX,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QA8CvF"}
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ import { debugLogWithTag } from "../logger.js";
3
+ import { checkResponseSize } from "../utils.js";
4
+ import { CPLACEJS_COMMON_API_CHEAT_SHEET } from "./common-schemas.js";
5
+ const TOOL_SIMULATE_WIDGET_SCRIPT = 'cplace_simulate_widget_script';
6
+ export const WIDGET_SIMULATION_TOOL_DEFINITIONS = {
7
+ [TOOL_SIMULATE_WIDGET_SCRIPT]: {
8
+ description: `Execute a widget script with real widget-runtime bindings for simulation.
9
+
10
+ Unlike cplace_execute_script which runs scripts with only baseline bindings, this tool injects
11
+ the same bindings that the real widget runtime provides — most importantly \`pages\` as a
12
+ SafeLazyIterable (not a plain Array). This catches binding-shape bugs (e.g., using .length or
13
+ index access on pages) that would otherwise only surface at widget render time.
14
+
15
+ **Mode**: Read-only — matches real widget runtime (widgets cannot modify data)
16
+ **Timeout**: 30 seconds maximum execution time
17
+
18
+ **Injected Bindings** (beyond baseline cplace/Search/Filters):
19
+ - \`pages\` — SafeLazyIterable<WrappedPage> from the search specified by typeName/workspaceId
20
+ - \`embeddingPage\` — WrappedPage (if embeddingPageUid provided)
21
+
22
+ **Return Value Restrictions**: Same as cplace_execute_script (primitives, flat arrays/objects only)
23
+
24
+ **When to use**: For simulating widget scripts (scriptingHighcharts, scriptingLineChart, lowCodeText,
25
+ lowCodeButton, dynamicCodeBlockWidget) before embedding them in layouts. Use cplace_execute_script
26
+ for non-widget simulation (wizard harnesses, workflow conditions, distribution probes).`,
27
+ inputSchema: {
28
+ script: z.string().describe(`JavaScript code to execute. The script receives \`pages\` as an injected binding
29
+ (SafeLazyIterable, not a plain Array). Iterate with cplace.each(pages, fn) or pages.forEach(fn).
30
+ Do NOT use pages.length, pages[i], or Array.from(pages) — these will fail, matching real widget runtime.
31
+
32
+ Must return a JSON-serializable value.` + CPLACEJS_COMMON_API_CHEAT_SHEET),
33
+ typeName: z.string().describe("Type internal name for the pages search (e.g., 'cf.cplace.project.Task')"),
34
+ workspaceId: z.string().optional().describe("Workspace ID to scope the pages search (optional)"),
35
+ embeddingPageUid: z.string().optional().describe("Page UID to inject as embeddingPage binding (optional)")
36
+ },
37
+ annotations: { title: "Simulate Widget Script" }
38
+ }
39
+ };
40
+ export function registerWidgetSimulationTools(server, client) {
41
+ server.registerTool(TOOL_SIMULATE_WIDGET_SCRIPT, WIDGET_SIMULATION_TOOL_DEFINITIONS[TOOL_SIMULATE_WIDGET_SCRIPT], async ({ script, typeName, workspaceId, embeddingPageUid }) => {
42
+ debugLogWithTag('WIDGET_SIM', `Simulating widget script (${script.length} chars) for type ${typeName}`);
43
+ try {
44
+ const requestBody = { script, typeName };
45
+ if (workspaceId)
46
+ requestBody.workspaceId = workspaceId;
47
+ if (embeddingPageUid)
48
+ requestBody.embeddingPageUid = embeddingPageUid;
49
+ const response = await client.makeApiRequest('json/widget/simulateScript', 'POST', undefined, requestBody);
50
+ const result = { result: response };
51
+ const sizeCheck = checkResponseSize(result);
52
+ if (sizeCheck.tooLarge) {
53
+ debugLogWithTag('WIDGET_SIM', `Response too large: ${sizeCheck.actualSize} characters`);
54
+ return {
55
+ content: [{
56
+ type: "text",
57
+ text: `Widget simulation result too large (${sizeCheck.actualSize} characters). Modify your script to return less data.`
58
+ }],
59
+ isError: true
60
+ };
61
+ }
62
+ debugLogWithTag('WIDGET_SIM', 'Widget script simulated successfully');
63
+ return {
64
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
65
+ };
66
+ }
67
+ catch (error) {
68
+ debugLogWithTag('WIDGET_SIM', `Error: ${error instanceof Error ? error.message : String(error)}`);
69
+ return {
70
+ content: [{ type: "text", text: `Error simulating widget script: ${error instanceof Error ? error.message : String(error)}` }],
71
+ isError: true
72
+ };
73
+ }
74
+ });
75
+ }
76
+ //# sourceMappingURL=widget-simulation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-simulation.js","sourceRoot":"","sources":["../../src/tools/widget-simulation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,2BAA2B,GAAG,+BAA+B,CAAC;AAEpE,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,CAAC,2BAA2B,CAAC,EAAE;QAC7B,WAAW,EAAE;;;;;;;;;;;;;;;;;;wFAkBuE;QACpF,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;;uCAIK,GAAG,+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,OAAO;oBACL,OAAO,EAAE,CAAC;4BACR,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,uCAAuC,SAAS,CAAC,UAAU,uDAAuD;yBACzH,CAAC;oBACF,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,eAAe,CAAC,YAAY,EAAE,sCAAsC,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,CAAC;QAEJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAe,CAAC,YAAY,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClG,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;gBACvI,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplace/mcp-server",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "MCP server that provides Claude Desktop with tools to interact with cplace APIs",
5
5
  "main": "dist/public-api.js",
6
6
  "types": "dist/public-api.d.ts",