diff --git a/cli/scripts/cli-tests.js b/cli/scripts/cli-tests.js index e737756f..675ea0bc 100755 --- a/cli/scripts/cli-tests.js +++ b/cli/scripts/cli-tests.js @@ -744,8 +744,8 @@ async function runTests() { "tools/list", ); - // Test 26: Config with SSE transport type (CLI mode) - await runBasicTest( + // Test 26: Config with SSE transport type (CLI mode) - expects connection error + await runErrorTest( "config_sse_type_cli", "--config", sseConfigPath, @@ -756,8 +756,8 @@ async function runTests() { "tools/list", ); - // Test 27: Config with streamable-http transport type (CLI mode) - await runBasicTest( + // Test 27: Config with streamable-http transport type (CLI mode) - expects connection error + await runErrorTest( "config_http_type_cli", "--config", httpConfigPath, diff --git a/cli/src/cli.ts b/cli/src/cli.ts index 09c99d51..df16f0cc 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -122,7 +122,18 @@ async function runCli(args: Args): Promise { }); try { - await spawnPromise("node", [cliPath, args.command, ...args.args], { + // Build CLI arguments + const cliArgs = [cliPath]; + + // Add transport flag if specified + if (args.transport && args.transport !== "stdio") { + cliArgs.push("--transport", args.transport); + } + + // Add command and remaining args + cliArgs.push(args.command, ...args.args); + + await spawnPromise("node", cliArgs, { env: { ...process.env, ...args.envArgs }, signal: abort.signal, echoOutput: true, @@ -268,7 +279,7 @@ function parseArgs(): Args { }; } else if (config.type === "sse" || config.type === "streamable-http") { return { - command: "", + command: config.url, args: finalArgs, envArgs: options.e || {}, cli: options.cli || false,