-
Notifications
You must be signed in to change notification settings - Fork 0
docs(mcp): update GitHub MCP server guide to use official server #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ae4aff3
4af864e
83bb848
08f08c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,19 @@ | ||
| { | ||
| "default": true, | ||
| "MD003": { "style": "atx" }, | ||
| "MD007": { "indent": 2 }, | ||
| "MD013": { "line_length": 120, "code_blocks": false, "tables": false }, | ||
| "MD024": { "allow_different_nesting": true }, | ||
| "MD003": { | ||
| "style": "atx" | ||
| }, | ||
| "MD007": { | ||
| "indent": 2 | ||
| }, | ||
| "MD013": { | ||
| "line_length": 120, | ||
| "code_blocks": false, | ||
| "tables": false | ||
| }, | ||
|
Comment on lines
+9
to
+13
|
||
| "MD024": { | ||
| "allow_different_nesting": true | ||
| }, | ||
| "MD033": false, | ||
| "MD041": false | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,117 +2,190 @@ | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Overview | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The GitHub MCP Server is a server that provides a MCP interface for the GitHub API. It is a simple server that can be | ||||||||||||||||||||||||||
| used to interact with the GitHub API. Users can use this server to get information about their GitHub repositories, | ||||||||||||||||||||||||||
| issues, pull requests, and more. | ||||||||||||||||||||||||||
| The GitHub MCP Server provides an MCP interface for the GitHub API. Users can | ||||||||||||||||||||||||||
| use this server to interact with GitHub repositories, issues, pull requests, and | ||||||||||||||||||||||||||
| more through AI-powered tools like Claude Code and Cursor AI. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| > **Note:** The npm package `@modelcontextprotocol/server-github` is | ||||||||||||||||||||||||||
| > **deprecated as of April 2025**. Follow the updated instructions below to use | ||||||||||||||||||||||||||
| > the official GitHub MCP server (`ghcr.io/github/github-mcp-server` via Docker | ||||||||||||||||||||||||||
| > or the remote hosted endpoint). | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## GitHub MCP Personal Access Token Setup | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| To use the GitHub MCP, you need to create a personal access token. GitHub users can create a personal access token | ||||||||||||||||||||||||||
| [by navigating to the GitHub settings page](https://github.com/settings/tokens). | ||||||||||||||||||||||||||
| To use the GitHub MCP, you need to create a personal access token. GitHub users | ||||||||||||||||||||||||||
| can create a personal access token [by navigating to the GitHub settings | ||||||||||||||||||||||||||
| page](https://github.com/settings/tokens). | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Once on the Personal Access Tokens page, click on 'Generate new token'. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| As the first step, provide a descriptive name for your token, such as 'GitHub MCP Token'. | ||||||||||||||||||||||||||
| As the first step, provide a descriptive name for your token, such as | ||||||||||||||||||||||||||
| 'GitHub MCP Token'. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Then, select the required scopes for the token: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - For full access to private repositories, select repo. | ||||||||||||||||||||||||||
| - For access to public repositories only, select public_repo. | ||||||||||||||||||||||||||
| - For full access to private repositories, select `repo`. | ||||||||||||||||||||||||||
| - For access to public repositories only, select `public_repo`. | ||||||||||||||||||||||||||
| - Scroll down and click on Generate token. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Copy the generated token and save it securely. This will be used in the various tooling configurations. | ||||||||||||||||||||||||||
| Copy the generated token and save it securely. At TLF, we recommend storing this | ||||||||||||||||||||||||||
| value into 1Password in your personal vault. This will be used in the various | ||||||||||||||||||||||||||
| tooling configurations. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| As a last step, users should select the 'Configure SSO' option adjacent to the newly generated token. | ||||||||||||||||||||||||||
| From the drop-down, select the 'linuxfoundation' to Authorize the token for use under the Linux | ||||||||||||||||||||||||||
| Foundation GitHub organization. | ||||||||||||||||||||||||||
| As a last step, users should select the 'Configure SSO' option adjacent to the | ||||||||||||||||||||||||||
| newly generated token. From the drop-down, select 'linuxfoundation' to authorize | ||||||||||||||||||||||||||
| the token for use under the Linux Foundation GitHub organization. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Claude Code GitHub MCP Setup | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| > Note: Before proceeding, ensure that the Personal Access Token has been | ||||||||||||||||||||||||||
| > configured for use under the Linux Foundation GitHub organization. See above. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| To setup the GitHub MCP for Claude Code (or commonly called Claude CLI), a MCP | ||||||||||||||||||||||||||
| configuration entry should be added to the Claude `mcpServers` configuration | ||||||||||||||||||||||||||
| section of the `~/.claude.json` file. Once added, Claude Code must be restarted | ||||||||||||||||||||||||||
| on the command line. The user must authorize the connection the first time the | ||||||||||||||||||||||||||
| MCP connection is used. | ||||||||||||||||||||||||||
| Claude Code 2.1.1+ supports connecting directly to the hosted GitHub MCP remote | ||||||||||||||||||||||||||
| server over HTTP. This is the recommended approach as it requires no local | ||||||||||||||||||||||||||
| Docker installation. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The MCP set up in the `~/.claude.json` file for the LF Atlassian Jira instance | ||||||||||||||||||||||||||
| would look like: | ||||||||||||||||||||||||||
| ### Option 1: Remote Server (Recommended, Claude Code 2.1.1+) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```jsonc | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| //... | ||||||||||||||||||||||||||
| "mcpServers": { | ||||||||||||||||||||||||||
| "github": { | ||||||||||||||||||||||||||
| "command": "npx", | ||||||||||||||||||||||||||
| "args": [ | ||||||||||||||||||||||||||
| "-y", | ||||||||||||||||||||||||||
| "@modelcontextprotocol/server-github" | ||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||
| "env": { | ||||||||||||||||||||||||||
| "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_PERSONAL_ACCESS_TOKEN" | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| > **Prerequisite:** The remote endpoint (`https://api.githubcopilot.com/mcp`) | ||||||||||||||||||||||||||
| > requires an active **GitHub Copilot** subscription (Individual, Business, or | ||||||||||||||||||||||||||
| > Enterprise). If your account does not have Copilot access, authentication will | ||||||||||||||||||||||||||
| > fail with a 401 or 403 error. Use Option 2 or Option 3 instead. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Run the following command, replacing `YOUR_GITHUB_PAT` with your personal | ||||||||||||||||||||||||||
| access token: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}' | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Use the `--scope` flag to control where the configuration is stored: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - `--scope local` — current project only (default) | ||||||||||||||||||||||||||
| - `--scope project` — shared with the team via `.mcp.json` | ||||||||||||||||||||||||||
| - `--scope user` — all projects on this machine | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| > **Security warning:** Do **not** store personal access tokens or secrets in | ||||||||||||||||||||||||||
| > `--scope project` configs (`.mcp.json`). Project-scoped files are typically | ||||||||||||||||||||||||||
| > committed to version control and will expose your token to everyone with | ||||||||||||||||||||||||||
| > repository access. Prefer `--scope user` or `--scope local` for tokens. | ||||||||||||||||||||||||||
| > Use environment variables or a secret manager rather than embedding | ||||||||||||||||||||||||||
| > `Authorization` headers with real tokens in JSON. If a project-scoped config | ||||||||||||||||||||||||||
| > is unavoidable, add `.mcp.json` to `.gitignore` and use a placeholder (e.g., | ||||||||||||||||||||||||||
| > `YOUR_GITHUB_PAT`) in any committed examples. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Example with user scope: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| claude mcp add-json --scope user github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}' | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| > Note: if you have an existing GitHub MCP installed and configured, you will need | ||||||||||||||||||||||||||
| > to disable and remove the old MCP before configuring the new MCP. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Option 2: Local Docker Deployment | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| If you prefer to run the server locally, ensure Docker is installed and running. | ||||||||||||||||||||||||||
| There are two ways to supply your token: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| **Option A — inline value** (replace `YOUR_GITHUB_PAT` with your actual token): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT -- \ | ||||||||||||||||||||||||||
| docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| **Option B — inherit from shell** (export the variable first, then omit the | ||||||||||||||||||||||||||
| value so Docker inherits it from the parent environment): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| export GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT | ||||||||||||||||||||||||||
| claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN -- \ | ||||||||||||||||||||||||||
| docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Once this is added, users can use the GitHub MCP by restarting Claude Code. | ||||||||||||||||||||||||||
| In Option A, `-e GITHUB_PERSONAL_ACCESS_TOKEN=VALUE` passes the token directly | ||||||||||||||||||||||||||
| in the `claude mcp` command. In Option B, `-e GITHUB_PERSONAL_ACCESS_TOKEN` | ||||||||||||||||||||||||||
| (without `=VALUE`) tells Docker to inherit the variable from your shell | ||||||||||||||||||||||||||
| environment, keeping the token out of your shell history and command line. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+108
to
+111
|
||||||||||||||||||||||||||
| in the `claude mcp` command. In Option B, `-e GITHUB_PERSONAL_ACCESS_TOKEN` | |
| (without `=VALUE`) tells Docker to inherit the variable from your shell | |
| environment, keeping the token out of your shell history and command line. | |
| in the `claude mcp` and `docker` command arguments. In Option B, | |
| `-e GITHUB_PERSONAL_ACCESS_TOKEN` (without `=VALUE`) tells Docker to inherit | |
| the variable from your shell environment, so the token does not appear in | |
| those command arguments. Note that the `export GITHUB_PERSONAL_ACCESS_TOKEN=…` | |
| command itself (and any literal token you type) may still be recorded in your | |
| shell history; consider using a history-safe method to set the variable (for | |
| example, `read -s GITHUB_PERSONAL_ACCESS_TOKEN` in an interactive shell, | |
| a secrets manager integration, or a shell config file that is not committed | |
| to version control). |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Cursor ~/.cursor/mcp.json example uses trailing commas in the args array and env object. Other MCP config examples in this repo avoid trailing commas (e.g., mcp/jira.md and mcp/playwright.md), and some JSONC parsers are stricter than VS Code’s. Consider removing trailing commas here to keep the example consistent and reduce copy/paste parse errors.
Uh oh!
There was an error while loading. Please reload this page.