@modelcontextprotocol/ext-apps 0.3.0 → 0.4.0

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.
@@ -111,12 +111,9 @@ export interface McpUiSandboxResourceReadyNotification {
111
111
  /** @description Optional override for the inner iframe's sandbox attribute. */
112
112
  sandbox?: string;
113
113
  /** @description CSP configuration from resource metadata. */
114
- csp?: {
115
- /** @description Origins for network requests (fetch/XHR/WebSocket). */
116
- connectDomains?: string[];
117
- /** @description Origins for static resources (scripts, images, styles, fonts). */
118
- resourceDomains?: string[];
119
- };
114
+ csp?: McpUiResourceCsp;
115
+ /** @description Sandbox permissions from resource metadata. */
116
+ permissions?: McpUiResourcePermissions;
120
117
  };
121
118
  }
122
119
  /**
@@ -262,6 +259,27 @@ export interface McpUiHostContextChangedNotification {
262
259
  /** @description Partial context update containing only changed fields. */
263
260
  params: McpUiHostContext;
264
261
  }
262
+ /**
263
+ * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host).
264
+ *
265
+ * Unlike `notifications/message` which is for debugging/logging, this request is intended
266
+ * to update the Host's model context. Each request overwrites the previous context sent by the Guest UI.
267
+ * Unlike messages, context updates do not trigger follow-ups.
268
+ *
269
+ * The host will typically defer sending the context to the model until the next user message
270
+ * (including `ui/message`), and will only send the last update received.
271
+ *
272
+ * @see {@link app.App.updateModelContext} for the method that sends this request
273
+ */
274
+ export interface McpUiUpdateModelContextRequest {
275
+ method: "ui/update-model-context";
276
+ params: {
277
+ /** @description Context content blocks (text, image, etc.). */
278
+ content?: ContentBlock[];
279
+ /** @description Structured content for machine-readable context data. */
280
+ structuredContent?: Record<string, unknown>;
281
+ };
282
+ }
265
283
  /**
266
284
  * @description Request for graceful shutdown of the Guest UI (Host -> Guest UI).
267
285
  * @see {@link app-bridge.AppBridge.teardownResource} for the host method that sends this
@@ -280,6 +298,20 @@ export interface McpUiResourceTeardownResult {
280
298
  */
281
299
  [key: string]: unknown;
282
300
  }
301
+ export interface McpUiSupportedContentBlockModalities {
302
+ /** @description Host supports text content blocks. */
303
+ text?: {};
304
+ /** @description Host supports image content blocks. */
305
+ image?: {};
306
+ /** @description Host supports audio content blocks. */
307
+ audio?: {};
308
+ /** @description Host supports resource content blocks. */
309
+ resource?: {};
310
+ /** @description Host supports resource link content blocks. */
311
+ resourceLink?: {};
312
+ /** @description Host supports structured content. */
313
+ structuredContent?: {};
314
+ }
283
315
  /**
284
316
  * @description Capabilities supported by the host application.
285
317
  * @see {@link McpUiInitializeResult} for the initialization result that includes these capabilities
@@ -301,6 +333,17 @@ export interface McpUiHostCapabilities {
301
333
  };
302
334
  /** @description Host accepts log messages. */
303
335
  logging?: {};
336
+ /** @description Sandbox configuration applied by the host. */
337
+ sandbox?: {
338
+ /** @description Permissions granted by the host (camera, microphone, geolocation). */
339
+ permissions?: McpUiResourcePermissions;
340
+ /** @description CSP domains approved by the host. */
341
+ csp?: McpUiResourceCsp;
342
+ };
343
+ /** @description Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns. */
344
+ updateModelContext?: McpUiSupportedContentBlockModalities;
345
+ /** @description Host supports receiving content messages (ui/message) from the Guest UI. */
346
+ message?: McpUiSupportedContentBlockModalities;
304
347
  }
