Skip to content

Commit 4704d5e

Browse files
committed
Merge branch 'main' into ochafik/fix-npm-opt-deps
2 parents ce7a8cc + 8428c68 commit 4704d5e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/types.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,3 +823,38 @@ type _VerifyInitializedNotification = VerifySchemaMatches<
823823
typeof McpUiInitializedNotificationSchema,
824824
McpUiInitializedNotification
825825
>;
826+
827+
// =============================================================================
828+
// UI Resource Metadata Types
829+
// =============================================================================
830+
831+
/**
832+
* Content Security Policy configuration for UI resources.
833+
*
834+
* Servers declare which external origins their UI needs to access.
835+
* Hosts use this to enforce appropriate CSP headers.
836+
*/
837+
export const McpUiResourceCspSchema = z.object({
838+
/** Origins for network requests (fetch/XHR/WebSocket). Maps to CSP connect-src */
839+
connectDomains: z.array(z.string()).optional(),
840+
/** Origins for static resources (images, scripts, stylesheets, fonts). Maps to CSP img-src, script-src, style-src, font-src */
841+
resourceDomains: z.array(z.string()).optional(),
842+
});
843+
export type McpUiResourceCsp = z.infer<typeof McpUiResourceCspSchema>;
844+
845+
/**
846+
* UI Resource metadata for security and rendering configuration.
847+
*
848+
* Included in the `_meta.ui` field of UI resource content returned via `resources/read`.
849+
*
850+
* @see {@link McpUiResourceCspSchema} for CSP configuration
851+
*/
852+
export const McpUiResourceMetaSchema = z.object({
853+
/** Content Security Policy configuration */
854+
csp: McpUiResourceCspSchema.optional(),
855+
/** Dedicated origin for widget sandbox */
856+
domain: z.string().optional(),
857+
/** Visual boundary preference - true if UI prefers a visible border */
858+
prefersBorder: z.boolean().optional(),
859+
});
860+
export type McpUiResourceMeta = z.infer<typeof McpUiResourceMetaSchema>;

0 commit comments

Comments
 (0)