|
| 1 | +# Toolsets and Icons |
| 2 | + |
| 3 | +This document explains how to work with toolsets and icons in the GitHub MCP Server. |
| 4 | + |
| 5 | +## Toolset Overview |
| 6 | + |
| 7 | +Toolsets are logical groupings of related tools. Each toolset has metadata defined in `pkg/github/tools.go`: |
| 8 | + |
| 9 | +```go |
| 10 | +ToolsetMetadataRepos = inventory.ToolsetMetadata{ |
| 11 | + ID: "repos", |
| 12 | + Description: "GitHub Repository related tools", |
| 13 | + Default: true, |
| 14 | + Icon: "repo", |
| 15 | +} |
| 16 | +``` |
| 17 | + |
| 18 | +### Toolset Fields |
| 19 | + |
| 20 | +| Field | Type | Description | |
| 21 | +|-------|------|-------------| |
| 22 | +| `ID` | `ToolsetID` | Unique identifier used in URLs and CLI flags (e.g., `repos`, `issues`) | |
| 23 | +| `Description` | `string` | Human-readable description shown in documentation | |
| 24 | +| `Default` | `bool` | Whether this toolset is enabled by default | |
| 25 | +| `Icon` | `string` | Octicon name for visual representation in MCP clients | |
| 26 | + |
| 27 | +## Adding Icons to Toolsets |
| 28 | + |
| 29 | +Icons help users quickly identify toolsets in MCP-compatible clients. We use [Primer Octicons](https://primer.style/foundations/icons) for all icons. |
| 30 | + |
| 31 | +### Step 1: Choose an Octicon |
| 32 | + |
| 33 | +Browse the [Octicon gallery](https://primer.style/foundations/icons) and select an appropriate icon. Use the base name without size suffix (e.g., `repo` not `repo-16`). |
| 34 | + |
| 35 | +### Step 2: Add the Icon Files |
| 36 | + |
| 37 | +Icons are stored as PNG files in `pkg/octicons/icons/` with light and dark theme variants: |
| 38 | + |
| 39 | +``` |
| 40 | +pkg/octicons/icons/ |
| 41 | +├── repo-light.png # For light theme |
| 42 | +├── repo-dark.png # For dark theme |
| 43 | +├── issue-opened-light.png |
| 44 | +├── issue-opened-dark.png |
| 45 | +└── ... |
| 46 | +``` |
| 47 | + |
| 48 | +Icon files should be 20x20 pixels in size. |
| 49 | + |
| 50 | +### Step 3: Update the Toolset Metadata |
| 51 | + |
| 52 | +Add or update the `Icon` field in the toolset definition: |
| 53 | + |
| 54 | +```go |
| 55 | +// In pkg/github/tools.go |
| 56 | +ToolsetMetadataRepos = inventory.ToolsetMetadata{ |
| 57 | + ID: "repos", |
| 58 | + Description: "GitHub Repository related tools", |
| 59 | + Default: true, |
| 60 | + Icon: "repo", // Add this line |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +### Step 4: Regenerate Documentation |
| 65 | + |
| 66 | +Run the documentation generator to update all markdown files: |
| 67 | + |
| 68 | +```bash |
| 69 | +go run ./cmd/github-mcp-server generate-docs |
| 70 | +``` |
| 71 | + |
| 72 | +This updates icons in: |
| 73 | +- `README.md` - Toolsets table and tool section headers |
| 74 | +- `docs/remote-server.md` - Remote toolsets table |
| 75 | + |
| 76 | +## Remote-Only Toolsets |
| 77 | + |
| 78 | +Some toolsets are only available in the remote GitHub MCP Server (hosted at `api.githubcopilot.com`). These are defined in `pkg/github/tools.go` with their icons, but are not registered with the local server: |
| 79 | + |
| 80 | +```go |
| 81 | +// Remote-only toolsets |
| 82 | +ToolsetMetadataCopilot = inventory.ToolsetMetadata{ |
| 83 | + ID: "copilot", |
| 84 | + Description: "Copilot related tools", |
| 85 | + Icon: "copilot", |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +The `RemoteOnlyToolsets()` function returns the list of these toolsets for documentation generation. |
| 90 | + |
| 91 | +To add a new remote-only toolset: |
| 92 | + |
| 93 | +1. Add the metadata definition in `pkg/github/tools.go` |
| 94 | +2. Add it to the slice returned by `RemoteOnlyToolsets()` |
| 95 | +3. Regenerate documentation |
| 96 | + |
| 97 | +## Tool Icon Inheritance |
| 98 | + |
| 99 | +Individual tools inherit icons from their parent toolset. When a tool is registered with a toolset, its icons are automatically set: |
| 100 | + |
| 101 | +```go |
| 102 | +// In pkg/inventory/server_tool.go |
| 103 | +toolCopy.Icons = tool.Toolset.Icons() |
| 104 | +``` |
| 105 | + |
| 106 | +This means you only need to set the icon once on the toolset, and all tools in that toolset will display the same icon. |
| 107 | + |
| 108 | +## How Icons Work in MCP |
| 109 | + |
| 110 | +The MCP protocol supports tool icons via the `icons` field. We provide icons in two formats: |
| 111 | + |
| 112 | +1. **Data URIs** - Base64-encoded PNG images embedded in the tool definition |
| 113 | +2. **Light/Dark variants** - Both theme variants are provided for proper display |
| 114 | + |
| 115 | +The `octicons.Icons()` function generates the MCP-compatible icon objects: |
| 116 | + |
| 117 | +```go |
| 118 | +// Returns []mcp.Icon with both light and dark variants |
| 119 | +icons := octicons.Icons("repo") |
| 120 | +``` |
| 121 | + |
| 122 | +## Existing Toolset Icons |
| 123 | + |
| 124 | +| Toolset | Octicon Name | |
| 125 | +|---------|--------------| |
| 126 | +| Context | `person` | |
| 127 | +| Repositories | `repo` | |
| 128 | +| Issues | `issue-opened` | |
| 129 | +| Pull Requests | `git-pull-request` | |
| 130 | +| Git | `git-branch` | |
| 131 | +| Users | `people` | |
| 132 | +| Organizations | `organization` | |
| 133 | +| Actions | `workflow` | |
| 134 | +| Code Security | `codescan` | |
| 135 | +| Secret Protection | `shield-lock` | |
| 136 | +| Dependabot | `dependabot` | |
| 137 | +| Discussions | `comment-discussion` | |
| 138 | +| Gists | `logo-gist` | |
| 139 | +| Security Advisories | `shield` | |
| 140 | +| Projects | `project` | |
| 141 | +| Labels | `tag` | |
| 142 | +| Stargazers | `star` | |
| 143 | +| Notifications | `bell` | |
| 144 | +| Dynamic | `tools` | |
| 145 | +| Copilot | `copilot` | |
| 146 | +| Support Search | `book` | |
| 147 | + |
| 148 | +## Troubleshooting |
| 149 | + |
| 150 | +### Icons not appearing in documentation |
| 151 | + |
| 152 | +1. Ensure PNG files exist in `pkg/octicons/icons/` with `-light.png` and `-dark.png` suffixes |
| 153 | +2. Run `go run ./cmd/github-mcp-server generate-docs` to regenerate |
| 154 | +3. Check that the `Icon` field is set on the toolset metadata |
| 155 | + |
| 156 | +### Icons not appearing in MCP clients |
| 157 | + |
| 158 | +1. Verify the client supports MCP tool icons |
| 159 | +2. Check that the octicons package is properly generating base64 data URIs |
| 160 | +3. Ensure the icon name matches a file in `pkg/octicons/icons/` |
0 commit comments