Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,21 @@ async function runWebClient(args: Args): Promise<void> {
abort.abort();
});

// Build arguments to pass to start.js
const startArgs: string[] = [];

// Pass environment variables
for (const [key, value] of Object.entries(args.envArgs)) {
startArgs.push("-e", `${key}=${value}`);
}

// Pass command and args (using -- to separate them)
if (args.command) {
startArgs.push("--", args.command, ...args.args);
}

try {
await spawnPromise("node", [inspectorClientPath], {
await spawnPromise("node", [inspectorClientPath, ...startArgs], {
signal: abort.signal,
echoOutput: true,
});
Expand Down
6 changes: 4 additions & 2 deletions client/bin/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ async function startProdServer(serverOptions) {
"node",
[
inspectorServerPath,
...(command ? [`--env`, command] : []),
...(mcpServerArgs ? [`--args=${mcpServerArgs.join(" ")}`] : []),
...(command ? [`--command`, command] : []),
...(mcpServerArgs && mcpServerArgs.length > 0
? [`--args`, mcpServerArgs.join(" ")]
: []),
],
{
env: {
Expand Down
3 changes: 2 additions & 1 deletion server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const { values } = parseArgs({
options: {
env: { type: "string", default: "" },
args: { type: "string", default: "" },
command: { type: "string", default: "" },
},
});

Expand Down Expand Up @@ -520,7 +521,7 @@ app.get("/config", originValidationMiddleware, authMiddleware, (req, res) => {
try {
res.json({
defaultEnvironment,
defaultCommand: values.env,
defaultCommand: values.command,
defaultArgs: values.args,
});
} catch (error) {
Expand Down