Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/examples/server/simpleStreamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const strictOAuth = process.argv.includes('--oauth-strict');
const getServer = () => {
const server = new McpServer({
name: 'simple-streamable-http-server',
version: '1.0.0'
version: '1.0.0',
icons: [{src: './mcp.svg', sizes: '512x512', mimeType: 'image/svg+xml'}],
websiteUrl: 'https://github.com/modelcontextprotocol/typescript-sdk',
}, { capabilities: { logging: {} } });

// Register a simple tool that returns a greeting
Expand Down
48 changes: 48 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,26 @@ export const CancelledNotificationSchema = NotificationSchema.extend({
});

/* Base Metadata */
/**
* Icon schema for use in tools, prompts, resources, and implementations.
*/
export const IconSchema = z
.object({
/**
* URL or data URI for the icon.
*/
src: z.string(),
/**
* Optional MIME type for the icon.
*/
mimeType: z.optional(z.string()),
/**
* Optional string specifying icon dimensions (e.g., "48x48 96x96").
*/
sizes: z.optional(z.string()),
})
.passthrough();

/**
* Base metadata interface for common properties across resources, tools, prompts, and implementations.
*/
Expand All @@ -225,6 +245,19 @@ export const BaseMetadataSchema = z
*/
export const ImplementationSchema = BaseMetadataSchema.extend({
version: z.string(),
/**
* An optional URL of the website for this implementation.
*/
websiteUrl: z.optional(z.string()),
/**
* An optional list of icons for this implementation.
* This can be used by clients to display the implementation in a user interface.
* 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.
* The `mimeType` property should be a valid MIME type for the icon file, such as "image/png" or "image/svg+xml".
* 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.
* The `sizes` property is optional, and if not provided, the client should assume that the icon can be used at any size.
*/
icons: z.optional(z.array(IconSchema)),
});

/**
Expand Down Expand Up @@ -506,6 +539,11 @@ export const ResourceSchema = BaseMetadataSchema.extend({
*/
mimeType: z.optional(z.string()),

/**
* An optional list of icons for this resource.
*/
icons: z.optional(z.array(IconSchema)),

/**
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
* for notes on _meta usage.
Expand Down Expand Up @@ -672,6 +710,10 @@ export const PromptSchema = BaseMetadataSchema.extend({
* A list of arguments to use for templating the prompt.
*/
arguments: z.optional(z.array(PromptArgumentSchema)),
/**
* An optional list of icons for this prompt.
*/
icons: z.optional(z.array(IconSchema)),
/**
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
* for notes on _meta usage.
Expand Down Expand Up @@ -930,6 +972,11 @@ export const ToolSchema = BaseMetadataSchema.extend({
*/
annotations: z.optional(ToolAnnotationsSchema),

/**
* An optional list of icons for this tool.
*/
icons: z.optional(z.array(IconSchema)),

/**
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
* for notes on _meta usage.
Expand Down Expand Up @@ -1535,6 +1582,7 @@ export type EmptyResult = Infer<typeof EmptyResultSchema>;
export type CancelledNotification = Infer<typeof CancelledNotificationSchema>;

/* Base Metadata */
export type Icon = Infer<typeof IconSchema>;
export type BaseMetadata = Infer<typeof BaseMetadataSchema>;

/* Initialization */
Expand Down