Implement auto-open feature for browser launch on server start

This commit is contained in:
KAWAKAMI Moeki
2025-04-07 16:09:46 +09:00
parent 3032a67d4e
commit a524f17d80
4 changed files with 140 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env node
import open from "open";
import { resolve, dirname } from "path";
import { spawnPromise } from "spawn-rx";
import { fileURLToPath } from "url";
@@ -99,6 +100,9 @@ async function main() {
if (serverOk) {
try {
if (!process.env.MCP_AUTO_OPEN_DISABLED) {
open(`http://localhost:${CLIENT_PORT}`);
}
await spawnPromise("node", [inspectorClientPath], {
env: { ...process.env, PORT: CLIENT_PORT },
signal: abort.signal,