fix: use shell-quote for proper argument parsing

This commit is contained in:
devin-ai-integration[bot]
2024-12-06 19:34:03 +00:00
parent 9ea77a729c
commit cc1ae05f9d

View File

@@ -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);