New browser launcher for MCP OAuth. (#5261)

This commit is contained in:
Brian Ray
2025-08-01 01:47:22 -04:00
committed by GitHub
parent f21ff09389
commit dc9f17bb4a
4 changed files with 445 additions and 12 deletions

View File

@@ -7,7 +7,7 @@
import * as http from 'node:http';
import * as crypto from 'node:crypto';
import { URL } from 'node:url';
import open from 'open';
import { openBrowserSecurely } from '../utils/secure-browser-launcher.js';
import { MCPOAuthToken, MCPOAuthTokenStorage } from './oauth-token-storage.js';
import { getErrorMessage } from '../utils/errors.js';
import { OAuthUtils } from './oauth-utils.js';
@@ -593,9 +593,9 @@ export class MCPOAuthProvider {
// Start callback server
const callbackPromise = this.startCallbackServer(pkceParams.state);
// Open browser
// Open browser securely
try {
await open(authUrl);
await openBrowserSecurely(authUrl);
} catch (error) {
console.warn(
'Failed to open browser automatically:',