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 1
1
#!/usr/bin/env node
2
2
3
+ import open from "open" ;
3
4
import { join , dirname } from "path" ;
4
5
import { fileURLToPath } from "url" ;
5
6
import handler from "serve-handler" ;
@@ -42,9 +43,12 @@ const server = http.createServer((request, response) => {
42
43
const port = parseInt ( process . env . CLIENT_PORT || "6274" , 10 ) ;
43
44
const host = process . env . HOST || "localhost" ;
44
45
server . 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
+ }
48
52
} ) ;
49
53
server . on ( "error" , ( err ) => {
50
54
if ( err . message . includes ( `EADDRINUSE` ) ) {
Original file line number Diff line number Diff line change @@ -187,17 +187,12 @@ async function startProdClient(clientOptions) {
187
187
SERVER_PORT ,
188
188
) ;
189
189
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
-
199
190
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
+ } ,
201
196
signal : abort . signal ,
202
197
echoOutput : true ,
203
198
} ) ;
Original file line number Diff line number Diff line change @@ -539,27 +539,9 @@ const server = app.listen(PORT, HOST);
539
539
server . on ( "listening" , ( ) => {
540
540
console . log ( `⚙️ Proxy server listening on ${ HOST } :${ PORT } ` ) ;
541
541
if ( ! authDisabled ) {
542
- console . log ( `🔑 Session token: ${ sessionToken } ` ) ;
543
542
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` ,
563
545
) ;
564
546
} else {
565
547
console . log (
You can’t perform that action at this time.
0 commit comments