Icon

data class Icon(val src: String, val mimeType: String? = null, val sizes: List<String>? = null, val theme: Icon.Theme? = null)(source)

An optionally sized icon that can be displayed in a user interface.

Icons help clients provide visual branding and identification for MCP implementations.

Security considerations:

  • Consumers SHOULD ensure URLs serving icons are from the same domain as the client/server or a trusted domain to prevent malicious content.

  • Consumers SHOULD take appropriate precautions when rendering SVGs as they can contain executable JavaScript. Consider sanitizing SVG content or rendering in isolated contexts.

Constructors

Link copied to clipboard
constructor(src: String, mimeType: String? = null, sizes: List<String>? = null, theme: Icon.Theme? = null)

Types

Link copied to clipboard

The theme context for which an icon is designed.

Properties

Link copied to clipboard

Optional MIME type override if the source MIME type is missing or generic. For example, "image/png", "image/jpeg", or "image/svg+xml". Useful when the URL doesn't include a file extension or uses a generic MIME type.

Link copied to clipboard

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.

Link copied to clipboard
val src: String

A standard URI pointing to an icon resource. Maybe an HTTP/HTTPS URL or a data: URI with Base64-encoded image data. Example: "https://example.com/icon.png" or "data:image/png;base64,iVBORw0KG..."

Link copied to clipboard

Optional specifier for the theme this icon is designed for. Theme.Light indicates the icon is designed for a light background, Theme.Dark indicates the icon is designed for a dark background. If not provided, the client should assume the icon can be used with any theme.