@modelcontextprotocol/ext-apps 0.1.0 → 0.2.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.
- package/README.md +1 -1
- package/dist/src/app-bridge.d.ts +310 -26
- package/dist/src/app-bridge.js +38 -25
- package/dist/src/app.d.ts +41 -9
- package/dist/src/app.js +38 -25
- package/dist/src/generated/schema.d.ts +101 -5
- package/dist/src/generated/schema.test.d.ts +8 -1
- package/dist/src/react/index.d.ts +4 -0
- package/dist/src/react/index.js +38 -25
- package/dist/src/react/useDocumentTheme.d.ts +46 -0
- package/dist/src/react/useHostStyles.d.ts +56 -0
- package/dist/src/server/index.d.ts +109 -0
- package/dist/src/server/index.js +42 -0
- package/dist/src/server/index.test.d.ts +1 -0
- package/dist/src/spec.types.d.ts +74 -1
- package/dist/src/styles.d.ts +89 -0
- package/dist/src/types.d.ts +31 -2
- package/package.json +51 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
2
|
/**
|
|
3
3
|
* @description Color theme preference for the host environment.
|
|
4
4
|
*/
|
|
@@ -7,6 +7,20 @@ export declare const McpUiThemeSchema: z.ZodUnion<readonly [z.ZodLiteral<"light"
|
|
|
7
7
|
* @description Display mode for UI presentation.
|
|
8
8
|
*/
|
|
9
9
|
export declare const McpUiDisplayModeSchema: z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>;
|
|
10
|
+
/**
|
|
11
|
+
* @description CSS variable keys available to MCP apps for theming.
|
|
12
|
+
*/
|
|
13
|
+
export declare const McpUiStyleVariableKeySchema: z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>;
|
|
14
|
+
/**
|
|
15
|
+
* @description Style variables for theming MCP apps.
|
|
16
|
+
*
|
|
17
|
+
* Individual style keys are optional - hosts may provide any subset of these values.
|
|
18
|
+
* Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
19
|
+
*
|
|
20
|
+
* Note: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`
|
|
21
|
+
* for compatibility with Zod schema generation. Both are functionally equivalent for validation.
|
|
22
|
+
*/
|
|
23
|
+
export declare const McpUiStylesSchema: z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>, z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>;
|
|
10
24
|
/**
|
|
11
25
|
* @description Request to open an external URL in the host's default browser.
|
|
12
26
|
* @see {@link app.App.sendOpenLink} for the method that sends this request
|
|
@@ -98,9 +112,15 @@ export declare const McpUiToolCancelledNotificationSchema: z.ZodObject<{
|
|
|
98
112
|
reason: z.ZodOptional<z.ZodString>;
|
|
99
113
|
}, z.core.$strip>;
|
|
100
114
|
}, z.core.$strip>;
|
|
115
|
+
/**
|
|
116
|
+
* @description Style configuration for theming MCP apps.
|
|
117
|
+
*/
|
|
118
|
+
export declare const McpUiHostStylesSchema: z.ZodObject<{
|
|
119
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>, z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
101
121
|
/**
|
|
102
122
|
* @description Request for graceful shutdown of the Guest UI (Host -> Guest UI).
|
|
103
|
-
* @see {@link app-bridge.AppBridge.
|
|
123
|
+
* @see {@link app-bridge.AppBridge.teardownResource} for the host method that sends this
|
|
104
124
|
*/
|
|
105
125
|
export declare const McpUiResourceTeardownRequestSchema: z.ZodObject<{
|
|
106
126
|
method: z.ZodLiteral<"ui/resource-teardown">;
|
|
@@ -162,6 +182,37 @@ export declare const McpUiResourceMetaSchema: z.ZodObject<{
|
|
|
162
182
|
domain: z.ZodOptional<z.ZodString>;
|
|
163
183
|
prefersBorder: z.ZodOptional<z.ZodBoolean>;
|
|
164
184
|
}, z.core.$strip>;
|
|
185
|
+
/**
|
|
186
|
+
* @description Request to change the display mode of the UI.
|
|
187
|
+
* The host will respond with the actual display mode that was set,
|
|
188
|
+
* which may differ from the requested mode if not supported.
|
|
189
|
+
* @see {@link app.App.requestDisplayMode} for the method that sends this request
|
|
190
|
+
*/
|
|
191
|
+
export declare const McpUiRequestDisplayModeRequestSchema: z.ZodObject<{
|
|
192
|
+
method: z.ZodLiteral<"ui/request-display-mode">;
|
|
193
|
+
params: z.ZodObject<{
|
|
194
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
/**
|
|
198
|
+
* @description Result from requesting a display mode change.
|
|
199
|
+
* @see {@link McpUiRequestDisplayModeRequest}
|
|
200
|
+
*/
|
|
201
|
+
export declare const McpUiRequestDisplayModeResultSchema: z.ZodObject<{
|
|
202
|
+
/** @description The display mode that was actually set. May differ from requested if not supported. */
|
|
203
|
+
mode: z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>;
|
|
204
|
+
}, z.core.$loose>;
|
|
205
|
+
/**
|
|
206
|
+
* @description Tool visibility scope - who can access the tool.
|
|
207
|
+
*/
|
|
208
|
+
export declare const McpUiToolVisibilitySchema: z.ZodUnion<readonly [z.ZodLiteral<"model">, z.ZodLiteral<"app">]>;
|
|
209
|
+
/**
|
|
210
|
+
* @description UI-related metadata for tools.
|
|
211
|
+
*/
|
|
212
|
+
export declare const McpUiToolMetaSchema: z.ZodObject<{
|
|
213
|
+
resourceUri: z.ZodString;
|
|
214
|
+
visibility: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"model">, z.ZodLiteral<"app">]>>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
165
216
|
/**
|
|
166
217
|
* @description Request to send a message to the host's chat interface.
|
|
167
218
|
* @see {@link app.App.sendMessage} for the method that sends this request
|
|
@@ -355,6 +406,7 @@ export declare const McpUiToolResultNotificationSchema: z.ZodObject<{
|
|
|
355
406
|
* @description Rich context about the host environment provided to Guest UIs.
|
|
356
407
|
*/
|
|
357
408
|
export declare const McpUiHostContextSchema: z.ZodObject<{
|
|
409
|
+
/** @description Metadata of the tool call that instantiated this App. */
|
|
358
410
|
toolInfo: z.ZodOptional<z.ZodObject<{
|
|
359
411
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
360
412
|
tool: z.ZodObject<{
|
|
@@ -393,30 +445,44 @@ export declare const McpUiHostContextSchema: z.ZodObject<{
|
|
|
393
445
|
title: z.ZodOptional<z.ZodString>;
|
|
394
446
|
}, z.core.$strip>;
|
|
395
447
|
}, z.core.$strip>>;
|
|
448
|
+
/** @description Current color theme preference. */
|
|
396
449
|
theme: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"light">, z.ZodLiteral<"dark">]>>;
|
|
450
|
+
/** @description Style configuration for theming the app. */
|
|
451
|
+
styles: z.ZodOptional<z.ZodObject<{
|
|
452
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>, z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>>;
|
|
453
|
+
}, z.core.$strip>>;
|
|
454
|
+
/** @description How the UI is currently displayed. */
|
|
397
455
|
displayMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>>;
|
|
456
|
+
/** @description Display modes the host supports. */
|
|
398
457
|
availableDisplayModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
458
|
+
/** @description Current and maximum dimensions available to the UI. */
|
|
399
459
|
viewport: z.ZodOptional<z.ZodObject<{
|
|
400
460
|
width: z.ZodNumber;
|
|
401
461
|
height: z.ZodNumber;
|
|
402
462
|
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
403
463
|
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
404
464
|
}, z.core.$strip>>;
|
|
465
|
+
/** @description User's language and region preference in BCP 47 format. */
|
|
405
466
|
locale: z.ZodOptional<z.ZodString>;
|
|
467
|
+
/** @description User's timezone in IANA format. */
|
|
406
468
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
469
|
+
/** @description Host application identifier. */
|
|
407
470
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
471
|
+
/** @description Platform type for responsive design decisions. */
|
|
408
472
|
platform: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"web">, z.ZodLiteral<"desktop">, z.ZodLiteral<"mobile">]>>;
|
|
473
|
+
/** @description Device input capabilities. */
|
|
409
474
|
deviceCapabilities: z.ZodOptional<z.ZodObject<{
|
|
410
475
|
touch: z.ZodOptional<z.ZodBoolean>;
|
|
411
476
|
hover: z.ZodOptional<z.ZodBoolean>;
|
|
412
477
|
}, z.core.$strip>>;
|
|
478
|
+
/** @description Mobile safe area boundaries in pixels. */
|
|
413
479
|
safeAreaInsets: z.ZodOptional<z.ZodObject<{
|
|
414
480
|
top: z.ZodNumber;
|
|
415
481
|
right: z.ZodNumber;
|
|
416
482
|
bottom: z.ZodNumber;
|
|
417
483
|
left: z.ZodNumber;
|
|
418
484
|
}, z.core.$strip>>;
|
|
419
|
-
}, z.core.$
|
|
485
|
+
}, z.core.$loose>;
|
|
420
486
|
/**
|
|
421
487
|
* @description Notification that host context has changed (Host -> Guest UI).
|
|
422
488
|
* @see {@link McpUiHostContext} for the full context structure
|
|
@@ -424,6 +490,7 @@ export declare const McpUiHostContextSchema: z.ZodObject<{
|
|
|
424
490
|
export declare const McpUiHostContextChangedNotificationSchema: z.ZodObject<{
|
|
425
491
|
method: z.ZodLiteral<"ui/notifications/host-context-changed">;
|
|
426
492
|
params: z.ZodObject<{
|
|
493
|
+
/** @description Metadata of the tool call that instantiated this App. */
|
|
427
494
|
toolInfo: z.ZodOptional<z.ZodObject<{
|
|
428
495
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
429
496
|
tool: z.ZodObject<{
|
|
@@ -462,30 +529,44 @@ export declare const McpUiHostContextChangedNotificationSchema: z.ZodObject<{
|
|
|
462
529
|
title: z.ZodOptional<z.ZodString>;
|
|
463
530
|
}, z.core.$strip>;
|
|
464
531
|
}, z.core.$strip>>;
|
|
532
|
+
/** @description Current color theme preference. */
|
|
465
533
|
theme: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"light">, z.ZodLiteral<"dark">]>>;
|
|
534
|
+
/** @description Style configuration for theming the app. */
|
|
535
|
+
styles: z.ZodOptional<z.ZodObject<{
|
|
536
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>, z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>>;
|
|
537
|
+
}, z.core.$strip>>;
|
|
538
|
+
/** @description How the UI is currently displayed. */
|
|
466
539
|
displayMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>>;
|
|
540
|
+
/** @description Display modes the host supports. */
|
|
467
541
|
availableDisplayModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
542
|
+
/** @description Current and maximum dimensions available to the UI. */
|
|
468
543
|
viewport: z.ZodOptional<z.ZodObject<{
|
|
469
544
|
width: z.ZodNumber;
|
|
470
545
|
height: z.ZodNumber;
|
|
471
546
|
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
472
547
|
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
473
548
|
}, z.core.$strip>>;
|
|
549
|
+
/** @description User's language and region preference in BCP 47 format. */
|
|
474
550
|
locale: z.ZodOptional<z.ZodString>;
|
|
551
|
+
/** @description User's timezone in IANA format. */
|
|
475
552
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
553
|
+
/** @description Host application identifier. */
|
|
476
554
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
555
|
+
/** @description Platform type for responsive design decisions. */
|
|
477
556
|
platform: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"web">, z.ZodLiteral<"desktop">, z.ZodLiteral<"mobile">]>>;
|
|
557
|
+
/** @description Device input capabilities. */
|
|
478
558
|
deviceCapabilities: z.ZodOptional<z.ZodObject<{
|
|
479
559
|
touch: z.ZodOptional<z.ZodBoolean>;
|
|
480
560
|
hover: z.ZodOptional<z.ZodBoolean>;
|
|
481
561
|
}, z.core.$strip>>;
|
|
562
|
+
/** @description Mobile safe area boundaries in pixels. */
|
|
482
563
|
safeAreaInsets: z.ZodOptional<z.ZodObject<{
|
|
483
564
|
top: z.ZodNumber;
|
|
484
565
|
right: z.ZodNumber;
|
|
485
566
|
bottom: z.ZodNumber;
|
|
486
567
|
left: z.ZodNumber;
|
|
487
568
|
}, z.core.$strip>>;
|
|
488
|
-
}, z.core.$
|
|
569
|
+
}, z.core.$loose>;
|
|
489
570
|
}, z.core.$strip>;
|
|
490
571
|
/**
|
|
491
572
|
* @description Initialization request sent from Guest UI to Host.
|
|
@@ -547,6 +628,7 @@ export declare const McpUiInitializeResultSchema: z.ZodObject<{
|
|
|
547
628
|
}, z.core.$strip>;
|
|
548
629
|
/** @description Rich context about the host environment. */
|
|
549
630
|
hostContext: z.ZodObject<{
|
|
631
|
+
/** @description Metadata of the tool call that instantiated this App. */
|
|
550
632
|
toolInfo: z.ZodOptional<z.ZodObject<{
|
|
551
633
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
552
634
|
tool: z.ZodObject<{
|
|
@@ -585,28 +667,42 @@ export declare const McpUiInitializeResultSchema: z.ZodObject<{
|
|
|
585
667
|
title: z.ZodOptional<z.ZodString>;
|
|
586
668
|
}, z.core.$strip>;
|
|
587
669
|
}, z.core.$strip>>;
|
|
670
|
+
/** @description Current color theme preference. */
|
|
588
671
|
theme: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"light">, z.ZodLiteral<"dark">]>>;
|
|
672
|
+
/** @description Style configuration for theming the app. */
|
|
673
|
+
styles: z.ZodOptional<z.ZodObject<{
|
|
674
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"--color-background-primary">, z.ZodLiteral<"--color-background-secondary">, z.ZodLiteral<"--color-background-tertiary">, z.ZodLiteral<"--color-background-inverse">, z.ZodLiteral<"--color-background-ghost">, z.ZodLiteral<"--color-background-info">, z.ZodLiteral<"--color-background-danger">, z.ZodLiteral<"--color-background-success">, z.ZodLiteral<"--color-background-warning">, z.ZodLiteral<"--color-background-disabled">, z.ZodLiteral<"--color-text-primary">, z.ZodLiteral<"--color-text-secondary">, z.ZodLiteral<"--color-text-tertiary">, z.ZodLiteral<"--color-text-inverse">, z.ZodLiteral<"--color-text-info">, z.ZodLiteral<"--color-text-danger">, z.ZodLiteral<"--color-text-success">, z.ZodLiteral<"--color-text-warning">, z.ZodLiteral<"--color-text-disabled">, z.ZodLiteral<"--color-border-primary">, z.ZodLiteral<"--color-border-secondary">, z.ZodLiteral<"--color-border-tertiary">, z.ZodLiteral<"--color-border-inverse">, z.ZodLiteral<"--color-border-ghost">, z.ZodLiteral<"--color-border-info">, z.ZodLiteral<"--color-border-danger">, z.ZodLiteral<"--color-border-success">, z.ZodLiteral<"--color-border-warning">, z.ZodLiteral<"--color-border-disabled">, z.ZodLiteral<"--color-ring-primary">, z.ZodLiteral<"--color-ring-secondary">, z.ZodLiteral<"--color-ring-inverse">, z.ZodLiteral<"--color-ring-info">, z.ZodLiteral<"--color-ring-danger">, z.ZodLiteral<"--color-ring-success">, z.ZodLiteral<"--color-ring-warning">, z.ZodLiteral<"--font-sans">, z.ZodLiteral<"--font-mono">, z.ZodLiteral<"--font-weight-normal">, z.ZodLiteral<"--font-weight-medium">, z.ZodLiteral<"--font-weight-semibold">, z.ZodLiteral<"--font-weight-bold">, z.ZodLiteral<"--font-text-xs-size">, z.ZodLiteral<"--font-text-sm-size">, z.ZodLiteral<"--font-text-md-size">, z.ZodLiteral<"--font-text-lg-size">, z.ZodLiteral<"--font-heading-xs-size">, z.ZodLiteral<"--font-heading-sm-size">, z.ZodLiteral<"--font-heading-md-size">, z.ZodLiteral<"--font-heading-lg-size">, z.ZodLiteral<"--font-heading-xl-size">, z.ZodLiteral<"--font-heading-2xl-size">, z.ZodLiteral<"--font-heading-3xl-size">, z.ZodLiteral<"--font-text-xs-line-height">, z.ZodLiteral<"--font-text-sm-line-height">, z.ZodLiteral<"--font-text-md-line-height">, z.ZodLiteral<"--font-text-lg-line-height">, z.ZodLiteral<"--font-heading-xs-line-height">, z.ZodLiteral<"--font-heading-sm-line-height">, z.ZodLiteral<"--font-heading-md-line-height">, z.ZodLiteral<"--font-heading-lg-line-height">, z.ZodLiteral<"--font-heading-xl-line-height">, z.ZodLiteral<"--font-heading-2xl-line-height">, z.ZodLiteral<"--font-heading-3xl-line-height">, z.ZodLiteral<"--border-radius-xs">, z.ZodLiteral<"--border-radius-sm">, z.ZodLiteral<"--border-radius-md">, z.ZodLiteral<"--border-radius-lg">, z.ZodLiteral<"--border-radius-xl">, z.ZodLiteral<"--border-radius-full">, z.ZodLiteral<"--border-width-regular">, z.ZodLiteral<"--shadow-hairline">, z.ZodLiteral<"--shadow-sm">, z.ZodLiteral<"--shadow-md">, z.ZodLiteral<"--shadow-lg">]>, z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>>;
|
|
675
|
+
}, z.core.$strip>>;
|
|
676
|
+
/** @description How the UI is currently displayed. */
|
|
589
677
|
displayMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inline">, z.ZodLiteral<"fullscreen">, z.ZodLiteral<"pip">]>>;
|
|
678
|
+
/** @description Display modes the host supports. */
|
|
590
679
|
availableDisplayModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
680
|
+
/** @description Current and maximum dimensions available to the UI. */
|
|
591
681
|
viewport: z.ZodOptional<z.ZodObject<{
|
|
592
682
|
width: z.ZodNumber;
|
|
593
683
|
height: z.ZodNumber;
|
|
594
684
|
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
595
685
|
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
596
686
|
}, z.core.$strip>>;
|
|
687
|
+
/** @description User's language and region preference in BCP 47 format. */
|
|
597
688
|
locale: z.ZodOptional<z.ZodString>;
|
|
689
|
+
/** @description User's timezone in IANA format. */
|
|
598
690
|
timeZone: z.ZodOptional<z.ZodString>;
|
|
691
|
+
/** @description Host application identifier. */
|
|
599
692
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
693
|
+
/** @description Platform type for responsive design decisions. */
|
|
600
694
|
platform: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"web">, z.ZodLiteral<"desktop">, z.ZodLiteral<"mobile">]>>;
|
|
695
|
+
/** @description Device input capabilities. */
|
|
601
696
|
deviceCapabilities: z.ZodOptional<z.ZodObject<{
|
|
602
697
|
touch: z.ZodOptional<z.ZodBoolean>;
|
|
603
698
|
hover: z.ZodOptional<z.ZodBoolean>;
|
|
604
699
|
}, z.core.$strip>>;
|
|
700
|
+
/** @description Mobile safe area boundaries in pixels. */
|
|
605
701
|
safeAreaInsets: z.ZodOptional<z.ZodObject<{
|
|
606
702
|
top: z.ZodNumber;
|
|
607
703
|
right: z.ZodNumber;
|
|
608
704
|
bottom: z.ZodNumber;
|
|
609
705
|
left: z.ZodNumber;
|
|
610
706
|
}, z.core.$strip>>;
|
|
611
|
-
}, z.core.$
|
|
707
|
+
}, z.core.$loose>;
|
|
612
708
|
}, z.core.$loose>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
2
|
import * as generated from "./schema.js";
|
|
3
3
|
export type McpUiThemeSchemaInferredType = z.infer<typeof generated.McpUiThemeSchema>;
|
|
4
4
|
export type McpUiDisplayModeSchemaInferredType = z.infer<typeof generated.McpUiDisplayModeSchema>;
|
|
5
|
+
export type McpUiStyleVariableKeySchemaInferredType = z.infer<typeof generated.McpUiStyleVariableKeySchema>;
|
|
6
|
+
export type McpUiStylesSchemaInferredType = z.infer<typeof generated.McpUiStylesSchema>;
|
|
5
7
|
export type McpUiOpenLinkRequestSchemaInferredType = z.infer<typeof generated.McpUiOpenLinkRequestSchema>;
|
|
6
8
|
export type McpUiOpenLinkResultSchemaInferredType = z.infer<typeof generated.McpUiOpenLinkResultSchema>;
|
|
7
9
|
export type McpUiMessageResultSchemaInferredType = z.infer<typeof generated.McpUiMessageResultSchema>;
|
|
@@ -11,6 +13,7 @@ export type McpUiSizeChangedNotificationSchemaInferredType = z.infer<typeof gene
|
|
|
11
13
|
export type McpUiToolInputNotificationSchemaInferredType = z.infer<typeof generated.McpUiToolInputNotificationSchema>;
|
|
12
14
|
export type McpUiToolInputPartialNotificationSchemaInferredType = z.infer<typeof generated.McpUiToolInputPartialNotificationSchema>;
|
|
13
15
|
export type McpUiToolCancelledNotificationSchemaInferredType = z.infer<typeof generated.McpUiToolCancelledNotificationSchema>;
|
|
16
|
+
export type McpUiHostStylesSchemaInferredType = z.infer<typeof generated.McpUiHostStylesSchema>;
|
|
14
17
|
export type McpUiResourceTeardownRequestSchemaInferredType = z.infer<typeof generated.McpUiResourceTeardownRequestSchema>;
|
|
15
18
|
export type McpUiResourceTeardownResultSchemaInferredType = z.infer<typeof generated.McpUiResourceTeardownResultSchema>;
|
|
16
19
|
export type McpUiHostCapabilitiesSchemaInferredType = z.infer<typeof generated.McpUiHostCapabilitiesSchema>;
|
|
@@ -18,6 +21,10 @@ export type McpUiAppCapabilitiesSchemaInferredType = z.infer<typeof generated.Mc
|
|
|
18
21
|
export type McpUiInitializedNotificationSchemaInferredType = z.infer<typeof generated.McpUiInitializedNotificationSchema>;
|
|
19
22
|
export type McpUiResourceCspSchemaInferredType = z.infer<typeof generated.McpUiResourceCspSchema>;
|
|
20
23
|
export type McpUiResourceMetaSchemaInferredType = z.infer<typeof generated.McpUiResourceMetaSchema>;
|
|
24
|
+
export type McpUiRequestDisplayModeRequestSchemaInferredType = z.infer<typeof generated.McpUiRequestDisplayModeRequestSchema>;
|
|
25
|
+
export type McpUiRequestDisplayModeResultSchemaInferredType = z.infer<typeof generated.McpUiRequestDisplayModeResultSchema>;
|
|
26
|
+
export type McpUiToolVisibilitySchemaInferredType = z.infer<typeof generated.McpUiToolVisibilitySchema>;
|
|
27
|
+
export type McpUiToolMetaSchemaInferredType = z.infer<typeof generated.McpUiToolMetaSchema>;
|
|
21
28
|
export type McpUiMessageRequestSchemaInferredType = z.infer<typeof generated.McpUiMessageRequestSchema>;
|
|
22
29
|
export type McpUiToolResultNotificationSchemaInferredType = z.infer<typeof generated.McpUiToolResultNotificationSchema>;
|
|
23
30
|
export type McpUiHostContextSchemaInferredType = z.infer<typeof generated.McpUiHostContextSchema>;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* ## Main Exports
|
|
10
10
|
*
|
|
11
11
|
* - {@link useApp} - React hook to create and connect an MCP App
|
|
12
|
+
* - {@link useHostStyleVariables} - React hook to apply host style variables and theme
|
|
13
|
+
* - {@link useDocumentTheme} - React hook for reactive document theme
|
|
12
14
|
* - {@link useAutoResize} - React hook for manual auto-resize control (rarely needed)
|
|
13
15
|
*
|
|
14
16
|
* @module @modelcontextprotocol/ext-apps/react
|
|
@@ -32,3 +34,5 @@
|
|
|
32
34
|
*/
|
|
33
35
|
export * from "./useApp";
|
|
34
36
|
export * from "./useAutoResize";
|
|
37
|
+
export * from "./useDocumentTheme";
|
|
38
|
+
export * from "./useHostStyles";
|