You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19,13 +19,11 @@ automation and interaction capabilities for developers and tools.
19
19
3. Lastly you will need to [Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new).
20
20
The MCP server can use many of the GitHub APIs, so enable the permissions that you feel comfortable granting your AI tools (to learn more about access tokens, please check out the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).
21
21
22
-
23
-
24
22
## Installation
25
23
26
24
### Usage with VS Code
27
25
28
-
For quick installation, use one of the one-click install buttons at the top of this README.
26
+
For quick installation, use one of the one-click install buttons at the top of this README. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
29
27
30
28
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open User Settings (JSON)`.
31
29
@@ -91,14 +89,110 @@ More about using MCP server tools in VS Code's [agent mode documentation](https:
91
89
92
90
### Build from source
93
91
94
-
If you don't have Docker, you can use `go` to build the binary in the
95
-
`cmd/github-mcp-server` directory, and use the `github-mcp-server stdio`
96
-
command with the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable set to
97
-
your token.
92
+
If you don't have Docker, you can use `go build` to build the binary in the
93
+
`cmd/github-mcp-server` directory, and use the `github-mcp-server stdio` command with the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable set to your token. To specify the output location of the build, use the `-o` flag. You should configure your server to use the built executable as its `command`. For example:
94
+
95
+
```JSON
96
+
{
97
+
"mcp": {
98
+
"servers": {
99
+
"github": {
100
+
"command": "/path/to/github-mcp-server",
101
+
"args": ["stdio"],
102
+
"env": {
103
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
104
+
}
105
+
}
106
+
}
107
+
}
108
+
}
109
+
```
110
+
111
+
## Tool Configuration
112
+
113
+
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.
114
+
115
+
### Available Toolsets
116
+
117
+
The following sets of tools are available (all are on by default):
The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration:
159
+
160
+
```bash
161
+
./github-mcp-server --toolsets all
162
+
```
163
+
164
+
Or using the environment variable:
165
+
166
+
```bash
167
+
GITHUB_TOOLSETS="all" ./github-mcp-server
168
+
```
169
+
170
+
## Dynamic Tool Discovery
171
+
172
+
**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.
173
+
174
+
Instead of starting with all tools enabled, you can turn on dynamic toolset discovery. Dynamic toolsets allow the MCP host to list and enable toolsets in response to a user prompt. This should help to avoid situations where the model gets confused by the shear number of tools available.
175
+
176
+
### Using Dynamic Tool Discovery
177
+
178
+
When using the binary, you can pass the `--dynamic-toolsets` flag.
179
+
180
+
```bash
181
+
./github-mcp-server --dynamic-toolsets
182
+
```
183
+
184
+
When using Docker, you can pass the toolsets as environment variables:
185
+
186
+
```bash
187
+
docker run -i --rm \
188
+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
189
+
-e GITHUB_DYNAMIC_TOOLSETS=1 \
190
+
ghcr.io/github/github-mcp-server
191
+
```
98
192
99
193
## GitHub Enterprise Server
100
194
101
-
The flag `--gh-host` and the environment variable `GH_HOST` can be used to set
195
+
The flag `--gh-host` and the environment variable `GITHUB_HOST` can be used to set
102
196
the GitHub Enterprise Server hostname.
103
197
104
198
## i18n / Overriding Descriptions
@@ -317,7 +411,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
317
411
### Repositories
318
412
319
413
-**create_or_update_file** - Create or update a single file in a repository
320
-
321
414
-`owner`: Repository owner (string, required)
322
415
-`repo`: Repository name (string, required)
323
416
-`path`: File path (string, required)
@@ -327,50 +420,43 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
327
420
-`sha`: File SHA if updating (string, optional)
328
421
329
422
-**list_branches** - List branches in a GitHub repository
330
-
331
423
-`owner`: Repository owner (string, required)
332
424
-`repo`: Repository name (string, required)
333
425
-`page`: Page number (number, optional)
334
426
-`perPage`: Results per page (number, optional)
335
427
336
428
-**push_files** - Push multiple files in a single commit
337
-
338
429
-`owner`: Repository owner (string, required)
339
430
-`repo`: Repository name (string, required)
340
431
-`branch`: Branch to push to (string, required)
341
432
-`files`: Files to push, each with path and content (array, required)
342
433
-`message`: Commit message (string, required)
343
434
344
435
-**search_repositories** - Search for GitHub repositories
345
-
346
436
-`query`: Search query (string, required)
347
437
-`sort`: Sort field (string, optional)
348
438
-`order`: Sort order (string, optional)
349
439
-`page`: Page number (number, optional)
350
440
-`perPage`: Results per page (number, optional)
351
441
352
442
-**create_repository** - Create a new GitHub repository
// Add global flags that will be shared by all commands
71
+
rootCmd.PersistentFlags().StringSlice("toolsets", github.DefaultTools, "An optional comma separated list of groups of tools to allow, defaults to enabling all")
rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")
66
74
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")
67
75
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
68
76
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")
69
77
rootCmd.PersistentFlags().String("gh-host", "", "Specify the GitHub hostname (for GitHub Enterprise etc.)")
0 commit comments