From 2da52f15969c74473b4fa928207f96acba9c6ccd Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Tue, 21 Apr 2026 12:11:52 +0100 Subject: [PATCH 1/2] fix(types): forbid csp/permissions on McpUiToolMeta via never Hosts read _meta.ui.csp and _meta.ui.permissions from the resource (resources/read content item, with resources/list entry as fallback), never from the tool. Typing them as `never` on McpUiToolMeta gives TypeScript users a compile-time error pointing at McpUiResourceMeta instead of silently accepting and ignoring them. Companion to anthropics/apps#38705 (host-side console.warn). Refs anthropics/claude-ai-mcp#40. --- src/generated/schema.json | 6 ++++++ src/generated/schema.ts | 12 ++++++++++++ src/spec.types.ts | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/generated/schema.json b/src/generated/schema.json index d66e55760..8f54bf3bb 100644 --- a/src/generated/schema.json +++ b/src/generated/schema.json @@ -5274,6 +5274,12 @@ ], "description": "Tool visibility scope - who can access the tool." } + }, + "csp": { + "not": {} + }, + "permissions": { + "not": {} } }, "additionalProperties": false diff --git a/src/generated/schema.ts b/src/generated/schema.ts index aed1f9651..18584ffb3 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -712,6 +712,18 @@ export const McpUiToolMetaSchema = z.object({ .describe( 'Who can access this tool. Default: ["model", "app"]\n- "model": Tool visible to and callable by the agent\n- "app": Tool callable by the app from this server only', ), + /** + * `csp` belongs on the UI **resource** (see {@link McpUiResourceMeta}), + * not the tool. Hosts read it from the `resources/read` content item + * (with `resources/list` entry as fallback) and ignore it here. + * @see {@link https://github.com/anthropics/claude-ai-mcp/issues/40 claude-ai-mcp#40} + */ + csp: z.never().optional(), + /** + * `permissions` belongs on the UI **resource** (see {@link McpUiResourceMeta}), + * not the tool. Hosts ignore it here. + */ + permissions: z.never().optional(), }); /** diff --git a/src/spec.types.ts b/src/spec.types.ts index 9f83fa972..c5bfcfc84 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -775,6 +775,18 @@ export interface McpUiToolMeta { * - "app": Tool callable by the app from this server only */ visibility?: McpUiToolVisibility[]; + /** + * `csp` belongs on the UI **resource** (see {@link McpUiResourceMeta}), + * not the tool. Hosts read it from the `resources/read` content item + * (with `resources/list` entry as fallback) and ignore it here. + * @see {@link https://github.com/anthropics/claude-ai-mcp/issues/40 claude-ai-mcp#40} + */ + csp?: never; + /** + * `permissions` belongs on the UI **resource** (see {@link McpUiResourceMeta}), + * not the tool. Hosts ignore it here. + */ + permissions?: never; } /** From b185b1c007f7f2cdc93fe25c613b18623d561a2b Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Tue, 21 Apr 2026 13:35:15 +0100 Subject: [PATCH 2/2] drop misleading #40 link from McpUiToolMeta.csp JSDoc --- src/generated/schema.ts | 1 - src/spec.types.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/generated/schema.ts b/src/generated/schema.ts index 18584ffb3..60dd80841 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -716,7 +716,6 @@ export const McpUiToolMetaSchema = z.object({ * `csp` belongs on the UI **resource** (see {@link McpUiResourceMeta}), * not the tool. Hosts read it from the `resources/read` content item * (with `resources/list` entry as fallback) and ignore it here. - * @see {@link https://github.com/anthropics/claude-ai-mcp/issues/40 claude-ai-mcp#40} */ csp: z.never().optional(), /** diff --git a/src/spec.types.ts b/src/spec.types.ts index c5bfcfc84..02fb75cdb 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -779,7 +779,6 @@ export interface McpUiToolMeta { * `csp` belongs on the UI **resource** (see {@link McpUiResourceMeta}), * not the tool. Hosts read it from the `resources/read` content item * (with `resources/list` entry as fallback) and ignore it here. - * @see {@link https://github.com/anthropics/claude-ai-mcp/issues/40 claude-ai-mcp#40} */ csp?: never; /**