Merge pull request #64 from modelcontextprotocol/ashwin/spaces

fix arg passing in cli
This commit is contained in:
ashwin-ant
2024-11-19 15:46:17 -08:00
committed by GitHub
2 changed files with 22 additions and 2 deletions

View File

@@ -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",
}, },
{ {

View File

@@ -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)",