Skip to content

Commit bf0d62e

Browse files
tonytrgalmaleksia
andauthored
Adding default toolset grouping (#1159)
* adding default toolset group, splitting up stargazers from repos * adding structs for toolset group metadata * update readme * refactor the readme * fix lint --------- Co-authored-by: Ksenia Bobrova <[email protected]>
1 parent 23fa0dd commit bf0d62e

File tree

4 files changed

+259
-81
lines changed

4 files changed

+259
-81
lines changed

README.md

Lines changed: 77 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,17 @@ Alternatively, to manually configure VS Code, choose the appropriate JSON block
8686
> **Note:** Each MCP host application needs to configure a GitHub App or OAuth App to support remote access via OAuth. Any host application that supports remote MCP servers should support the remote GitHub server with PAT authentication. Configuration details and support levels vary by host. Make sure to refer to the host application's documentation for more info.
8787
8888
### Configuration
89-
See [Remote Server Documentation](/docs/remote-server.md) on how to pass additional configuration settings to the remote GitHub MCP Server.
89+
90+
#### Default toolset configuration
91+
92+
The default configuration is:
93+
- context
94+
- repos
95+
- issues
96+
- pull_requests
97+
- users
98+
99+
See [Remote Server Documentation](docs/remote-server.md) for full details on remote server configuration, toolsets, headers, and advanced usage. This file provides comprehensive instructions and examples for connecting, customizing, and installing the remote GitHub MCP Server in VS Code and other MCP hosts.
90100

91101
---
92102

@@ -271,6 +281,50 @@ The GitHub MCP Server supports enabling or disabling specific groups of function
271281

272282
_Toolsets are not limited to Tools. Relevant MCP Resources and Prompts are also included where applicable._
273283

284+
The Local GitHub MCP Server follows the same [default toolset configuration](#default-toolset-configuration) as the remote version.
285+
286+
#### Specifying Toolsets
287+
288+
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
289+
290+
1. **Using Command Line Argument**:
291+
292+
```bash
293+
github-mcp-server --toolsets repos,issues,pull_requests,actions,code_security
294+
```
295+
296+
2. **Using Environment Variable**:
297+
```bash
298+
GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server
299+
```
300+
301+
The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided.
302+
303+
### Using Toolsets With Docker
304+
305+
When using Docker, you can pass the toolsets as environment variables:
306+
307+
```bash
308+
docker run -i --rm \
309+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
310+
-e GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security,experiments" \
311+
ghcr.io/github/github-mcp-server
312+
```
313+
314+
### The "all" Toolset
315+
316+
The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration:
317+
318+
```bash
319+
./github-mcp-server --toolsets all
320+
```
321+
322+
Or using the environment variable:
323+
324+
```bash
325+
GITHUB_TOOLSETS="all" ./github-mcp-server
326+
```
327+
274328
### Available Toolsets
275329

276330
The following sets of tools are available (all are on by default):
@@ -293,12 +347,12 @@ The following sets of tools are available (all are on by default):
293347
| `repos` | GitHub Repository related tools |
294348
| `secret_protection` | Secret protection related tools, such as GitHub Secret Scanning |
295349
| `security_advisories` | Security advisories related tools |
350+
| `stargazers` | GitHub Stargazers related tools |
296351
| `users` | GitHub User related tools |
297352
<!-- END AUTOMATED TOOLSETS -->
298353

299354
## Tools
300355

301-
302356
<!-- START AUTOMATED TOOLS -->
303357
<details>
304358

@@ -933,13 +987,6 @@ The following sets of tools are available (all are on by default):
933987
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
934988
- `repo`: Repository name (string, required)
935989

936-
- **list_starred_repositories** - List starred repositories
937-
- `direction`: The direction to sort the results by. (string, optional)
938-
- `page`: Page number for pagination (min 1) (number, optional)
939-
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
940-
- `sort`: How to sort the results. Can be either 'created' (when the repository was starred) or 'updated' (when the repository was last pushed to). (string, optional)
941-
- `username`: Username to list starred repositories for. Defaults to the authenticated user. (string, optional)
942-
943990
- **list_tags** - List tags
944991
- `owner`: Repository owner (string, required)
945992
- `page`: Page number for pagination (min 1) (number, optional)
@@ -966,14 +1013,6 @@ The following sets of tools are available (all are on by default):
9661013
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
9671014
- `query`: Repository search query. Examples: 'machine learning in:name stars:>1000 language:python', 'topic:react', 'user:facebook'. Supports advanced search syntax for precise filtering. (string, required)
9681015

969-
- **star_repository** - Star repository
970-
- `owner`: Repository owner (string, required)
971-
- `repo`: Repository name (string, required)
972-
973-
- **unstar_repository** - Unstar repository
974-
- `owner`: Repository owner (string, required)
975-
- `repo`: Repository name (string, required)
976-
9771016
</details>
9781017

9791018
<details>
@@ -1031,6 +1070,27 @@ The following sets of tools are available (all are on by default):
10311070

10321071
<details>
10331072

1073+
<summary>Stargazers</summary>
1074+
1075+
- **list_starred_repositories** - List starred repositories
1076+
- `direction`: The direction to sort the results by. (string, optional)
1077+
- `page`: Page number for pagination (min 1) (number, optional)
1078+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
1079+
- `sort`: How to sort the results. Can be either 'created' (when the repository was starred) or 'updated' (when the repository was last pushed to). (string, optional)
1080+
- `username`: Username to list starred repositories for. Defaults to the authenticated user. (string, optional)
1081+
1082+
- **star_repository** - Star repository
1083+
- `owner`: Repository owner (string, required)
1084+
- `repo`: Repository name (string, required)
1085+
1086+
- **unstar_repository** - Unstar repository
1087+
- `owner`: Repository owner (string, required)
1088+
- `repo`: Repository name (string, required)
1089+
1090+
</details>
1091+
1092+
<details>
1093+
10341094
<summary>Users</summary>
10351095

10361096
- **search_users** - Search users
@@ -1069,48 +1129,6 @@ The following sets of tools are available (all are on by default):
10691129
- **list_copilot_spaces** - List Copilot Spaces
10701130
</details>
10711131

1072-
#### Specifying Toolsets
1073-
1074-
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
1075-
1076-
1. **Using Command Line Argument**:
1077-
1078-
```bash
1079-
github-mcp-server --toolsets repos,issues,pull_requests,actions,code_security
1080-
```
1081-
1082-
2. **Using Environment Variable**:
1083-
```bash
1084-
GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server
1085-
```
1086-
1087-
The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided.
1088-
1089-
### Using Toolsets With Docker
1090-
1091-
When using Docker, you can pass the toolsets as environment variables:
1092-
1093-
```bash
1094-
docker run -i --rm \
1095-
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
1096-
-e GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security,experiments" \
1097-
ghcr.io/github/github-mcp-server
1098-
```
1099-
1100-
### The "all" Toolset
1101-
1102-
The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration:
1103-
1104-
```bash
1105-
./github-mcp-server --toolsets all
1106-
```
1107-
1108-
Or using the environment variable:
1109-
1110-
```bash
1111-
GITHUB_TOOLSETS="all" ./github-mcp-server
1112-
```
1113-
11141132
## Dynamic Tool Discovery
11151133

11161134
**Note**: This feature is currently in beta and may not be available in all environments. Please test it out and let us know if you encounter any issues.

cmd/github-mcp-server/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ var (
4545
return fmt.Errorf("failed to unmarshal toolsets: %w", err)
4646
}
4747

48+
if len(enabledToolsets) == 0 {
49+
enabledToolsets = github.GetDefaultToolsetIDs()
50+
}
51+
4852
stdioServerConfig := ghmcp.StdioServerConfig{
4953
Version: version,
5054
Host: viper.GetString("host"),
@@ -69,7 +73,7 @@ func init() {
6973
rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n")
7074

7175
// Add global flags that will be shared by all commands
72-
rootCmd.PersistentFlags().StringSlice("toolsets", github.DefaultTools, "An optional comma separated list of groups of tools to allow, defaults to enabling all")
76+
rootCmd.PersistentFlags().StringSlice("toolsets", nil, github.GenerateToolsetsHelp())
7377
rootCmd.PersistentFlags().Bool("dynamic-toolsets", false, "Enable dynamic toolsets")
7478
rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")
7579
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")

docs/remote-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
3434
| Repositories | GitHub Repository related tools | https://api.githubcopilot.com/mcp/x/repos | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-repos&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Frepos%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/repos/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-repos&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Frepos%2Freadonly%22%7D) |
3535
| Secret Protection | Secret protection related tools, such as GitHub Secret Scanning | https://api.githubcopilot.com/mcp/x/secret_protection | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-secret_protection&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecret_protection%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/secret_protection/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-secret_protection&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecret_protection%2Freadonly%22%7D) |
3636
| Security Advisories | Security advisories related tools | https://api.githubcopilot.com/mcp/x/security_advisories | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-security_advisories&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecurity_advisories%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/security_advisories/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-security_advisories&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecurity_advisories%2Freadonly%22%7D) |
37+
| Stargazers | GitHub Stargazers related tools | https://api.githubcopilot.com/mcp/x/stargazers | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-stargazers&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fstargazers%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/stargazers/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-stargazers&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fstargazers%2Freadonly%22%7D) |
3738
| Users | GitHub User related tools | https://api.githubcopilot.com/mcp/x/users | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-users&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fusers%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/users/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-users&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fusers%2Freadonly%22%7D) |
3839

3940
<!-- END AUTOMATED TOOLSETS -->

0 commit comments

Comments
 (0)