Add fixed OAuth callback port option for MCP servers in Copilot
@TylerLeonhardt is already working on this.
Since Jun 1, 2026.
Assessment
This issue has not been assessed yet.
Description
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:
- Claude Code —
--callback-portflag and"callbackPort"in JSON config - Kiro CLI —
"redirectUri"field in oauth config - Codex —
mcp_oauth_callback_portin config.toml
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.9k
- PR merge metrics
- PR metrics pending
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
new release
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in microsoft/vscode
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·