Merge pull request #64 from modelcontextprotocol/ashwin/spaces
fix arg passing in cli
This commit is contained in:
22
bin/cli.js
22
bin/cli.js
@@ -16,10 +16,30 @@ const inspectorClientPath = join(__dirname, "../client/bin/cli.js");
|
|||||||
|
|
||||||
console.log("Starting MCP inspector...");
|
console.log("Starting MCP inspector...");
|
||||||
|
|
||||||
|
function escapeArg(arg) {
|
||||||
|
if (arg.includes(" ") || arg.includes("'") || arg.includes('"')) {
|
||||||
|
return `\\"${arg.replace(/"/g, '\\\\\\"')}\\"`;
|
||||||
|
}
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
const serverCommand = [
|
||||||
|
`node`,
|
||||||
|
inspectorServerPath,
|
||||||
|
command ? `--env ${escapeArg(command)}` : "",
|
||||||
|
mcpServerArgs.length
|
||||||
|
? `--args="${mcpServerArgs.map(escapeArg).join(" ")}"`
|
||||||
|
: "",
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" ");
|
||||||
|
|
||||||
|
console.log(serverCommand);
|
||||||
|
|
||||||
const { result } = concurrently(
|
const { result } = concurrently(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
command: `node ${inspectorServerPath}${command ? ` --env ${command}` : ""}${mcpServerArgs.length ? ` --args "${mcpServerArgs.join(" ")}"` : ""}`,
|
command: serverCommand,
|
||||||
name: "server",
|
name: "server",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/inspector",
|
"name": "@modelcontextprotocol/inspector",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Model Context Protocol inspector",
|
"description": "Model Context Protocol inspector",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Anthropic, PBC (https://anthropic.com)",
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||||
|
|||||||
Reference in New Issue
Block a user