Skip to content

Commit ae1aeb3

Browse files
fix: improve logging consistency between dev and prod client startup
Refactored startProdClient to match startDevClient's logging pattern, ensuring consistent user feedback whether auto-open is enabled or disabled. Also ensures that we log full information on how to open the browser regardless of whether MCP_AUTO_OPEN_ENABLED=false.
1 parent 9e9419b commit ae1aeb3

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

client/bin/start.js

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ async function startDevClient(clientOptions) {
133133
echoOutput: true,
134134
});
135135

136-
// Auto-open browser after vite starts
137-
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false") {
138-
const url = getClientUrl(
139-
CLIENT_PORT,
140-
authDisabled,
141-
sessionToken,
142-
SERVER_PORT,
143-
);
136+
const url = getClientUrl(
137+
CLIENT_PORT,
138+
authDisabled,
139+
sessionToken,
140+
SERVER_PORT,
141+
);
144142

145-
// Give vite time to start before opening browser
146-
setTimeout(() => {
143+
// Give vite time to start before opening or logging the URL
144+
setTimeout(() => {
145+
console.log(`\n🚀 MCP Inspector is up and running at:\n ${url}\n`);
146+
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false") {
147+
console.log("🌐 Opening browser...");
147148
open(url);
148-
console.log(`\n🔗 Opening browser at: ${url}\n`);
149-
}, 3000);
150-
}
149+
}
150+
}, 3000);
151151

152152
await new Promise((resolve) => {
153153
client.subscribe({
@@ -180,15 +180,20 @@ async function startProdClient(clientOptions) {
180180
"client.js",
181181
);
182182

183-
// Only auto-open browser if not cancelled
184-
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false" && !cancelled) {
185-
const url = getClientUrl(
186-
CLIENT_PORT,
187-
authDisabled,
188-
sessionToken,
189-
SERVER_PORT,
190-
);
191-
open(url);
183+
const url = getClientUrl(
184+
CLIENT_PORT,
185+
authDisabled,
186+
sessionToken,
187+
SERVER_PORT,
188+
);
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+
}
192197
}
193198

194199
await spawnPromise("node", [inspectorClientPath], {

0 commit comments

Comments
 (0)