feat: enhance sandbox capability negotiation (#158)
* feat: enhance sandbox capability negotiation * Update specification/draft/apps.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add all csp and permissions to host capabilities + update SEP * feat: add clipboard-write permission support Adds clipboardWrite to McpUiResourcePermissions for clipboard access. Maps to Permission Policy 'clipboard-write' feature. * rm files added by mistake * refactor: change McpUiResourcePermissions properties to empty objects * chore: remove scratch files and redundant cross-env dependency --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Olivier Chafik <ochafik@anthropic.com>
This commit is contained in:
parent
9f09932baf
commit
9acc52cb96
1 changed files with 496 additions and 16 deletions
56
src/generated/schema.ts
generated
56
src/generated/schema.ts
generated
|
|
@ -211,6 +211,40 @@ export const McpUiResourceCspSchema = z.object({
|
|||
.describe("Allowed base URIs for the document (base-uri directive)."),
|
||||
});
|
||||
|
||||
/**
|
||||
* @description Sandbox permissions requested by the UI resource.
|
||||
* Hosts MAY honor these by setting appropriate iframe `allow` attributes.
|
||||
* Apps SHOULD NOT assume permissions are granted; use JS feature detection as fallback.
|
||||
*/
|
||||
export const McpUiResourcePermissionsSchema = z.object({
|
||||
/** @description Request camera access (Permission Policy `camera` feature). */
|
||||
camera: z
|
||||
.object({})
|
||||
.optional()
|
||||
.describe("Request camera access (Permission Policy `camera` feature)."),
|
||||
/** @description Request microphone access (Permission Policy `microphone` feature). */
|
||||
microphone: z
|
||||
.object({})
|
||||
.optional()
|
||||
.describe(
|
||||
"Request microphone access (Permission Policy `microphone` feature).",
|
||||
),
|
||||
/** @description Request geolocation access (Permission Policy `geolocation` feature). */
|
||||
geolocation: z
|
||||
.object({})
|
||||
.optional()
|
||||
.describe(
|
||||
"Request geolocation access (Permission Policy `geolocation` feature).",
|
||||
),
|
||||
/** @description Request clipboard write access (Permission Policy `clipboard-write` feature). */
|
||||
clipboardWrite: z
|
||||
.object({})
|
||||
.optional()
|
||||
.describe(
|
||||
"Request clipboard write access (Permission Policy `clipboard-write` feature).",
|
||||
),
|
||||
});
|
||||
|
||||
/**
|
||||
* @description Notification of UI size changes (bidirectional: Guest <-> Host).
|
||||
* @see {@link app.App.sendSizeChanged} for the method to send this from Guest UI
|
||||
|
|
@ -363,6 +397,20 @@ export const McpUiHostCapabilitiesSchema = z.object({
|
|||
.describe("Host can proxy resource reads to the MCP server."),
|
||||
/** @description Host accepts log messages. */
|
||||
logging: z.object({}).optional().describe("Host accepts log messages."),
|
||||
/** @description Sandbox configuration applied by the host. */
|
||||
sandbox: z
|
||||
.object({
|
||||
/** @description Permissions granted by the host (camera, microphone, geolocation). */
|
||||
permissions: McpUiResourcePermissionsSchema.optional().describe(
|
||||
"Permissions granted by the host (camera, microphone, geolocation).",
|
||||
),
|
||||
/** @description CSP domains approved by the host. */
|
||||
csp: McpUiResourceCspSchema.optional().describe(
|
||||
"CSP domains approved by the host.",
|
||||
),
|
||||
})
|
||||
.optional()
|
||||
.describe("Sandbox configuration applied by the host."),
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -405,6 +453,10 @@ export const McpUiResourceMetaSchema = z.object({
|
|||
csp: McpUiResourceCspSchema.optional().describe(
|
||||
"Content Security Policy configuration.",
|
||||
),
|
||||
/** @description Sandbox permissions requested by the UI. */
|
||||
permissions: McpUiResourcePermissionsSchema.optional().describe(
|
||||
"Sandbox permissions requested by the UI.",
|
||||
),
|
||||
/** @description Dedicated origin for widget sandbox. */
|
||||
domain: z
|
||||
.string()
|
||||
|
|
@ -514,6 +566,10 @@ export const McpUiSandboxResourceReadyNotificationSchema = z.object({
|
|||
csp: McpUiResourceCspSchema.optional().describe(
|
||||
"CSP configuration from resource metadata.",
|
||||
),
|
||||
/** @description Sandbox permissions from resource metadata. */
|
||||
permissions: McpUiResourcePermissionsSchema.optional().describe(
|
||||
"Sandbox permissions from resource metadata.",
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue