Skip to content

Commit 6a66ca5

Browse files
committed
fix startup of webclient through cli
1 parent 38bead3 commit 6a66ca5

File tree

1 file changed

+8
-41
lines changed

1 file changed

+8
-41
lines changed

cli/src/cli.ts

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,13 @@ function delay(ms: number): Promise<void> {
5050
}
5151

5252
async function runWebClient(args: Args): Promise<void> {
53-
const inspectorServerPath = resolve(
54-
__dirname,
55-
"../../",
56-
"server",
57-
"build",
58-
"index.js",
59-
);
60-
6153
// Path to the client entry point
6254
const inspectorClientPath = resolve(
6355
__dirname,
6456
"../../",
6557
"client",
6658
"bin",
67-
"client.js",
59+
"start.js",
6860
);
6961

7062
const CLIENT_PORT: string = process.env.CLIENT_PORT ?? "6274";
@@ -83,38 +75,13 @@ async function runWebClient(args: Args): Promise<void> {
8375
let serverOk: unknown;
8476

8577
try {
86-
server = spawnPromise(
87-
"node",
88-
[
89-
inspectorServerPath,
90-
...(args.command ? [`--env`, args.command] : []),
91-
...(args.args ? [`--args=${args.args.join(" ")}`] : []),
92-
],
93-
{
94-
env: {
95-
...process.env,
96-
PORT: SERVER_PORT,
97-
MCP_ENV_VARS: JSON.stringify(args.envArgs),
98-
},
99-
signal: abort.signal,
100-
echoOutput: true,
101-
},
102-
);
103-
104-
// Make sure server started before starting client
105-
serverOk = await Promise.race([server, delay(2 * 1000)]);
106-
} catch (error) {}
107-
108-
if (serverOk) {
109-
try {
110-
await spawnPromise("node", [inspectorClientPath], {
111-
env: { ...process.env, PORT: CLIENT_PORT },
112-
signal: abort.signal,
113-
echoOutput: true,
114-
});
115-
} catch (e) {
116-
if (!cancelled || process.env.DEBUG) throw e;
117-
}
78+
await spawnPromise("node", [inspectorClientPath], {
79+
env: { ...process.env, PORT: CLIENT_PORT },
80+
signal: abort.signal,
81+
echoOutput: true,
82+
});
83+
} catch (e) {
84+
if (!cancelled || process.env.DEBUG) throw e;
11885
}
11986
}
12087

0 commit comments

Comments
 (0)