@ggui-ai/mcp-server 0.6.1 → 0.6.3

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.
@@ -260,7 +260,7 @@ export interface SelfContainedShellInputs {
260
260
  * Build the self-contained shell HTML for a given render.
261
261
  *
262
262
  * The returned HTML is a complete, standalone document: it inlines the
263
- * compiled component (base64) + the render id in a `window.__GGUI_META__`
263
+ * compiled component (base64) + the render id in a `globalThis.__GGUI_META__`
264
264
  * global, then loads the iframe-runtime bundle via `<script type="module"
265
265
  * src={runtimeUrl}>`. The runtime takes over synchronously on import,
266
266
  * mounts the component, and the iframe paints WITHOUT any further server
@@ -271,12 +271,12 @@ export interface SelfContainedShellInputs {
271
271
  * bootstrap object's optional fields), which makes the output cacheable
272
272
  * and testable.
273
273
  *
274
- * Escapes that matter:
275
- * - HTML-entity-escapes the bootstrap JSON for `<` `>` `&` so a
276
- * malicious appId / sessionId can't break out of the script tag.
277
- * - The componentCode is base64-encoded by the caller before the JSON
278
- * stringification runs, so even a raw `</script>` sequence in the
279
- * compiled source can't break the surrounding HTML.
274
+ * This builder owns SLICE COMPOSITION (server-side inputs → the typed
275
+ * `ai.ggui/render` slice); the envelope wrapping, script-safe escaping,
276
+ * and HTML assembly are delegated to the protocol host-helper
277
+ * (`gguiShellHtml` in `@ggui-ai/protocol/integrations/mcp-apps`) — the
278
+ * same assembler MCP-Apps hosts use, so served and host-built shells
279
+ * cannot drift.
280
280
  *
281
281
  * @public
282
282
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-apps-outbound.d.ts","sourceRoot":"","sources":["../src/mcp-apps-outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAOL,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAC;A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AA4DD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,iCAAiC,GACtC,IAAI,CAoVN;AAiGD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,IAAI,GAAE;IACJ,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,iCAAiC,CAAC;IAC3D;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAC5B,GACL,IAAI,CAMN"}
@@ -33,7 +33,7 @@
33
33
  */
34
34
  import { deriveBundleOrigins, deriveContractBundle, derivePublicEnvProjection, deriveRenderMeta, findBlueprintExact, } from "@ggui-ai/mcp-server-handlers/renders";
35
35
  import { deriveContextDefault, isRecord } from "@ggui-ai/protocol";
36
- import { GGUI_RENDER_RESOURCE_MIME, GGUI_RENDER_RESOURCE_URI, MCP_APPS_UI_CAPABILITY, MCP_APP_AI_GGUI_RENDER_META_KEY, MCP_APP_BOOTSTRAP_FAILED_TYPE, deriveContextName, } from "@ggui-ai/protocol/integrations/mcp-apps";
36
+ import { GGUI_RENDER_RESOURCE_MIME, GGUI_RENDER_RESOURCE_URI, GGUI_RENDER_SHELL_SURFACE, MCP_APPS_UI_CAPABILITY, MCP_APP_BOOTSTRAP_FAILED_TYPE, asGguiRenderBootstrap, deriveContextName, gguiShellHtml, toMcpAppEnvelope, } from "@ggui-ai/protocol/integrations/mcp-apps";
37
37
  import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
38
38
  import { registerAppResource } from "@modelcontextprotocol/ext-apps/server";
39
39
  import { createHash } from "node:crypto";
@@ -311,8 +311,10 @@ postRpc('ui/initialize',{
311
311
  // diverged. Painting the served document's own surface here removes the
312
312
  // dependency on a browser honoring iframe transparency.
313
313
  //
314
- // Value-resolution only — no `--ggui-*` token added or renamed.
315
- const GGUI_RENDER_SHELL_SURFACE = `var(--ggui-color-surface, #1e293b)`;
314
+ // Value-resolution only — no `--ggui-*` token added or renamed. The
315
+ // constant itself lives with the protocol host-helper (the shared
316
+ // self-contained-shell assembler paints the same surface); imported
317
+ // above and reused here for the thin postMessage shell + loading shell.
316
318
  // `#ggui-root` here is LOAD-BEARING for the shell script (NOT a React
317
319
  // mount target): the inline script grabs it as `rootEl` for the
318
320
  // pre-mount overlays ("Initializing…", "Waiting for tool result…",
@@ -516,7 +518,7 @@ export function advertiseMcpAppsUiCapability(server) {
516
518
  * Build the self-contained shell HTML for a given render.
517
519
  *
518
520
  * The returned HTML is a complete, standalone document: it inlines the
519
- * compiled component (base64) + the render id in a `window.__GGUI_META__`
521
+ * compiled component (base64) + the render id in a `globalThis.__GGUI_META__`
520
522
  * global, then loads the iframe-runtime bundle via `<script type="module"
521
523
  * src={runtimeUrl}>`. The runtime takes over synchronously on import,
522
524
  * mounts the component, and the iframe paints WITHOUT any further server
@@ -527,12 +529,12 @@ export function advertiseMcpAppsUiCapability(server) {
527
529
  * bootstrap object's optional fields), which makes the output cacheable
528
530
  * and testable.
529
531
  *
530
- * Escapes that matter:
531
- * - HTML-entity-escapes the bootstrap JSON for `<` `>` `&` so a
532
- * malicious appId / sessionId can't break out of the script tag.
533
- * - The componentCode is base64-encoded by the caller before the JSON
534
- * stringification runs, so even a raw `</script>` sequence in the
535
- * compiled source can't break the surrounding HTML.
532
+ * This builder owns SLICE COMPOSITION (server-side inputs → the typed
533
+ * `ai.ggui/render` slice); the envelope wrapping, script-safe escaping,
534
+ * and HTML assembly are delegated to the protocol host-helper
535
+ * (`gguiShellHtml` in `@ggui-ai/protocol/integrations/mcp-apps`) — the
536
+ * same assembler MCP-Apps hosts use, so served and host-built shells
537
+ * cannot drift.
536
538
  *
537
539
  * @public
538
540
  */
@@ -627,53 +629,22 @@ export function buildSelfContainedShell(opts) {
627
629
  }
628
630
  : {}),
629
631
  };
630
- // Same wire shape as `_meta` — the iframe-runtime's global parser
631
- // reuses `parseMcpAppAiGguiRenderMeta` for the single render slice.
632
- const bootstrap = {
633
- [MCP_APP_AI_GGUI_RENDER_META_KEY]: render,
634
- };
635
- // JSON.stringify produces valid JS, but `<` / `>` / `&` / `U+2028`
636
- // / `U+2029` can break HTML or JS parsers when embedded inline.
637
- // Escape them. `U+2028` / `U+2029` are JS-source line terminators
638
- // that JSON allows but JS parsers historically choked on; modern
639
- // engines accept them in strings but the escape is cheap insurance.
640
- const json = JSON.stringify(bootstrap)
641
- .replace(/</g, "\\u003c")
642
- .replace(/>/g, "\\u003e")
643
- .replace(/&/g, "\\u0026")
644
- .replace(/\u2028/g, "\\u2028")
645
- .replace(/\u2029/g, "\\u2029");
646
- // HTML-escape the runtimeUrl for the `src` attribute. Server
647
- // operators control this string but a defensive escape avoids any
648
- // surprise if a future code path lets user-derived data flow here.
649
- const safeRuntimeUrl = opts.runtimeUrl
650
- .replace(/&/g, "&amp;")
651
- .replace(/"/g, "&quot;")
652
- .replace(/</g, "&lt;")
653
- .replace(/>/g, "&gt;");
654
- // Standalone served-iframe document — paint its own surface backdrop
655
- // so the canvas behind the rendered component never depends on a
656
- // browser honoring iframe transparency (the Safari white-canvas bug).
657
- // Same gating rationale as `GGUI_RENDER_SHELL_HTML`: this is ALWAYS a
658
- // top-level iframe document (the `__GGUI_META__` self-contained shell
659
- // for claude.ai / per-render resource shells), never inlined into a
660
- // host page, so painting `html`/`body` here cannot regress inline
661
- // embedding. `var(--ggui-color-surface, …)` resolves to the active
662
- // theme's per-mode surface once the iframe-runtime injects the `:root`
663
- // theme vars; the static dark fallback covers pre-resolve paint.
664
- // No anchor div: the iframe-runtime never mounts into a server-
665
- // provided container — it appends its own `<ul data-ggui-session-root>`
666
- // mount target to `document.body` at boot (iframe-runtime
667
- // `status-dom.ts#ensureStatusDom`). The thin postMessage shell's
668
- // `#ggui-root` is different: its inline script uses that div for
669
- // pre-mount overlays, which this shell has none of (the runtime boots
670
- // synchronously from the inline `__GGUI_META__` global).
671
- return `<!doctype html>
672
- <html lang="en" style="background-color:${GGUI_RENDER_SHELL_SURFACE}"><head><meta charset="utf-8"><title>ggui render</title></head>
673
- <body style="background-color:${GGUI_RENDER_SHELL_SURFACE}">
674
- <script>window.__GGUI_META__ = ${json};</script>
675
- <script type="module" crossorigin="anonymous" src="${safeRuntimeUrl}"></script>
676
- </body></html>`;
632
+ // Delegate envelope wrapping + HTML assembly to the protocol's
633
+ // host-helper (`gguiShellHtml`) — the SAME assembler MCP-Apps hosts
634
+ // consume — so the server-served shell and host-built shells cannot
635
+ // drift. Routing through `asGguiRenderBootstrap` also proves at
636
+ // build time that the composed slice passes the host-side
637
+ // mountability gate.
638
+ const bootstrap = asGguiRenderBootstrap(toMcpAppEnvelope(render));
639
+ if (bootstrap === undefined) {
640
+ throw new Error("buildSelfContainedShell: composed render slice failed the host mountability gate (empty runtimeUrl?)");
641
+ }
642
+ // 'surface' posture: this shell is ALWAYS the top-level document of a
643
+ // standalone served iframe (claude.ai per-render resource shells,
644
+ // `/r/<shortCode>`), never inlined into a host page — so it paints
645
+ // its own theme-surface backdrop. See `GguiShellHtmlOptions` for the
646
+ // Safari white-canvas rationale.
647
+ return gguiShellHtml(bootstrap, { background: "surface" });
677
648
  }
678
649
  /**
679
650
  * Minimal "loading" HTML served when a per-render resource is fetched
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ggui-ai/mcp-server",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Self-hosted MCP server for the ggui protocol. An HTTP/MCP binding layer over @ggui-ai/mcp-server-handlers and the reference adapters from @ggui-ai/mcp-server-core — run it via `ggui serve`.",
5
5
  "keywords": [
6
6
  "ggui",
@@ -32,16 +32,16 @@
32
32
  "resend": "^6.12.2",
33
33
  "ws": "^8.20.1",
34
34
  "zod": "^4.3.6",
35
- "@ggui-ai/iframe-runtime": "0.6.1",
36
- "@ggui-ai/mcp-server-core": "0.6.1",
37
- "@ggui-ai/console": "0.6.1",
38
- "@ggui-ai/mcp-server-handlers": "0.6.1",
39
- "@ggui-ai/negotiator": "0.6.1",
40
- "@ggui-ai/preview-a2ui": "0.6.1",
41
- "@ggui-ai/project-config": "0.6.1",
42
- "@ggui-ai/ui-gen": "0.6.1",
43
- "@ggui-ai/protocol": "0.6.1",
44
- "@ggui-ai/ui-registry": "0.6.1"
35
+ "@ggui-ai/console": "0.6.3",
36
+ "@ggui-ai/mcp-server-core": "0.6.3",
37
+ "@ggui-ai/negotiator": "0.6.3",
38
+ "@ggui-ai/iframe-runtime": "0.6.3",
39
+ "@ggui-ai/mcp-server-handlers": "0.6.3",
40
+ "@ggui-ai/preview-a2ui": "0.6.3",
41
+ "@ggui-ai/project-config": "0.6.3",
42
+ "@ggui-ai/ui-gen": "0.6.3",
43
+ "@ggui-ai/ui-registry": "0.6.3",
44
+ "@ggui-ai/protocol": "0.6.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/express": "^5.0.0",
@@ -50,7 +50,7 @@
50
50
  "@types/ws": "^8.5.10",
51
51
  "typescript": "^5.0.0",
52
52
  "vitest": "^3.2.6",
53
- "@ggui-ai/protocol-conformance": "0.6.1"
53
+ "@ggui-ai/protocol-conformance": "0.6.3"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",