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

Commit836a0e2

Browse files
authored
Merge branch 'main' into camila/update-wording-on-create-or-update-file
2 parents90cc813 +4e26dce commit836a0e2

24 files changed

+1070
-619
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

‎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: 136 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,18 @@ automation and interaction capabilities for developers and tools.
1515
##Prerequisites
1616

1717
1. To run the server in a container, you will need to have[Docker](https://www.docker.com/) installed.
18-
2. Once Docker is installed, you will also need to ensure Docker is running.
18+
2. Once Docker is installed, you will also need to ensure Docker is running. The image is public; if you get errors on pull, you may have an expired token and need to`docker logout ghcr.io`.
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
@@ -110,9 +137,91 @@ If you don't have Docker, you can use `go build` to build the binary in the
110137
}
111138
```
112139

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+
```
221+
113222
##GitHub Enterprise Server
114223

115-
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
116225
the GitHub Enterprise Server hostname.
117226

118227
##i18n / Overriding Descriptions
@@ -331,7 +440,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
331440
###Repositories
332441

333442
-**create_or_update_file** - Create or update a single file in a repository
334-
335443
-`owner`: Repository owner (string, required)
336444
-`repo`: Repository name (string, required)
337445
-`path`: File path (string, required)
@@ -341,50 +449,43 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
341449
-`sha`: File SHA if updating (string, optional)
342450

343451
-**list_branches** - List branches in a GitHub repository
344-
345452
-`owner`: Repository owner (string, required)
346453
-`repo`: Repository name (string, required)
347454
-`page`: Page number (number, optional)
348455
-`perPage`: Results per page (number, optional)
349456

350457
-**push_files** - Push multiple files in a single commit
351-
352458
-`owner`: Repository owner (string, required)
353459
-`repo`: Repository name (string, required)
354460
-`branch`: Branch to push to (string, required)
355461
-`files`: Files to push, each with path and content (array, required)
356462
-`message`: Commit message (string, required)
357463

358464
-**search_repositories** - Search for GitHub repositories
359-
360465
-`query`: Search query (string, required)
361466
-`sort`: Sort field (string, optional)
362467
-`order`: Sort order (string, optional)
363468
-`page`: Page number (number, optional)
364469
-`perPage`: Results per page (number, optional)
365470

366471
-**create_repository** - Create a new GitHub repository
367-
368472
-`name`: Repository name (string, required)
369473
-`description`: Repository description (string, optional)
370474
-`private`: Whether the repository is private (boolean, optional)
371475
-`autoInit`: Auto-initialize with README (boolean, optional)
372476

373477
-**get_file_contents** - Get contents of a file or directory
374-
375478
-`owner`: Repository owner (string, required)
376479
-`repo`: Repository name (string, required)
377480
-`path`: File path (string, required)
378481
-`ref`: Git reference (string, optional)
379482

380483
-**fork_repository** - Fork a repository
381-
382484
-`owner`: Repository owner (string, required)
383485
-`repo`: Repository name (string, required)
384486
-`organization`: Target organization name (string, optional)
385487

386488
-**create_branch** - Create a new branch
387-
388489
-`owner`: Repository owner (string, required)
389490
-`repo`: Repository name (string, required)
390491
-`branch`: New branch name (string, required)
@@ -405,18 +506,17 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
405506
-`page`: Page number, for files in the commit (number, optional)
406507
-`perPage`: Results per page, for files in the commit (number, optional)
407508

408-
###Search
409-
410509
-**search_code** - Search for code across GitHub repositories
411-
412510
-`query`: Search query (string, required)
413511
-`sort`: Sort field (string, optional)
414512
-`order`: Sort order (string, optional)
415513
-`page`: Page number (number, optional)
416514
-`perPage`: Results per page (number, optional)
417515

516+
###Users
517+
418518
-**search_users** - Search for GitHub users
419-
-`query`: Search query (string, required)
519+
-`q`: Search query (string, required)
420520
-`sort`: Sort field (string, optional)
421521
-`order`: Sort order (string, optional)
422522
-`page`: Page number (number, optional)
@@ -438,6 +538,21 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
438538
-`severity`: Alert severity (string, optional)
439539
-`tool_name`: The name of the tool used for code scanning (string, optional)
440540

541+
###Secret Scanning
542+
543+
-**get_secret_scanning_alert** - Get a secret scanning alert
544+
545+
-`owner`: Repository owner (string, required)
546+
-`repo`: Repository name (string, required)
547+
-`alertNumber`: Alert number (number, required)
548+
549+
-**list_secret_scanning_alerts** - List secret scanning alerts for a repository
550+
-`owner`: Repository owner (string, required)
551+
-`repo`: Repository name (string, required)
552+
-`state`: Alert state (string, optional)
553+
-`secret_type`: The secret types to be filtered for in a comma-separated list (string, optional)
554+
-`resolution`: The resolution status (string, optional)
555+
441556
##Resources
442557

443558
###Repository Content

‎cmd/github-mcp-server/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ var (
4545
stdlog.Fatal("Failed to initialize logger:",err)
4646
}
4747

48-
enabledToolsets:=viper.GetStringSlice("toolsets")
48+
// If you're wondering why we're not using viper.GetStringSlice("toolsets"),
49+
// it's because viper doesn't handle comma-separated values correctly for env
50+
// vars when using GetStringSlice.
51+
// https://github.com/spf13/viper/issues/380
52+
varenabledToolsets []string
53+
err=viper.UnmarshalKey("toolsets",&enabledToolsets)
54+
iferr!=nil {
55+
stdlog.Fatal("Failed to unmarshal toolsets:",err)
56+
}
4957

5058
logCommands:=viper.GetBool("enable-command-logging")
5159
cfg:=runConfig{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp