Skip to content

Commit 0346995

Browse files
authored
Merge pull request #104 from devin-open-source/fix-shell-quote
Fix shell argument parsing issue: #96
2 parents 8c7b0c3 + fdc5216 commit 0346995

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

package-lock.json

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636
"@modelcontextprotocol/inspector-client": "0.3.0",
3737
"@modelcontextprotocol/inspector-server": "0.3.0",
3838
"concurrently": "^9.0.1",
39+
"shell-quote": "^1.8.2",
3940
"spawn-rx": "^5.1.0",
4041
"ts-node": "^10.9.2"
4142
},
4243
"devDependencies": {
4344
"@types/node": "^22.7.5",
45+
"@types/shell-quote": "^1.7.5",
4446
"prettier": "3.3.3"
4547
}
4648
}

server/src/index.ts

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

78
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
89
import {
@@ -38,7 +39,7 @@ const createTransport = async (query: express.Request["query"]) => {
3839

3940
if (transportType === "stdio") {
4041
const command = query.command as string;
41-
const origArgs = (query.args as string).split(/\s+/);
42+
const origArgs = shellParseArgs(query.args as string) as string[];
4243
const env = query.env ? JSON.parse(query.env as string) : undefined;
4344

4445
const { cmd, args } = findActualExecutable(command, origArgs);

0 commit comments

Comments
 (0)