๐ Using GitHub MCP Server in VS Code
Overview
This guide explains how to configure GitHub MCP Server inside VS Code so Copilot can interact with GitHub — such as listing repositories, creating branches, and creating pull requests — all through chat.
GitHub CLI (gh) is not required for this setup.
✔ Prerequisites
| Requirement | Status |
|---|
| Visual Studio Code | Installed |
| GitHub Copilot Extension | Installed |
| GitHub Account | Required |
๐ Step 1 - Create PAT (Personal Access Token)
-
Open: https://github.com/settings/personal-access-tokens?type=beta
-
Click Generate new token
-
Select Fine-grained token
-
Repository Access → choose:
✔ All repositories
or
✔ Specific repositories (recommended for security) -
Under Repository permissions, enable:
| Permission | Access |
|---|---|
| Contents | Read and write |
| Administration | Read and write |
๐งฉ Step 2 - Add MCP Configuration to VS Code
-
Press: Ctrl + Shift + P
-
Search:
Open User MCP Settings (JSON) -
Paste this JSON and Save:
๐ Step 3 - Reload VS Code
Use any option:
-
Press Ctrl + Shift + P → Reload Window
-
OR restart VS Code
VS Code will ask for:
Authorization Token
Paste the PAT you created earlier.
๐ Step 4 - Allow MCP GitHub Tools (Safest Option)
When prompted:
⚠ Allow Tools from GitHub MCP Server?
Choose:
✔ Allow Tools in this Session (best for security)
This ensures MCP is only active when you want it.
๐ Step 5 — Test in Copilot Chat
If the setup is correct, you will see GitHub actions like:
-
listRepositories
-
createRepository
-
getFileContents
-
createPullRequest
| Issue | Cause | Fix |
|---|---|---|
| 403 Resource not accessible by PAT | Token missing Admin or Contents access | Update token permissions |
| No tools found | VS Code didn't reload MCP config | Restart / Reload Window |
| Token prompt missing | Wrong JSON file edited | Check Open User MCP Settings (JSON) |
| gh command not found | GitHub CLI not installed | Ignore — not required |
Copilot MCP will:
-
Connect to the GitHub MCP server
MCP will assist with code-level corrections, completion of code, and create an AL object with NLP
-
Create an issue, pull the repo, commit object/code, and merge via Copilot
-
Issue Respond with:
-
issue number
-
issue URL
-
status confirmation
-
No CLI, no terminal — just natural language.