@blade-hq/agent-react 2612.0.0-beta.68 → 2612.0.0-beta.69

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.
Files changed (66) hide show
  1. package/dist/{chunk-SA2U6KC5.js → chunk-HCW7SI5Q.js} +321 -257
  2. package/dist/chunk-HCW7SI5Q.js.map +1 -0
  3. package/dist/{chunk-SK5LWVRX.js → chunk-XP6T6SHZ.js} +2 -2
  4. package/dist/components/McpAppFrame.d.ts +17 -0
  5. package/dist/index.js +2 -2
  6. package/dist/internal.d.ts +2 -0
  7. package/dist/internal.js +4 -2
  8. package/dist/internal.js.map +1 -1
  9. package/dist/tool-details.js +1 -1
  10. package/node_modules/@modelcontextprotocol/ext-apps/LICENSE +216 -0
  11. package/node_modules/@modelcontextprotocol/ext-apps/README.md +284 -0
  12. package/node_modules/@modelcontextprotocol/ext-apps/dist/docs/patterns.d.ts +9 -0
  13. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.d.ts +1348 -0
  14. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.examples.d.ts +9 -0
  15. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js +39 -0
  16. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.test.d.ts +1 -0
  17. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-with-deps.js +82 -0
  18. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.d.ts +1214 -0
  19. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.examples.d.ts +9 -0
  20. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.js +39 -0
  21. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.test.d.ts +1 -0
  22. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/constants.d.ts +65 -0
  23. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.d.ts +47 -0
  24. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.test.d.ts +1 -0
  25. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.d.ts +1047 -0
  26. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.json +6170 -0
  27. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.test.d.ts +41 -0
  28. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/interop-v1.test.d.ts +1 -0
  29. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.d.ts +66 -0
  30. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.test.d.ts +1 -0
  31. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.d.ts +126 -0
  32. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.examples.d.ts +9 -0
  33. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.test.d.ts +1 -0
  34. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.d.ts +37 -0
  35. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.examples.d.ts +6 -0
  36. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js +39 -0
  37. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/react-with-deps.js +82 -0
  38. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.d.ts +115 -0
  39. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.examples.d.ts +6 -0
  40. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.d.ts +54 -0
  41. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.examples.d.ts +6 -0
  42. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.d.ts +44 -0
  43. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.examples.d.ts +6 -0
  44. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.d.ts +113 -0
  45. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.examples.d.ts +6 -0
  46. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.d.ts +381 -0
  47. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.examples.d.ts +9 -0
  48. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js +1 -0
  49. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.test.d.ts +1 -0
  50. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/spec.types.d.ts +698 -0
  51. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/standard-schema.d.ts +23 -0
  52. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.d.ts +184 -0
  53. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.examples.d.ts +9 -0
  54. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/types.d.ts +33 -0
  55. package/node_modules/@modelcontextprotocol/ext-apps/dist/src/wire-compat.test.d.ts +1 -0
  56. package/node_modules/@modelcontextprotocol/ext-apps/package.json +144 -0
  57. package/node_modules/@standard-schema/spec/LICENSE +21 -0
  58. package/node_modules/@standard-schema/spec/README.md +198 -0
  59. package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
  60. package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
  61. package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
  62. package/node_modules/@standard-schema/spec/dist/index.js +0 -0
  63. package/node_modules/@standard-schema/spec/package.json +52 -0
  64. package/package.json +6 -2
  65. package/dist/chunk-SA2U6KC5.js.map +0 -1
  66. /package/dist/{chunk-SK5LWVRX.js.map → chunk-XP6T6SHZ.js.map} +0 -0
