Skip to content

Commit 6173178

Browse files
authored
Merge branch 'main' into almaleksia/consolidate-pull-requests
2 parents d09c58c + 8a69a5c commit 6173178

File tree

5 files changed

+265
-87
lines changed

5 files changed

+265
-87
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

@@ -917,13 +971,6 @@ Possible options:
917971
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
918972
- `repo`: Repository name (string, required)
919973

920-
- **list_starred_repositories** - List starred repositories
921-
- `direction`: The direction to sort the results by. (string, optional)
922-
- `page`: Page number for pagination (min 1) (number, optional)
923-
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
924-
- `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)
925-
- `username`: Username to list starred repositories for. Defaults to the authenticated user. (string, optional)
926-
927974
- **list_tags** - List tags
928975
- `owner`: Repository owner (string, required)
929976
- `page`: Page number for pagination (min 1) (number, optional)
@@ -950,14 +997,6 @@ Possible options:
950997
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
951998
- `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)
952999

953-
- **star_repository** - Star repository
954-
- `owner`: Repository owner (string, required)
955-
- `repo`: Repository name (string, required)
956-
957-
- **unstar_repository** - Unstar repository
958-
- `owner`: Repository owner (string, required)
959-
- `repo`: Repository name (string, required)
960-
9611000
</details>
9621001

9631002
<details>
@@ -1015,6 +1054,27 @@ Possible options:
10151054

10161055
<details>
10171056

1057+
<summary>Stargazers</summary>
1058+
1059+
- **list_starred_repositories** - List starred repositories
1060+
- `direction`: The direction to sort the results by. (string, optional)
1061+
- `page`: Page number for pagination (min 1) (number, optional)
1062+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
1063+
- `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)
1064+
- `username`: Username to list starred repositories for. Defaults to the authenticated user. (string, optional)
1065+
1066+
- **star_repository** - Star repository
1067+
- `owner`: Repository owner (string, required)
1068+
- `repo`: Repository name (string, required)
1069+
1070+
- **unstar_repository** - Unstar repository
1071+
- `owner`: Repository owner (string, required)
1072+
- `repo`: Repository name (string, required)
1073+
1074+
</details>
1075+
1076+
<details>
1077+
10181078
<summary>Users</summary>
10191079

10201080
- **search_users** - Search users
@@ -1053,48 +1113,6 @@ Possible options:
10531113
- **list_copilot_spaces** - List Copilot Spaces
10541114
</details>
10551115

1056-
#### Specifying Toolsets
1057-
1058-
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
1059-
1060-
1. **Using Command Line Argument**:
1061-
1062-
```bash
1063-
github-mcp-server --toolsets repos,issues,pull_requests,actions,code_security
1064-
```
1065-
1066-
2. **Using Environment Variable**:
1067-
```bash
1068-
GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server
1069-
```
1070-
1071-
The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided.
1072-
1073-
### Using Toolsets With Docker
1074-
1075-
When using Docker, you can pass the toolsets as environment variables:
1076-
1077-
```bash
1078-
docker run -i --rm \
1079-
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
1080-
-e GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security,experiments" \
1081-
ghcr.io/github/github-mcp-server
1082-
```
1083-
1084-
### The "all" Toolset
1085-
1086-
The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration:
1087-
1088-
```bash
1089-
./github-mcp-server --toolsets all
1090-
```
1091-
1092-
Or using the environment variable:
1093-
1094-
```bash
1095-
GITHUB_TOOLSETS="all" ./github-mcp-server
1096-
```
1097-
10981116
## Dynamic Tool Discovery
10991117

11001118
**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 -->

pkg/github/instructions.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ func GenerateInstructions(enabledToolsets []string) string {
2828
}
2929

3030
// Base instruction with context management
31-
baseInstruction := `The GitHub MCP Server provides tools to interact with GitHub platform.
32-
33-
Tool selection guidance:
34-
1. Use 'list_*' tools for broad, simple retrieval and pagination of all items of a type (e.g., all issues, all PRs, all branches) with basic filtering.
35-
2. Use 'search_*' tools for targeted queries with specific criteria, keywords, or complex filters (e.g., issues with certain text, PRs by author, code containing functions).
31+
baseInstruction := `The GitHub MCP Server provides tools to interact with GitHub.
3632
3733
Context management:
3834
1. Use pagination whenever possible with batches of 5-10 items.
39-
2. Use minimal_output parameter set to true if the full information is not needed to accomplish a task.`
35+
2. Use minimal_output parameter set to true if the full information is not needed to accomplish a task.
36+
37+
Tool selection guidance:
38+
1. Use 'list_*' tools for broad, simple retrieval and pagination of all items of a type (e.g., all issues, all PRs, all branches) with basic filtering.
39+
2. Use tools containing 'search' in their name for targeted queries with specific criteria, keywords, or complex filters (e.g., issues with certain text, PRs by author, code containing functions).`
4040

4141
allInstructions := []string{baseInstruction}
4242
allInstructions = append(allInstructions, instructions...)

0 commit comments

Comments
 (0)