MCPcopy
hub / github.com/github/github-mcp-server

github.com/github/github-mcp-server @v1.5.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.5.0 ↗
2,002 symbols 10,638 edges 205 files 871 documented · 44%
README

Go Report Card

GitHub MCP Server

The GitHub MCP Server connects AI tools directly to GitHub's platform. This gives AI agents, assistants, and chatbots the ability to read repositories and code files, manage issues and PRs, analyze code, and automate workflows. All through natural language interactions.

Use Cases

  • Repository Management: Browse and query code, search files, analyze commits, and understand project structure across any repository you have access to.
  • Issue & PR Automation: Create, update, and manage issues and pull requests. Let AI help triage bugs, review code changes, and maintain project boards.
  • CI/CD & Workflow Intelligence: Monitor GitHub Actions workflow runs, analyze build failures, manage releases, and get insights into your development pipeline.
  • Code Analysis: Examine security findings, review Dependabot alerts, understand code patterns, and get comprehensive insights into your codebase.
  • Team Collaboration: Access discussions, manage notifications, analyze team activity, and streamline processes for your team.

Built for developers who want to connect their AI tools to GitHub context and capabilities, from simple natural language queries to complex multi-step agent workflows.


Remote GitHub MCP Server

Install in VS Code Install in VS Code Insiders Install in Visual Studio

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 instead.

Prerequisites

  1. A compatible MCP host with remote server support (VS Code 1.101+, Claude Desktop, Cursor, Windsurf, etc.)
  2. Any applicable policies enabled

Install in VS Code

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. Make sure you're using VS Code 1.101 or later for remote MCP and OAuth support.

Alternatively, to manually configure VS Code, choose the appropriate JSON block from the examples below and add it to your host configuration:

Using OAuthUsing a GitHub PAT
VS Code (version 1.101 or greater)
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${input:github_mcp_pat}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "github_mcp_pat",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ]
}

Install in other MCP hosts

  • Copilot CLI - Installation guide for GitHub Copilot CLI
  • GitHub Copilot in other IDEs - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
  • Claude Applications - Installation guide for Claude Desktop and Claude Code CLI
  • Codex - Installation guide for OpenAI Codex
  • Cursor - Installation guide for Cursor IDE
  • OpenCode - Installation guide for the OpenCode terminal agent
  • Windsurf - Installation guide for Windsurf IDE
  • Zed - Installation guide for Zed editor
  • Rovo Dev CLI - Installation guide for Rovo Dev CLI

Note: Each MCP host application needs to configure a GitHub App or OAuth App to support remote access via OAuth. Any host application that supports remote MCP servers should support the remote GitHub server with PAT authentication. Configuration details and support levels vary by host. Make sure to refer to the host application's documentation for more info.

Configuration

Toolset configuration

See Remote Server Documentation for full details on remote server configuration, toolsets, headers, and advanced usage. This file provides comprehensive instructions and examples for connecting, customizing, and installing the remote GitHub MCP Server in VS Code and other MCP hosts.

When no toolsets are specified, default toolsets are used.

Insiders Mode

Try new features early! The remote server offers an insiders version with early access to new features and experimental tools.

Using URL PathUsing Header
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/insiders"
    }
  }
}
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "X-MCP-Insiders": "true"
      }
    }
  }
}

See Remote Server Documentation for more details and examples, and Insiders Features for a full list of what's available.

GitHub Enterprise

GitHub Enterprise Cloud with data residency (ghe.com)

GitHub Enterprise Cloud can also make use of the remote server.

Example for https://octocorp.ghe.com with GitHub PAT token:

{
    ...
    "github-octocorp": {
      "type": "http",
      "url": "https://copilot-api.octocorp.ghe.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:github_mcp_pat}"
      }
    },
    ...
}

Note: When using OAuth with GitHub Enterprise with VS Code and GitHub Copilot, you also need to configure your VS Code settings to point to your GitHub Enterprise instance - see Authenticate from VS Code

GitHub Enterprise Server

GitHub Enterprise Server does not support remote server hosting. Please refer to GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com) from the local server configuration.


Local GitHub MCP Server

Install with Docker in VS Code Install with Docker in VS Code Insiders Install with Docker in Visual Studio

Prerequisites

  1. To run the server in a container, you will need to have Docker installed.
  2. Once Docker is installed, you will also need to ensure Docker is running. The Docker image is available at ghcr.io/github/github-mcp-server. The image is public; if you get errors on pull, you may have an expired token and need to docker logout ghcr.io.
  3. Authentication. On github.com you don't need to create anything up front — the one-click buttons above log you in with OAuth on first use (a browser-based flow; the token is kept in memory only). The Docker buttons publish a fixed callback port (127.0.0.1:8085) so the container's login callback is reachable. See Local Server OAuth Login for how it works, headless/device-code fallback, and bringing your own OAuth or GitHub App (required for GitHub Enterprise Server and ghe.com).

Prefer a token? You can still authenticate with a GitHub Personal Access Token by setting GITHUB_PERSONAL_ACCESS_TOKEN instead (it takes precedence over OAuth). 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).

Handling PATs Securely

Environment Variables (Recommended)

To keep your GitHub PAT secure and reusable across different MCP hosts:

  1. Store your PAT in environment variables

