Skip to content

Copilot authentication issue #3956

Backlog
Backlog

Description

@nmtri-dev

Describe the bug

When I use Copilot Agent to access Github, Copilot ask me to authenticate the Github MCP server but Github Authorization page rejects it.

Affected version

Please run docker run -i --rm ghcr.io/github/github-mcp-server ./github-mcp-server --version and paste the output below

Steps to reproduce the behavior

  1. Ask agent to do something like reviewing a PR
  2. Copilot asks to authenticate Github MCP Server
  3. Github Authorization rejects it
Screenshot 2026-11-26 at 14 32 28

This is the redirect URI query param redirect_uri=http%3A%2F%2F127.0.0.1%3A33418%2F

Expected vs actual behavior

I need Github MCP Server to be authenticated successfully

Logs

Paste any available logs. Redact if needed.

Activity

  1. added
    bug
    on Nov 26, 2026
  2. chrissmithptml commented on Dec 3, 2026

    @chrissmithptml

    I too see this when using the copilot chat within the latest VS Code 1.149.0

    My github mcp server configuration is as follows

            "github": {
    			"type": "http",
    			"url": "https://api.githubcopilot.com/mcp/",
    			"tools": [
    				"*"
    			],
    			"headers": {
    				"X-MCP-Toolsets": "default,copilot_spaces"
    			}
    		},
    

    If I attempt to connect to the MCP server in a chat

    image

    The browser launches with the following URL
    https://github.com/login/oauth/authorize?client_id=Ov23ctDVkRmgkPke0Mmm&response_type=code&code_challenge=REDACTED&code_challenge_method=S256&scope=read%3Aorg+offline_access&resource=https%3A%2F%2Fapi.githubcopilot.com%2Fmcp&redirect_uri=http%3A%2F%2F127.0.0.1%3A33418%2F&state=REDACTED

    And we see the following in the browser

    image
  3. chrissmithptml commented on Dec 3, 2026

    @chrissmithptml

    I let copilot do a bit of digging in this area, and as far as it says (and I have been able to partially confirm this to be true)

    Hypothesis

    The Copilot runtime initiates GitHub MCP OAuth using a client registered for a /callback redirect. VS Code takes over the browser flow but supplies a loopback redirect ending in / instead. GitHub rejects that mismatch before authentication can complete.

    Most likely fix

    Update the VS Code ↔ Copilot OAuth handoff so the authorization request and callback listener both use /callback. This points to an integration bug between the MCP and VS Code.

    Verification

    Calling the following URLs gets me two different behaviours. If I call the following, the browser window attempts to redirect back to the localhost
    https://github.com/login/oauth/authorize?client_id=Ov23ctDVkRmgkPke0Mmm&redirect_uri=http://127.0.0.1:33418/callback

    If I call this (the one which is what is currently generated by vs code) I get the ugly Be Careful! page above.
    https://github.com/login/oauth/authorize?client_id=Ov23ctDVkRmgkPke0Mmm&redirect_uri=http://127.0.0.1:33418/

    So clearly there is some busted auth redirect logic (likely being handled by VS Code, but cannot say for sure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions