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
Copy file name to clipboardExpand all lines: README.md
+75-8Lines changed: 75 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ automation and interaction capabilities for developers and tools.
15
15
## Prerequisites
16
16
17
17
1. To run the server in a container, you will need to have [Docker](https://www.docker.com/) installed.
18
-
2.[Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new).
18
+
2. Once Docker is installed, you will also need to ensure Docker is running.
19
+
3. Lastly you will need to [Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new).
19
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)).
20
21
21
22
@@ -90,10 +91,24 @@ More about using MCP server tools in VS Code's [agent mode documentation](https:
90
91
91
92
### Build from source
92
93
93
-
If you don't have Docker, you can use `go` to build the binary in the
94
-
`cmd/github-mcp-server` directory, and use the `github-mcp-server stdio`
95
-
command with the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable set to
96
-
your token.
94
+
If you don't have Docker, you can use `go build` to build the binary in the
95
+
`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:
96
+
97
+
```JSON
98
+
{
99
+
"mcp": {
100
+
"servers": {
101
+
"github": {
102
+
"command": "/path/to/github-mcp-server",
103
+
"args": ["stdio"],
104
+
"env": {
105
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
106
+
}
107
+
}
108
+
}
109
+
}
110
+
}
111
+
```
97
112
98
113
## GitHub Enterprise Server
99
114
@@ -153,6 +168,12 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
153
168
-`repo`: Repository name (string, required)
154
169
-`issue_number`: Issue number (number, required)
155
170
171
+
-**get_issue_comments** - Get comments for a GitHub issue
172
+
173
+
-`owner`: Repository owner (string, required)
174
+
-`repo`: Repository name (string, required)
175
+
-`issue_number`: Issue number (number, required)
176
+
156
177
-**create_issue** - Create a new issue in a GitHub repository
157
178
158
179
-`owner`: Repository owner (string, required)
@@ -198,7 +219,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
198
219
-`sort`: Sort field (string, optional)
199
220
-`order`: Sort order (string, optional)
200
221
-`page`: Page number (number, optional)
201
-
-`per_page`: Results per page (number, optional)
222
+
-`perPage`: Results per page (number, optional)
202
223
203
224
### Pull Requests
204
225
@@ -266,7 +287,9 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
-**create_or_update_file** - Create or update a single file in a repository
@@ -291,6 +340,13 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
291
340
-`branch`: Branch name (string, optional)
292
341
-`sha`: File SHA if updating (string, optional)
293
342
343
+
-**list_branches** - List branches in a GitHub repository
344
+
345
+
-`owner`: Repository owner (string, required)
346
+
-`repo`: Repository name (string, required)
347
+
-`page`: Page number (number, optional)
348
+
-`perPage`: Results per page (number, optional)
349
+
294
350
-**push_files** - Push multiple files in a single commit
295
351
296
352
-`owner`: Repository owner (string, required)
@@ -334,14 +390,21 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
334
390
-`branch`: New branch name (string, required)
335
391
-`sha`: SHA to create branch from (string, required)
336
392
337
-
-**list_commits** - Gets commits of a branch in a repository
393
+
-**list_commits** - Get a list of commits of a branch in a repository
338
394
-`owner`: Repository owner (string, required)
339
395
-`repo`: Repository name (string, required)
340
396
-`sha`: Branch name, tag, or commit SHA (string, optional)
341
397
-`path`: Only commits containing this file path (string, optional)
342
398
-`page`: Page number (number, optional)
343
399
-`perPage`: Results per page (number, optional)
344
400
401
+
-**get_commit** - Get details for a commit from a repository
402
+
-`owner`: Repository owner (string, required)
403
+
-`repo`: Repository name (string, required)
404
+
-`sha`: Commit SHA, branch name, or tag name (string, required)
405
+
-`page`: Page number, for files in the commit (number, optional)
406
+
-`perPage`: Results per page, for files in the commit (number, optional)
407
+
345
408
### Search
346
409
347
410
-**search_code** - Search for code across GitHub repositories
@@ -427,6 +490,10 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
427
490
-`prNumber`: Pull request number (string, required)
428
491
-`path`: File or directory path (string, optional)
429
492
493
+
## Library Usage
494
+
495
+
The exported Go API of this module should currently be considered unstable, and subject to breaking changes. In the future, we may offer stability; please file an issue if there is a use case where this would be valuable.
496
+
430
497
## License
431
498
432
499
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE) for the full terms.
// 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")
71
74
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")
72
75
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
73
76
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")
74
77
rootCmd.PersistentFlags().String("gh-host", "", "Specify the GitHub hostname (for GitHub Enterprise etc.)")
0 commit comments