bash export GITHUB_PAT=your_token_here

Or create a .env file:

env GITHUB_PAT=your_token_here

  1. Protect your .env file

bash # Add to .gitignore to prevent accidental commits echo ".env" >> .gitignore

  1. Reference the token in configurations

```bash # CLI usage claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server

# In config files (where supported) "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT" } ```

Note: Environment variable support varies by host app and IDE. Some applications (like Windsurf) require hardcoded tokens in config files.

Token Security Best Practices

  • Minimum scopes: Only grant necessary permissions
  • repo - Repository operations
  • read:packages - Docker image access
  • read:org - Organization team access
  • Separate tokens: Use different PATs for different projects/environments
  • Regular rotation: Update tokens periodically
  • Never commit: Keep tokens out of version control
  • File permissions: Restrict access to config files containing tokens

bash chmod 600 ~/.your-app/config.json

GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com)

The flag --gh-host and the environment variable GITHUB_HOST can be used to set the hostname for GitHub Enterprise Server or GitHub Enterprise Cloud with data residency.

  • For GitHub Enterprise Server, prefix the hostname with the https:// URI scheme, as it otherwise defaults to http://, which GitHub Enterprise Server does not support.
  • For GitHub Enterprise Cloud with data residency, use https://YOURSUBDOMAIN.ghe.com as the hostname.
"github": {
    "command": "docker",
    "args": [
    "run",
    "-i",
    "--rm",
    "-e",
    "GITHUB_PERSONAL_ACCESS_TOKEN",
    "-e",
    "GITHUB_HOST",
    "ghcr.io/github/github-mcp-server"
    ],
    "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}",
        "GITHUB_HOST": "https://<your GHES or ghe.com domain name>"
    }
}

Installation

Install in GitHub Copilot on VS Code

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.

More about using MCP server tools in VS Code's agent mode documentation.

Install in GitHub Copilot on other IDEs (JetBrains, Visual Studio, Eclipse, etc.)

Add one of the following JSON blocks to your IDE's MCP settings.

Log in with OAuth (no token to create or store). On github.com the official image already includes the app credentials, so you provide n

Extension points exported contracts — how you extend this code

Exporters (Interface)
Exporters bundles observability primitives (logger + metrics) for dependency injection. The logger is Go's stdlib *slog. [4 …
pkg/observability/observability.go
IssueQueryResult (Interface)
Common interface for all issue query types [4 implementers]
pkg/github/issues.go
Prompter (Interface)
Prompter presents authorization prompts to the user out of band from the LLM context — for example via MCP elicitation. [2 …
internal/oauth/prompter.go
FetcherInterface (Interface)
(no doc) [3 implementers]
pkg/scopes/fetcher.go
APIHostResolver (Interface)
(no doc) [2 implementers]
pkg/utils/api.go
GitHubMCPServerFactoryFunc (FuncType)
GitHubMCPServerFactoryFunc is a function type for creating a new MCP Server instance. middleware are applied AFTER the d
pkg/http/handler.go
GetRawClientFn (FuncType)
GetRawClientFn is a function type that returns a RawClient instance.
pkg/raw/raw.go
RepoAccessOption (FuncType)
RepoAccessOption configures RepoAccessCache at construction time.
pkg/lockdown/lockdown.go

Core symbols most depended-on inside this repo

NewToolResultError
called by 713
pkg/utils/result.go
Error
called by 663
pkg/http/mark/mark.go
String
called by 430
pkg/github/copilot.go
ContextWithDeps
called by 272
pkg/github/dependencies.go
Handler
called by 260
pkg/inventory/server_tool.go
Close
called by 206
pkg/log/io.go
NewMockedHTTPClient
called by 186
internal/githubv4mock/githubv4mock.go
DataResponse
called by 172
internal/githubv4mock/githubv4mock.go

Shape

Function 1,422
Struct 269
Method 246
Interface 32
FuncType 18
TypeAlias 15

Languages

Go96%
TypeScript4%

Modules by API surface

pkg/github/minimal_types.go106 symbols
pkg/inventory/registry_test.go83 symbols
pkg/github/issues.go68 symbols
pkg/github/projects.go44 symbols
pkg/github/dependencies.go42 symbols
pkg/github/helper_test.go40 symbols
pkg/github/issues_test.go36 symbols
pkg/github/pullrequests.go32 symbols
pkg/github/granular_tools_test.go32 symbols
ui/src/apps/issue-write/App.tsx31 symbols
pkg/github/pullrequests_test.go31 symbols
pkg/github/csv_output_test.go30 symbols

Dependencies from manifests, versioned

github.com/aymerick/douceurv0.2.0 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×
github.com/fsnotify/fsnotifyv1.9.0 · 1×
github.com/go-viper/mapstructure/v2v2.5.0 · 1×
github.com/google/go-github/v87v87.0.0 · 1×
github.com/google/go-querystringv1.2.0 · 1×
github.com/google/jsonschema-gov0.4.3 · 1×
github.com/gorilla/cssv1.0.1 · 1×
github.com/inconshreveable/mousetrapv1.1.0 · 1×
github.com/josephburnett/jd/v2v2.5.0 · 1×
github.com/lithammer/fuzzysearchv1.1.8 · 1×

For agents

$ claude mcp add github-mcp-server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact