@modelcontextprotocol/ext-apps 0.4.0 → 0.4.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.
@@ -2,7 +2,7 @@
2
2
  * MCP Apps Protocol Types (spec.types.ts)
3
3
  *
4
4
  * This file contains pure TypeScript interface definitions for the MCP Apps protocol.
5
- * These types are the source of truth and are used to generate Zod schemas via ts-to-zod.
5
+ * These types are the source of truth and are used to generate Zod schemas via `ts-to-zod`.
6
6
  *
7
7
  * - Use `@description` JSDoc tags to generate `.describe()` calls on schemas
8
8
  * - Run `npm run generate:schemas` to regenerate schemas from these types
@@ -41,7 +41,7 @@ export type McpUiStyleVariableKey = "--color-background-primary" | "--color-back
41
41
  export type McpUiStyles = Record<McpUiStyleVariableKey, string | undefined>;
42
42
  /**
43
43
  * @description Request to open an external URL in the host's default browser.
44
- * @see {@link app.App.sendOpenLink} for the method that sends this request
44
+ * @see {@link app!App.openLink} for the method that sends this request
45
45
  */
46
46
  export interface McpUiOpenLinkRequest {
47
47
  method: "ui/open-link";
@@ -59,13 +59,13 @@ export interface McpUiOpenLinkResult {
59
59
  isError?: boolean;
60
60
  /**
61
61
  * Index signature required for MCP SDK `Protocol` class compatibility.
62
- * Note: The schema intentionally omits this to enforce strict validation.
62
+ * Note: The generated schema uses passthrough() to allow additional properties.
63
63
  */
64
64
  [key: string]: unknown;
65
65
  }
66
66
  /**
67
67
  * @description Request to send a message to the host's chat interface.
68
- * @see {@link app.App.sendMessage} for the method that sends this request
68
+ * @see {@link app!App.sendMessage} for the method that sends this request
69
69
  */
70
70
  export interface McpUiMessageRequest {
71
71
  method: "ui/message";
@@ -85,7 +85,7 @@ export interface McpUiMessageResult {
85
85
  isError?: boolean;
86
86
  /**
87
87
  * Index signature required for MCP SDK `Protocol` class compatibility.
88
- * Note: The schema intentionally omits this to enforce strict validation.
88
+ * Note: The generated schema uses passthrough() to allow additional properties.
89
89
  */
90
90
  [key: string]: unknown;
91
91
  }
@@ -117,8 +117,8 @@ export interface McpUiSandboxResourceReadyNotification {
117
117
  };
118
118
  }
119
119
  /**
120
- * @description Notification of UI size changes (bidirectional: Guest <-> Host).
121
- * @see {@link app.App.sendSizeChanged} for the method to send this from Guest UI
120
+ * @description Notification of UI size changes (Guest UI -> Host).
121
+ * @see {@link app!App.sendSizeChanged} for the method to send this from Guest UI
122
122
  */
123
123
  export interface McpUiSizeChangedNotification {
124
124
  method: "ui/notifications/size-changed";
@@ -173,7 +173,7 @@ export interface McpUiToolCancelledNotification {
173
173
  * @description CSS blocks that can be injected by apps.
174
174
  */
175
175
  export interface McpUiHostCss {
176
- /** @description CSS for font loading (@font-face rules or @import statements). Apps must apply using applyHostFonts(). */
176
+ /** @description CSS for font loading (`@font-face` rules or `@import` statements). Apps must apply using {@link applyHostFonts}. */
177
177
  fonts?: string;
178
178
  }
179
179
  /**
@@ -282,7 +282,7 @@ export interface McpUiUpdateModelContextRequest {
282
282
  }
283
283
  /**
284
284
  * @description Request for graceful shutdown of the Guest UI (Host -> Guest UI).
285
- * @see {@link app-bridge.AppBridge.teardownResource} for the host method that sends this
285
+ * @see {@link app-bridge!AppBridge.teardownResource} for the host method that sends this
286
286
  */
287
287
  export interface McpUiResourceTeardownRequest {
288
288
  method: "ui/resource-teardown";
@@ -346,7 +346,7 @@ export interface McpUiHostCapabilities {
346
346
  message?: McpUiSupportedContentBlockModalities;
347
347
  }
348
348
  /**
349
- * @description Capabilities provided by the Guest UI (App).
349
+ * @description Capabilities provided by the Guest UI ({@link app!App}).
350
350
  * @see {@link McpUiInitializeRequest} for the initialization request that includes these capabilities
351
351
  */
352
352
  export interface McpUiAppCapabilities {
@@ -360,7 +360,7 @@ export interface McpUiAppCapabilities {
360
360
  }
361
361
  /**
362
362
  * @description Initialization request sent from Guest UI to Host.
363
- * @see {@link app.App.connect} for the method that sends this request
363
+ * @see {@link app!App.connect} for the method that sends this request
364
364
  */
365
365
  export interface McpUiInitializeRequest {
366
366
  method: "ui/initialize";
@@ -388,13 +388,13 @@ export interface McpUiInitializeResult {
388
388
  hostContext: McpUiHostContext;
389
389
  /**
390
390
  * Index signature required for MCP SDK `Protocol` class compatibility.
391
- * Note: The schema intentionally omits this to enforce strict validation.
391
+ * Note: The generated schema uses passthrough() to allow additional properties.
392
392
  */
393
393
  [key: string]: unknown;
394
394
  }
395
395
  /**
396
396
  * @description Notification that Guest UI has completed initialization (Guest UI -> Host).
397
- * @see {@link app.App.connect} for the method that sends this notification
397
+ * @see {@link app!App.connect} for the method that sends this notification
398
398
  */
399
399
  export interface McpUiInitializedNotification {
400
400
  method: "ui/notifications/initialized";
@@ -445,7 +445,7 @@ export interface McpUiResourceMeta {
445
445
  * @description Request to change the display mode of the UI.
446
446
  * The host will respond with the actual display mode that was set,
447
447
  * which may differ from the requested mode if not supported.
448
- * @see {@link app.App.requestDisplayMode} for the method that sends this request
448
+ * @see {@link app!App.requestDisplayMode} for the method that sends this request
449
449
  */
450
450
  export interface McpUiRequestDisplayModeRequest {
451
451
  method: "ui/request-display-mode";
@@ -463,7 +463,7 @@ export interface McpUiRequestDisplayModeResult {
463
463
  mode: McpUiDisplayMode;
464
464
  /**
465
465
  * Index signature required for MCP SDK `Protocol` class compatibility.
466
- * Note: The schema intentionally omits this to enforce strict validation.
466
+ * Note: The generated schema uses passthrough() to allow additional properties.
467
467
  */
468
468
  [key: string]: unknown;
469
469
  }
@@ -58,12 +58,12 @@ export declare function applyDocumentTheme(theme: McpUiTheme): void;
58
58
  /**
59
59
  * Apply host style variables as CSS custom properties on an element.
60
60
  *
61
- * This function takes the `variables` object from `McpUiHostContext.styles` and sets
61
+ * This function takes the `variables` object from {@link McpUiHostContext.styles} and sets
62
62
  * each CSS variable on the specified root element (defaults to `document.documentElement`).
63
63
  * This allows apps to use the host's theming values via CSS variables like
64
64
  * `var(--color-background-primary)`.
65
65
  *
66
- * @param styles - The styles object from `McpUiHostContext.styles.variables`
66
+ * @param styles - The style variables object from `McpUiHostContext.styles.variables`
67
67
  * @param root - The element to apply styles to (defaults to `document.documentElement`)
68
68
  *
69
69
  * @example Apply style variables from host context
@@ -95,10 +95,10 @@ export declare function applyHostStyleVariables(styles: McpUiStyles, root?: HTML
95
95
  * self-hosted fonts, `@import` statements for Google Fonts or other font services,
96
96
  * or a combination of both.
97
97
  *
98
- * The styles are only injected once. Subsequent calls will not create duplicate
99
- * style tags.
98
+ * The styles are only injected once. Subsequent calls are no-ops and will not
99
+ * create duplicate style tags.
100
100
  *
101
- * @param fontCss - CSS string containing @font-face rules and/or @import statements
101
+ * @param fontCss - CSS string containing `@font-face` rules and/or `@import` statements
102
102
  *
103
103
  * @example Apply fonts from host context
104
104
  * ```typescript
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * MCP Apps Protocol Types and Schemas
3
3
  *
4
- * This file re-exports types from spec.types.ts and schemas from generated/schema.ts.
5
- * Compile-time verification is handled by generated/schema.test.ts.
4
+ * This file re-exports types from `spec.types.ts` and schemas from `generated/schema.ts`.
5
+ * Compile-time verification is handled by `generated/schema.test.ts`.
6
6
  *
7
- * @see spec.types.ts for the source of truth TypeScript interfaces
8
- * @see generated/schema.ts for auto-generated Zod schemas
9
- * @see generated/schema.test.ts for compile-time verification
7
+ * @see `spec.types.ts` for the source of truth TypeScript interfaces
8
+ * @see `generated/schema.ts` for auto-generated Zod schemas
9
+ * @see `generated/schema.test.ts` for compile-time verification
10
10
  */
11
11
  export { LATEST_PROTOCOL_VERSION, OPEN_LINK_METHOD, MESSAGE_METHOD, SANDBOX_PROXY_READY_METHOD, SANDBOX_RESOURCE_READY_METHOD, SIZE_CHANGED_METHOD, TOOL_INPUT_METHOD, TOOL_INPUT_PARTIAL_METHOD, TOOL_RESULT_METHOD, TOOL_CANCELLED_METHOD, HOST_CONTEXT_CHANGED_METHOD, RESOURCE_TEARDOWN_METHOD, INITIALIZE_METHOD, INITIALIZED_METHOD, REQUEST_DISPLAY_MODE_METHOD, type McpUiTheme, type McpUiDisplayMode, type McpUiStyleVariableKey, type McpUiStyles, type McpUiHostCss, type McpUiHostStyles, type McpUiOpenLinkRequest, type McpUiOpenLinkResult, type McpUiMessageRequest, type McpUiMessageResult, type McpUiUpdateModelContextRequest, type McpUiSupportedContentBlockModalities, type McpUiSandboxProxyReadyNotification, type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, type McpUiToolInputNotification, type McpUiToolInputPartialNotification, type McpUiToolResultNotification, type McpUiToolCancelledNotification, type McpUiHostContext, type McpUiHostContextChangedNotification, type McpUiResourceTeardownRequest, type McpUiResourceTeardownResult, type McpUiHostCapabilities, type McpUiAppCapabilities, type McpUiInitializeRequest, type McpUiInitializeResult, type McpUiInitializedNotification, type McpUiResourceCsp, type McpUiResourcePermissions, type McpUiResourceMeta, type McpUiRequestDisplayModeRequest, type McpUiRequestDisplayModeResult, type McpUiToolVisibility, type McpUiToolMeta, } from "./spec.types.js";
12
12
  import type { McpUiInitializeRequest, McpUiOpenLinkRequest, McpUiMessageRequest, McpUiUpdateModelContextRequest, McpUiResourceTeardownRequest, McpUiRequestDisplayModeRequest, McpUiHostContextChangedNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiToolCancelledNotification, McpUiSandboxResourceReadyNotification, McpUiInitializedNotification, McpUiSizeChangedNotification, McpUiSandboxProxyReadyNotification, McpUiInitializeResult, McpUiOpenLinkResult, McpUiMessageResult, McpUiResourceTeardownResult, McpUiRequestDisplayModeResult } from "./spec.types.js";
@@ -17,7 +17,8 @@ import { CallToolRequest, CallToolResult, EmptyResult, ListPromptsRequest, ListP
17
17
  *
18
18
  * Includes:
19
19
  * - MCP UI requests (initialize, open-link, message, resource-teardown, request-display-mode)
20
- * - MCP server requests forwarded from the app (tools/call, resources/*, prompts/list)
20
+ * - MCP server requests forwarded from the app (tools/call, tools/list, resources/list,
21
+ * resources/templates/list, resources/read, prompts/list)
21
22
  * - Protocol requests (ping)
22
23
  */
23
24
  export type AppRequest = McpUiInitializeRequest | McpUiOpenLinkRequest | McpUiMessageRequest | McpUiUpdateModelContextRequest | McpUiResourceTeardownRequest | McpUiRequestDisplayModeRequest | CallToolRequest | ListToolsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | ListPromptsRequest | PingRequest;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/modelcontextprotocol/ext-apps"
6
6
  },
7
7
  "homepage": "https://github.com/modelcontextprotocol/ext-apps",
8
- "version": "0.4.0",
8
+ "version": "0.4.1",
9
9
  "license": "MIT",
10
10
  "description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
11
11
  "type": "module",
@@ -54,8 +54,8 @@
54
54
  "test:e2e": "playwright test",
55
55
  "test:e2e:update": "playwright test --update-snapshots",
56
56
  "test:e2e:ui": "playwright test --ui",
57
- "test:e2e:docker": "docker run --rm -v $(pwd):/work -w /work -it mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'npm i -g bun && npm ci && npx playwright test'",
58
- "test:e2e:docker:update": "docker run --rm -v $(pwd):/work -w /work -it mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'npm i -g bun && npm ci && npx playwright test --update-snapshots'",
57
+ "test:e2e:docker": "docker run --rm -v $(pwd):/work -w /work -it mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'apt-get update -qq && apt-get install -qq -y python3-venv curl > /dev/null && curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH=\"$HOME/.local/bin:$PATH\" && npm i -g bun && npm ci && npx playwright test'",
58
+ "test:e2e:docker:update": "npm run build:all && docker run --rm -v $(pwd):/work -w /work -it mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'apt-get update -qq && apt-get install -qq -y python3-venv curl > /dev/null && curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH=\"$HOME/.local/bin:$PATH\" && npm i -g bun && npm ci && npx playwright test --update-snapshots'",
59
59
  "preexamples:build": "npm run build",
60
60
  "examples:build": "bun examples/run-all.ts build",
61
61
  "examples:start": "NODE_ENV=development npm run build && bun examples/run-all.ts start",
@@ -64,6 +64,7 @@
64
64
  "prepare": "node scripts/setup-bun.mjs && npm run build && husky",
65
65
  "docs": "typedoc",
66
66
  "docs:watch": "typedoc --watch",
67
+ "generate:screenshots": "npm run build:all && docker run --rm -v $(pwd):/work -w /work mcr.microsoft.com/playwright:v1.57.0-noble sh -c 'apt-get update -qq && apt-get install -qq -y python3-venv curl > /dev/null && curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH=\"$HOME/.local/bin:$PATH\" && npm i -g bun && npm ci && npx playwright test tests/e2e/generate-grid-screenshots.spec.ts'",
67
68
  "prettier": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --check",
68
69
  "prettier:fix": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --write",
69
70
  "check:versions": "node scripts/check-versions.mjs"
@@ -85,6 +86,7 @@
85
86
  "prettier": "^3.6.2",
86
87
  "react": "^19.2.0",
87
88
  "react-dom": "^19.2.0",
89
+ "sharp": "^0.34.5",
88
90
  "ts-to-zod": "^5.1.0",
89
91
  "tsx": "^4.21.0",
90
92
  "typedoc": "^0.28.14",