Skip to content

Commit d76a79a

Browse files
committed
Making the server provide info on what transport to delete by default
Fixes #255
1 parent 04800f7 commit d76a79a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

client/src/App.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ const App = () => {
239239
if (data.defaultArgs) {
240240
setArgs(data.defaultArgs);
241241
}
242+
243+
if (data.defaultTransportType) {
244+
setTransportType(data.defaultTransportType);
245+
if (data.defaultTransportType === "sse") {
246+
setSseUrl(data.defaultCommand);
247+
}
248+
}
242249
})
243250
.catch((error) =>
244251
console.error("Error fetching default environment:", error),

server/src/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ app.get("/config", (req, res) => {
185185
defaultEnvironment,
186186
defaultCommand: values.env,
187187
defaultArgs: values.args,
188+
defaultTransportType: isSSETransport(values.env) ? "sse" : "stdio",
188189
});
189190
} catch (error) {
190191
console.error("Error in /config route:", error);
@@ -206,3 +207,12 @@ server.on("error", (err) => {
206207
}
207208
process.exit(1);
208209
});
210+
211+
function isSSETransport(command: string | undefined): boolean {
212+
if (!command) {
213+
return false;
214+
}
215+
216+
// check if the command is a url, which would indicate an SSE transport
217+
return command.startsWith("https://") || command.startsWith("http://");
218+
}

0 commit comments

Comments
 (0)