feat: use GitHub Copilot client ID as default for MCP OAuth

Use the well-known Copilot client ID (aebc6443-996d-45c2-90f0-388ff96faa56)
when no static client config is provided and the auth server doesn't
support dynamic client registration. This matches how VS Code authenticates
with Entra ID-backed MCP servers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-27 20:08:40 +01:00
co-authored by Copilot
parent 4f7b479996
commit 53f1167681
+6 -1
View File
@@ -61,8 +61,13 @@ export async function performMcpOAuthFlow(options: McpOAuthFlowOptions): Promise
const authServerUrl = await discoverAuthorizationServer(serverUrl);
const metadata = await fetchAuthServerMetadata(authServerUrl);
// Use explicit static config, fall back to the well-known GitHub Copilot client ID,
// and only attempt dynamic registration as a last resort.
const COPILOT_CLIENT_ID = 'aebc6443-996d-45c2-90f0-388ff96faa56';
const clientId = staticClientConfig?.clientId
?? await dynamicClientRegistration(metadata, serverUrl);
?? (metadata.registration_endpoint
? await dynamicClientRegistration(metadata, serverUrl)
: COPILOT_CLIENT_ID);
const { verifier, challenge } = generatePkceChallenge();
const { port, redirectUri, waitForCallback, close } = await startCallbackServer();