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

Commite1bc53b

Browse files
committed
docs: update README
1 parent51ccba0 commite1bc53b

File tree

2 files changed

+73
-166
lines changed

2 files changed

+73
-166
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.idea
2+
cmd/github-mcp-server/github-mcp-server

‎README.md

Lines changed: 72 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,106 @@
11
#GitHub MCP Server
22

3-
GitHub MCP Server implemented in Go.
3+
The GitHub MCP Server is a Model Context Protocol (MCP) server that provides
4+
seamless integration with GitHub's APIs, enabling advanced automation and
5+
interaction capabilities for developers and tools.
46

5-
##Setup
7+
##Use Cases
68

7-
Create a GitHub Personal Access Token with the appropriate permissions
8-
and set it as the GITHUB_PERSONAL_ACCESS_TOKEN environment variable.
9+
- Automating GitHub workflows and processes.
10+
- Extracting and analyzing data from GitHub repositories.
11+
- Building AI powered tools and applications that interact with GitHub's ecosystem.
912

10-
##Testing in VS Code Insiders
13+
##Prerequisites
1114

12-
###Requirements
15+
[Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new)
16+
with the permissions you want to give the MCP server. You can also install
17+
[Docker](https://www.docker.com/) to run the server in a container or build the
18+
binary from the repo.
1319

14-
You can either use a Docker image or build the binary from the repo.
20+
##Installation
1521

16-
####Docker image
17-
18-
As of now, this repo is private, and hence the docker image is not available publicly. To pull it,
19-
you need to make sure you can access the GitHub docker registry. See[this](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic)
20-
for more details.
21-
22-
To make sure you can access the GitHub docker registry, run the following command:
22+
###Usage with VS Code
2323

2424
```bash
25-
docker pull ghcr.io/github/github-mcp-server:main
26-
```
25+
code --add-mcp'{"name":"github","command":"docker","args":["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server:main"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-pat}"}, "inputs": [{ "id": "github-pat", "type": "promptString", "description": "Github Personal Access Token", "password": true}]}'
2726

28-
If the above command works, you are good to go.
29-
30-
####Build from repo
31-
First, install`github-mcp-server` by cloning the repo and running the following command:
32-
33-
```bash
34-
go install ./cmd/github-mcp-server
3527
```
28+
When you start the server, VS Code will prompt for your token. On top of
29+
`servers`, you should see a`Start` link to start the server.
3630

37-
If you don't want to clone the repo, you can run:
38-
39-
```bash
40-
GOPRIVATE=github.com/github go install github.com/github/github-mcp-server/cmd/github-mcp-server@latest
41-
```
42-
43-
This will install the`github-mcp-server` binary in your`$GOPATH/bin` directory.
44-
45-
Find where the binary is installed by running:
31+
###Usage with Claude Desktop
4632

47-
```bash
48-
# note this assumes $GOPATH/bin is in your $PATH
49-
which github-mcp-server
33+
```json
34+
{
35+
"mcpServers": {
36+
"github": {
37+
"command":"docker",
38+
"args": [
39+
"run",
40+
"-i",
41+
"--rm",
42+
"-e",
43+
"GITHUB_PERSONAL_ACCESS_TOKEN",
44+
"ghcr.io/github/github-mcp-server:main"
45+
],
46+
"env": {
47+
"GITHUB_PERSONAL_ACCESS_TOKEN":"<YOUR_TOKEN>"
48+
}
49+
}
50+
}
51+
}
5052
```
5153

52-
###Start VS Code Insiders
54+
###Build from source
5355

54-
Start VS Code Insiders and make sure you pass the`GITHUB_PERSONAL_ACCESS_TOKEN` environment variable to the process.
56+
If you don't have Docker, you can use`go` to build the binary in the
57+
`cmd/github-mcp-server` directory, and use the`github-mcp-server stdio`
58+
command with the`GITHUB_PERSONAL_ACCESS_TOKEN` environment variable set to
59+
your token.
5560

56-
One way to do this is to make sure that[you can run VS code from your terminal](https://code.visualstudio.com/docs/setup/mac#_launch-vs-code-from-the-command-line) and
57-
start it with the following command:
61+
##GitHub Enterprise Server
5862

59-
```bash
60-
export GITHUB_PERSONAL_ACCESS_TOKEN=your-token-here
61-
code-insiders
62-
```
63+
The flag`--gh-host` and the environment variable`GH_HOST` can be used to set
64+
the GitHub Enterprise Server hostname.
6365

64-
Another way is to set the environment variable in your shell configuration file (e.g.,`.bashrc`,`.zshrc`, etc.).
66+
##i18n / Overriding Descriptions
6567

66-
Create a new file`.vscode/mcp.json` and provide this configuration:
68+
The descriptions of the tools can be overridden by creating a
69+
github-mcp-server.json file in the same directory as the binary.
6770

68-
If you are using the docker image, use this configuration:
71+
The file should contain a JSON object with the tool names as keys and the new
72+
descriptions as values. For example:
6973

7074
```json
7175
{
72-
"inputs": [
73-
{
74-
"id":"github-pat",
75-
"type":"promptString",
76-
"description":"Github Personal Access Token",
77-
"password":true,
78-
}
79-
],
80-
"servers": {
81-
"github-mcp-server": {
82-
"type":"stdio",
83-
"command":"docker",
84-
"args": [
85-
"run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server:main"
86-
],
87-
"env": {
88-
"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github-pat}"
89-
}
90-
}
91-
}
76+
"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION":"an alternative description",
77+
"TOOL_CREATE_BRANCH_DESCRIPTION":"Create a new branch in a GitHub repository"
9278
}
9379
```
9480

95-
When you start the server, VS Code will prompt for your token, as indicated by`${input:github-pat}`.
81+
You can create an export of the current translations by running the binary with
82+
the`--export-translations` flag.
9683

97-
If you built the binary from the repo use this configuration:
84+
This flag will preserve any translations/overrides you have made, while adding
85+
any new translations that have been added to the binary since the last time you
86+
exported.
9887

99-
```json
100-
{
101-
"mcp": {
102-
"inputs": [ ],
103-
"servers": {
104-
"mcp-github-server": {
105-
"command":"path-to-your/github-mcp-server",
106-
"args": ["stdio"],
107-
"env": { }
108-
}
109-
}
110-
}
111-
}
88+
```sh
89+
./github-mcp-server --export-translations
90+
cat github-mcp-server.json
11291
```
11392

114-
Right on top of`servers`, you should see a`Start` link to start the server.
115-
93+
You can also use ENV vars to override the descriptions. The environment
94+
variable names are the same as the keys in the JSON file, prefixed with
95+
`GITHUB_MCP_` and all uppercase.
11696

117-
Try something like the following prompt to verify that it works:
97+
For example, to override the`TOOL_ADD_ISSUE_COMMENT_DESCRIPTION` tool, you can
98+
set the following environment variable:
11899

119-
```
120-
I'd like to know more about my GitHub profile.
100+
```sh
101+
export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"
121102
```
122103

123-
##GitHub Enterprise Server
124-
125-
The flag`--gh-host` and the environment variable`GH_HOST` can be used to set the GitHub Enterprise Server hostname.
126-
127-
128104
##Tools
129105

130106
###Users
@@ -355,7 +331,7 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
355331

356332
###Repository Content
357333

358-
-**Get Repository Content**
334+
-**Get Repository Content**
359335
Retrieves the content of a repository at a specific path.
360336

361337
-**Template**:`repo://{owner}/{repo}/contents{/path*}`
@@ -364,7 +340,7 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
364340
-`repo`: Repository name (string, required)
365341
-`path`: File or directory path (string, optional)
366342

367-
-**Get Repository Content for a Specific Branch**
343+
-**Get Repository Content for a Specific Branch**
368344
Retrieves the content of a repository at a specific path for a given branch.
369345

370346
-**Template**:`repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}`
@@ -374,7 +350,7 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
374350
-`branch`: Branch name (string, required)
375351
-`path`: File or directory path (string, optional)
376352

377-
-**Get Repository Content for a Specific Commit**
353+
-**Get Repository Content for a Specific Commit**
378354
Retrieves the content of a repository at a specific path for a given commit.
379355

380356
-**Template**:`repo://{owner}/{repo}/sha/{sha}/contents{/path*}`
@@ -384,7 +360,7 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
384360
-`sha`: Commit SHA (string, required)
385361
-`path`: File or directory path (string, optional)
386362

387-
-**Get Repository Content for a Specific Tag**
363+
-**Get Repository Content for a Specific Tag**
388364
Retrieves the content of a repository at a specific path for a given tag.
389365

390366
-**Template**:`repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}`
@@ -394,7 +370,7 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
394370
-`tag`: Tag name (string, required)
395371
-`path`: File or directory path (string, optional)
396372

397-
-**Get Repository Content for a Specific Pull Request**
373+
-**Get Repository Content for a Specific Pull Request**
398374
Retrieves the content of a repository at a specific path for a given pull request.
399375

400376
-**Template**:`repo://{owner}/{repo}/refs/pull/{pr_number}/head/contents{/path*}`
@@ -403,73 +379,3 @@ The flag `--gh-host` and the environment variable `GH_HOST` can be used to set t
403379
-`repo`: Repository name (string, required)
404380
-`pr_number`: Pull request number (string, required)
405381
-`path`: File or directory path (string, optional)
406-
407-
##Standard input/output server
408-
409-
```sh
410-
go run cmd/github-mcp-server/main.go stdio
411-
```
412-
413-
E.g:
414-
415-
Set the PAT token in the environment variable and run:
416-
417-
```sh
418-
script/get-me
419-
```
420-
421-
And you should see the output of the GitHub MCP server responding with the user information.
422-
423-
```sh
424-
GitHub MCP Server running on stdio
425-
{
426-
"jsonrpc":"2.0",
427-
"id": 3,
428-
"result": {
429-
"content": [
430-
{
431-
"type":"text",
432-
"text":"{\"login\":\"juruen\",\"id\" ... }
433-
}
434-
]
435-
}
436-
}
437-
438-
```
439-
440-
## i18n / Overriding descriptions
441-
442-
The descriptions of the tools can be overridden by creating a github-mcp-server.json filein the same directory as the binary.
443-
The file should contain a JSON object with the tool names as keys and the new descriptions as values.
444-
For example:
445-
446-
```json
447-
{
448-
"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION":"an alternative description",
449-
"TOOL_CREATE_BRANCH_DESCRIPTION":"Create a new branchin a GitHub repository"
450-
}
451-
```
452-
453-
You can create anexport of the current translations by running the binary with the`--export-translations` flag.
454-
This flag will preserve any translations/overrides you have made,while adding any new translations that have been added to the binary since the lasttime you exported.
455-
456-
```sh
457-
./github-mcp-server --export-translations
458-
cat github-mcp-server.json
459-
```
460-
461-
You can also use ENV vars to override the descriptions. The environment variable names are the same as the keysin the JSON file,
462-
prefixed with`GITHUB_MCP_` and all uppercase.
463-
464-
For example, to override the`TOOL_ADD_ISSUE_COMMENT_DESCRIPTION` tool, you canset the following environment variable:
465-
466-
```sh
467-
export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"
468-
```
469-
470-
## TODO
471-
472-
Testing
473-
474-
- Integration tests
475-
- Blackbox testing: ideally comparing output to Anthropic's server to make sure that this is a fully compatible drop-in replacement.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp