@@ -130,14 +130,14 @@ export async function connectToRemoteServer(
130
130
const sseTransport = transportStrategy === 'sse-only' || transportStrategy === 'sse-first'
131
131
const transport = sseTransport
132
132
? new SSEClientTransport ( url , {
133
- authProvider,
134
- requestInit : { headers } ,
135
- eventSourceInit,
136
- } )
133
+ authProvider,
134
+ requestInit : { headers } ,
135
+ eventSourceInit,
136
+ } )
137
137
: new StreamableHTTPClientTransport ( url , {
138
- authProvider,
139
- requestInit : { headers } ,
140
- } )
138
+ authProvider,
139
+ requestInit : { headers } ,
140
+ } )
141
141
142
142
try {
143
143
if ( client ) {
@@ -300,8 +300,16 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe
300
300
log ( 'Auth code received, resolving promise' )
301
301
authCompletedResolve ( code )
302
302
303
- res . send ( 'Authorization successful! You may close this window and return to the CLI.' +
304
- '<script>window.close();</script>' )
303
+ res . send ( `
304
+ Authorization successful!
305
+ You may close this window and return to the CLI.
306
+ <script>
307
+ // If this is a non-interactive session (no manual approval step was required) then
308
+ // this should automatically close the window. If not, this will have no effect and
309
+ // the user will see the message above.
310
+ window.close();
311
+ </script>
312
+ ` )
305
313
306
314
// Notify main flow that auth code is available
307
315
options . events . emit ( 'auth-code-received' , code )
@@ -377,7 +385,7 @@ export async function findAvailablePort(preferredPort?: number): Promise<number>
377
385
export async function parseCommandLineArgs ( args : string [ ] , defaultPort : number , usage : string ) {
378
386
// Process headers
379
387
const headers : Record < string , string > = { }
380
- let i = 0 ;
388
+ let i = 0
381
389
while ( i < args . length ) {
382
390
if ( args [ i ] === '--header' && i < args . length - 1 ) {
383
391
const value = args [ i + 1 ]
0 commit comments