From cc1ae05f9d2fcbca82f1380d0df15ffd449a4ab7 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:34:03 +0000 Subject: [PATCH] fix: use shell-quote for proper argument parsing --- server/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/index.ts b/server/src/index.ts index a217f44..940a008 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -3,6 +3,7 @@ import cors from "cors"; import EventSource from "eventsource"; import { parseArgs } from "node:util"; +import { parse as shellParseArgs } from 'shell-quote'; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { @@ -38,7 +39,7 @@ const createTransport = async (query: express.Request["query"]) => { if (transportType === "stdio") { const command = query.command as string; - const origArgs = (query.args as string).split(/\s+/); + 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);