305
348
  /**
306
349
  * @description Capabilities provided by the Guest UI (App).
@@ -365,6 +408,25 @@ export interface McpUiResourceCsp {
365
408
  connectDomains?: string[];
366
409
  /** @description Origins for static resources (scripts, images, styles, fonts). */
367
410
  resourceDomains?: string[];
411
+ /** @description Origins for nested iframes (frame-src directive). */
412
+ frameDomains?: string[];
413
+ /** @description Allowed base URIs for the document (base-uri directive). */
414
+ baseUriDomains?: string[];
415
+ }
416
+ /**
417
+ * @description Sandbox permissions requested by the UI resource.
418
+ * Hosts MAY honor these by setting appropriate iframe `allow` attributes.
419
+ * Apps SHOULD NOT assume permissions are granted; use JS feature detection as fallback.
420
+ */
421
+ export interface McpUiResourcePermissions {
422
+ /** @description Request camera access (Permission Policy `camera` feature). */
423
+ camera?: {};
424
+ /** @description Request microphone access (Permission Policy `microphone` feature). */
425
+ microphone?: {};
426
+ /** @description Request geolocation access (Permission Policy `geolocation` feature). */
427
+ geolocation?: {};
428
+ /** @description Request clipboard write access (Permission Policy `clipboard-write` feature). */
429
+ clipboardWrite?: {};
368
430
  }
369
431
  /**
370
432
  * @description UI Resource metadata for security and rendering configuration.
@@ -372,6 +434,8 @@ export interface McpUiResourceCsp {
372
434
  export interface McpUiResourceMeta {
373
435
  /** @description Content Security Policy configuration. */
374
436
  csp?: McpUiResourceCsp;
437
+ /** @description Sandbox permissions requested by the UI. */
438
+ permissions?: McpUiResourcePermissions;
375
439
  /** @description Dedicated origin for widget sandbox. */
376
440
  domain?: string;
377
441
  /** @description Visual boundary preference - true if UI prefers a visible border. */
@@ -8,9 +8,9 @@
8
8
  * @see generated/schema.ts for auto-generated Zod schemas
9
9
  * @see generated/schema.test.ts for compile-time verification
10
10
  */
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 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 McpUiResourceMeta, type McpUiRequestDisplayModeRequest, type McpUiRequestDisplayModeResult, type McpUiToolVisibility, type McpUiToolMeta, } from "./spec.types.js";
12
- import type { McpUiInitializeRequest, McpUiOpenLinkRequest, McpUiMessageRequest, McpUiResourceTeardownRequest, McpUiRequestDisplayModeRequest, McpUiHostContextChangedNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiToolCancelledNotification, McpUiSandboxResourceReadyNotification, McpUiInitializedNotification, McpUiSizeChangedNotification, McpUiSandboxProxyReadyNotification, McpUiInitializeResult, McpUiOpenLinkResult, McpUiMessageResult, McpUiResourceTeardownResult, McpUiRequestDisplayModeResult } from "./spec.types.js";
13
- export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostCssSchema, McpUiHostStylesSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextSchema, McpUiHostContextChangedNotificationSchema, McpUiResourceTeardownRequestSchema, McpUiResourceTeardownResultSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiResourceCspSchema, McpUiResourceMetaSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, McpUiToolVisibilitySchema, McpUiToolMetaSchema, } from "./generated/schema.js";
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
+ 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";
13
+ export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostCssSchema, McpUiHostStylesSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiUpdateModelContextRequestSchema, McpUiSupportedContentBlockModalitiesSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextSchema, McpUiHostContextChangedNotificationSchema, McpUiResourceTeardownRequestSchema, McpUiResourceTeardownResultSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiResourceCspSchema, McpUiResourcePermissionsSchema, McpUiResourceMetaSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, McpUiToolVisibilitySchema, McpUiToolMetaSchema, } from "./generated/schema.js";
14
14
  import { CallToolRequest, CallToolResult, EmptyResult, ListPromptsRequest, ListPromptsResult, ListResourcesRequest, ListResourcesResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, ListToolsRequest, ListToolsResult, LoggingMessageNotification, PingRequest, PromptListChangedNotification, ReadResourceRequest, ReadResourceResult, ResourceListChangedNotification, ToolListChangedNotification } from "@modelcontextprotocol/sdk/types.js";
