Skip to content

Commit 0e502ba

Browse files
committed
docs: add Copilot CLI installation guide
1 parent 47412e5 commit 0e502ba

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Alternatively, to manually configure VS Code, choose the appropriate JSON block
8181

8282
### Install in other MCP hosts
8383

84+
- **[Copilot CLI](/docs/installation-guides/install-copilot-cli.md)** - Installation guide for GitHub Copilot CLI
8485
- **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
8586
- **[Claude Applications](/docs/installation-guides/install-claude.md)** - Installation guide for Claude Desktop and Claude Code CLI
8687
- **[Codex](/docs/installation-guides/install-codex.md)** - Installation guide for OpenAI Codex
@@ -350,6 +351,7 @@ Optionally, you can add a similar example (i.e. without the mcp key) to a file c
350351

351352
For other MCP host applications, please refer to our installation guides:
352353

354+
- **[Copilot CLI](docs/installation-guides/install-copilot-cli.md)** - Installation guide for GitHub Copilot CLI
353355
- **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
354356
- **[Claude Code & Claude Desktop](docs/installation-guides/install-claude.md)** - Installation guide for Claude Code and Claude Desktop
355357
- **[Cursor](docs/installation-guides/install-cursor.md)** - Installation guide for Cursor IDE

docs/installation-guides/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This directory contains detailed installation instructions for the GitHub MCP Server across different host applications and IDEs. Choose the guide that matches your development environment.
44

55
## Installation Guides by Host Application
6+
- **[Copilot CLI](install-copilot-cli.md)** - Installation guide for GitHub Copilot CLI
67
- **[GitHub Copilot in other IDEs](install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
78
- **[Antigravity](install-antigravity.md)** - Installation for Google Antigravity IDE
89
- **[Claude Applications](install-claude.md)** - Installation guide for Claude Web, Claude Desktop and Claude Code CLI
@@ -15,6 +16,7 @@ This directory contains detailed installation instructions for the GitHub MCP Se
1516

1617
| Host Application | Local GitHub MCP Support | Remote GitHub MCP Support | Prerequisites | Difficulty |
1718
|-----------------|---------------|----------------|---------------|------------|
19+
| Copilot CLI || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
1820
| Copilot in VS Code || ✅ Full (OAuth + PAT) | Local: Docker or Go build, GitHub PAT<br>Remote: VS Code 1.101+ | Easy |
1921
| Copilot Coding Agent || ✅ Full (on by default; no auth needed) | Any _paid_ copilot license | Default on |
2022
| Copilot in Visual Studio || ✅ Full (OAuth + PAT) | Local: Docker or Go build, GitHub PAT<br>Remote: Visual Studio 17.14+ | Easy |
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Install GitHub MCP Server in Copilot CLI
2+
3+
## Prerequisites
4+
5+
1. Copilot CLI installed (see [official Copilot CLI documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli))
6+
2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes
7+
3. For local installation: [Docker](https://www.docker.com/) installed and running
8+
9+
<details>
10+
<summary><b>Storing Your PAT Securely</b></summary>
11+
<br>
12+
13+
For security, avoid hardcoding your token. Set your PAT as an environment variable:
14+
15+
```bash
16+
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
17+
export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
18+
```
19+
20+
</details>
21+
22+
## GitHub MCP Server Configuration
23+
24+
You can configure the GitHub MCP server in Copilot CLI using either the interactive command or by manually editing the configuration file.
25+
26+
### Method 1: Interactive Setup (Recommended)
27+
28+
Use the Copilot CLI to interactively add the MCP server:
29+
30+
```
31+
/mcp add
32+
```
33+
34+
Follow the prompts to configure the GitHub MCP server.
35+
36+
### Method 2: Manual Configuration
37+
38+
Create or edit the configuration file `~/.copilot/mcp-config.json` and add one of the following configurations:
39+
40+
#### Remote Server
41+
42+
Connect to the hosted MCP server:
43+
44+
```json
45+
{
46+
"mcpServers": {
47+
"github": {
48+
"url": "https://api.githubcopilot.com/mcp/",
49+
"headers": {
50+
"Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
51+
}
52+
}
53+
}
54+
}
55+
```
56+
57+
#### Local Docker
58+
59+
With Docker running, you can run the GitHub MCP server in a container:
60+
61+
```json
62+
{
63+
"mcpServers": {
64+
"github": {
65+
"command": "docker",
66+
"args": [
67+
"run",
68+
"-i",
69+
"--rm",
70+
"-e",
71+
"GITHUB_PERSONAL_ACCESS_TOKEN",
72+
"ghcr.io/github/github-mcp-server"
73+
],
74+
"env": {
75+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
76+
}
77+
}
78+
}
79+
}
80+
```
81+
82+
#### Binary
83+
84+
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`.
85+
86+
Then, replacing `/path/to/binary` with the actual path to your binary, configure Copilot CLI with:
87+
88+
```json
89+
{
90+
"mcpServers": {
91+
"github": {
92+
"command": "/path/to/binary",
93+
"args": ["stdio"],
94+
"env": {
95+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
96+
}
97+
}
98+
}
99+
}
100+
```
101+
102+
## Verification
103+
104+
To verify that the GitHub MCP server has been configured:
105+
106+
1. Start or restart Copilot CLI
107+
2. The GitHub tools should be available for use in your conversations
108+
109+
## Troubleshooting
110+
111+
### Local Server Issues
112+
113+
- **Docker errors**: Ensure Docker Desktop is running
114+
```bash
115+
docker --version
116+
```
117+
- **Image pull failures**: Try `docker logout ghcr.io` then retry
118+
- **Docker not found**: Install Docker Desktop and ensure it's running
119+
120+
### Authentication Issues
121+
122+
- **Invalid PAT**: Verify your GitHub PAT has correct scopes:
123+
- `repo` - Repository operations
124+
- `read:packages` - Docker image access (if using Docker)
125+
- **Token expired**: Generate a new GitHub PAT
126+
127+
### Configuration Issues
128+
129+
- **Invalid JSON**: Validate your configuration:
130+
```bash
131+
cat ~/.copilot/mcp-config.json | jq .
132+
```
133+
134+
## References
135+
136+
- [Copilot CLI Documentation](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli)

0 commit comments

Comments
 (0)