The GitHub MCP server comes pre-installed in Copilot CLI, with read-only tools enabled by default.
To verify the server is available, from an active Copilot CLI session:
/mcp show github-mcp-serverUse CLI flags to customize the server for a session:
# 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-mcpsRun copilot --help for all available flags. For the list of toolsets, see Available toolsets; for the list of tools, see Tools.
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-serverto replace the built-in server, or use a different name (e.g.,github) to run alongside it.
- GitHub Personal Access Token with appropriate scopes
- For local server: Docker installed and running
Storing Your PAT Securely
To set your PAT as an environment variable:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_hereFrom an active Copilot CLI session, run the interactive command:
/mcp addFollow the prompts to configure the server.
Create or edit the configuration file ~/.copilot/mcp-config.json and add one of the following configurations:
Connect to the hosted MCP server:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}For additional options like toolsets and read-only mode, see the remote server documentation.
With Docker running, you can run the GitHub MCP server in a container:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}You can download the latest binary release from the GitHub releases page or build it from source by running:
go build -o github-mcp-server ./cmd/github-mcp-serverThen configure (replace /path/to/binary with the actual path):
{
"mcpServers": {
"github": {
"command": "/path/to/binary",
"args": ["stdio"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}- Restart Copilot CLI
- Run
/mcp showto list configured servers - Try: "List my GitHub repositories"
- Docker errors: Ensure Docker Desktop is running
- Image pull failures: Try
docker logout ghcr.iothen retry
- Invalid PAT: Verify your GitHub PAT has correct scopes:
repo- Repository operationsread:packages- Docker image access (if using Docker)
- Token expired: Generate a new GitHub PAT
- Invalid JSON: Validate your configuration:
cat ~/.copilot/mcp-config.json | jq .