Skip to content

Commit a84ede9

Browse files
authored
Merge branch 'main' into feat/259/assign-reviewers
2 parents 9db748b + 8991436 commit a84ede9

File tree

3 files changed

+92
-19
lines changed

3 files changed

+92
-19
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

README.md

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,88 @@ If you don't have Docker, you can use `go build` to build the binary in the
108108
}
109109
```
110110

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):
118+
119+
| Toolset | Description |
120+
| ----------------------- | ------------------------------------------------------------- |
121+
| `repos` | Repository-related tools (file operations, branches, commits) |
122+
| `issues` | Issue-related tools (create, read, update, comment) |
123+
| `users` | Anything relating to GitHub Users |
124+
| `pull_requests` | Pull request operations (create, merge, review) |
125+
| `code_security` | Code scanning alerts and security features |
126+
| `experiments` | Experimental features (not considered stable) |
127+
128+
#### Specifying Toolsets
129+
130+
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
131+
132+
1. **Using Command Line Argument**:
133+
134+
```bash
135+
github-mcp-server --toolsets repos,issues,pull_requests,code_security
136+
```
137+
138+
2. **Using Environment Variable**:
139+
```bash
140+
GITHUB_TOOLSETS="repos,issues,pull_requests,code_security" ./github-mcp-server
141+
```
142+
143+
The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided.
144+
145+
### Using Toolsets With Docker
146+
147+
When using Docker, you can pass the toolsets as environment variables:
148+
149+
```bash
150+
docker run -i --rm \
151+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
152+
-e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \
153+
ghcr.io/github/github-mcp-server
154+
```
155+
156+
### The "all" Toolset
157+
158+
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+
```
192+
111193
## GitHub Enterprise Server
112194

113195
The flag `--gh-host` and the environment variable `GH_HOST` can be used to set
@@ -330,7 +412,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
330412
### Repositories
331413

332414
- **create_or_update_file** - Create or update a single file in a repository
333-
334415
- `owner`: Repository owner (string, required)
335416
- `repo`: Repository name (string, required)
336417
- `path`: File path (string, required)
@@ -340,50 +421,43 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
340421
- `sha`: File SHA if updating (string, optional)
341422

342423
- **list_branches** - List branches in a GitHub repository
343-
344424
- `owner`: Repository owner (string, required)
345425
- `repo`: Repository name (string, required)
346426
- `page`: Page number (number, optional)
347427
- `perPage`: Results per page (number, optional)
348428

349429
- **push_files** - Push multiple files in a single commit
350-
351430
- `owner`: Repository owner (string, required)
352431
- `repo`: Repository name (string, required)
353432
- `branch`: Branch to push to (string, required)
354433
- `files`: Files to push, each with path and content (array, required)
355434
- `message`: Commit message (string, required)
356435

357436
- **search_repositories** - Search for GitHub repositories
358-
359437
- `query`: Search query (string, required)
360438
- `sort`: Sort field (string, optional)
361439
- `order`: Sort order (string, optional)
362440
- `page`: Page number (number, optional)
363441
- `perPage`: Results per page (number, optional)
364442

365443
- **create_repository** - Create a new GitHub repository
366-
367444
- `name`: Repository name (string, required)
368445
- `description`: Repository description (string, optional)
369446
- `private`: Whether the repository is private (boolean, optional)
370447
- `autoInit`: Auto-initialize with README (boolean, optional)
371448

372449
- **get_file_contents** - Get contents of a file or directory
373-
374450
- `owner`: Repository owner (string, required)
375451
- `repo`: Repository name (string, required)
376452
- `path`: File path (string, required)
377453
- `ref`: Git reference (string, optional)
378454

379455
- **fork_repository** - Fork a repository
380-
381456
- `owner`: Repository owner (string, required)
382457
- `repo`: Repository name (string, required)
383458
- `organization`: Target organization name (string, optional)
384459

385460
- **create_branch** - Create a new branch
386-
387461
- `owner`: Repository owner (string, required)
388462
- `repo`: Repository name (string, required)
389463
- `branch`: New branch name (string, required)
@@ -404,16 +478,15 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
404478
- `page`: Page number, for files in the commit (number, optional)
405479
- `perPage`: Results per page, for files in the commit (number, optional)
406480

407-
### Search
408-
409-
- **search_code** - Search for code across GitHub repositories
410-
481+
- **search_code** - Search for code across GitHub repositories
411482
- `query`: Search query (string, required)
412483
- `sort`: Sort field (string, optional)
413484
- `order`: Sort order (string, optional)
414485
- `page`: Page number (number, optional)
415486
- `perPage`: Results per page (number, optional)
416487

488+
### Users
489+
417490
- **search_users** - Search for GitHub users
418491
- `query`: Search query (string, required)
419492
- `sort`: Sort field (string, optional)

pkg/github/pullrequests.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -989,30 +989,30 @@ func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHe
989989
map[string]interface{}{
990990
"type": "object",
991991
"additionalProperties": false,
992-
"required": []string{"path", "body"},
992+
"required": []string{"path", "body", "position", "line", "side", "start_line", "start_side"},
993993
"properties": map[string]interface{}{
994994
"path": map[string]interface{}{
995995
"type": "string",
996996
"description": "path to the file",
997997
},
998998
"position": map[string]interface{}{
999-
"type": "number",
999+
"type": []string{"number", "null"},
10001000
"description": "position of the comment in the diff",
10011001
},
10021002
"line": map[string]interface{}{
1003-
"type": "number",
1003+
"type": []string{"number", "null"},
10041004
"description": "line number in the file to comment on. For multi-line comments, the end of the line range",
10051005
},
10061006
"side": map[string]interface{}{
1007-
"type": "string",
1007+
"type": []string{"string", "null"},
10081008
"description": "The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. (LEFT or RIGHT)",
10091009
},
10101010
"start_line": map[string]interface{}{
1011-
"type": "number",
1011+
"type": []string{"number", "null"},
10121012
"description": "The first line of the range to which the comment refers. Required for multi-line comments.",
10131013
},
10141014
"start_side": map[string]interface{}{
1015-
"type": "string",
1015+
"type": []string{"string", "null"},
10161016
"description": "The side of the diff on which the start line resides for multi-line comments. (LEFT or RIGHT)",
10171017
},
10181018
"body": map[string]interface{}{

0 commit comments

Comments
 (0)