@cloudgrid-io/mcp 0.16.0 → 0.16.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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/src/tools.js +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudgrid-io/mcp",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "MCP server for CloudGrid. Three editions: a local stdio server (full toolset), a hosted web server (light, CLI-free toolset), and a public docs server (search_cloudgrid_documentation) over MCP Streamable HTTP.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,8 @@
39
39
  "smoke:docs": "node test/smoke-docs.mjs",
40
40
  "start:docs": "node src/docs.js",
41
41
  "snapshot:corpus": "node scripts/snapshot-corpus.mjs",
42
- "build:mcpb": "node scripts/build-mcpb.mjs"
42
+ "build:mcpb": "node scripts/build-mcpb.mjs",
43
+ "test:widgets": "node test/apps-widgets.test.mjs"
43
44
  },
44
45
  "dependencies": {
45
46
  "@modelcontextprotocol/sdk": "^1.0.0",
package/src/tools.js CHANGED
@@ -45,6 +45,14 @@ const AUTHED_HTML_MAX_BYTES = 25_000_000;
45
45
  const CONSOLE_URL = "https://console.cloudgrid.io/";
46
46
 
47
47
  // ── Widget resources (ChatGPT Apps SDK, web edition only) ────────────────────
48
+ // The Apps-SDK UI widgets (openai/outputTemplate → a ui:// html resource) render
49
+ // as a broken black frame in ChatGPT today, hiding the plain-text result. Gate
50
+ // them behind an env flag, DEFAULT OFF, so the drop/plug result is text-first
51
+ // (the live URL is already the first line of the text content) and the widget is
52
+ // optional. Flip MCP_APPS_WIDGETS=1 in the platform manifest to re-enable once
53
+ // the widget HTML is verified to render. The resources stay registered either
54
+ // way (harmless when no tool references them via outputTemplate).
55
+ const APPS_WIDGETS_ENABLED = process.env.MCP_APPS_WIDGETS === "1";
48
56
  const LIVE_RESULT_URI = "ui://cloudgrid/live-result.html";
49
57
  // URI/resource-name/filename stay `org-picker` — that's the stable contract the
50
58
  // web card is registered under; only the JS identifier moves toward grid.
@@ -753,7 +761,7 @@ export async function resolveGridOrAsk(ctx, { token, suppliedGrid, edition }, de
753
761
  // `needs_grid` is the new field; `needs_org`/`orgs` are kept as aliases
754
762
  // so the existing org-picker.html web widget (reads data.orgs) still works.
755
763
  structured: { needs_grid: true, needs_org: true, grids: annotated, orgs: annotated },
756
- ...(edition === "web" ? { meta: { "openai/outputTemplate": GRID_PICKER_URI } } : {}),
764
+ ...(edition === "web" && APPS_WIDGETS_ENABLED ? { meta: { "openai/outputTemplate": GRID_PICKER_URI } } : {}),
757
765
  },
758
766
  };
759
767
  }
@@ -2531,7 +2539,7 @@ export function registerTools(server, ctx) {
2531
2539
  login_url: z.string().optional().describe("Sign-in URL when authentication is needed."),
2532
2540
  },
2533
2541
  annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
2534
- ...(ctx.edition === "web" ? {
2542
+ ...(ctx.edition === "web" && APPS_WIDGETS_ENABLED ? {
2535
2543
  _meta: {
2536
2544
  ui: { resourceUri: LIVE_RESULT_URI, csp: WIDGET_CSP },
2537
2545
  "openai/outputTemplate": LIVE_RESULT_URI,