Fix command-line argument passing to pre-fill UI
When running the inspector with command-line arguments (e.g., `npx @modelcontextprotocol/inspector node build/index.js arg1 arg2`), the command and arguments were not being properly passed through to the UI for pre-filling. Changes: - cli.ts now passes command and args to start.js - start.js uses --command for the command and --args for arguments - Server parses the new --command parameter - /config endpoint returns correct values for UI pre-filling This ensures the UI correctly displays the command and arguments passed on the command line instead of showing old localStorage values. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1ea8e9a939
commit
c7b90a1af9
1 changed files with 20 additions and 4 deletions
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue