Skip to content

Commit 7ffbad4

Browse files
D1M1TR10SSamMorrowDrums
authored andcommitted
docs: Update README.md
Adding info about the Remote GitHub MCP server. Cleaned up some of the formatting and adding more info on the warning note.
1 parent 3e32f75 commit 7ffbad4

File tree

3 files changed

+278
-5
lines changed

3 files changed

+278
-5
lines changed

README.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,56 @@ The GitHub MCP Server is a [Model Context Protocol (MCP)](https://modelcontextpr
44
server that provides seamless integration with GitHub APIs, enabling advanced
55
automation and interaction capabilities for developers and tools.
66

7-
[![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D&quality=insiders)
8-
9-
## Use Cases
7+
### Use Cases
108

119
- Automating GitHub workflows and processes.
1210
- Extracting and analyzing data from GitHub repositories.
1311
- Building AI powered tools and applications that interact with GitHub's ecosystem.
1412

13+
---
14+
15+
## Remote GitHub MCP Server
16+
17+
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D&quality=insiders)
18+
19+
The remote GitHub MCP Server is hosted by GitHub and provides the easiest method for getting up and running. If your MCP host does not support remote MCP servers, don't worry! You can use the [local version of the GitHub MCP Server](https://github.com/github/github-mcp-server?tab=readme-ov-file#local-github-mcp-server) instead.
20+
21+
## Prerequisites
22+
23+
1. An MCP host that supports the latest MCP specification and remote servers, such as [VS Code](https://code.visualstudio.com/).
24+
2. OAuth support in the host application and a registered OAuth app on GitHub associated with that host (optional; required if authenticating with OAuth).
25+
26+
## Installation
27+
28+
### Usage with VS Code
29+
30+
For quick installation, use one of the one-click install buttons above. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
31+
32+
### Usage in other MCP Hosts
33+
34+
Add the following JSON block to your MCP host’s configuration:
35+
36+
```json
37+
{
38+
"mcp": {
39+
"servers": {
40+
"github": {
41+
"type": "http",
42+
"url": "https://api.githubcopilot.com/mcp/"
43+
}
44+
}
45+
}
46+
}
47+
```
48+
49+
> **Note:** The exact configuration format may vary by host. Refer to your host's documentation for the correct syntax and location for remote MCP server setup.
50+
51+
---
52+
53+
## Local GitHub MCP Server
54+
55+
[![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D&quality=insiders)
56+
1557
## Prerequisites
1658

1759
1. To run the server in a container, you will need to have [Docker](https://www.docker.com/) installed.
@@ -23,9 +65,11 @@ The MCP server can use many of the GitHub APIs, so enable the permissions that y
2365

2466
### Usage with VS Code
2567

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.
68+
For quick installation, use one of the one-click install buttons. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
2769

28-
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)`.
70+
### Usage in other MCP Hosts
71+
72+
Add the following JSON block to your IDE MCP settings.
2973

3074
```json
3175
{
@@ -159,6 +203,7 @@ The following sets of tools are available (all are on by default):
159203
| `users` | Anything relating to GitHub Users |
160204
| `experiments` | Experimental features (not considered stable) |
161205

206+
162207
#### Specifying Toolsets
163208

164209
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:

docs/host-integration.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# GitHub Remote MCP Integration Guide for MCP Host Authors
2+
3+
This guide outlines high-level considerations for MCP Host authors who want to allow installation of the Remote GitHub MCP server.
4+
5+
The goal is to explain the architecture at a high-level, define key requirements, and provide guidance to get you started, while pointing to official documentation for deeper implementation details.
6+
7+
---
8+
9+
## Table of Contents
10+
11+
- [Understanding MCP Architecture](#understanding-mcp-architecture)
12+
- [Connecting to the Remote GitHub MCP Server](#connecting-to-the-remote-github-mcp-server)
13+
- [Authentication and Authorization](#authentication-and-authorization)
14+
- [OAuth Support on GitHub](#oauth-support-on-github)
15+
- [Create an OAuth-enabled App Using the GitHub UI](#create-an-oauth-enabled-app-using-the-github-ui)
16+
- [Things to Consider](#things-to-consider)
17+
- [Initiating the OAuth Flow from your Client Application](#initiating-the-oauth-flow-from-your-client-application)
18+
- [Handling Organization Access Restrictions](#handling-organization-access-restrictions)
19+
- [Essential Security Considerations](#essential-security-considerations)
20+
- [Additional Resources](#additional-resources)
21+
22+
---
23+
24+
## Understanding MCP Architecture
25+
26+
The Model Context Protocol (MCP) enables seamless communication between your application and various external tools through an architecture defined by the [MCP Standard](https://modelcontextprotocol.io/).
27+
28+
### High-level Architecture
29+
30+
The diagram below illustrates how a single client application can connect to multiple MCP Servers, each providing access to a unique set of resources. Notice that some MCP Servers are running locally (side-by-side with the client application) while others are hosted remotely. GitHub's MCP offerings are available to run either locally or remotely.
31+
32+
```mermaid
33+
flowchart LR
34+
subgraph "Local Runtime Environment"
35+
subgraph "Client Application (e.g., IDE)"
36+
CLIENTAPP[Application Runtime]
37+
CX["MCP Client (FileSystem)"]
38+
CY["MCP Client (GitHub)"]
39+
CZ["MCP Client (Other)"]
40+
end
41+
42+
LOCALMCP[File System MCP Server]
43+
end
44+
45+
subgraph "Internet"
46+
GITHUBMCP[GitHub Remote MCP Server]
47+
OTHERMCP[Other Remote MCP Server]
48+
end
49+
50+
CLIENTAPP --> CX
51+
CLIENTAPP --> CY
52+
CLIENTAPP --> CZ
53+
54+
CX <-->|"stdio"| LOCALMCP
55+
CY <-->|"OAuth 2.0 + HTTP/SSE"| GITHUBMCP
56+
CZ <-->|"OAuth 2.0 + HTTP/SSE"| OTHERMCP
57+
```
58+
59+
### Runtime Environment
60+
61+
- **Application**: The user-facing application you are building. It instantiates one or more MCP clients and orchestrates tool calls.
62+
- **MCP Client**: A component within your client application that maintains a 1:1 connection with a single MCP server.
63+
- **MCP Server**: A service that provides access to a specific set of tools.
64+
- **Local MCP Server**: An MCP Server running locally, side-by-side with the Application.
65+
- **Remote MCP Server**: An MCP Server running remotely, accessed via the internet. Most Remote MCP Servers require authentication via OAuth.
66+
67+
For more detail, see the [official MCP specification](https://modelcontextprotocol.io/specification/draft).
68+
69+
> [!NOTE]
70+
> GitHub offers both a Local MCP Server and a Remote MCP Server.
71+
72+
---
73+
74+
## Connecting to the Remote GitHub MCP Server
75+
76+
### Authentication and Authorization
77+
78+
GitHub MCP Servers require a valid access token in the `Authorization` header. This is true for both the Local GitHub MCP Server and the Remote GitHub MCP Server.
79+
80+
For the Remote GitHub MCP Server, the recommended way to obtain a valid access token is to ensure your client application supports [OAuth 2.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13). It should be noted, however, that you may also supply any valid access token. For example, you may supply a pre-generated Personal Access Token (PAT).
81+
82+
83+
> [!IMPORTANT]
84+
> The Remote GitHub MCP Server itself does not provide Authentication services.
85+
> Your client application must obtain valid GitHub access tokens through one of the supported methods.
86+
87+
The expected flow for obtaining a valid access token via OAuth is depicted in the [MCP Specification](https://modelcontextprotocol.io/specification/draft/basic/authorization#authorization-flow-steps). For convenience, we've embedded a copy of the authorization flow below. Please study it carefully as the remainder of this document is written with this flow in mind.
88+
89+
```mermaid
90+
sequenceDiagram
91+
participant B as User-Agent (Browser)
92+
participant C as Client
93+
participant M as MCP Server (Resource Server)
94+
participant A as Authorization Server
95+
96+
C->>M: MCP request without token
97+
M->>C: HTTP 401 Unauthorized with WWW-Authenticate header
98+
Note over C: Extract resource_metadata URL from WWW-Authenticate
99+
100+
C->>M: Request Protected Resource Metadata
101+
M->>C: Return metadata
102+
103+
Note over C: Parse metadata and extract authorization server(s)<br/>Client determines AS to use
104+
105+
C->>A: GET /.well-known/oauth-authorization-server
106+
A->>C: Authorization server metadata response
107+
108+
alt Dynamic client registration
109+
C->>A: POST /register
110+
A->>C: Client Credentials
111+
end
112+
113+
Note over C: Generate PKCE parameters
114+
C->>B: Open browser with authorization URL + code_challenge
115+
B->>A: Authorization request
116+
Note over A: User authorizes
117+
A->>B: Redirect to callback with authorization code
118+
B->>C: Authorization code callback
119+
C->>A: Token request + code_verifier
120+
A->>C: Access token (+ refresh token)
121+
C->>M: MCP request with access token
122+
M-->>C: MCP response
123+
Note over C,M: MCP communication continues with valid token
124+
```
125+
126+
> [!NOTE]
127+
> Dynamic Client Registration is NOT supported by Remote GitHub MCP Server at this time.
128+
129+
130+
#### OAuth Support on GitHub
131+
132+
GitHub offers two solutions for obtaining access tokens via OAuth: [**GitHub Apps**](https://docs.github.com/en/apps/using-github-apps/about-using-github-apps#about-github-apps) and [**OAuth Apps**](https://docs.github.com/en/apps/oauth-apps). These solutions are typically created, administered, and maintained by GitHub Organization administrators. Collaborate with a GitHub Organization administrator to configure either a **GitHub App** or an **OAuth App** to allow your client application to utilize GitHub OAuth support. Furthermore, be aware that it may be necessary for users of your client application to register your **GitHub App** or **OAuth App** within their own GitHub Organization in order to generate authorization tokens capable of accessing Organization's GitHub resources.
133+
134+
> [!TIP]
135+
> Before proceeding, check whether your organization already supports one of these solutions. Administrators of your GitHub Organization can help you determine what **GitHub Apps** or **OAuth Apps** are already registered. If there's an existing **GitHub App** or **OAuth App** that fits your use case, consider reusing it for Remote MCP Authorization. That said, be sure to take heed of the following warning.
136+
137+
> [!WARNING]
138+
> Both **GitHub Apps** and **OAuth Apps** require the client application to pass a "client secret" in order to initiate the OAuth flow. If your client application is designed to run in an uncontrolled environment (i.e. customer-provided hardware), end users will be able to discover your "client secret" and potentially exploit it for other purposes. In such cases, our recommendation is to register a new **GitHub App** (or **OAuth App**) exclusively dedicated to servicing OAuth requests from your client application.
139+
140+
#### Create an OAuth-enabled App Using the GitHub UI
141+
142+
Detailed instructions for creating a **GitHub App** can be found at ["Creating GitHub Apps"](https://docs.github.com/en/apps/creating-github-apps/about-creating-github-apps/about-creating-github-apps#building-a-github-app). (RECOMMENDED)<br/>
143+
Detailed instructions for creating an **OAuth App** can be found ["Creating an OAuth App"](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app).
144+
145+
For guidance on which type of app to choose, see ["Differences Between GitHub Apps and OAuth Apps"](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps).
146+
147+
#### Things to Consider:
148+
- Tokens provided by **GitHub Apps** are generally more secure because they:
149+
- include an expiration
150+
- include support for fine-grained permissions
151+
- **GitHub Apps** must be installed on a GitHub Organization before they can be used.<br/>In general, installation must be approved by someone in the Organization with administrator permissions. For more details, see [this explanation](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps#who-can-install-github-apps-and-authorize-oauth-apps).<br/>By contrast, **OAuth Apps** don't require installation and, typically, can be used immediately.
152+
- Members of an Organization may use the GitHub UI to [request that a GitHub App be installed](https://docs.github.com/en/apps/using-github-apps/requesting-a-github-app-from-your-organization-owner) organization-wide.
153+
- While not strictly necessary, if you expect that a wide range of users will use your MCP Server, consider publishing its corresponding **GitHub App** or **OAuth App** on the [GitHub App Marketplace](https://github.com/marketplace?type=apps) to ensure that it's discoverable by your audience.
154+
155+
156+
#### Initiating the OAuth Flow from your Client Application
157+
158+
For **GitHub Apps**, details on initiating the OAuth flow from a client application are described in detail [here](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app#using-the-web-application-flow-to-generate-a-user-access-token).
159+
160+
For **OAuth Apps**, details on initiating the OAuth flow from a client application are described in detail [here](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow).
161+
162+
> [!IMPORTANT]
163+
> For endpoint discovery, be sure to honor the [`WWW-Authenticate` information provided](https://modelcontextprotocol.io/specification/draft/basic/authorization#authorization-server-location) by the Remote GitHub MCP Server rather than relying on hard-coded endpoints like `https://github.com/login/oauth/authorize`.
164+
165+
166+
### Handling Organization Access Restrictions
167+
Organizations may block **GitHub Apps** and **OAuth Apps** until explicitly approved. Within your client application code, you can provide actionable next steps for a smooth user experience in the event that OAuth-related calls fail due to your **GitHub App** or **OAuth App** being unavailable (i.e. not registered within the user's organization).
168+
169+
1. Detect the specific error.
170+
2. Notify the user clearly.
171+
3. Depending on their GitHub organization privileges:
172+
- Org Members: Prompt them to request approval from a GitHub organization admin, within the organization where access has not been approved.
173+
- Org Admins: Link them to the corresponding GitHub organization’s App approval settings at `https://github.com/organizations/[ORG_NAME]/settings/oauth_application_policy`
174+
175+
176+
## Essential Security Considerations
177+
- **Token Storage**: Use secure platform APIs (e.g. keytar for Node.js).
178+
- **Input Validation**: Sanitize all tool arguments.
179+
- **HTTPS Only**: Never send requests over plaintext HTTP. Always use HTTPS in production.
180+
- **PKCE:** We strongly recommend implementing [PKCE](https://datatracker.ietf.org/doc/html/rfc7636) for all OAuth flows to prevent code interception, to prepare for upcoming PKCE support.
181+
182+
## Additional Resources
183+
- [MCP Official Spec](https://modelcontextprotocol.io/specification/draft)
184+
- [MCP SDKs](https://modelcontextprotocol.io/sdk/java/mcp-overview)
185+
- [GitHub Docs on Creating GitHub Apps](https://docs.github.com/en/apps/creating-github-apps)
186+
- [GitHub Docs on Using GitHub Apps](https://docs.github.com/en/apps/using-github-apps/about-using-github-apps)
187+
- [GitHub Docs on Creating OAuth Apps](https://docs.github.com/en/apps/oauth-apps)
188+
- GitHub Docs on Installing OAuth Apps into a [Personal Account](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/installing-an-oauth-app-in-your-personal-account) and [Organization](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/installing-an-oauth-app-in-your-organization)
189+
- [Managing OAuth Apps at the Organization Level](https://docs.github.com/en/organizations/managing-oauth-access-to-your-organizations-data)
190+
- [Managing Programmatic Access at the GitHub Organization Level](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization)
191+
- [Building Copilot Extensions](https://docs.github.com/en/copilot/building-copilot-extensions)
192+
- [Managing App/Extension Visibility](https://docs.github.com/en/copilot/building-copilot-extensions/managing-the-availability-of-your-copilot-extension) (including GitHub Marketplace information)
193+
- [Example Implementation in VS Code Repository](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostMcp.ts#L313)

0 commit comments

Comments
 (0)