Skip to content

Commit c04541b

Browse files
Patch SDK to support icons in tools/list response
The @modelcontextprotocol/sdk@1.25.1 includes type definitions for icons (SEP-973) but the runtime implementation was incomplete. The SDK's registerTool() and _createRegisteredTool() methods didn't process the icons field, and the listTools handler didn't include icons in responses. This patch adds: - Icon extraction in registerTool() config destructuring - Icon parameter to _createRegisteredTool() signature - Icon storage in registered tool objects - Icon support in tool update() method - Icon inclusion in tools/list response With this patch, all Mapbox tools now correctly display the Mapbox organization icon (https://avatars.githubusercontent.com/u/600935?s=200&v=4) in MCP clients like Claude Desktop, VS Code, Cursor, and the MCP Inspector. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 0999df8 commit c04541b

1 file changed

Lines changed: 58 additions & 2 deletions

File tree

patches/@modelcontextprotocol+sdk+1.25.1.patch

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,20 @@ index e10bb3d..2e99bee 100644
3232
}
3333
/**
3434
diff --git a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
35-
index 23639ce..7b8a325 100644
35+
index 23639ce..75f18b5 100644
3636
--- a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
3737
+++ b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
38-
@@ -194,15 +194,20 @@ export class McpServer {
38+
@@ -85,6 +85,9 @@ export class McpServer {
39+
execution: tool.execution,
40+
_meta: tool._meta
41+
};
42+
+ if (tool.icons) {
43+
+ toolDefinition.icons = tool.icons;
44+
+ }
45+
if (tool.outputSchema) {
46+
const obj = normalizeObjectSchema(tool.outputSchema);
47+
if (obj) {
48+
@@ -194,15 +197,20 @@ export class McpServer {
3949
return;
4050
}
4151
if (!result.structuredContent) {
@@ -64,3 +74,49 @@ index 23639ce..7b8a325 100644
6474
}
6575
}
6676
/**
77+
@@ -602,7 +610,7 @@ export class McpServer {
78+
}
79+
return registeredPrompt;
80+
}
81+
- _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {
82+
+ _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, icons, handler) {
83+
// Validate tool name according to SEP specification
84+
validateAndWarnToolName(name);
85+
const registeredTool = {
86+
@@ -613,6 +621,7 @@ export class McpServer {
87+
annotations,
88+
execution,
89+
_meta,
90+
+ icons,
91+
handler: handler,
92+
enabled: true,
93+
disable: () => registeredTool.update({ enabled: false }),
94+
@@ -641,6 +650,8 @@ export class McpServer {
95+
registeredTool.annotations = updates.annotations;
96+
if (typeof updates._meta !== 'undefined')
97+
registeredTool._meta = updates._meta;
98+
+ if (typeof updates.icons !== 'undefined')
99+
+ registeredTool.icons = updates.icons;
100+
if (typeof updates.enabled !== 'undefined')
101+
registeredTool.enabled = updates.enabled;
102+
this.sendToolListChanged();
103+
@@ -690,7 +701,7 @@ export class McpServer {
104+
}
105+
}
106+
const callback = rest[0];
107+
- return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback);
108+
+ return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, undefined, callback);
109+
}
110+
/**
111+
* Registers a tool with a config object and callback.
112+
@@ -699,8 +710,8 @@ export class McpServer {
113+
if (this._registeredTools[name]) {
114+
throw new Error(`Tool ${name} is already registered`);
115+
}
116+
- const { title, description, inputSchema, outputSchema, annotations, _meta } = config;
117+
- return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb);
118+
+ const { title, description, inputSchema, outputSchema, annotations, _meta, icons } = config;
119+
+ return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, icons, cb);
120+
}
121+
prompt(name, ...rest) {
122+
if (this._registeredPrompts[name]) {

0 commit comments

Comments
 (0)