Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9424fbd

Browse files
authored
Merge branch 'main' into martinajir-list-notifications
2 parentsea562ae +9fa582d commit9424fbd

12 files changed

+576
-55
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
.idea
22
cmd/github-mcp-server/github-mcp-server
3+
4+
# VSCode
5+
.vscode/mcp.json
6+
37
# Added by goreleaser init:
48
dist/
5-
__debug_bin*
9+
__debug_bin*
10+
11+
# Go
12+
vendor

‎README.md

Lines changed: 103 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ 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

@@ -110,9 +108,91 @@ If you don't have Docker, you can use `go build` to build the binary in the
110108
}
111109
```
112110

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+
113193
##GitHub Enterprise Server
114194

115-
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
116196
the GitHub Enterprise Server hostname.
117197

118198
##i18n / Overriding Descriptions
@@ -331,7 +411,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
331411
###Repositories
332412

333413
-**create_or_update_file** - Create or update a single file in a repository
334-
335414
-`owner`: Repository owner (string, required)
336415
-`repo`: Repository name (string, required)
337416
-`path`: File path (string, required)
@@ -341,50 +420,43 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
341420
-`sha`: File SHA if updating (string, optional)
342421

343422
-**list_branches** - List branches in a GitHub repository
344-
345423
-`owner`: Repository owner (string, required)
346424
-`repo`: Repository name (string, required)
347425
-`page`: Page number (number, optional)
348426
-`perPage`: Results per page (number, optional)
349427

350428
-**push_files** - Push multiple files in a single commit
351-
352429
-`owner`: Repository owner (string, required)
353430
-`repo`: Repository name (string, required)
354431
-`branch`: Branch to push to (string, required)
355432
-`files`: Files to push, each with path and content (array, required)
356433
-`message`: Commit message (string, required)
357434

358435
-**search_repositories** - Search for GitHub repositories
359-
360436
-`query`: Search query (string, required)
361437
-`sort`: Sort field (string, optional)
362438
-`order`: Sort order (string, optional)
363439
-`page`: Page number (number, optional)
364440
-`perPage`: Results per page (number, optional)
365441

366442
-**create_repository** - Create a new GitHub repository
367-
368443
-`name`: Repository name (string, required)
369444
-`description`: Repository description (string, optional)
370445
-`private`: Whether the repository is private (boolean, optional)
371446
-`autoInit`: Auto-initialize with README (boolean, optional)
372447

373448
-**get_file_contents** - Get contents of a file or directory
374-
375449
-`owner`: Repository owner (string, required)
376450
-`repo`: Repository name (string, required)
377451
-`path`: File path (string, required)
378452
-`ref`: Git reference (string, optional)
379453

380454
-**fork_repository** - Fork a repository
381-
382455
-`owner`: Repository owner (string, required)
383456
-`repo`: Repository name (string, required)
384457
-`organization`: Target organization name (string, optional)
385458

386459
-**create_branch** - Create a new branch
387-
388460
-`owner`: Repository owner (string, required)
389461
-`repo`: Repository name (string, required)
390462
-`branch`: New branch name (string, required)
@@ -405,16 +477,15 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
405477
-`page`: Page number, for files in the commit (number, optional)
406478
-`perPage`: Results per page, for files in the commit (number, optional)
407479

408-
###Search
409-
410-
-**search_code** - Search for code across GitHub repositories
411-
480+
-**search_code** - Search for code across GitHub repositories
412481
-`query`: Search query (string, required)
413482
-`sort`: Sort field (string, optional)
414483
-`order`: Sort order (string, optional)
415484
-`page`: Page number (number, optional)
416485
-`perPage`: Results per page (number, optional)
417486

487+
###Users
488+
418489
-**search_users** - Search for GitHub users
419490
-`query`: Search query (string, required)
420491
-`sort`: Sort field (string, optional)
@@ -436,6 +507,22 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
436507
-`ref`: Git reference (string, optional)
437508
-`state`: Alert state (string, optional)
438509
-`severity`: Alert severity (string, optional)
510+
-`tool_name`: The name of the tool used for code scanning (string, optional)
511+
512+
###Secret Scanning
513+
514+
-**get_secret_scanning_alert** - Get a secret scanning alert
515+
516+
-`owner`: Repository owner (string, required)
517+
-`repo`: Repository name (string, required)
518+
-`alertNumber`: Alert number (number, required)
519+
520+
-**list_secret_scanning_alerts** - List secret scanning alerts for a repository
521+
-`owner`: Repository owner (string, required)
522+
-`repo`: Repository name (string, required)
523+
-`state`: Alert state (string, optional)
524+
-`secret_type`: The secret types to be filtered for in a comma-separated list (string, optional)
525+
-`resolution`: The resolution status (string, optional)
439526

440527
###Notifications
441528

‎pkg/github/code_scanning.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,16 @@ func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHel
8686
mcp.Description("The Git reference for the results you want to list."),
8787
),
8888
mcp.WithString("state",
89-
mcp.Description("State of thecode scanning alertsto list. Set to closed to list only closed code scanning alerts. Default: open"),
89+
mcp.Description("Filtercode scanning alertsby state. Defaults to open"),
9090
mcp.DefaultString("open"),
91+
mcp.Enum("open","closed","dismissed","fixed"),
9192
),
9293
mcp.WithString("severity",
93-
mcp.Description("Only code scanning alerts with this severity will be returned. Possible values are: critical, high, medium, low, warning, note, error."),
94+
mcp.Description("Filter code scanning alerts by severity"),
95+
mcp.Enum("critical","high","medium","low","warning","note","error"),
96+
),
97+
mcp.WithString("tool_name",
98+
mcp.Description("The name of the tool used for code scanning."),
9499
),
95100
),
96101
func(ctx context.Context,request mcp.CallToolRequest) (*mcp.CallToolResult,error) {
@@ -114,12 +119,16 @@ func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHel
114119
iferr!=nil {
115120
returnmcp.NewToolResultError(err.Error()),nil
116121
}
122+
toolName,err:=OptionalParam[string](request,"tool_name")
123+
iferr!=nil {
124+
returnmcp.NewToolResultError(err.Error()),nil
125+
}
117126

118127
client,err:=getClient(ctx)
119128
iferr!=nil {
120129
returnnil,fmt.Errorf("failed to get GitHub client: %w",err)
121130
}
122-
alerts,resp,err:=client.CodeScanning.ListAlertsForRepo(ctx,owner,repo,&github.AlertListOptions{Ref:ref,State:state,Severity:severity})
131+
alerts,resp,err:=client.CodeScanning.ListAlertsForRepo(ctx,owner,repo,&github.AlertListOptions{Ref:ref,State:state,Severity:severity,ToolName:toolName})
123132
iferr!=nil {
124133
returnnil,fmt.Errorf("failed to list alerts: %w",err)
125134
}

‎pkg/github/code_scanning_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func Test_ListCodeScanningAlerts(t *testing.T) {
127127
assert.Contains(t,tool.InputSchema.Properties,"ref")
128128
assert.Contains(t,tool.InputSchema.Properties,"state")
129129
assert.Contains(t,tool.InputSchema.Properties,"severity")
130+
assert.Contains(t,tool.InputSchema.Properties,"tool_name")
130131
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"owner","repo"})
131132

132133
// Setup mock alerts for success case
@@ -159,20 +160,22 @@ func Test_ListCodeScanningAlerts(t *testing.T) {
159160
mock.WithRequestMatchHandler(
160161
mock.GetReposCodeScanningAlertsByOwnerByRepo,
161162
expectQueryParams(t,map[string]string{
162-
"ref":"main",
163-
"state":"open",
164-
"severity":"high",
163+
"ref":"main",
164+
"state":"open",
165+
"severity":"high",
166+
"tool_name":"codeql",
165167
}).andThen(
166168
mockResponse(t,http.StatusOK,mockAlerts),
167169
),
168170
),
169171
),
170172
requestArgs:map[string]interface{}{
171-
"owner":"owner",
172-
"repo":"repo",
173-
"ref":"main",
174-
"state":"open",
175-
"severity":"high",
173+
"owner":"owner",
174+
"repo":"repo",
175+
"ref":"main",
176+
"state":"open",
177+
"severity":"high",
178+
"tool_name":"codeql",
176179
},
177180
expectError:false,
178181
expectedAlerts:mockAlerts,

‎pkg/github/issues.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc
9090
),
9191
mcp.WithString("body",
9292
mcp.Required(),
93-
mcp.Description("Commenttext"),
93+
mcp.Description("Commentcontent"),
9494
),
9595
),
9696
func(ctx context.Context,request mcp.CallToolRequest) (*mcp.CallToolResult,error) {
@@ -151,7 +151,7 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (
151151
mcp.Description("Search query using GitHub issues search syntax"),
152152
),
153153
mcp.WithString("sort",
154-
mcp.Description("Sort field(comments, reactions, created, etc.)"),
154+
mcp.Description("Sort fieldby number of matches of categories, defaults to best match"),
155155
mcp.Enum(
156156
"comments",
157157
"reactions",
@@ -167,7 +167,7 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (
167167
),
168168
),
169169
mcp.WithString("order",
170-
mcp.Description("Sort order ('asc' or 'desc')"),
170+
mcp.Description("Sort order"),
171171
mcp.Enum("asc","desc"),
172172
),
173173
WithPagination(),
@@ -357,7 +357,7 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to
357357
mcp.Description("Repository name"),
358358
),
359359
mcp.WithString("state",
360-
mcp.Description("Filter by state ('open', 'closed', 'all')"),
360+
mcp.Description("Filter by state"),
361361
mcp.Enum("open","closed","all"),
362362
),
363363
mcp.WithArray("labels",
@@ -369,11 +369,11 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to
369369
),
370370
),
371371
mcp.WithString("sort",
372-
mcp.Description("Sortby ('created', 'updated', 'comments')"),
372+
mcp.Description("Sortorder"),
373373
mcp.Enum("created","updated","comments"),
374374
),
375375
mcp.WithString("direction",
376-
mcp.Description("Sort direction ('asc', 'desc')"),
376+
mcp.Description("Sort direction"),
377377
mcp.Enum("asc","desc"),
378378
),
379379
mcp.WithString("since",
@@ -485,7 +485,7 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
485485
mcp.Description("New description"),
486486
),
487487
mcp.WithString("state",
488-
mcp.Description("New state ('open' or 'closed')"),
488+
mcp.Description("New state"),
489489
mcp.Enum("open","closed"),
490490
),
491491
mcp.WithArray("labels",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp