File tree Expand file tree Collapse file tree 3 files changed +14
-33
lines changed
Expand file tree Collapse file tree 3 files changed +14
-33
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3+ import open from "open" ;
34import { join , dirname } from "path" ;
45import { fileURLToPath } from "url" ;
56import handler from "serve-handler" ;
@@ -42,9 +43,12 @@ const server = http.createServer((request, response) => {
4243const port = parseInt ( process . env . CLIENT_PORT || "6274" , 10 ) ;
4344const host = process . env . HOST || "localhost" ;
4445server . on ( "listening" , ( ) => {
45- console . log (
46- `🔍 MCP Inspector is up and running at http://${ host } :${ port } 🚀` ,
47- ) ;
46+ const url = process . env . INSPECTOR_URL || `http://${ host } :${ port } ` ;
47+ console . log ( `\n🚀 MCP Inspector is up and running at:\n ${ url } \n` ) ;
48+ if ( process . env . MCP_AUTO_OPEN_ENABLED !== "false" ) {
49+ console . log ( `🌐 Opening browser...` ) ;
50+ open ( url ) ;
51+ }
4852} ) ;
4953server . on ( "error" , ( err ) => {
5054 if ( err . message . includes ( `EADDRINUSE` ) ) {
Original file line number Diff line number Diff line change @@ -187,17 +187,12 @@ async function startProdClient(clientOptions) {
187187 SERVER_PORT ,
188188 ) ;
189189
190- // Handle auto-open and logging
191- if ( ! cancelled ) {
192- console . log ( `\n🚀 MCP Inspector is up and running at:\n ${ url } \n` ) ;
193- if ( process . env . MCP_AUTO_OPEN_ENABLED !== "false" ) {
194- console . log ( `\n🌐 Opening browser...:\n` ) ;
195- open ( url ) ;
196- }
197- }
198-
199190 await spawnPromise ( "node" , [ inspectorClientPath ] , {
200- env : { ...process . env , CLIENT_PORT : CLIENT_PORT } ,
191+ env : {
192+ ...process . env ,
193+ CLIENT_PORT : CLIENT_PORT ,
194+ INSPECTOR_URL : url ,
195+ } ,
201196 signal : abort . signal ,
202197 echoOutput : true ,
203198 } ) ;
Original file line number Diff line number Diff line change @@ -539,27 +539,9 @@ const server = app.listen(PORT, HOST);
539539server . on ( "listening" , ( ) => {
540540 console . log ( `⚙️ Proxy server listening on ${ HOST } :${ PORT } ` ) ;
541541 if ( ! authDisabled ) {
542- console . log ( `🔑 Session token: ${ sessionToken } ` ) ;
543542 console . log (
544- `Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth` ,
545- ) ;
546-
547- // Display clickable URL with pre-filled token
548- const clientPort = process . env . CLIENT_PORT || "6274" ;
549- const clientHost = process . env . HOST || "localhost" ;
550-
551- // Build URL with query parameters
552- const params = new URLSearchParams ( ) ;
553- params . set ( "MCP_PROXY_AUTH_TOKEN" , sessionToken ) ;
554-
555- // Add server port if it's not the default
556- if ( PORT !== parseInt ( DEFAULT_MCP_PROXY_LISTEN_PORT , 10 ) ) {
557- params . set ( "MCP_PROXY_PORT" , PORT . toString ( ) ) ;
558- }
559-
560- const clientUrl = `http://${ clientHost } :${ clientPort } /?${ params . toString ( ) } ` ;
561- console . log (
562- `\n🔗 Open inspector with token pre-filled:\n ${ clientUrl } \n` ,
543+ `🔑 Session token: ${ sessionToken } \n ` +
544+ `Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth` ,
563545 ) ;
564546 } else {
565547 console . log (
You can’t perform that action at this time.
0 commit comments