Skip to content

Conversation

@gfortaine
Copy link

Summary

Add IconTheme type alias and theme field to the Icon class for parity with the Go SDK. This allows servers to specify whether an icon is designed for a light or dark background, enabling clients to select the appropriate icon based on their UI theme.

Changes

  • Added IconTheme = Literal["light", "dark"] type alias
  • Added optional theme field to Icon class
  • Exported IconTheme from mcp.types

Go SDK Reference

The Go SDK already implements this feature:

type IconTheme string

const (
    IconThemeLight IconTheme = "light"
    IconThemeDark  IconTheme = "dark"
)

type Icon struct {
    Source   string    `json:"src"`
    MIMEType string    `json:"mimeType,omitempty"`
    Sizes    []string  `json:"sizes,omitempty"`
    Theme    IconTheme `json:"theme,omitempty"`
}

Source: https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/protocol.go

Use Case

MCP servers like GitHub MCP Server provide both light and dark variants of their icons. Without the theme field, Python SDK servers cannot express this distinction, limiting their ability to integrate well with themed client UIs.

Testing

  • ✅ Imports work correctly: from mcp.types import Icon, IconTheme
  • ✅ Linter passes: ruff check

Closes #1977

Add IconTheme type alias and theme field to the Icon class for parity
with the Go SDK. This allows servers to specify whether an icon is
designed for a light or dark background, enabling clients to select
the appropriate icon based on their UI theme.

Closes modelcontextprotocol#1977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add theme field to Icon type for light/dark mode support

1 participant