From e7a14da1f37f0ddfda9ed62ded7aa76c4a38451e Mon Sep 17 00:00:00 2001 From: Adam Jones Date: Mon, 29 Sep 2025 17:49:28 +0000 Subject: [PATCH] fix: change Icon.sizes from string to string[] Updates the Icon schema to match the MCP specification, which defines sizes as an array of strings rather than a single string. This allows icons to specify multiple size variants (e.g., ["48x48", "96x96"]). Also updates the example usage in simpleStreamableHttp.ts to use the new array format. --- src/examples/server/simpleStreamableHttp.ts | 2 +- src/types.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/examples/server/simpleStreamableHttp.ts b/src/examples/server/simpleStreamableHttp.ts index 6f1e20080..de420c1cc 100644 --- a/src/examples/server/simpleStreamableHttp.ts +++ b/src/examples/server/simpleStreamableHttp.ts @@ -22,7 +22,7 @@ const getServer = () => { const server = new McpServer({ name: 'simple-streamable-http-server', version: '1.0.0', - icons: [{src: './mcp.svg', sizes: '512x512', mimeType: 'image/svg+xml'}], + icons: [{src: './mcp.svg', sizes: ['512x512'], mimeType: 'image/svg+xml'}], websiteUrl: 'https://github.com/modelcontextprotocol/typescript-sdk', }, { capabilities: { logging: {} } }); diff --git a/src/types.ts b/src/types.ts index 262e3b623..9ca4e4d8a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -214,9 +214,11 @@ export const IconSchema = z */ mimeType: z.optional(z.string()), /** - * Optional string specifying icon dimensions (e.g., "48x48 96x96"). + * Optional array of strings that specify sizes at which the icon can be used. + * Each string should be in WxH format (e.g., "48x48", "96x96") or "any" for scalable formats like SVG. + * If not provided, the client should assume that the icon can be used at any size. */ - sizes: z.optional(z.string()), + sizes: z.optional(z.array(z.string())), }) .passthrough();