Skip to content

Commit ef8356c

Browse files
committed
fix: use a flag for transport choice
1 parent f497fb9 commit ef8356c

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/app.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,25 @@ program
6262
.command("start-server", { isDefault: true })
6363
.description("Starts the Algolia MCP server")
6464
.option<string[]>(...ALLOW_TOOLS_OPTIONS_TUPLE)
65+
.option("--transport [stdio|sse]", "Transport type, either `stdio` (default) or `sse`", "stdio")
6566
.action(async (opts: StartServerOptions) => {
66-
const { startServer } = await import("./commands/start-server.ts");
67-
await startServer(opts);
68-
});
69-
70-
program
71-
.command("start-sse-server")
72-
.description("Starts the remote-ready Algolia MCP server")
73-
.option<string[]>(...ALLOW_TOOLS_OPTIONS_TUPLE)
74-
.action(async (opts: StartServerOptions) => {
75-
const { startSseServer } = await import("./commands/start-sse-server.ts");
76-
await startSseServer(opts);
67+
switch (opts.transport) {
68+
case "stdio": {
69+
console.info('Starting server with stdio transport');
70+
const { startServer } = await import("./commands/start-server.ts");
71+
await startServer(opts);
72+
break;
73+
}
74+
case "sse": {
75+
console.info('Starting server with SSE transport');
76+
const { startSseServer } = await import("./commands/start-sse-server.ts");
77+
await startSseServer(opts);
78+
break;
79+
}
80+
default:
81+
console.error(`Unknown transport type: ${opts.transport}\nAllowed values: stdio, sse`);
82+
process.exit(1);
83+
}
7784
});
7885

7986
program

src/toolFilters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type CliFilteringOptions = {
22
allowTools?: string[];
33
denyTools?: string[];
4+
transport?: 'stdio' | 'sse';
45
};
56

67
export type ToolFilter = {

0 commit comments

Comments
 (0)