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.
This commit is contained in:
parent
9e9419bf21
commit
ae1aeb3c3f
1 changed files with 27 additions and 22 deletions
|
|
@ -133,21 +133,21 @@ async function startDevClient(clientOptions) {
|
||||||
echoOutput: true,
|
echoOutput: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auto-open browser after vite starts
|
const url = getClientUrl(
|
||||||
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false") {
|
CLIENT_PORT,
|
||||||
const url = getClientUrl(
|
authDisabled,
|
||||||
CLIENT_PORT,
|
sessionToken,
|
||||||
authDisabled,
|
SERVER_PORT,
|
||||||
sessionToken,
|
);
|
||||||
SERVER_PORT,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Give vite time to start before opening browser
|
// Give vite time to start before opening or logging the URL
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.log(`\n🚀 MCP Inspector is up and running at:\n ${url}\n`);
|
||||||
|
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false") {
|
||||||
|
console.log("🌐 Opening browser...");
|
||||||
open(url);
|
open(url);
|
||||||
console.log(`\n🔗 Opening browser at: ${url}\n`);
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
|
||||||
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
client.subscribe({
|
client.subscribe({
|
||||||
|
|
@ -180,15 +180,20 @@ async function startProdClient(clientOptions) {
|
||||||
"client.js",
|
"client.js",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Only auto-open browser if not cancelled
|
const url = getClientUrl(
|
||||||
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false" && !cancelled) {
|
CLIENT_PORT,
|
||||||
const url = getClientUrl(
|
authDisabled,
|
||||||
CLIENT_PORT,
|
sessionToken,
|
||||||
authDisabled,
|
SERVER_PORT,
|
||||||
sessionToken,
|
);
|
||||||
SERVER_PORT,
|
|
||||||
);
|
// Handle auto-open and logging
|
||||||
open(url);
|
if (!cancelled) {
|
||||||
|
console.log(`\n🚀 MCP Inspector is up and running at:\n ${url}\n`);
|
||||||
|
if (process.env.MCP_AUTO_OPEN_ENABLED !== "false") {
|
||||||
|
console.log(`\n🌐 Opening browser...:\n`);
|
||||||
|
open(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await spawnPromise("node", [inspectorClientPath], {
|
await spawnPromise("node", [inspectorClientPath], {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue