# How to Integrate the GitHub MCP Server with VS Code: A Complete Configuration Guide

> Integrate the GitHub MCP Server with VS Code using a host JSON object in Copilot settings. Learn to configure endpoints for AI agents to invoke GitHub APIs. Complete guide included.

- Repository: [GitHub/github-mcp-server](https://github.com/github/github-mcp-server)
- Tags: how-to-guide
- Published: 2026-02-16

---

**Integrate the GitHub MCP Server with VS Code by configuring a host JSON object in your GitHub Copilot settings that points to either the official remote endpoint (`https://api.githubcopilot.com/mcp/`) or a local instance via HTTP or stdio, enabling AI agents to invoke GitHub APIs as tools.**

The `github/github-mcp-server` repository provides a Model Context Protocol (MCP) server that exposes GitHub APIs as callable tools for AI agents. When you integrate the GitHub MCP Server with VS Code, the GitHub Copilot extension connects to this server—implemented in [`cmd/github-mcp-server/main.go`](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go)—via HTTP headers or standard I/O streams, allowing you to query repositories, manage issues, and create pull requests using natural language commands.

## Architecture Overview

The integration relies on three core components working together to expose GitHub functionality inside VS Code.

The **MCP server binary** ([`cmd/github-mcp-server/main.go`](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go)) provides the HTTP API and implements all tool handlers. The **VS Code GitHub Copilot extension** reads a **host configuration** JSON object that defines how to reach the server, which toolsets to enable, and which security headers to apply. When VS Code starts, Copilot sends an initialization request to the server, receives the list of enabled tools, and exposes them to AI agents running in Agent mode.

Configuration options are documented in [`docs/remote-server.md`](https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md) (for HTTP header-based settings) and [`docs/server-configuration.md`](https://github.com/github/github-mcp-server/blob/main/docs/server-configuration.md) (for concrete JSON examples).

## Configuration Methods

You can connect VS Code to the GitHub MCP Server using three distinct transport methods: remote HTTP, local HTTP via Docker, or local stdio process.

### Remote HTTP Server (Cloud Hosted)

The simplest method uses GitHub’s official hosted endpoint. Add this configuration to your VS Code settings under **Extensions > GitHub Copilot > Host Configuration**:

```json
{
  "type": "http",
  "url": "https://api.githubcopilot.com/mcp/"
}

```

This configuration requires no local setup. The Copilot extension connects directly to the remote server, which handles authentication using your existing GitHub session.

### Local HTTP Server (Docker)

For environments requiring data residency or custom toolsets, run the server locally using Docker and point VS Code to your instance.

First, start the container:

```bash
docker run -i --rm \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_TOKEN \
  -p 8080:8080 \
  ghcr.io/github/github-mcp-server

```

Then configure VS Code to use your local endpoint:

```json
{
  "type": "http",
  "url": "http://localhost:8080/mcp/",
  "headers": {
    "X-MCP-Toolsets": "repos,issues"
  }
}

```

This method allows you to control exactly which toolsets are exposed and ensures all GitHub API calls originate from your infrastructure.

### Local stdio Process (Go Run)

For development or debugging, you can configure VS Code to spawn the MCP server directly as a subprocess using standard input/output.

Add this configuration to your host settings:

```json
{
  "type": "stdio",
  "command": "go",
  "args": [
    "run",
    "./cmd/github-mcp-server",
    "stdio",
    "--toolsets=repos,issues",
    "--tools=get_me"
  ],
  "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
  }
}

```

The `type: "stdio"` directive tells Copilot to launch the process and communicate over stdin/stdout. The `--toolsets` and `--tools` flags function as command-line equivalents to the `X-MCP-Toolsets` and `X-MCP-Tools` HTTP headers.

## Customizing Tool Access and Security

The GitHub MCP Server provides granular control over which capabilities are exposed to AI agents. You can restrict access using HTTP headers (for remote connections) or command-line flags (for stdio connections).

### Available Security Headers and Options

| Header / Flag | Purpose | Example Value |
|--------------|---------|---------------|
| **X-MCP-Toolsets** | Enable specific tool groups | `repos,issues,pull_requests` |
| **X-MCP-Tools** | Enable individual tools | `get_me,get_file_contents` |
| **X-MCP-Readonly** | Disable all write operations | `true` |
| **X-MCP-Insiders** | Enable experimental tools | `true` |
| **X-MCP-Lockdown** | Hide public issue details from users without push access | `true` |

These options are documented in [`docs/remote-server.md`](https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md) under the "Optional Headers" section.

### Read-Only Configuration Example

For security-sensitive environments, run the server in read-only mode to prevent AI agents from creating or modifying resources:

```json
{
  "type": "http",
  "url": "https://api.githubcopilot.com/mcp/",
  "headers": {
    "X-MCP-Readonly": "true",
    "X-MCP-Toolsets": "repos,issues"
  }
}

```

This configuration allows agents to query repository metadata and read issues but blocks all POST, PUT, DELETE, and PATCH operations.

## One-Click Installation Option

The repository provides a convenient installation badge in [`README.md`](https://github.com/github/github-mcp-server/blob/main/README.md) that generates a pre-filled VS Code URL. Clicking this badge automatically adds the remote server configuration to your Copilot host settings without manual JSON editing.

The badge constructs a URL that opens VS Code with the following configuration pre-populated:

```json
{
  "type": "http",
  "url": "https://api.githubcopilot.com/mcp/"
}

```

This method is the fastest way to integrate the GitHub MCP Server with VS Code for users who do not require custom toolsets or local hosting.

## Summary

- **Integrate the GitHub MCP Server with VS Code** by adding a host configuration object to your GitHub Copilot settings, choosing between `type: "http"` for remote or local servers and `type: "stdio"` for locally spawned processes.
- **Reference the source code** at [`cmd/github-mcp-server/main.go`](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go) for the server implementation, and consult [`docs/remote-server.md`](https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md) and [`docs/server-configuration.md`](https://github.com/github/github-mcp-server/blob/main/docs/server-configuration.md) for detailed header and JSON configuration options.
- **Secure your integration** using `X-MCP-Readonly` to prevent write operations, `X-MCP-Toolsets` to limit exposed functionality, and `X-MCP-Lockdown` for repository privacy controls.
- **Choose your transport** based on your environment: use the official remote endpoint for zero-setup access, Docker for local HTTP hosting, or `go run` with stdio for development and debugging.

## Frequently Asked Questions

### What is the difference between HTTP and stdio configuration types?

The **HTTP** type configures VS Code to connect to a running server via HTTP requests, allowing you to use remote endpoints like `https://api.githubcopilot.com/mcp/` or local Docker containers on `localhost`. The **stdio** type instructs VS Code to spawn the MCP server as a subprocess and communicate directly through standard input and output streams, which is useful for local development when running the Go binary directly with `go run ./cmd/github-mcp-server`.

### How do I restrict which GitHub tools the AI agent can access?

Control tool access using the **`X-MCP-Toolsets`** and **`X-MCP-Tools`** headers in HTTP configurations, or the equivalent **`--toolsets`** and **`--tools`** command-line flags in stdio configurations. For example, setting `"X-MCP-Toolsets": "repos,issues"` limits the agent to repository and issue operations, while `"X-MCP-Readonly": "true"` disables all write-capable tools to prevent modifications.

### Can I run the GitHub MCP Server locally instead of using the remote endpoint?

Yes, you can run the server locally using either **Docker** or the **Go toolchain**. For Docker, run `docker run -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_TOKEN -p 8080:8080 ghcr.io/github/github-mcp-server` and configure VS Code with `{"type": "http", "url": "http://localhost:8080/mcp/"}`. Alternatively, use stdio configuration with `go run ./cmd/github-mcp-server` for development scenarios.

### Where are the configuration options documented in the source code?

Configuration options for HTTP headers and security settings are documented in **[`docs/remote-server.md`](https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md)**, while concrete JSON examples for VS Code integration are located in **[`docs/server-configuration.md`](https://github.com/github/github-mcp-server/blob/main/docs/server-configuration.md)**. The server implementation itself, including command-line flag parsing for stdio mode, can be found in **[`cmd/github-mcp-server/main.go`](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go)**. The **[`README.md`](https://github.com/github/github-mcp-server/blob/main/README.md)** file contains the one-click installation badge and quick start instructions.