@ggui-ai/iframe-runtime 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.
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* The iframe plays the MCP Apps HOST role for the embedded content:
|
|
8
8
|
*
|
|
9
|
-
* - `ui/initialize` → respond with
|
|
10
|
-
*
|
|
9
|
+
* - `ui/initialize` → respond with a spec-canonical
|
|
10
|
+
* `McpUiInitializeResult` whose `hostContext` carries minimal
|
|
11
|
+
* context (locale + containerDimensions).
|
|
11
12
|
* - `tools/call` → forward to the ggui server's
|
|
12
13
|
* `/mcp-apps/tools-call` endpoint. The server enforces source
|
|
13
14
|
* connector scoping + `_meta.ui.visibility: ['app']`.
|
|
@@ -46,8 +47,6 @@ export interface McpAppIframeMountOptions {
|
|
|
46
47
|
* NOT have a trailing slash. Empty string = same-origin.
|
|
47
48
|
*/
|
|
48
49
|
readonly serverBaseUrl?: string;
|
|
49
|
-
/** Optional theme override for the `ui/initialize` context. */
|
|
50
|
-
readonly theme?: Readonly<Record<string, string>>;
|
|
51
50
|
/** Optional locale; defaults to `navigator.language` when
|
|
52
51
|
* available. */
|
|
53
52
|
readonly locale?: string;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
'--color-primary': '#0284c7',
|
|
4
|
-
'--color-surface': '#ffffff',
|
|
5
|
-
'--color-text': '#111111',
|
|
6
|
-
'--font-family': 'system-ui, -apple-system, sans-serif',
|
|
7
|
-
'--border-radius-md': '8px',
|
|
8
|
-
};
|
|
1
|
+
import { LATEST_PROTOCOL_VERSION, } from '@modelcontextprotocol/ext-apps';
|
|
2
|
+
const EMBED_HOST_VERSION = typeof __GGUI_RUNTIME_VERSION__ === 'string' ? __GGUI_RUNTIME_VERSION__ : 'dev';
|
|
9
3
|
// =============================================================================
|
|
10
4
|
// Helpers
|
|
11
5
|
// =============================================================================
|
|
@@ -108,16 +102,28 @@ export function mountMcpAppIframe(container, opts) {
|
|
|
108
102
|
let response;
|
|
109
103
|
switch (req.method) {
|
|
110
104
|
case 'ui/initialize': {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
// Spec-canonical `McpUiInitializeResult` — a spec-compliant
|
|
106
|
+
// embedded app connects via ext-apps `App.connect`, which
|
|
107
|
+
// zod-requires `protocolVersion` + `hostInfo` +
|
|
108
|
+
// `hostCapabilities` + `hostContext`; the pre-App draft shape
|
|
109
|
+
// fails that gate and kills the embedded mount. Adapter
|
|
110
|
+
// boundary — `hostContext` carries `{locale,
|
|
111
|
+
// containerDimensions}` ONLY (no outer ggui render state).
|
|
112
|
+
const requestedRaw = req.params?.['protocolVersion'];
|
|
113
|
+
const requested = typeof requestedRaw === 'string' && requestedRaw.length > 0
|
|
114
|
+
? requestedRaw
|
|
115
|
+
: LATEST_PROTOCOL_VERSION;
|
|
116
|
+
const result = {
|
|
117
|
+
protocolVersion: requested,
|
|
118
|
+
hostInfo: { name: 'ggui-iframe-runtime-embed-host', version: EMBED_HOST_VERSION },
|
|
119
|
+
hostCapabilities: {},
|
|
120
|
+
hostContext: {
|
|
117
121
|
locale: opts.locale ??
|
|
118
122
|
(typeof navigator !== 'undefined' ? navigator.language : 'en-US'),
|
|
123
|
+
containerDimensions: dims,
|
|
119
124
|
},
|
|
120
125
|
};
|
|
126
|
+
response = { jsonrpc: '2.0', id, result };
|
|
121
127
|
break;
|
|
122
128
|
}
|
|
123
129
|
case 'tools/call': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggui-ai/iframe-runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "The iframe-local ggui runtime: a self-contained ESM bundle that boots inside an MCP Apps host iframe, runs the protocol-version handshake, opens the live-channel WebSocket, and mounts the rendered UI. Bundles React, ReactDOM, and the ggui design system so generated component code has a single seam to read from.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ggui",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"qrcode-generator": "^2.0.4",
|
|
36
36
|
"react": "^19.0.0",
|
|
37
37
|
"react-dom": "^19.0.0",
|
|
38
|
-
"@ggui-ai/live-channel": "0.6.
|
|
39
|
-
"@ggui-ai/gadgets": "0.6.
|
|
40
|
-
"@ggui-ai/
|
|
41
|
-
"@ggui-ai/
|
|
42
|
-
"@ggui-ai/
|
|
43
|
-
"@ggui-ai/wire": "0.6.
|
|
38
|
+
"@ggui-ai/live-channel": "0.6.3",
|
|
39
|
+
"@ggui-ai/gadgets": "0.6.3",
|
|
40
|
+
"@ggui-ai/preview-a2ui": "0.6.3",
|
|
41
|
+
"@ggui-ai/design": "0.6.3",
|
|
42
|
+
"@ggui-ai/protocol": "0.6.3",
|
|
43
|
+
"@ggui-ai/wire": "0.6.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.27.0"
|