Skip to content

Commit 0fa56e1

Browse files
committed
fix(server) Differentiate command resolution by platform
1 parent eb70539 commit 0fa56e1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cors from "cors";
44
import EventSource from "eventsource";
55
import { parseArgs } from "node:util";
66
import { parse as shellParseArgs } from "shell-quote";
7+
import { platform } from "node:os";
78

89
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
910
import {
@@ -42,7 +43,12 @@ const createTransport = async (query: express.Request["query"]) => {
4243
const origArgs = shellParseArgs(query.args as string) as string[];
4344
const env = query.env ? JSON.parse(query.env as string) : undefined;
4445

45-
const { cmd, args } = findActualExecutable(command, origArgs);
46+
// On Windows, we need to find the actual executable to run
47+
// On other platforms, we can just use the command as-is
48+
const { cmd, args } =
49+
platform() === "win32"
50+
? findActualExecutable(command, origArgs)
51+
: { cmd: command, args: origArgs };
4652

4753
console.log(
4854
`Stdio transport: command=${cmd}, args=${args}, env=${JSON.stringify(env)}`,

0 commit comments

Comments
 (0)