Skip to content

Commit 195f790

Browse files
Fix CLI test failures for SSE/HTTP transport configs
- Pass URL as command for SSE/HTTP configs instead of empty string - Update runCli to pass transport type flag when needed - Update tests to expect connection errors for non-existent SSE/HTTP servers
1 parent 1e399b7 commit 195f790

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

cli/scripts/cli-tests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@ async function runTests() {
744744
"tools/list",
745745
);
746746

747-
// Test 26: Config with SSE transport type (CLI mode)
748-
await runBasicTest(
747+
// Test 26: Config with SSE transport type (CLI mode) - expects connection error
748+
await runErrorTest(
749749
"config_sse_type_cli",
750750
"--config",
751751
sseConfigPath,
@@ -756,8 +756,8 @@ async function runTests() {
756756
"tools/list",
757757
);
758758

759-
// Test 27: Config with streamable-http transport type (CLI mode)
760-
await runBasicTest(
759+
// Test 27: Config with streamable-http transport type (CLI mode) - expects connection error
760+
await runErrorTest(
761761
"config_http_type_cli",
762762
"--config",
763763
httpConfigPath,

cli/src/cli.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,18 @@ async function runCli(args: Args): Promise<void> {
122122
});
123123

124124
try {
125-
await spawnPromise("node", [cliPath, args.command, ...args.args], {
125+
// Build CLI arguments
126+
const cliArgs = [cliPath];
127+
128+
// Add transport flag if specified
129+
if (args.transport && args.transport !== "stdio") {
130+
cliArgs.push("--transport", args.transport);
131+
}
132+
133+
// Add command and remaining args
134+
cliArgs.push(args.command, ...args.args);
135+
136+
await spawnPromise("node", cliArgs, {
126137
env: { ...process.env, ...args.envArgs },
127138
signal: abort.signal,
128139
echoOutput: true,
@@ -268,7 +279,7 @@ function parseArgs(): Args {
268279
};
269280
} else if (config.type === "sse" || config.type === "streamable-http") {
270281
return {
271-
command: "",
282+
command: config.url,
272283
args: finalArgs,
273284
envArgs: options.e || {},
274285
cli: options.cli || false,

0 commit comments

Comments
 (0)