Skip to content

Commit 217756e

Browse files
mcp: update SDK for SEP 973 + add to example server (#904)
Co-authored-by: David Soria Parra <[email protected]>
1 parent bf81793 commit 217756e

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

src/examples/server/simpleStreamableHttp.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ const strictOAuth = process.argv.includes('--oauth-strict');
2121
const getServer = () => {
2222
const server = new McpServer({
2323
name: 'simple-streamable-http-server',
24-
version: '1.0.0'
24+
version: '1.0.0',
25+
icons: [{src: './mcp.svg', sizes: '512x512', mimeType: 'image/svg+xml'}],
26+
websiteUrl: 'https://github.com/modelcontextprotocol/typescript-sdk',
2527
}, { capabilities: { logging: {} } });
2628

2729
// Register a simple tool that returns a greeting

src/types.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,26 @@ export const CancelledNotificationSchema = NotificationSchema.extend({
200200
});
201201

202202
/* Base Metadata */
203+
/**
204+
* Icon schema for use in tools, prompts, resources, and implementations.
205+
*/
206+
export const IconSchema = z
207+
.object({
208+
/**
209+
* URL or data URI for the icon.
210+
*/
211+
src: z.string(),
212+
/**
213+
* Optional MIME type for the icon.
214+
*/
215+
mimeType: z.optional(z.string()),
216+
/**
217+
* Optional string specifying icon dimensions (e.g., "48x48 96x96").
218+
*/
219+
sizes: z.optional(z.string()),
220+
})
221+
.passthrough();
222+
203223
/**
204224
* Base metadata interface for common properties across resources, tools, prompts, and implementations.
205225
*/
@@ -225,6 +245,19 @@ export const BaseMetadataSchema = z
225245
*/
226246
export const ImplementationSchema = BaseMetadataSchema.extend({
227247
version: z.string(),
248+
/**
249+
* An optional URL of the website for this implementation.
250+
*/
251+
websiteUrl: z.optional(z.string()),
252+
/**
253+
* An optional list of icons for this implementation.
254+
* This can be used by clients to display the implementation in a user interface.
255+
* Each icon should have a `kind` property that specifies whether it is a data representation or a URL source, a `src` property that points to the icon file or data representation, and may also include a `mimeType` and `sizes` property.
256+
* The `mimeType` property should be a valid MIME type for the icon file, such as "image/png" or "image/svg+xml".
257+
* The `sizes` property should be a string that specifies one or more sizes at which the icon file can be used, such as "48x48" or "any" for scalable formats like SVG.
258+
* The `sizes` property is optional, and if not provided, the client should assume that the icon can be used at any size.
259+
*/
260+
icons: z.optional(z.array(IconSchema)),
228261
});
229262

230263
/**
@@ -506,6 +539,11 @@ export const ResourceSchema = BaseMetadataSchema.extend({
506539
*/
507540
mimeType: z.optional(z.string()),
508541

542+
/**
543+
* An optional list of icons for this resource.
544+
*/
545+
icons: z.optional(z.array(IconSchema)),
546+
509547
/**
510548
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
511549
* for notes on _meta usage.
@@ -672,6 +710,10 @@ export const PromptSchema = BaseMetadataSchema.extend({
672710
* A list of arguments to use for templating the prompt.
673711
*/
674712
arguments: z.optional(z.array(PromptArgumentSchema)),
713+
/**
714+
* An optional list of icons for this prompt.
715+
*/
716+
icons: z.optional(z.array(IconSchema)),
675717
/**
676718
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
677719
* for notes on _meta usage.
@@ -930,6 +972,11 @@ export const ToolSchema = BaseMetadataSchema.extend({
930972
*/
931973
annotations: z.optional(ToolAnnotationsSchema),
932974

975+
/**
976+
* An optional list of icons for this tool.
977+
*/
978+
icons: z.optional(z.array(IconSchema)),
979+
933980
/**
934981
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
935982
* for notes on _meta usage.
@@ -1535,6 +1582,7 @@ export type EmptyResult = Infer<typeof EmptyResultSchema>;
15351582
export type CancelledNotification = Infer<typeof CancelledNotificationSchema>;
15361583

15371584
/* Base Metadata */
1585+
export type Icon = Infer<typeof IconSchema>;
15381586
export type BaseMetadata = Infer<typeof BaseMetadataSchema>;
15391587

15401588
/* Initialization */

0 commit comments

Comments
 (0)