@@ -0,0 +1,698 @@
1
+ /**
2
+ * MCP Apps Protocol Types (spec.types.ts)
3
+ *
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`.
6
+ *
7
+ * - Use `@description` JSDoc tags to generate `.describe()` calls on schemas
8
+ * - Run `npm run generate:schemas` to regenerate schemas from these types
9
+ *
10
+ * @see https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
11
+ */
12
+ import type { CallToolResult, ContentBlock, EmbeddedResource, Implementation, RequestId, ResourceLink, Tool } from "@modelcontextprotocol/client";
13
+ /**
14
+ * Current protocol version supported by this SDK.
15
+ *
16
+ * The SDK automatically handles version negotiation during initialization.
17
+ * Apps and hosts don't need to manage protocol versions manually.
18
+ */
19
+ export declare const LATEST_PROTOCOL_VERSION = "2026-01-26";
20
+ /**
21
+ * @description Color theme preference for the host environment.
22
+ */
23
+ export type McpUiTheme = "light" | "dark";
24
+ /**
25
+ * @description Display mode for UI presentation.
26
+ */
27
+ export type McpUiDisplayMode = "inline" | "fullscreen" | "pip";
28
+ /**
29
+ * @description CSS variable keys available to MCP apps for theming.
30
+ */
31
+ export type McpUiStyleVariableKey = "--color-background-primary" | "--color-background-secondary" | "--color-background-tertiary" | "--color-background-inverse" | "--color-background-ghost" | "--color-background-info" | "--color-background-danger" | "--color-background-success" | "--color-background-warning" | "--color-background-disabled" | "--color-text-primary" | "--color-text-secondary" | "--color-text-tertiary" | "--color-text-inverse" | "--color-text-ghost" | "--color-text-info" | "--color-text-danger" | "--color-text-success" | "--color-text-warning" | "--color-text-disabled" | "--color-border-primary" | "--color-border-secondary" | "--color-border-tertiary" | "--color-border-inverse" | "--color-border-ghost" | "--color-border-info" | "--color-border-danger" | "--color-border-success" | "--color-border-warning" | "--color-border-disabled" | "--color-ring-primary" | "--color-ring-secondary" | "--color-ring-inverse" | "--color-ring-info" | "--color-ring-danger" | "--color-ring-success" | "--color-ring-warning" | "--font-sans" | "--font-mono" | "--font-weight-normal" | "--font-weight-medium" | "--font-weight-semibold" | "--font-weight-bold" | "--font-text-xs-size" | "--font-text-sm-size" | "--font-text-md-size" | "--font-text-lg-size" | "--font-heading-xs-size" | "--font-heading-sm-size" | "--font-heading-md-size" | "--font-heading-lg-size" | "--font-heading-xl-size" | "--font-heading-2xl-size" | "--font-heading-3xl-size" | "--font-text-xs-line-height" | "--font-text-sm-line-height" | "--font-text-md-line-height" | "--font-text-lg-line-height" | "--font-heading-xs-line-height" | "--font-heading-sm-line-height" | "--font-heading-md-line-height" | "--font-heading-lg-line-height" | "--font-heading-xl-line-height" | "--font-heading-2xl-line-height" | "--font-heading-3xl-line-height" | "--border-radius-xs" | "--border-radius-sm" | "--border-radius-md" | "--border-radius-lg" | "--border-radius-xl" | "--border-radius-full" | "--border-width-regular" | "--shadow-hairline" | "--shadow-sm" | "--shadow-md" | "--shadow-lg";
32
+ /**
33
+ * @description Style variables for theming MCP apps.
34
+ *
35
+ * Individual style keys are optional - hosts may provide any subset of these values.
36
+ * Values are strings containing CSS values (colors, sizes, font stacks, etc.).
37
+ *
38
+ * Note: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`
39
+ * for compatibility with Zod schema generation. Both are functionally equivalent for validation.
40
+ */
41
+ export type McpUiStyles = Record<McpUiStyleVariableKey, string | undefined>;
42
+ /**
43
+ * @description Request to open an external URL in the host's default browser.
44
+ * @see {@link app!App.openLink `App.openLink`} for the method that sends this request
45
+ */
46
+ export interface McpUiOpenLinkRequest {
47
+ method: "ui/open-link";
48
+ params: {
49
+ /** @description URL to open in the host's browser */
50
+ url: string;
51
+ };
52
+ }
53
+ /**
54
+ * @description Result from opening a URL.
55
+ * @see {@link McpUiOpenLinkRequest `McpUiOpenLinkRequest`}
56
+ */
57
+ export interface McpUiOpenLinkResult {
58
+ /** @description True if the host failed to open the URL (e.g., due to security policy). */
59
+ isError?: boolean;
60
+ /**
61
+ * Additional result properties are preserved for protocol extensibility.
62
+ * The generated schema uses passthrough() to allow them.
63
+ */
64
+ [key: string]: unknown;
65
+ }
66
+ /**
67
+ * @description Request to download a file through the host.
68
+ *
69
+ * Sent from the View to the Host when the app wants to trigger a file download.
70
+ * Since MCP Apps run in sandboxed iframes where direct downloads are blocked,
71
+ * this provides a host-mediated mechanism for file exports.
72
+ * The host SHOULD show a confirmation dialog before initiating the download.
73
+ *
74
+ * @see {@link app!App.downloadFile `App.downloadFile`} for the method that sends this request
75
+ */
76
+ export interface McpUiDownloadFileRequest {
77
+ method: "ui/download-file";
78
+ params: {
79
+ /** @description Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types. */
80
+ contents: (EmbeddedResource | ResourceLink)[];
81
+ };
82
+ }
83
+ /**
84
+ * @description Result from a file download request.
85
+ * @see {@link McpUiDownloadFileRequest `McpUiDownloadFileRequest`}
86
+ */
87
+ export interface McpUiDownloadFileResult {
88
+ /** @description True if the download failed (e.g., user cancelled or host denied). */
89
+ isError?: boolean;
90
+ /**
91
+ * Additional result properties are preserved for protocol extensibility.
92
+ * The generated schema uses passthrough() to allow them.
93
+ */
94
+ [key: string]: unknown;
95
+ }
96
+ /**
97
+ * @description Request to send a message to the host's chat interface.
98
+ * @see {@link app!App.sendMessage `App.sendMessage`} for the method that sends this request
99
+ */
100
+ export interface McpUiMessageRequest {
101
+ method: "ui/message";
102
+ params: {
103
+ /** @description Message role, currently only "user" is supported. */
104
+ role: "user";
105
+ /** @description Message content blocks (text, image, etc.). */
106
+ content: ContentBlock[];
107
+ };
108
+ }
109
+ /**
110
+ * @description Result from sending a message.
111
+ * @see {@link McpUiMessageRequest `McpUiMessageRequest`}
112
+ */
113
+ export interface McpUiMessageResult {
114
+ /** @description True if the host rejected or failed to deliver the message. */
115
+ isError?: boolean;
116
+ /**
117
+ * Additional result properties are preserved for protocol extensibility.
118
+ * The generated schema uses passthrough() to allow them.
119
+ */
120
+ [key: string]: unknown;
121
+ }
122
+ /**
123
+ * @description Notification that the sandbox proxy iframe is ready to receive content.
124
+ * @internal
125
+ * @see https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx#sandbox-proxy
126
+ */
127
+ export interface McpUiSandboxProxyReadyNotification {
128
+ method: "ui/notifications/sandbox-proxy-ready";
129
+ params: {};
130
+ }
131
+ /**
132
+ * @description Notification containing HTML resource for the sandbox proxy to load.
133
+ * @internal
134
+ * @see https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx#sandbox-proxy
135
+ */
136
+ export interface McpUiSandboxResourceReadyNotification {
137
+ method: "ui/notifications/sandbox-resource-ready";
138
+ params: {
139
+ /** @description HTML content to load into the inner iframe. */
140
+ html: string;
141
+ /** @description Optional override for the inner iframe's sandbox attribute. */
142
+ sandbox?: string;
143
+ /** @description CSP configuration from resource metadata. */
144
+ csp?: McpUiResourceCsp;
145
+ /** @description Sandbox permissions from resource metadata. */
146
+ permissions?: McpUiResourcePermissions;
147
+ };
148
+ }
149
+ /**
150
+ * @description Notification of UI size changes (View -> Host).
151
+ * @see {@link app!App.sendSizeChanged `App.sendSizeChanged`} for the method to send this from View
152
+ */
153
+ export interface McpUiSizeChangedNotification {
154
+ method: "ui/notifications/size-changed";
155
+ params: {
156
+ /** @description New width in pixels. */
157
+ width?: number;
158
+ /** @description New height in pixels. */
159
+ height?: number;
160
+ };
161
+ }
162
+ /**
163
+ * @description Notification containing complete tool arguments (Host -> View).
164
+ */
165
+ export interface McpUiToolInputNotification {
166
+ method: "ui/notifications/tool-input";
167
+ params: {
168
+ /** @description Complete tool call arguments as key-value pairs. */
169
+ arguments?: Record<string, unknown>;
170
+ };
171
+ }
172
+ /**
173
+ * @description Notification containing partial/streaming tool arguments (Host -> View).
174
+ */
175
+ export interface McpUiToolInputPartialNotification {
176
+ method: "ui/notifications/tool-input-partial";
177
+ params: {
178
+ /** @description Partial tool call arguments (incomplete, may change). */
179
+ arguments?: Record<string, unknown>;
180
+ };
181
+ }
182
+ /**
183
+ * @description Notification containing tool execution result (Host -> View).
184
+ */
185
+ export interface McpUiToolResultNotification {
186
+ method: "ui/notifications/tool-result";
187
+ /** @description Standard MCP tool execution result. */
188
+ params: CallToolResult;
189
+ }
190
+ /**
191
+ * @description Notification that tool execution was cancelled (Host -> View).
192
+ * Host MUST send this if tool execution was cancelled for any reason (user action,
193
+ * sampling error, classifier intervention, etc.).
194
+ */
195
+ export interface McpUiToolCancelledNotification {
196
+ method: "ui/notifications/tool-cancelled";
197
+ params: {
198
+ /** @description Optional reason for the cancellation (e.g., "user action", "timeout"). */
199
+ reason?: string;
200
+ };
201
+ }
202
+ /**
203
+ * @description CSS blocks that can be injected by apps.
204
+ */
205
+ export interface McpUiHostCss {
206
+ /** @description CSS for font loading (`@font-face` rules or `@import` statements). Apps must apply using {@link applyHostFonts `applyHostFonts`}. */
207
+ fonts?: string;
208
+ }
209
+ /**
210
+ * @description Style configuration for theming MCP apps.
211
+ */
212
+ export interface McpUiHostStyles {
213
+ /** @description CSS variables for theming the app. */
214
+ variables?: McpUiStyles;
215
+ /** @description CSS blocks that apps can inject. */
216
+ css?: McpUiHostCss;
217
+ }
218
+ /**
219
+ * @description Rich context about the host environment provided to views.
220
+ */
221
+ export interface McpUiHostContext {
222
+ /** @description Allow additional properties for forward compatibility. */
223
+ [key: string]: unknown;
224
+ /** @description Metadata of the tool call that instantiated this App. */
225
+ toolInfo?: {
226
+ /** @description JSON-RPC id of the tools/call request. */
227
+ id?: RequestId;
228
+ /** @description Tool definition including name, inputSchema, etc. */
229
+ tool: Tool;
230
+ };
231
+ /** @description Current color theme preference. */
232
+ theme?: McpUiTheme;
233
+ /** @description Style configuration for theming the app. */
234
+ styles?: McpUiHostStyles;
235
+ /** @description How the UI is currently displayed. */
236
+ displayMode?: McpUiDisplayMode;
237
+ /** @description Display modes the host supports. */
238
+ availableDisplayModes?: McpUiDisplayMode[];
239
+ /**
240
+ * @description Container dimensions. Represents the dimensions of the iframe or other
241
+ * container holding the app. Specify either width or maxWidth, and either height or maxHeight.
242
+ */
243
+ containerDimensions?: ({
244
+ /** @description Fixed container height in pixels. */
245
+ height: number;
246
+ } | {
247
+ /** @description Maximum container height in pixels. */
248
+ maxHeight?: number | undefined;
249
+ }) & ({
250
+ /** @description Fixed container width in pixels. */
251
+ width: number;
252
+ } | {
253
+ /** @description Maximum container width in pixels. */
254
+ maxWidth?: number | undefined;
255
+ });
256
+ /** @description User's language and region preference in BCP 47 format. */
257
+ locale?: string;
258
+ /** @description User's timezone in IANA format. */
259
+ timeZone?: string;
260
+ /** @description Host application identifier. */
261
+ userAgent?: string;
262
+ /** @description Platform type for responsive design decisions. */
263
+ platform?: "web" | "desktop" | "mobile";
264
+ /** @description Device input capabilities. */
265
+ deviceCapabilities?: {
266
+ /** @description Whether the device supports touch input. */
267
+ touch?: boolean;
268
+ /** @description Whether the device supports hover interactions. */
269
+ hover?: boolean;
270
+ };
271
+ /** @description Mobile safe area boundaries in pixels. */
272
+ safeAreaInsets?: {
273
+ /** @description Top safe area inset in pixels. */
274
+ top: number;
275
+ /** @description Right safe area inset in pixels. */
276
+ right: number;
277
+ /** @description Bottom safe area inset in pixels. */
278
+ bottom: number;
279
+ /** @description Left safe area inset in pixels. */
280
+ left: number;
281
+ };
282
+ }
283
+ /**
284
+ * @description Notification that host context has changed (Host -> View).
285
+ * @see {@link McpUiHostContext `McpUiHostContext`} for the full context structure
286
+ */
287
+ export interface McpUiHostContextChangedNotification {
288
+ method: "ui/notifications/host-context-changed";
289
+ /** @description Partial context update containing only changed fields. */
290
+ params: McpUiHostContext;
291
+ }
292
+ /**
293
+ * @description Request to update the agent's context without requiring a follow-up action (View -> Host).
294
+ *
295
+ * Unlike `notifications/message` which is for debugging/logging, this request is intended
296
+ * to update the Host's model context. Each request overwrites the previous context sent by the View.
297
+ * Unlike messages, context updates do not trigger follow-ups.
298
+ *
299
+ * The host will typically defer sending the context to the model until the next user message
300
+ * (including `ui/message`), and will only send the last update received.
301
+ *
302
+ * @see {@link app.App.updateModelContext `App.updateModelContext`} for the method that sends this request
303
+ */
304
+ export interface McpUiUpdateModelContextRequest {
305
+ method: "ui/update-model-context";
306
+ params: {
307
+ /** @description Context content blocks (text, image, etc.). */
308
+ content?: ContentBlock[];
309
+ /** @description Structured content for machine-readable context data. */
310
+ structuredContent?: Record<string, unknown>;
311
+ };
312
+ }
313
+ /**
314
+ * @description Request for graceful shutdown of the View (Host -> View).
315
+ * @see {@link app-bridge!AppBridge.teardownResource `AppBridge.teardownResource`} for the host method that sends this
316
+ */
317
+ export interface McpUiResourceTeardownRequest {
318
+ method: "ui/resource-teardown";
319
+ params: {};
320
+ }
321
+ /**
322
+ * @description Result from graceful shutdown request.
323
+ * @see {@link McpUiResourceTeardownRequest `McpUiResourceTeardownRequest`}
324
+ */
325
+ export interface McpUiResourceTeardownResult {
326
+ /**
327
+ * Additional result properties are preserved for protocol extensibility.
328
+ */
329
+ [key: string]: unknown;
330
+ }
331
+ export interface McpUiSupportedContentBlockModalities {
332
+ /** @description Host supports text content blocks. */
333
+ text?: {};
334
+ /** @description Host supports image content blocks. */
335
+ image?: {};
336
+ /** @description Host supports audio content blocks. */
337
+ audio?: {};
338
+ /** @description Host supports resource content blocks. */
339
+ resource?: {};
340
+ /** @description Host supports resource link content blocks. */
341
+ resourceLink?: {};
342
+ /** @description Host supports structured content. */
343
+ structuredContent?: {};
344
+ }
345
+ /**
346
+ * @description Notification for app-initiated teardown request (View -> Host).
347
+ * Views send this to request that the host tear them down. The host decides
348
+ * whether to proceed - if approved, the host will send
349
+ * `ui/resource-teardown` to allow the view to perform cleanup before being
350
+ * unmounted.
351
+ * @see {@link app.App.requestTeardown} for the app method that sends this
352
+ */
353
+ export interface McpUiRequestTeardownNotification {
354
+ method: "ui/notifications/request-teardown";
355
+ params?: {};
356
+ }
357
+ /**
358
+ * @description Capabilities supported by the host application.
359
+ * @see {@link McpUiInitializeResult `McpUiInitializeResult`} for the initialization result that includes these capabilities
360
+ */
361
+ export interface McpUiHostCapabilities {
362
+ /** @description Experimental features keyed by identifier. */
363
+ experimental?: Record<string, object>;
364
+ /** @description Host supports opening external URLs. */
365
+ openLinks?: {};
366
+ /** @description Host supports file downloads via ui/download-file. */
367
+ downloadFile?: {};
368
+ /** @description Host can proxy tool calls to the MCP server. */
369
+ serverTools?: {
370
+ /** @description Host supports tools/list_changed notifications. */
371
+ listChanged?: boolean;
372
+ };
373
+ /** @description Host can proxy resource reads to the MCP server. */
374
+ serverResources?: {
375
+ /** @description Host supports resources/list_changed notifications. */
376
+ listChanged?: boolean;
377
+ };
378
+ /** @description Host accepts log messages. */
379
+ logging?: {};
380
+ /** @description Sandbox configuration applied by the host. */
381
+ sandbox?: {
382
+ /** @description Permissions granted by the host (camera, microphone, geolocation). */
383
+ permissions?: McpUiResourcePermissions;
384
+ /** @description CSP domains approved by the host. */
385
+ csp?: McpUiResourceCsp;
386
+ };
387
+ /** @description Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns. */
388
+ updateModelContext?: McpUiSupportedContentBlockModalities;
389
+ /** @description Host supports receiving content messages (ui/message) from the view. */
390
+ message?: McpUiSupportedContentBlockModalities;
391
+ /**
392
+ * @description Host supports LLM sampling (sampling/createMessage) from the view.
393
+ * Mirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.
394
+ */
395
+ sampling?: {
396
+ /** @description Host supports tool use via `tools` and `toolChoice` parameters. */
397
+ tools?: {};
398
+ };
399
+ }
400
+ /**
401
+ * @description Capabilities provided by the View ({@link app!App `App`}).
402
+ * @see {@link McpUiInitializeRequest `McpUiInitializeRequest`} for the initialization request that includes these capabilities
403
+ */
404
+ export interface McpUiAppCapabilities {
405
+ /** @description Experimental features keyed by identifier. */
406
+ experimental?: Record<string, object>;
407
+ /** @description App exposes MCP-style tools that the host can call. */
408
+ tools?: {
409
+ /** @description App supports tools/list_changed notifications. */
410
+ listChanged?: boolean;
411
+ };
412
+ /** @description Display modes the app supports. */
413
+ availableDisplayModes?: McpUiDisplayMode[];
414
+ }
415
+ /**
416
+ * @description Initialization request sent from View to Host.
417
+ * @see {@link app!App.connect `App.connect`} for the method that sends this request
418
+ */
419
+ export interface McpUiInitializeRequest {
420
+ method: "ui/initialize";
421
+ params: {
422
+ /** @description App identification (name and version). */
423
+ appInfo: Implementation;
424
+ /** @description Features and capabilities this app provides. */
425
+ appCapabilities: McpUiAppCapabilities;
426
+ /** @description Protocol version this app supports. */
427
+ protocolVersion: string;
428
+ };
429
+ }
430
+ /**
431
+ * @description Initialization result returned from Host to View.
432
+ * @see {@link McpUiInitializeRequest `McpUiInitializeRequest`}
433
+ */
434
+ export interface McpUiInitializeResult {
435
+ /** @description Negotiated protocol version string (e.g., "2025-11-21"). */
436
+ protocolVersion: string;
437
+ /** @description Host application identification and version. */
438
+ hostInfo: Implementation;
439
+ /** @description Features and capabilities provided by the host. */
440
+ hostCapabilities: McpUiHostCapabilities;
441
+ /** @description Rich context about the host environment. */
442
+ hostContext: McpUiHostContext;
443
+ /**
444
+ * Additional result properties are preserved for protocol extensibility.
445
+ * The generated schema uses passthrough() to allow them.
446
+ */
447
+ [key: string]: unknown;
448
+ }
449
+ /**
450
+ * @description Notification that View has completed initialization (View -> Host).
451
+ * @see {@link app!App.connect `App.connect`} for the method that sends this notification
452
+ */
453
+ export interface McpUiInitializedNotification {
454
+ method: "ui/notifications/initialized";
455
+ params?: {};
456
+ }
457
+ /**
458
+ * @description Content Security Policy configuration for UI resources.
459
+ *
460
+ * Servers declare which origins their UI requires. Hosts use this to enforce appropriate CSP headers.
461
+ *
462
+ * > [!IMPORTANT]
463
+ * > MCP App HTML runs in a sandboxed iframe with no same-origin server.
464
+ * > **All** origins must be declared—including where your bundled JS/CSS is
465
+ * > served from (`localhost` in dev, your CDN in production).
466
+ */
467
+ export interface McpUiResourceCsp {
468
+ /**
469
+ * @description Origins for network requests (fetch/XHR/WebSocket).
470
+ *
471
+ * - Maps to CSP `connect-src` directive
472
+ * - Empty or omitted → no network connections (secure default)
473
+ *
474
+ * @example
475
+ * ```ts
476
+ * ["https://api.weather.com", "wss://realtime.service.com"]
477
+ * ```
478
+ */
479
+ connectDomains?: string[];
480
+ /**
481
+ * @description Origins for static resources (images, scripts, stylesheets, fonts, media).
482
+ *
483
+ * - Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives
484
+ * - Wildcard subdomains supported: `https://*.example.com`
485
+ * - Empty or omitted → no network resources (secure default)
486
+ *
487
+ * @example
488
+ * ```ts
489
+ * ["https://cdn.jsdelivr.net", "https://*.cloudflare.com"]
490
+ * ```
491
+ */
492
+ resourceDomains?: string[];
493
+ /**
494
+ * @description Origins for nested iframes.
495
+ *
496
+ * - Maps to CSP `frame-src` directive
497
+ * - Empty or omitted → no nested iframes allowed (`frame-src 'none'`)
498
+ *
499
+ * @example
500
+ * ```ts
501
+ * ["https://www.youtube.com", "https://player.vimeo.com"]
502
+ * ```
503
+ */
504
+ frameDomains?: string[];
505
+ /**
506
+ * @description Allowed base URIs for the document.
507
+ *
508
+ * - Maps to CSP `base-uri` directive
509
+ * - Empty or omitted → only same origin allowed (`base-uri 'self'`)
510
+ *
511
+ * @example
512
+ * ```ts
513
+ * ["https://cdn.example.com"]
514
+ * ```
515
+ */
516
+ baseUriDomains?: string[];
517
+ }
518
+ /**
519
+ * @description Sandbox permissions requested by the UI resource.
520
+ *
521
+ * Servers declare which browser capabilities their UI needs.
522
+ * Hosts MAY honor these by setting appropriate iframe `allow` attributes.
523
+ * Apps SHOULD NOT assume permissions are granted; use JS feature detection as fallback.
524
+ */
525
+ export interface McpUiResourcePermissions {
526
+ /**
527
+ * @description Request camera access.
528
+ *
529
+ * Maps to Permission Policy `camera` feature.
530
+ */
531
+ camera?: {};
532
+ /**
533
+ * @description Request microphone access.
534
+ *
535
+ * Maps to Permission Policy `microphone` feature.
536
+ */
537
+ microphone?: {};
538
+ /**
539
+ * @description Request geolocation access.
540
+ *
541
+ * Maps to Permission Policy `geolocation` feature.
542
+ */
543
+ geolocation?: {};
544
+ /**
545
+ * @description Request clipboard write access.
546
+ *
547
+ * Maps to Permission Policy `clipboard-write` feature.
548
+ */
549
+ clipboardWrite?: {};
550
+ }
551
+ /**
552
+ * @description UI Resource metadata for security and rendering configuration.
553
+ */
554
+ export interface McpUiResourceMeta {
555
+ /** @description Content Security Policy configuration for UI resources. */
556
+ csp?: McpUiResourceCsp;
557
+ /** @description Sandbox permissions requested by the UI resource. */
558
+ permissions?: McpUiResourcePermissions;
559
+ /**
560
+ * @description Dedicated origin for view sandbox.
561
+ *
562
+ * Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
563
+ *
564
+ * **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
565
+ * - Hash-based subdomains (e.g., `{hash}.claudemcpcontent.com`)
566
+ * - URL-derived subdomains (e.g., `www-example-com.oaiusercontent.com`)
567
+ *
568
+ * If omitted, host uses default sandbox origin (typically per-conversation).
569
+ *
570
+ * @example
571
+ * ```ts
572
+ * "a904794854a047f6.claudemcpcontent.com"
573
+ * ```
574
+ *
575
+ * @example
576
+ * ```ts
577
+ * "www-example-com.oaiusercontent.com"
578
+ * ```
579
+ */
580
+ domain?: string;
581
+ /**
582
+ * @description Visual boundary preference - true if view prefers a visible border.
583
+ *
584
+ * Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
585
+ *
586
+ * - `true`: request visible border + background
587
+ * - `false`: request no visible border + background
588
+ * - omitted: host decides border
589
+ */
590
+ prefersBorder?: boolean;
591
+ }
592
+ /**
593
+ * @description Request to change the display mode of the UI.
594
+ * The host will respond with the actual display mode that was set,
595
+ * which may differ from the requested mode if not supported.
596
+ * @see {@link app!App.requestDisplayMode `App.requestDisplayMode`} for the method that sends this request
597
+ */
598
+ export interface McpUiRequestDisplayModeRequest {
599
+ method: "ui/request-display-mode";
600
+ params: {
601
+ /** @description The display mode being requested. */
602
+ mode: McpUiDisplayMode;
603
+ };
604
+ }
605
+ /**
606
+ * @description Result from requesting a display mode change.
607
+ * @see {@link McpUiRequestDisplayModeRequest `McpUiRequestDisplayModeRequest`}
608
+ */
609
+ export interface McpUiRequestDisplayModeResult {
610
+ /** @description The display mode that was actually set. May differ from requested if not supported. */
611
+ mode: McpUiDisplayMode;
612
+ /**
613
+ * Additional result properties are preserved for protocol extensibility.
614
+ * Note: The generated schema uses passthrough() to allow additional properties.
615
+ */
616
+ [key: string]: unknown;
617
+ }
618
+ /**
619
+ * @description Tool visibility scope - who can access the tool.
620
+ */
621
+ export type McpUiToolVisibility = "model" | "app";
622
+ /**
623
+ * @description UI-related metadata for tools.
624
+ */
625
+ export interface McpUiToolMeta {
626
+ /**
627
+ * URI of the UI resource to display for this tool, if any.
628
+ *
629
+ * @example
630
+ * ```ts
631
+ * "ui://weather/view.html"
632
+ * ```
633
+ */
634
+ resourceUri?: string;
635
+ /**
636
+ * @description Who can access this tool. Default: ["model", "app"]
637
+ * - "model": Tool visible to and callable by the agent
638
+ * - "app": Tool callable by the app from this server only
639
+ */
640
+ visibility?: McpUiToolVisibility[];
641
+ /**
642
+ * `csp` belongs on the UI **resource** (see {@link McpUiResourceMeta}),
643
+ * not the tool. Hosts read it from the `resources/read` content item
644
+ * (with `resources/list` entry as fallback) and ignore it here.
645
+ */
646
+ csp?: never;
647
+ /**
648
+ * `permissions` belongs on the UI **resource** (see {@link McpUiResourceMeta}),
649
+ * not the tool. Hosts ignore it here.
650
+ */
651
+ permissions?: never;
652
+ }
653
+ /**
654
+ * Method string constants for MCP Apps protocol messages.
655
+ *
656
+ * These constants provide a type-safe way to check message methods without
657
+ * accessing internal Zod schema properties. External libraries should use
658
+ * these constants instead of accessing `schema.shape.method._def.values[0]`.
659
+ *
660
+ * @example
661
+ * ```typescript
662
+ * import { SANDBOX_PROXY_READY_METHOD } from '@modelcontextprotocol/ext-apps';
663
+ *
664
+ * if (event.data.method === SANDBOX_PROXY_READY_METHOD) {
665
+ * // Handle sandbox proxy ready notification
666
+ * }
667
+ * ```
668
+ */
669
+ export declare const OPEN_LINK_METHOD: McpUiOpenLinkRequest["method"];
670
+ export declare const DOWNLOAD_FILE_METHOD: McpUiDownloadFileRequest["method"];
671
+ export declare const MESSAGE_METHOD: McpUiMessageRequest["method"];
672
+ export declare const SANDBOX_PROXY_READY_METHOD: McpUiSandboxProxyReadyNotification["method"];
673
+ export declare const SANDBOX_RESOURCE_READY_METHOD: McpUiSandboxResourceReadyNotification["method"];
674
+ export declare const SIZE_CHANGED_METHOD: McpUiSizeChangedNotification["method"];
675
+ export declare const TOOL_INPUT_METHOD: McpUiToolInputNotification["method"];
676
+ export declare const TOOL_INPUT_PARTIAL_METHOD: McpUiToolInputPartialNotification["method"];
677
+ export declare const TOOL_RESULT_METHOD: McpUiToolResultNotification["method"];
678
+ export declare const TOOL_CANCELLED_METHOD: McpUiToolCancelledNotification["method"];
679
+ export declare const HOST_CONTEXT_CHANGED_METHOD: McpUiHostContextChangedNotification["method"];
680
+ export declare const REQUEST_TEARDOWN_METHOD: McpUiRequestTeardownNotification["method"];
681
+ export declare const RESOURCE_TEARDOWN_METHOD: McpUiResourceTeardownRequest["method"];
682
+ export declare const INITIALIZE_METHOD: McpUiInitializeRequest["method"];
683
+ export declare const INITIALIZED_METHOD: McpUiInitializedNotification["method"];
684
+ export declare const REQUEST_DISPLAY_MODE_METHOD: McpUiRequestDisplayModeRequest["method"];
685
+ /**
686
+ * @description MCP Apps capability settings advertised by clients to servers.
687
+ *
688
+ * Clients advertise these capabilities via the `extensions` field in their
689
+ * capabilities during MCP initialization. Servers can check for MCP Apps
690
+ * support using {@link server-helpers!getUiCapability}.
691
+ */
692
+ export interface McpUiClientCapabilities {
693
+ /**
694
+ * @description Array of supported MIME types for UI resources.
695
+ * Must include `"text/html;profile=mcp-app"` for MCP Apps support.
696
+ */
697
+ mimeTypes?: string[];
698
+ }