From 0fa56e14d9da239e1c04e2bd4a1634baf7d61ee2 Mon Sep 17 00:00:00 2001 From: Jack Steam Date: Tue, 17 Dec 2024 16:49:55 -0600 Subject: [PATCH] fix(server) Differentiate command resolution by platform --- server/src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/index.ts b/server/src/index.ts index b82b17d..67ff9a0 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -4,6 +4,7 @@ import cors from "cors"; import EventSource from "eventsource"; import { parseArgs } from "node:util"; import { parse as shellParseArgs } from "shell-quote"; +import { platform } from "node:os"; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { @@ -42,7 +43,12 @@ const createTransport = async (query: express.Request["query"]) => { const origArgs = shellParseArgs(query.args as string) as string[]; const env = query.env ? JSON.parse(query.env as string) : undefined; - const { cmd, args } = findActualExecutable(command, origArgs); + // On Windows, we need to find the actual executable to run + // On other platforms, we can just use the command as-is + const { cmd, args } = + platform() === "win32" + ? findActualExecutable(command, origArgs) + : { cmd: command, args: origArgs }; console.log( `Stdio transport: command=${cmd}, args=${args}, env=${JSON.stringify(env)}`,