@@ -25,7 +25,6 @@ import {
2525} from '../../types.js' ;
2626import { getDisplayName } from '../../shared/metadataUtils.js' ;
2727import { OAuthClientMetadata } from '../../shared/auth.js' ;
28- import { exec } from 'node:child_process' ;
2928import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js' ;
3029import { UnauthorizedError } from '../../client/auth.js' ;
3130import { createServer } from 'node:http' ;
@@ -45,8 +44,7 @@ const clientMetadata: OAuthClientMetadata = {
4544 scope : 'mcp:tools'
4645} ;
4746oauthProvider = new InMemoryOAuthClientProvider ( OAUTH_CALLBACK_URL , clientMetadata , ( redirectUrl : URL ) => {
48- console . log ( `🌐 Opening browser for OAuth redirect: ${ redirectUrl . toString ( ) } ` ) ;
49- openBrowser ( redirectUrl . toString ( ) ) ;
47+ console . log ( `\n🔗 Please open this URL in your browser to authorize:\n ${ redirectUrl . toString ( ) } ` ) ;
5048} ) ;
5149
5250// Create readline interface for user input
@@ -259,17 +257,6 @@ async function elicitationLoop(): Promise<void> {
259257 }
260258}
261259
262- async function openBrowser ( url : string ) : Promise < void > {
263- const command = `open "${ url } "` ;
264-
265- exec ( command , error => {
266- if ( error ) {
267- console . error ( `Failed to open browser: ${ error . message } ` ) ;
268- console . log ( `Please manually open: ${ url } ` ) ;
269- }
270- } ) ;
271- }
272-
273260/**
274261 * Enqueues an elicitation request and returns the result.
275262 *
@@ -402,9 +389,8 @@ async function handleURLElicitation(params: ElicitRequestURLParams): Promise<Eli
402389 console . error ( 'Background completion wait failed:' , error ) ;
403390 } ) ;
404391
405- // 4. Open the URL in the browser
406- console . log ( `\n🚀 Opening browser to: ${ url } ` ) ;
407- await openBrowser ( url ) ;
392+ // 4. Direct user to open the URL in their browser
393+ console . log ( `\n🔗 Please open this URL in your browser:\n ${ url } ` ) ;
408394
409395 console . log ( '\n⏳ Waiting for you to complete the interaction in your browser...' ) ;
410396 console . log ( ' The server will send a notification once you complete the action.' ) ;
0 commit comments