Add fixed OAuth callback port option for MCP servers in Copilot

Open
#319,440 1 comment 8 reactions 1 assignee View on GitHub

@TylerLeonhardt is already working on this.

Since Jun 1, 2026.

Assessment

This issue has not been assessed yet.

Description

authentication feature-request mcp
Feature Request: Add fixed OAuth callback port option for MCP servers in Copilot
Problem

When connecting to a remote MCP server that requires OAuth authentication, VS Code Copilot binds to a random ephemeral port for the localhost callback (e.g. http://localhost:54321/callback). The MCP spec states that authorization servers SHOULD accept any loopback port, but many identity providers require the exact redirect_uri (including port) to be pre-registered.

There are a couple reasons this is not always practical:

  • Enterprise identity providers (Cognito, Entra ID, Okta in strict mode) enforce exact redirect URI matching as a security policy
  • Organizations with compliance requirements may not be able to relax redirect URI validation
Proposed Solution

Allow users to specify a fixed callback port in the MCP server's oauth configuration:

// .vscode/mcp.json
{
  "servers": {
    "my-server": {
      "type": "http",
      "url": "https://mcp.example.com",
      "oauth": {
        "clientId": "my-client-id",
        "callbackPort": 8080
      }
    }
  }
}

When callbackPort is set, the OAuth callback listener binds to that specific port instead of an ephemeral one, producing a predictable redirect URI (e.g. http://localhost:8080/callback) that can be pre-registered with the identity provider.

Other Client Examples

This pattern has been adopted by a handful of clients already:

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.