Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 62 additions & 26 deletions docs/installation-guides/install-copilot-cli.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
# Install GitHub MCP Server in Copilot CLI

## Prerequisites
The GitHub MCP server comes pre-installed in Copilot CLI, with read-only tools enabled by default.

1. Copilot CLI installed (see [official Copilot CLI documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli))
2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes
3. For local installation: [Docker](https://www.docker.com/) installed and running
## Built-in Server

To verify the server is available, from an active Copilot CLI session:

```bash
/mcp show github-mcp-server
```

### Per-Session Customization

Use CLI flags to customize the server for a session:

```bash
# Enable an additional toolset
copilot --add-github-mcp-toolset discussions

# Enable multiple additional toolsets
copilot --add-github-mcp-toolset discussions --add-github-mcp-toolset stargazers

# Enable all toolsets
copilot --enable-all-github-mcp-tools

# Enable a specific tool
copilot --add-github-mcp-tool list_discussions

# Disable the built-in server entirely
copilot --disable-builtin-mcps
```

Run `copilot --help` for all available flags. For the list of toolsets, see [Available toolsets](../../README.md#available-toolsets); for the list of tools, see [Tools](../../README.md#tools).

## Custom Configuration

You can configure the GitHub MCP server in Copilot CLI using either the interactive command or by manually editing the configuration file.

> **Server naming:** Name your server `github-mcp-server` to replace the built-in server, or use a different name (e.g., `github`) to run alongside it.

### Prerequisites

1. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes
2. For local server: [Docker](https://www.docker.com/) installed and running

<details>
<summary><b>Storing Your PAT Securely</b></summary>
Expand All @@ -19,21 +57,17 @@ export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here

</details>

## GitHub MCP Server Configuration

You can configure the GitHub MCP server in Copilot CLI using either the interactive command or by manually editing the configuration file.

### Method 1: Interactive Setup (Recommended)

Use the Copilot CLI to interactively add the MCP server:
From an active Copilot CLI session, run the interactive command:

```bash
/mcp add
```

Follow the prompts to configure the GitHub MCP server.
Follow the prompts to configure the server.

### Method 2: Manual Configuration
### Method 2: Manual Setup

Create or edit the configuration file `~/.copilot/mcp-config.json` and add one of the following configurations:

Expand All @@ -45,6 +79,7 @@ Connect to the hosted MCP server:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
Expand All @@ -54,6 +89,8 @@ Connect to the hosted MCP server:
}
```

For additional options like toolsets and read-only mode, see the [remote server documentation](../remote-server.md#optional-headers).

#### Local Docker

With Docker running, you can run the GitHub MCP server in a container:
Expand Down Expand Up @@ -81,9 +118,13 @@ With Docker running, you can run the GitHub MCP server in a container:

#### Binary

You can download the latest binary release from the [GitHub releases page](https://github.com/github/github-mcp-server/releases) or build it from source by running `go build -o github-mcp-server ./cmd/github-mcp-server`.
You can download the latest binary release from the [GitHub releases page](https://github.com/github/github-mcp-server/releases) or build it from source by running:

Then, replacing `/path/to/binary` with the actual path to your binary, configure Copilot CLI with:
```bash
go build -o github-mcp-server ./cmd/github-mcp-server
```

Then configure (replace `/path/to/binary` with the actual path):

```json
{
Expand All @@ -101,35 +142,30 @@ Then, replacing `/path/to/binary` with the actual path to your binary, configure

## Verification

To verify that the GitHub MCP server has been configured:

1. Start or restart Copilot CLI
2. The GitHub tools should be available for use in your conversations
1. Restart Copilot CLI
2. Run `/mcp show` to list configured servers
3. Try: "List my GitHub repositories"

## Troubleshooting

### Local Server Issues

- **Docker errors**: Ensure Docker Desktop is running
```bash
docker --version
```
- **Image pull failures**: Try `docker logout ghcr.io` then retry
- **Docker not found**: Install Docker Desktop and ensure it's running

### Authentication Issues

- **Invalid PAT**: Verify your GitHub PAT has correct scopes:
- `repo` - Repository operations
- `read:packages` - Docker image access (if using Docker)
- `repo` - Repository operations
- `read:packages` - Docker image access (if using Docker)
- **Token expired**: Generate a new GitHub PAT

### Configuration Issues

- **Invalid JSON**: Validate your configuration:
```bash
cat ~/.copilot/mcp-config.json | jq .
```
```bash
cat ~/.copilot/mcp-config.json | jq .
```

## References

Expand Down