@modelcontextprotocol/ext-apps 0.3.1 → 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.
- package/LICENSE +196 -1
- package/README.md +32 -10
- package/dist/src/app-bridge.d.ts +131 -72
- package/dist/src/app-bridge.js +10 -10
- package/dist/src/app-with-deps.js +9 -9
- package/dist/src/app.d.ts +75 -24
- package/dist/src/app.js +18 -18
- package/dist/src/generated/schema.d.ts +230 -29
- package/dist/src/generated/schema.test.d.ts +5 -2
- package/dist/src/message-transport.d.ts +20 -22
- package/dist/src/react/index.js +17 -17
- package/dist/src/react/react-with-deps.js +17 -17
- package/dist/src/react/useApp.d.ts +22 -17
- package/dist/src/react/useAutoResize.d.ts +5 -3
- package/dist/src/react/useDocumentTheme.d.ts +3 -1
- package/dist/src/react/useHostStyles.d.ts +19 -18
- package/dist/src/server/index.d.ts +106 -13
- package/dist/src/server/index.js +19 -19
- package/dist/src/spec.types.d.ts +85 -21
- package/dist/src/styles.d.ts +5 -5
- package/dist/src/types.d.ts +11 -10
- package/package.json +6 -4
package/dist/src/spec.types.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
88
|
+
* Note: The generated schema uses passthrough() to allow additional properties.
|
|
89
89
|
*/
|
|
90
90
|
[key: string]: unknown;
|
|
91
91
|
}
|
|
@@ -111,17 +111,14 @@ 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
|
-
|
|
116
|
-
|
|
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
|
/**
|
|
123
|
-
* @description Notification of UI size changes (
|
|
124
|
-
* @see {@link app
|
|
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
|
|
125
122
|
*/
|
|
126
123
|
export interface McpUiSizeChangedNotification {
|
|
127
124
|
method: "ui/notifications/size-changed";
|
|
@@ -176,7 +173,7 @@ export interface McpUiToolCancelledNotification {
|
|
|
176
173
|
* @description CSS blocks that can be injected by apps.
|
|
177
174
|
*/
|
|
178
175
|
export interface McpUiHostCss {
|
|
179
|
-
/** @description CSS for font loading (
|
|
176
|
+
/** @description CSS for font loading (`@font-face` rules or `@import` statements). Apps must apply using {@link applyHostFonts}. */
|
|
180
177
|
fonts?: string;
|
|
181
178
|
}
|
|
182
179
|
/**
|
|
@@ -262,9 +259,30 @@ 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
|
-
* @see {@link app-bridge
|
|
285
|
+
* @see {@link app-bridge!AppBridge.teardownResource} for the host method that sends this
|
|
268
286
|
*/
|
|
269
287
|
export interface McpUiResourceTeardownRequest {
|
|
270
288
|
method: "ui/resource-teardown";
|
|
@@ -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,9 +333,20 @@ 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
|
-
* @description Capabilities provided by the Guest UI (App).
|
|
349
|
+
* @description Capabilities provided by the Guest UI ({@link app!App}).
|
|
307
350
|
* @see {@link McpUiInitializeRequest} for the initialization request that includes these capabilities
|
|
308
351
|
*/
|
|
309
352
|
export interface McpUiAppCapabilities {
|
|
@@ -317,7 +360,7 @@ export interface McpUiAppCapabilities {
|
|
|
317
360
|
}
|
|
318
361
|
/**
|
|
319
362
|
* @description Initialization request sent from Guest UI to Host.
|
|
320
|
-
* @see {@link app
|
|
363
|
+
* @see {@link app!App.connect} for the method that sends this request
|
|
321
364
|
*/
|
|
322
365
|
export interface McpUiInitializeRequest {
|
|
323
366
|
method: "ui/initialize";
|
|
@@ -345,13 +388,13 @@ export interface McpUiInitializeResult {
|
|
|
345
388
|
hostContext: McpUiHostContext;
|
|
346
389
|
/**
|
|
347
390
|
* Index signature required for MCP SDK `Protocol` class compatibility.
|
|
348
|
-
* Note: The schema
|
|
391
|
+
* Note: The generated schema uses passthrough() to allow additional properties.
|
|
349
392
|
*/
|
|
350
393
|
[key: string]: unknown;
|
|
351
394
|
}
|
|
352
395
|
/**
|
|
353
396
|
* @description Notification that Guest UI has completed initialization (Guest UI -> Host).
|
|
354
|
-
* @see {@link app
|
|
397
|
+
* @see {@link app!App.connect} for the method that sends this notification
|
|
355
398
|
*/
|
|
356
399
|
export interface McpUiInitializedNotification {
|
|
357
400
|
method: "ui/notifications/initialized";
|
|
@@ -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. */
|
|
@@ -381,7 +445,7 @@ export interface McpUiResourceMeta {
|
|
|
381
445
|
* @description Request to change the display mode of the UI.
|
|
382
446
|
* The host will respond with the actual display mode that was set,
|
|
383
447
|
* which may differ from the requested mode if not supported.
|
|
384
|
-
* @see {@link app
|
|
448
|
+
* @see {@link app!App.requestDisplayMode} for the method that sends this request
|
|
385
449
|
*/
|
|
386
450
|
export interface McpUiRequestDisplayModeRequest {
|
|
387
451
|
method: "ui/request-display-mode";
|
|
@@ -399,7 +463,7 @@ export interface McpUiRequestDisplayModeResult {
|
|
|
399
463
|
mode: McpUiDisplayMode;
|
|
400
464
|
/**
|
|
401
465
|
* Index signature required for MCP SDK `Protocol` class compatibility.
|
|
402
|
-
* Note: The schema
|
|
466
|
+
* Note: The generated schema uses passthrough() to allow additional properties.
|
|
403
467
|
*/
|
|
404
468
|
[key: string]: unknown;
|
|
405
469
|
}
|
package/dist/src/styles.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
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
|
-
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.
|
|
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
|
|
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
|
-
export type AppRequest = McpUiInitializeRequest | McpUiOpenLinkRequest | McpUiMessageRequest | McpUiResourceTeardownRequest | McpUiRequestDisplayModeRequest | CallToolRequest | ListToolsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | ListPromptsRequest | PingRequest;
|
|
24
|
+
export type AppRequest = McpUiInitializeRequest | McpUiOpenLinkRequest | McpUiMessageRequest | McpUiUpdateModelContextRequest | McpUiResourceTeardownRequest | McpUiRequestDisplayModeRequest | CallToolRequest | ListToolsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | ListPromptsRequest | PingRequest;
|
|
24
25
|
/**
|
|
25
26
|
* All notification types in the MCP Apps protocol.
|
|
26
27
|
*
|
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.
|
|
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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"scripts": {
|
|
47
47
|
"postinstall": "node scripts/setup-bun.mjs || echo 'setup-bun.mjs failed or not available'",
|
|
48
|
-
"start": "npm run examples:
|
|
48
|
+
"start": "npm run examples:dev",
|
|
49
49
|
"generate:schemas": "tsx scripts/generate-schemas.ts && prettier --write \"src/generated/**/*\"",
|
|
50
50
|
"build": "npm run generate:schemas && node scripts/run-bun.mjs build.bun.ts",
|
|
51
51
|
"prepack": "npm run build",
|
|
@@ -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",
|