Skip to content

Commit 93dd4a6

Browse files
ochafikclaude
andcommitted
fix: add missing type exports for backwards compatibility
Added missing exports that existed in main: - McpUiTheme, McpUiThemeSchema - McpUiDisplayMode, McpUiDisplayModeSchema - McpUiResourceCsp, McpUiResourceCspSchema - McpUiResourceMeta, McpUiResourceMetaSchema Also fixed theme/displayMode to match original values: - theme: 'light' | 'dark' (removed 'system') - displayMode: 'inline' | 'fullscreen' | 'pip' (removed 'carousel') Verified: all 47 exports from main are preserved with compatible types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0b37d0c commit 93dd4a6

File tree

5 files changed

+214
-40
lines changed

5 files changed

+214
-40
lines changed

src/generated/schema.json

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@
2828
},
2929
"additionalProperties": false
3030
},
31+
"McpUiDisplayMode": {
32+
"$schema": "https://json-schema.org/draft/2020-12/schema",
33+
"description": "Display mode for UI presentation.",
34+
"anyOf": [
35+
{
36+
"type": "string",
37+
"const": "inline"
38+
},
39+
{
40+
"type": "string",
41+
"const": "fullscreen"
42+
},
43+
{
44+
"type": "string",
45+
"const": "pip"
46+
}
47+
]
48+
},
3149
"McpUiHostCapabilities": {
3250
"$schema": "https://json-schema.org/draft/2020-12/schema",
3351
"type": "object",
@@ -243,10 +261,6 @@
243261
{
244262
"type": "string",
245263
"const": "dark"
246-
},
247-
{
248-
"type": "string",
249-
"const": "system"
250264
}
251265
]
252266
},
@@ -264,10 +278,6 @@
264278
{
265279
"type": "string",
266280
"const": "pip"
267-
},
268-
{
269-
"type": "string",
270-
"const": "carousel"
271281
}
272282
]
273283
},
@@ -537,10 +547,6 @@
537547
{
538548
"type": "string",
539549
"const": "dark"
540-
},
541-
{
542-
"type": "string",
543-
"const": "system"
544550
}
545551
]
546552
},
@@ -558,10 +564,6 @@
558564
{
559565
"type": "string",
560566
"const": "pip"
561-
},
562-
{
563-
"type": "string",
564-
"const": "carousel"
565567
}
566568
]
567569
},
@@ -1013,10 +1015,6 @@
10131015
{
10141016
"type": "string",
10151017
"const": "dark"
1016-
},
1017-
{
1018-
"type": "string",
1019-
"const": "system"
10201018
}
10211019
]
10221020
},
@@ -1034,10 +1032,6 @@
10341032
{
10351033
"type": "string",
10361034
"const": "pip"
1037-
},
1038-
{
1039-
"type": "string",
1040-
"const": "carousel"
10411035
}
10421036
]
10431037
},
@@ -1551,6 +1545,63 @@
15511545
},
15521546
"additionalProperties": {}
15531547
},
1548+
"McpUiResourceCsp": {
1549+
"$schema": "https://json-schema.org/draft/2020-12/schema",
1550+
"type": "object",
1551+
"properties": {
1552+
"connectDomains": {
1553+
"description": "Origins for network requests (fetch/XHR/WebSocket).",
1554+
"type": "array",
1555+
"items": {
1556+
"type": "string"
1557+
}
1558+
},
1559+
"resourceDomains": {
1560+
"description": "Origins for static resources (scripts, images, styles, fonts).",
1561+
"type": "array",
1562+
"items": {
1563+
"type": "string"
1564+
}
1565+
}
1566+
},
1567+
"additionalProperties": false
1568+
},
1569+
"McpUiResourceMeta": {
1570+
"$schema": "https://json-schema.org/draft/2020-12/schema",
1571+
"type": "object",
1572+
"properties": {
1573+
"csp": {
1574+
"description": "Content Security Policy configuration.",
1575+
"type": "object",
1576+
"properties": {
1577+
"connectDomains": {
1578+
"description": "Origins for network requests (fetch/XHR/WebSocket).",
1579+
"type": "array",
1580+
"items": {
1581+
"type": "string"
1582+
}
1583+
},
1584+
"resourceDomains": {
1585+
"description": "Origins for static resources (scripts, images, styles, fonts).",
1586+
"type": "array",
1587+
"items": {
1588+
"type": "string"
1589+
}
1590+
}
1591+
},
1592+
"additionalProperties": false
1593+
},
1594+
"domain": {
1595+
"description": "Dedicated origin for widget sandbox.",
1596+
"type": "string"
1597+
},
1598+
"prefersBorder": {
1599+
"description": "Visual boundary preference - true if UI prefers a visible border.",
1600+
"type": "boolean"
1601+
}
1602+
},
1603+
"additionalProperties": false
1604+
},
15541605
"McpUiResourceTeardownRequest": {
15551606
"$schema": "https://json-schema.org/draft/2020-12/schema",
15561607
"type": "object",
@@ -1667,6 +1718,20 @@
16671718
"required": ["method", "params"],
16681719
"additionalProperties": false
16691720
},
1721+
"McpUiTheme": {
1722+
"$schema": "https://json-schema.org/draft/2020-12/schema",
1723+
"description": "Color theme preference for the host environment.",
1724+
"anyOf": [
1725+
{
1726+
"type": "string",
1727+
"const": "light"
1728+
},
1729+
{
1730+
"type": "string",
1731+
"const": "dark"
1732+
}
1733+
]
1734+
},
16701735
"McpUiToolInputNotification": {
16711736
"$schema": "https://json-schema.org/draft/2020-12/schema",
16721737
"type": "object",

src/generated/schema.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ function expectType<T>(_: T) {
1111
/* noop */
1212
}
1313

14+
export type McpUiThemeSchemaInferredType = z.infer<
15+
typeof generated.McpUiThemeSchema
16+
>;
17+
18+
export type McpUiDisplayModeSchemaInferredType = z.infer<
19+
typeof generated.McpUiDisplayModeSchema
20+
>;
21+
1422
export type McpUiOpenLinkRequestSchemaInferredType = z.infer<
1523
typeof generated.McpUiOpenLinkRequestSchema
1624
>;
@@ -63,6 +71,14 @@ export type McpUiInitializedNotificationSchemaInferredType = z.infer<
6371
typeof generated.McpUiInitializedNotificationSchema
6472
>;
6573

74+
export type McpUiResourceCspSchemaInferredType = z.infer<
75+
typeof generated.McpUiResourceCspSchema
76+
>;
77+
78+
export type McpUiResourceMetaSchemaInferredType = z.infer<
79+
typeof generated.McpUiResourceMetaSchema
80+
>;
81+
6682
export type McpUiMessageRequestSchemaInferredType = z.infer<
6783
typeof generated.McpUiMessageRequestSchema
6884
>;
@@ -87,6 +103,10 @@ export type McpUiInitializeResultSchemaInferredType = z.infer<
87103
typeof generated.McpUiInitializeResultSchema
88104
>;
89105

106+
expectType<spec.McpUiTheme>({} as McpUiThemeSchemaInferredType);
107+
expectType<McpUiThemeSchemaInferredType>({} as spec.McpUiTheme);
108+
expectType<spec.McpUiDisplayMode>({} as McpUiDisplayModeSchemaInferredType);
109+
expectType<McpUiDisplayModeSchemaInferredType>({} as spec.McpUiDisplayMode);
90110
expectType<spec.McpUiOpenLinkRequest>(
91111
{} as McpUiOpenLinkRequestSchemaInferredType,
92112
);
@@ -161,6 +181,10 @@ expectType<spec.McpUiInitializedNotification>(
161181
expectType<McpUiInitializedNotificationSchemaInferredType>(
162182
{} as spec.McpUiInitializedNotification,
163183
);
184+
expectType<spec.McpUiResourceCsp>({} as McpUiResourceCspSchemaInferredType);
185+
expectType<McpUiResourceCspSchemaInferredType>({} as spec.McpUiResourceCsp);
186+
expectType<spec.McpUiResourceMeta>({} as McpUiResourceMetaSchemaInferredType);
187+
expectType<McpUiResourceMetaSchemaInferredType>({} as spec.McpUiResourceMeta);
164188
expectType<spec.McpUiMessageRequest>(
165189
{} as McpUiMessageRequestSchemaInferredType,
166190
);

src/generated/schema.ts

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ import {
1010
ToolSchema,
1111
} from "@modelcontextprotocol/sdk/types.js";
1212

13+
/**
14+
* @description Color theme preference for the host environment.
15+
*/
16+
export const McpUiThemeSchema = z
17+
.union([z.literal("light"), z.literal("dark")])
18+
.describe("Color theme preference for the host environment.");
19+
20+
/**
21+
* @description Display mode for UI presentation.
22+
*/
23+
export const McpUiDisplayModeSchema = z
24+
.union([z.literal("inline"), z.literal("fullscreen"), z.literal("pip")])
25+
.describe("Display mode for UI presentation.");
26+
1327
/**
1428
* @description Request to open an external URL in the host's default browser.
1529
* @see {@link app.App.sendOpenLink} for the method that sends this request
@@ -237,6 +251,44 @@ export const McpUiInitializedNotificationSchema = z.object({
237251
params: z.object({}).optional(),
238252
});
239253

254+
/**
255+
* @description Content Security Policy configuration for UI resources.
256+
*/
257+
export const McpUiResourceCspSchema = z.object({
258+
/** @description Origins for network requests (fetch/XHR/WebSocket). */
259+
connectDomains: z
260+
.array(z.string())
261+
.optional()
262+
.describe("Origins for network requests (fetch/XHR/WebSocket)."),
263+
/** @description Origins for static resources (scripts, images, styles, fonts). */
264+
resourceDomains: z
265+
.array(z.string())
266+
.optional()
267+
.describe("Origins for static resources (scripts, images, styles, fonts)."),
268+
});
269+
270+
/**
271+
* @description UI Resource metadata for security and rendering configuration.
272+
*/
273+
export const McpUiResourceMetaSchema = z.object({
274+
/** @description Content Security Policy configuration. */
275+
csp: McpUiResourceCspSchema.optional().describe(
276+
"Content Security Policy configuration.",
277+
),
278+
/** @description Dedicated origin for widget sandbox. */
279+
domain: z
280+
.string()
281+
.optional()
282+
.describe("Dedicated origin for widget sandbox."),
283+
/** @description Visual boundary preference - true if UI prefers a visible border. */
284+
prefersBorder: z
285+
.boolean()
286+
.optional()
287+
.describe(
288+
"Visual boundary preference - true if UI prefers a visible border.",
289+
),
290+
});
291+
240292
/**
241293
* @description Request to send a message to the host's chat interface.
242294
* @see {@link app.App.sendMessage} for the method that sends this request
@@ -281,20 +333,13 @@ export const McpUiHostContextSchema = z.object({
281333
.optional()
282334
.describe("Metadata of the tool call that instantiated this App."),
283335
/** @description Current color theme preference. */
284-
theme: z
285-
.union([z.literal("light"), z.literal("dark"), z.literal("system")])
286-
.optional()
287-
.describe("Current color theme preference."),
336+
theme: McpUiThemeSchema.optional().describe(
337+
"Current color theme preference.",
338+
),
288339
/** @description How the UI is currently displayed. */
289-
displayMode: z
290-
.union([
291-
z.literal("inline"),
292-
z.literal("fullscreen"),
293-
z.literal("pip"),
294-
z.literal("carousel"),
295-
])
296-
.optional()
297-
.describe("How the UI is currently displayed."),
340+
displayMode: McpUiDisplayModeSchema.optional().describe(
341+
"How the UI is currently displayed.",
342+
),
298343
/** @description Display modes the host supports. */
299344
availableDisplayModes: z
300345
.array(z.string())

src/spec.types.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ import type {
2626
*/
2727
export const LATEST_PROTOCOL_VERSION = "2025-11-21";
2828

29+
/**
30+
* @description Color theme preference for the host environment.
31+
*/
32+
export type McpUiTheme = "light" | "dark";
33+
34+
/**
35+
* @description Display mode for UI presentation.
36+
*/
37+
export type McpUiDisplayMode = "inline" | "fullscreen" | "pip";
38+
2939
/**
3040
* @description Request to open an external URL in the host's default browser.
3141
* @see {@link app.App.sendOpenLink} for the method that sends this request
@@ -169,9 +179,9 @@ export interface McpUiHostContext {
169179
tool: Tool;
170180
};
171181
/** @description Current color theme preference. */
172-
theme?: "light" | "dark" | "system";
182+
theme?: McpUiTheme;
173183
/** @description How the UI is currently displayed. */
174-
displayMode?: "inline" | "fullscreen" | "pip" | "carousel";
184+
displayMode?: McpUiDisplayMode;
175185
/** @description Display modes the host supports. */
176186
availableDisplayModes?: string[];
177187
/** @description Current and maximum dimensions available to the UI. */
@@ -324,3 +334,25 @@ export interface McpUiInitializedNotification {
324334
method: "ui/notifications/initialized";
325335
params?: {};
326336
}
337+
338+
/**
339+
* @description Content Security Policy configuration for UI resources.
340+
*/
341+
export interface McpUiResourceCsp {
342+
/** @description Origins for network requests (fetch/XHR/WebSocket). */
343+
connectDomains?: string[];
344+
/** @description Origins for static resources (scripts, images, styles, fonts). */
345+
resourceDomains?: string[];
346+
}
347+
348+
/**
349+
* @description UI Resource metadata for security and rendering configuration.
350+
*/
351+
export interface McpUiResourceMeta {
352+
/** @description Content Security Policy configuration. */
353+
csp?: McpUiResourceCsp;
354+
/** @description Dedicated origin for widget sandbox. */
355+
domain?: string;
356+
/** @description Visual boundary preference - true if UI prefers a visible border. */
357+
prefersBorder?: boolean;
358+
}

0 commit comments

Comments
 (0)