Tuesday, 25 November 2025

Integrate ๐Ÿค– GitHub MCP Server in VS Code

๐Ÿš€ 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)

  1. Open: https://github.com/settings/personal-access-tokens?type=beta

  2. Click Generate new token

  3. Select Fine-grained token

  4. Repository Access → choose:
    ✔ All repositories
    or
    ✔ Specific repositories (recommended for security)

  5. Under Repository permissions, enable:

        Permission Access
            Contents     Read and write
            Administration     Read and write
     6. Click Generate toke
     7. Copy & save the token securely 
         (you will enter it later in VS Code)

๐Ÿงฉ Step 2 - Add MCP Configuration to VS Code

  1. Press: Ctrl + Shift + P

  2. Search:
    Open User MCP Settings (JSON)

  3. Paste this JSON and Save:

{
  "servers": {
    "io.github.github/github-mcp-server": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "${input:Authorization}"
      },
      "gallery": "https://api.mcp.github.com",
      "version": "0.21.1"
    }
  },
  "inputs": [
    {
      "id": "Authorization",
      "type": "promptString",
      "description": "Authentication token (PAT or App token)",
      "password": true
    }
  ]
}

    

๐Ÿ”„ Step 3 - Reload VS Code

Use any option:

  • Press Ctrl + Shift + PReload 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

Open Copilot Chat and run: /tools

If the setup is correct, you will see GitHub actions like:

  • listRepositories

  • createRepository

  • getFileContents

  • createPullRequest

๐Ÿงช Example Command
 Create a private repository named "First-MCP" with a description "Repository created via Copilot"

 Note: if you failed to create a repo, then add more permissions on PAT, regenerate the Token, and save.

๐Ÿ›‘ Troubleshooting

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:

  1. Connect to the GitHub MCP server

  2. MCP will assist with code-level corrections, completion of code, and create an AL object with NLP

  3. Create an issue, pull the repo, commit object/code, and merge via Copilot

  4. Issue Respond with:

    • issue number

    • issue URL

    • status confirmation


Copilot Chat in VS Code
No CLI, no terminal — just natural language.

No comments:

Post a Comment