Skip to content

Commit 3a390a0

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 62b0458 + 3134b09 commit 3a390a0

35 files changed

+2306
-908
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @juruen @sammorrowdrums @williammartin @toby
1+
* @github/github-mcp-server

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
.idea
22
cmd/github-mcp-server/github-mcp-server
3+
4+
# VSCode
5+
.vscode/*
6+
!.vscode/launch.json
7+
38
# Added by goreleaser init:
49
dist/
5-
__debug_bin*
10+
__debug_bin*
11+
12+
# Go
13+
vendor

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[fork]: https://github.com/github/github-mcp-server/fork
44
[pr]: https://github.com/github/github-mcp-server/compare
5-
[style]: https://github.com/github/github-mcp-server/blob/main/.golangci.yaml
5+
[style]: https://github.com/github/github-mcp-server/blob/main/.golangci.yml
66

77
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
88

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG VERSION="dev"
22

3-
FROM golang:1.23.7 AS build
3+
FROM golang:1.24.2 AS build
44
# allow this step access to build arg
55
ARG VERSION
66
# Set the working directory

README.md

Lines changed: 169 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,14 @@ automation and interaction capabilities for developers and tools.
1919
3. Lastly you will need to [Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new).
2020
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)).
2121

22-
23-
2422
## Installation
2523

2624
### Usage with VS Code
2725

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.
2927

3028
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)`.
3129

32-
Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
33-
34-
> Note that the `mcp` key is not needed in the `.vscode/mcp.json` file.
35-
3630
```json
3731
{
3832
"mcp": {
@@ -64,6 +58,39 @@ Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace
6458
}
6559
```
6660

61+
Optionally, you can add a similar example (i.e. without the mcp key) to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
62+
63+
64+
```json
65+
{
66+
"inputs": [
67+
{
68+
"type": "promptString",
69+
"id": "github_token",
70+
"description": "GitHub Personal Access Token",
71+
"password": true
72+
}
73+
],
74+
"servers": {
75+
"github": {
76+
"command": "docker",
77+
"args": [
78+
"run",
79+
"-i",
80+
"--rm",
81+
"-e",
82+
"GITHUB_PERSONAL_ACCESS_TOKEN",
83+
"ghcr.io/github/github-mcp-server"
84+
],
85+
"env": {
86+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
87+
}
88+
}
89+
}
90+
}
91+
92+
```
93+
6794
More about using MCP server tools in VS Code's [agent mode documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).
6895

6996
### Usage with Claude Desktop
@@ -91,14 +118,110 @@ More about using MCP server tools in VS Code's [agent mode documentation](https:
91118

92119
### Build from source
93120

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.
121+
If you don't have Docker, you can use `go build` to build the binary in the
122+
`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:
123+
124+
```JSON
125+
{
126+
"mcp": {
127+
"servers": {
128+
"github": {
129+
"command": "/path/to/github-mcp-server",
130+
"args": ["stdio"],
131+
"env": {
132+
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
133+
}
134+
}
135+
}
136+
}
137+
}
138+
```
139+
140+
## Tool Configuration
141+
142+
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.
143+
144+
### Available Toolsets
145+
146+
The following sets of tools are available (all are on by default):
147+
148+
| Toolset | Description |
149+
| ----------------------- | ------------------------------------------------------------- |
150+
| `repos` | Repository-related tools (file operations, branches, commits) |
151+
| `issues` | Issue-related tools (create, read, update, comment) |
152+
| `users` | Anything relating to GitHub Users |
153+
| `pull_requests` | Pull request operations (create, merge, review) |
154+
| `code_security` | Code scanning alerts and security features |
155+
| `experiments` | Experimental features (not considered stable) |
156+
157+
#### Specifying Toolsets
158+
159+
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
160+
161+
1. **Using Command Line Argument**:
162+
163+
```bash
164+
github-mcp-server --toolsets repos,issues,pull_requests,code_security
165+
```
166+
167+
2. **Using Environment Variable**:
168+
```bash
169+
GITHUB_TOOLSETS="repos,issues,pull_requests,code_security" ./github-mcp-server
170+
```
171+
172+
The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided.
173+
174+
### Using Toolsets With Docker
175+
176+
When using Docker, you can pass the toolsets as environment variables:
177+
178+
```bash
179+
docker run -i --rm \
180+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
181+
-e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \
182+
ghcr.io/github/github-mcp-server
183+
```
184+
185+
### The "all" Toolset
186+
187+
The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration:
188+
189+
```bash
190+
./github-mcp-server --toolsets all
191+
```
192+
193+
Or using the environment variable:
194+
195+
```bash
196+
GITHUB_TOOLSETS="all" ./github-mcp-server
197+
```
198+
199+
## Dynamic Tool Discovery
200+
201+
**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.
202+
203+
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.
204+
205+
### Using Dynamic Tool Discovery
206+
207+
When using the binary, you can pass the `--dynamic-toolsets` flag.
208+
209+
```bash
210+
./github-mcp-server --dynamic-toolsets
211+
```
212+
213+
When using Docker, you can pass the toolsets as environment variables:
214+
215+
```bash
216+
docker run -i --rm \
217+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
218+
-e GITHUB_DYNAMIC_TOOLSETS=1 \
219+
ghcr.io/github/github-mcp-server
220+
```
98221

99222
## GitHub Enterprise Server
100223

101-
The flag `--gh-host` and the environment variable `GH_HOST` can be used to set
224+
The flag `--gh-host` and the environment variable `GITHUB_HOST` can be used to set
102225
the GitHub Enterprise Server hostname.
103226

104227
## i18n / Overriding Descriptions
@@ -309,6 +432,21 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
309432
- `draft`: Create as draft PR (boolean, optional)
310433
- `maintainer_can_modify`: Allow maintainer edits (boolean, optional)
311434

435+
- **add_pull_request_review_comment** - Add a review comment to a pull request or reply to an existing comment
436+
437+
- `owner`: Repository owner (string, required)
438+
- `repo`: Repository name (string, required)
439+
- `pull_number`: Pull request number (number, required)
440+
- `body`: The text of the review comment (string, required)
441+
- `commit_id`: The SHA of the commit to comment on (string, required unless using in_reply_to)
442+
- `path`: The relative path to the file that necessitates a comment (string, required unless using in_reply_to)
443+
- `line`: The line of the blob in the pull request diff that the comment applies to (number, optional)
444+
- `side`: The side of the diff to comment on (LEFT or RIGHT) (string, optional)
445+
- `start_line`: For multi-line comments, the first line of the range (number, optional)
446+
- `start_side`: For multi-line comments, the starting side of the diff (LEFT or RIGHT) (string, optional)
447+
- `subject_type`: The level at which the comment is targeted (line or file) (string, optional)
448+
- `in_reply_to`: The ID of the review comment to reply to (number, optional). When specified, only body is required and other parameters are ignored.
449+
312450
- **update_pull_request** - Update an existing pull request in a GitHub repository
313451

314452
- `owner`: Repository owner (string, required)
@@ -323,7 +461,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
323461
### Repositories
324462

325463
- **create_or_update_file** - Create or update a single file in a repository
326-
327464
- `owner`: Repository owner (string, required)
328465
- `repo`: Repository name (string, required)
329466
- `path`: File path (string, required)
@@ -333,50 +470,43 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
333470
- `sha`: File SHA if updating (string, optional)
334471

335472
- **list_branches** - List branches in a GitHub repository
336-
337473
- `owner`: Repository owner (string, required)
338474
- `repo`: Repository name (string, required)
339475
- `page`: Page number (number, optional)
340476
- `perPage`: Results per page (number, optional)
341477

342478
- **push_files** - Push multiple files in a single commit
343-
344479
- `owner`: Repository owner (string, required)
345480
- `repo`: Repository name (string, required)
346481
- `branch`: Branch to push to (string, required)
347482
- `files`: Files to push, each with path and content (array, required)
348483
- `message`: Commit message (string, required)
349484

350485
- **search_repositories** - Search for GitHub repositories
351-
352486
- `query`: Search query (string, required)
353487
- `sort`: Sort field (string, optional)
354488
- `order`: Sort order (string, optional)
355489
- `page`: Page number (number, optional)
356490
- `perPage`: Results per page (number, optional)
357491

358492
- **create_repository** - Create a new GitHub repository
359-
360493
- `name`: Repository name (string, required)
361494
- `description`: Repository description (string, optional)
362495
- `private`: Whether the repository is private (boolean, optional)
363496
- `autoInit`: Auto-initialize with README (boolean, optional)
364497

365498
- **get_file_contents** - Get contents of a file or directory
366-
367499
- `owner`: Repository owner (string, required)
368500
- `repo`: Repository name (string, required)
369501
- `path`: File path (string, required)
370502
- `ref`: Git reference (string, optional)
371503

372504
- **fork_repository** - Fork a repository
373-
374505
- `owner`: Repository owner (string, required)
375506
- `repo`: Repository name (string, required)
376507
- `organization`: Target organization name (string, optional)
377508

378509
- **create_branch** - Create a new branch
379-
380510
- `owner`: Repository owner (string, required)
381511
- `repo`: Repository name (string, required)
382512
- `branch`: New branch name (string, required)
@@ -397,18 +527,17 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
397527
- `page`: Page number, for files in the commit (number, optional)
398528
- `perPage`: Results per page, for files in the commit (number, optional)
399529

400-
### Search
401-
402530
- **search_code** - Search for code across GitHub repositories
403-
404531
- `query`: Search query (string, required)
405532
- `sort`: Sort field (string, optional)
406533
- `order`: Sort order (string, optional)
407534
- `page`: Page number (number, optional)
408535
- `perPage`: Results per page (number, optional)
409536

537+
### Users
538+
410539
- **search_users** - Search for GitHub users
411-
- `query`: Search query (string, required)
540+
- `q`: Search query (string, required)
412541
- `sort`: Sort field (string, optional)
413542
- `order`: Sort order (string, optional)
414543
- `page`: Page number (number, optional)
@@ -428,6 +557,22 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
428557
- `ref`: Git reference (string, optional)
429558
- `state`: Alert state (string, optional)
430559
- `severity`: Alert severity (string, optional)
560+
- `tool_name`: The name of the tool used for code scanning (string, optional)
561+
562+
### Secret Scanning
563+
564+
- **get_secret_scanning_alert** - Get a secret scanning alert
565+
566+
- `owner`: Repository owner (string, required)
567+
- `repo`: Repository name (string, required)
568+
- `alertNumber`: Alert number (number, required)
569+
570+
- **list_secret_scanning_alerts** - List secret scanning alerts for a repository
571+
- `owner`: Repository owner (string, required)
572+
- `repo`: Repository name (string, required)
573+
- `state`: Alert state (string, optional)
574+
- `secret_type`: The secret types to be filtered for in a comma-separated list (string, optional)
575+
- `resolution`: The resolution status (string, optional)
431576

432577
## Resources
433578

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy