-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Octicon icons to MCP tools #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: SamMorrowDrums/server-tool-refactor-toolsets
Are you sure you want to change the base?
Add Octicon icons to MCP tools #1603
Conversation
- Upgrade MCP Go SDK from v1.1.0 to v1.2.0-pre.1 for Icon support - Add Icon field to ToolsetMetadata for Octicon name assignment - Add OcticonURL() helper to generate CDN URLs for Octicon SVGs - Add Icons() method on ToolsetMetadata to generate MCP Icon objects - Apply icons automatically in RegisterFunc when tool is registered - Add icons to all 22 toolset metadata constants with appropriate Octicons - Update server.go to use new Capabilities API (fixes deprecation warnings) This demonstrates how the toolsets refactor makes adding new features simpler: icons are defined once in ToolsetMetadata and automatically applied to all tools in that toolset during registration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Octicon icons to all MCP tools by upgrading the MCP Go SDK from v1.1.0 to v1.2.0-pre.1 and implementing icon infrastructure that automatically applies icons based on toolset metadata.
Key Changes
- Upgraded MCP Go SDK to v1.2.0-pre.1 to enable Icons field support
- Added icon infrastructure in
pkg/toolsets/server_tool.gowith automatic icon application during tool registration - Assigned appropriate Octicon icons to all 22 toolset metadata constants
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Upgraded modelcontextprotocol/go-sdk from v1.1.0 to v1.2.0-pre.1 |
| go.sum | Updated checksums for SDK upgrade and new golang-jwt/jwt/v5 dependency |
| pkg/github/server.go | Migrated from deprecated HasTools/HasResources/HasPrompts to new Capabilities API structure |
| pkg/toolsets/server_tool.go | Added Icon field to ToolsetMetadata, OcticonURL helper, Icons() method, and automatic icon application in RegisterFunc |
| pkg/github/tools.go | Assigned Octicon icon names to all 22 toolset metadata constants |
- Replace runtime size validation with compile-time enum type (Size with SizeSM=16, SizeLG=24) - Fix RegisterFunc mutation by making shallow copy of tool before modifying Icons - Add comprehensive tests for octicons package (URL, Icons, Size constants) - Add toolsets tests for ToolsetMetadata.Icons(), RegisterFunc mutation prevention, and existing icon preservation - Improve icon choices for better visual semantics: - actions: play → workflow (more specific to GitHub Actions) - secret_protection: key → shield-lock (better represents protection) - gists: code → logo-gist (dedicated gist icon exists)
bretthowell714-source
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
Summary
This PR adds Octicon icons to all MCP tools, using the new
Iconsfield added in MCP Go SDK v1.2.0-pre.1.Stacked on #1602 (toolsets refactor) - demonstrates how the refactored architecture makes adding new cross-cutting features simpler.
Changes
SDK Upgrade
Iconsfield on Tool struct)NewServer()to use newCapabilitiesAPI instead of deprecatedHasTools/HasResources/HasPromptsfieldsIcon Infrastructure (pkg/toolsets/server_tool.go)
Iconfield toToolsetMetadatafor storing Octicon nameOcticonURL(name, size)helper to generate CDN URLs for Octicon SVGsIcons()method onToolsetMetadatathat returns[]mcp.Icon(16x16 and 24x24 sizes)RegisterFunc()to automatically apply icons from toolset metadata when registering toolsIcon Assignments (pkg/github/tools.go)
All 22 toolset metadata constants now have appropriate Octicon icons:
repos→repo,issues→issue-opened,pull_requests→git-pull-requestactions→play,code_security→codescan,dependabot→dependabotnotifications→bell,discussions→comment-discussionThe chosen icons:
Why the Refactor Makes This Easier
Before refactor: Would need to call
SetIcons()on every toolset creation inDefaultToolsetGroup(), or modify each individual tool definition.After refactor: Simply add
Iconfield toToolsetMetadatain one place, and icons are automatically applied to all tools viaRegisterFunc(). The self-describing nature ofServerToolwith embeddedToolsetMetadataenables this clean architecture.Testing
raw.githubusercontent.com/primer/octicons/main/icons/Related