15
15
  /**
16
16
  * All request types in the MCP Apps protocol.
@@ -20,7 +20,7 @@ import { CallToolRequest, CallToolResult, EmptyResult, ListPromptsRequest, ListP
20
20
  * - MCP server requests forwarded from the app (tools/call, resources/*, prompts/list)
21
21
  * - Protocol requests (ping)
22
22
  */
23
- export type AppRequest = McpUiInitializeRequest | McpUiOpenLinkRequest | McpUiMessageRequest | McpUiResourceTeardownRequest | McpUiRequestDisplayModeRequest | CallToolRequest | ListToolsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | ListPromptsRequest | PingRequest;
23
+ export type AppRequest = McpUiInitializeRequest | McpUiOpenLinkRequest | McpUiMessageRequest | McpUiUpdateModelContextRequest | McpUiResourceTeardownRequest | McpUiRequestDisplayModeRequest | CallToolRequest | ListToolsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | ListPromptsRequest | PingRequest;
24
24
  /**
25
25
  * All notification types in the MCP Apps protocol.
26
26
  *
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.3.0",
8
+ "version": "0.4.0",
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",
@@ -15,10 +15,18 @@
15
15
  "types": "./dist/src/app.d.ts",
16
16
  "default": "./dist/src/app.js"
17
17
  },
18
+ "./app-with-deps": {
19
+ "types": "./dist/src/app.d.ts",
20
+ "default": "./dist/src/app-with-deps.js"
21
+ },
18
22
  "./react": {
19
23
  "types": "./dist/src/react/index.d.ts",
20
24
  "default": "./dist/src/react/index.js"
21
25
  },
26
+ "./react-with-deps": {
27
+ "types": "./dist/src/react/index.d.ts",
28
+ "default": "./dist/src/react/react-with-deps.js"
29
+ },
22
30
  "./app-bridge": {
23
31
  "types": "./dist/src/app-bridge.d.ts",
24
32
  "default": "./dist/src/app-bridge.js"
@@ -37,17 +45,18 @@
37
45
  ],
38
46
  "scripts": {
39
47
  "postinstall": "node scripts/setup-bun.mjs || echo 'setup-bun.mjs failed or not available'",
40
- "start": "npm run examples:start",
48
+ "start": "npm run examples:dev",
41
49
  "generate:schemas": "tsx scripts/generate-schemas.ts && prettier --write \"src/generated/**/*\"",
42
50
  "build": "npm run generate:schemas && node scripts/run-bun.mjs build.bun.ts",
43
51
  "prepack": "npm run build",
44
- "build:all": "npm run build && npm run examples:build",
52
+ "build:all": "npm run examples:build",
45
53
  "test": "bun test src",
46
54
  "test:e2e": "playwright test",
47
55
  "test:e2e:update": "playwright test --update-snapshots",
48
56
  "test:e2e:ui": "playwright test --ui",
49
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'",
50
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'",
59
+ "preexamples:build": "npm run build",
51
60
  "examples:build": "bun examples/run-all.ts build",
52
61
  "examples:start": "NODE_ENV=development npm run build && bun examples/run-all.ts start",
53
62
  "examples:dev": "NODE_ENV=development bun examples/run-all.ts dev",
@@ -56,7 +65,8 @@
56
65
  "docs": "typedoc",
57
66
  "docs:watch": "typedoc --watch",
58
67
  "prettier": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --check",
59
- "prettier:fix": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --write"
68
+ "prettier:fix": "prettier -u \"**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --write",
69
+ "check:versions": "node scripts/check-versions.mjs"
60
70
  },
61
71
  "author": "Olivier Chafik",
62
72
  "devDependencies": {