Skip to content

Commit 39dc861

Browse files
committed
Add tool search CLI
1 parent 7c053f1 commit 39dc861

File tree

8 files changed

+484
-18
lines changed

8 files changed

+484
-18
lines changed

README.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Alternatively, to manually configure VS Code, choose the appropriate JSON block
8080
</table>
8181

8282
### Install in other MCP hosts
83+
8384
- **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
8485
- **[Claude Applications](/docs/installation-guides/install-claude.md)** - Installation guide for Claude Desktop and Claude Code CLI
8586
- **[Codex](/docs/installation-guides/install-codex.md)** - Installation guide for Open AI Codex
@@ -104,6 +105,7 @@ When no toolsets are specified, [default toolsets](#default-toolset) are used.
104105
GitHub Enterprise Cloud can also make use of the remote server.
105106

106107
Example for `https://octocorp.ghe.com` with GitHub PAT token:
108+
107109
```
108110
{
109111
...
@@ -140,24 +142,30 @@ The MCP server can use many of the GitHub APIs, so enable the permissions that y
140142
<details><summary><b>Handling PATs Securely</b></summary>
141143

142144
### Environment Variables (Recommended)
145+
143146
To keep your GitHub PAT secure and reusable across different MCP hosts:
144147

145148
1. **Store your PAT in environment variables**
149+
146150
```bash
147151
export GITHUB_PAT=your_token_here
148152
```
153+
149154
Or create a `.env` file:
155+
150156
```env
151157
GITHUB_PAT=your_token_here
152158
```
153159

154160
2. **Protect your `.env` file**
161+
155162
```bash
156163
# Add to .gitignore to prevent accidental commits
157164
echo ".env" >> .gitignore
158165
```
159166

160167
3. **Reference the token in configurations**
168+
161169
```bash
162170
# CLI usage
163171
claude mcp update github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT
@@ -180,6 +188,7 @@ To keep your GitHub PAT secure and reusable across different MCP hosts:
180188
- **Regular rotation**: Update tokens periodically
181189
- **Never commit**: Keep tokens out of version control
182190
- **File permissions**: Restrict access to config files containing tokens
191+
183192
```bash
184193
chmod 600 ~/.your-app/config.json
185194
```
@@ -193,6 +202,7 @@ the hostname for GitHub Enterprise Server or GitHub Enterprise Cloud with data r
193202

194203
- For GitHub Enterprise Server, prefix the hostname with the `https://` URI scheme, as it otherwise defaults to `http://`, which GitHub Enterprise Server does not support.
195204
- For GitHub Enterprise Cloud with data residency, use `https://YOURSUBDOMAIN.ghe.com` as the hostname.
205+
196206
``` json
197207
"github": {
198208
"command": "docker",
@@ -328,6 +338,20 @@ If you don't have Docker, you can use `go build` to build the binary in the
328338
}
329339
```
330340

341+
### CLI utilities
342+
343+
The `github-mcp-server` binary includes a few CLI subcommands that are helpful for debugging and exploring the server.
344+
345+
- `github-mcp-server tool-search "<query>"` searches tools by name, description, and input parameter names.
346+
- Use `--max-results` to return more matches.
347+
- Output is colorized when writing to a TTY (and typically not colorized when piped).
348+
349+
Example:
350+
351+
```bash
352+
github-mcp-server tool-search "owner" --max-results 5
353+
```
354+
331355
## Tool Configuration
332356

333357
The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the `--toolsets` flag. This allows you to control which GitHub API capabilities are available to your AI tools. Enabling only the toolsets that you need can help the LLM with tool choice and reduce the context size.
@@ -349,6 +373,7 @@ To specify toolsets you want available to the LLM, you can pass an allow-list in
349373
```
350374

351375
2. **Using Environment Variable**:
376+
352377
```bash
353378
GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server
354379
```
@@ -366,23 +391,29 @@ You can also configure specific tools using the `--tools` flag. Tools can be use
366391
```
367392

368393
2. **Using Environment Variable**:
394+
369395
```bash
370396
GITHUB_TOOLS="get_file_contents,issue_read,create_pull_request" ./github-mcp-server
371397
```
372398

373399
3. **Combining with Toolsets** (additive):
400+
374401
```bash
375402
github-mcp-server --toolsets repos,issues --tools get_gist
376403
```
404+
377405
This registers all tools from `repos` and `issues` toolsets, plus `get_gist`.
378406

379407
4. **Combining with Dynamic Toolsets** (additive):
408+
380409
```bash
381410
github-mcp-server --tools get_file_contents --dynamic-toolsets
382411
```
412+
383413
This registers `get_file_contents` plus the dynamic toolset tools (`enable_toolset`, `list_available_toolsets`, `get_toolset_tools`).
384414

385415
**Important Notes:**
416+
386417
- Tools, toolsets, and dynamic toolsets can all be used together
387418
- Read-only mode takes priority: write tools are skipped if `--read-only` is set, even if explicitly requested via `--tools`
388419
- Tool names must match exactly (e.g., `get_file_contents`, not `getFileContents`). Invalid tool names will cause the server to fail at startup with an error message
@@ -435,9 +466,11 @@ GITHUB_TOOLSETS="all" ./github-mcp-server
435466
```
436467

437468
#### "default" toolset
469+
438470
The default toolset `default` is the configuration that gets passed to the server if no toolsets are specified.
439471

440472
The default configuration is:
473+
441474
- context
442475
- repos
443476
- issues
@@ -1371,32 +1404,34 @@ The following sets of tools are available:
13711404

13721405
<summary>Copilot</summary>
13731406

1374-
- **create_pull_request_with_copilot** - Perform task with GitHub Copilot coding agent
1375-
- `owner`: Repository owner. You can guess the owner, but confirm it with the user before proceeding. (string, required)
1376-
- `repo`: Repository name. You can guess the repository name, but confirm it with the user before proceeding. (string, required)
1377-
- `problem_statement`: Detailed description of the task to be performed (e.g., 'Implement a feature that does X', 'Fix bug Y', etc.) (string, required)
1378-
- `title`: Title for the pull request that will be created (string, required)
1379-
- `base_ref`: Git reference (e.g., branch) that the agent will start its work from. If not specified, defaults to the repository's default branch (string, optional)
1407+
- **create_pull_request_with_copilot** - Perform task with GitHub Copilot coding agent
1408+
- `owner`: Repository owner. You can guess the owner, but confirm it with the user before proceeding. (string, required)
1409+
- `repo`: Repository name. You can guess the repository name, but confirm it with the user before proceeding. (string, required)
1410+
- `problem_statement`: Detailed description of the task to be performed (e.g., 'Implement a feature that does X', 'Fix bug Y', etc.) (string, required)
1411+
- `title`: Title for the pull request that will be created (string, required)
1412+
- `base_ref`: Git reference (e.g., branch) that the agent will start its work from. If not specified, defaults to the repository's default branch (string, optional)
13801413

13811414
</details>
13821415

13831416
<details>
13841417

13851418
<summary>Copilot Spaces</summary>
13861419

1387-
- **get_copilot_space** - Get Copilot Space
1388-
- `owner`: The owner of the space. (string, required)
1389-
- `name`: The name of the space. (string, required)
1420+
- **get_copilot_space** - Get Copilot Space
1421+
- `owner`: The owner of the space. (string, required)
1422+
- `name`: The name of the space. (string, required)
1423+
1424+
- **list_copilot_spaces** - List Copilot Spaces
13901425

1391-
- **list_copilot_spaces** - List Copilot Spaces
13921426
</details>
13931427

13941428
<details>
13951429

13961430
<summary>GitHub Support Docs Search</summary>
13971431

1398-
- **github_support_docs_search** - Retrieve documentation relevant to answer GitHub product and support questions. Support topics include: GitHub Actions Workflows, Authentication, GitHub Support Inquiries, Pull Request Practices, Repository Maintenance, GitHub Pages, GitHub Packages, GitHub Discussions, Copilot Spaces
1399-
- `query`: Input from the user about the question they need answered. This is the latest raw unedited user message. You should ALWAYS leave the user message as it is, you should never modify it. (string, required)
1432+
- **github_support_docs_search** - Retrieve documentation relevant to answer GitHub product and support questions. Support topics include: GitHub Actions Workflows, Authentication, GitHub Support Inquiries, Pull Request Practices, Repository Maintenance, GitHub Pages, GitHub Packages, GitHub Discussions, Copilot Spaces
1433+
- `query`: Input from the user about the question they need answered. This is the latest raw unedited user message. You should ALWAYS leave the user message as it is, you should never modify it. (string, required)
1434+
14001435
</details>
14011436

14021437
## Dynamic Tool Discovery

cmd/github-mcp-server/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ func initConfig() {
136136
viper.SetEnvPrefix("github")
137137
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
138138
viper.AutomaticEnv()
139-
140139
}
141140

142141
func main() {

docs/installation-guides/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This directory contains detailed installation instructions for the GitHub MCP Server across different host applications and IDEs. Choose the guide that matches your development environment.
44

55
## Installation Guides by Host Application
6+
67
- **[GitHub Copilot in other IDEs](install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
78
- **[Antigravity](install-antigravity.md)** - Installation for Google Antigravity IDE
89
- **[Claude Applications](install-claude.md)** - Installation guide for Claude Web, Claude Desktop and Claude Code CLI
@@ -28,32 +29,36 @@ This directory contains detailed installation instructions for the GitHub MCP Se
2829
| Copilot in Eclipse || ✅ Full (OAuth + PAT) | Local: Docker or Go build, GitHub PAT<br>Remote: Eclipse Plug-in for Copilot 0.10.0+ | Easy |
2930

3031
**Legend:**
32+
3133
- ✅ = Fully supported
3234
- ❌ = Not yet supported
3335

34-
**Note:** Remote MCP support requires host applications to register a GitHub App or OAuth app for OAuth flow support – even if the new OAuth spec is supported by that host app. Currently, only VS Code has full remote GitHub server support.
36+
**Note:** Remote MCP support requires host applications to register a GitHub App or OAuth app for OAuth flow support – even if the new OAuth spec is supported by that host app. Currently, only VS Code has full remote GitHub server support.
3537

3638
## Installation Methods
3739

3840
The GitHub MCP Server can be installed using several methods. **Docker is the most popular and recommended approach** for most users, but alternatives are available depending on your needs:
3941

4042
### 🐳 Docker (Most Common & Recommended)
43+
4144
- **Pros**: No local build required, consistent environment, easy updates, works across all platforms
4245
- **Cons**: Requires Docker installed and running
4346
- **Best for**: Most users, especially those already using Docker or wanting the simplest setup
4447
- **Used by**: Claude Desktop, Copilot in VS Code, Cursor, Windsurf, etc.
4548

4649
### 📦 Pre-built Binary (Lightweight Alternative)
50+
4751
- **Pros**: No Docker required, direct execution via stdio, minimal setup
4852
- **Cons**: Need to manually download and manage updates, platform-specific binaries
4953
- **Best for**: Minimal environments, users who prefer not to use Docker
5054
- **Used by**: Claude Code CLI, lightweight setups
5155

5256
### 🔨 Build from Source (Advanced Users)
57+
5358
- **Pros**: Latest features, full customization, no external dependencies
5459
- **Cons**: Requires Go development environment, more complex setup
5560
- **Prerequisites**: [Go 1.24+](https://go.dev/doc/install)
56-
- **Build command**: `go build -o github-mcp-server cmd/github-mcp-server/main.go`
61+
- **Build command**: `go build -o github-mcp-server ./cmd/github-mcp-server`
5762
- **Best for**: Developers who want the latest features or need custom modifications
5863

5964
### Important Notes on the GitHub MCP Server
@@ -65,9 +70,11 @@ The GitHub MCP Server can be installed using several methods. **Docker is the mo
6570
## General Prerequisites
6671

6772
All installations with Personal Access Tokens (PAT) require:
73+
6874
- **GitHub Personal Access Token (PAT)**: [Create one here](https://github.com/settings/personal-access-tokens/new)
6975

7076
Optional (depending on installation method):
77+
7178
- **Docker** (for Docker-based installations): [Download Docker](https://www.docker.com/)
7279
- **Go 1.24+** (for building from source): [Install Go](https://go.dev/doc/install)
7380

@@ -84,6 +91,7 @@ Regardless of which installation method you choose, follow these security guidel
8491
## Getting Help
8592

8693
If you encounter issues:
94+
8795
1. Check the troubleshooting section in your specific installation guide
8896
2. Verify your GitHub PAT has the required permissions
8997
3. Ensure Docker is running (for local installations)
@@ -93,8 +101,8 @@ If you encounter issues:
93101
## Configuration Options
94102

95103
After installation, you may want to explore:
104+
96105
- **Toolsets**: Enable/disable specific GitHub API capabilities
97106
- **Read-Only Mode**: Restrict to read-only operations
98107
- **Dynamic Tool Discovery**: Enable tools on-demand
99108
- **Lockdown Mode**: Hide public issue details created by users without push access
100-

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/github/github-mcp-server
33
go 1.24.0
44

55
require (
6+
github.com/fatih/color v1.18.0
67
github.com/google/go-github/v79 v79.0.0
78
github.com/google/jsonschema-go v0.4.2
89
github.com/josephburnett/jd v1.9.2
@@ -20,6 +21,8 @@ require (
2021
github.com/gorilla/css v1.0.1 // indirect
2122
github.com/josharian/intern v1.0.0 // indirect
2223
github.com/mailru/easyjson v0.7.7 // indirect
24+
github.com/mattn/go-colorable v0.1.13 // indirect
25+
github.com/mattn/go-isatty v0.0.20 // indirect
2326
github.com/stretchr/objx v0.5.2 // indirect
2427
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
2528
go.yaml.in/yaml/v3 v3.0.4 // indirect
@@ -34,6 +37,7 @@ require (
3437
github.com/go-viper/mapstructure/v2 v2.4.0
3538
github.com/google/go-querystring v1.1.0 // indirect
3639
github.com/inconshreveable/mousetrap v1.1.0 // indirect
40+
github.com/lithammer/fuzzysearch v1.1.8
3741
github.com/modelcontextprotocol/go-sdk v1.2.0
3842
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
3943
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

0 commit comments

Comments
 (0)