`-e KEY=` (empty value) is rejected on all four clients, though `--config` passes an empty env value through
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- cli
调研方向
拒绝逻辑位于 core/mcp/node/config.ts(约第 55 行)的 parseKeyValuePair 中,当值为空时会抛出异常;四个客户端都使用这条共享路径。请结合 core/cli/utils/prompt-args.ts 一起阅读,其中 q= 已经被允许。clients/web/src/test/core/mcp/node/config.test.ts(约第 47 行)中的测试目前期望 key= 抛出异常,因此在修改前请先确认这是否是有意为之。完成的标准是 -e EMPTY_VAR= 得到空字符串值,并且测试已相应更新。
由索引模型根据 Issue 内容生成。
描述
Which version line?
v2 — current (@modelcontextprotocol/inspector@latest)
Which client?
All / shared core
Inspector version
2.17.0
Node version
v26.13.1
Operating system (and browser, for the web client)
macOS 27.3 (arm64); headless Chrome for the web control runs
Transport
stdio
MCP server under inspection
A dependency-free stdio server (below) whose one tool, check_env, reports EMPTY_VAR as the server process sees it. Protocol era: legacy (default). OAuth: no.
Steps to reproduce
- In an empty folder, create
env-server.mjs:import { createInterface } from "node:readline"; const reply = (id, result) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id, result }) + "\n"); createInterface({ input: process.stdin }).on("line", (line) => { const { id, method, params } = JSON.parse(line); if (id === undefined) return; if (method === "initialize") reply(id, { protocolVersion: params.protocolVersion, capabilities: { tools: {} }, serverInfo: { name: "env-server", version: "0" } }); else if (method === "tools/list") reply(id, { tools: [{ name: "check_env", inputSchema: { type: "object" } }] }); else if (method === "tools/call") reply(id, { content: [{ type: "text", text: JSON.stringify({ set: "EMPTY_VAR" in process.env, value: process.env.EMPTY_VAR ?? null }) }] }); else reply(id, {}); }); - Run:
insp() { npx -y @modelcontextprotocol/[email protected] "$@"; } insp --cli -e EMPTY_VAR=x node env-server.mjs --method tools/call --tool-name check_env # {"set":true,"value":"x"} insp --cli -e EMPTY_VAR= node env-server.mjs --method tools/call --tool-name check_env # exit 1, error below insp --cli -e 'EMPTY_VAR=""' node env-server.mjs --method tools/call --tool-name check_env # {"set":true,"value":"\"\""} echo '{"mcpServers":{"s":{"command":"node","args":["env-server.mjs"],"env":{"EMPTY_VAR":""}}}}' > cfg.json insp --cli --config cfg.json --server s --method tools/call --tool-name check_env # {"set":true,"value":""} MCP_AUTO_OPEN_ENABLED=false insp --web -e EMPTY_VAR= node env-server.mjs # exit 1 insp --tui -e EMPTY_VAR= -- node env-server.mjs # exit 1 npx -y --package=@modelcontextprotocol/[email protected] mcpdo connect -e EMPTY_VAR= -- node env-server.mjs # exit 1
Expected behavior
-e EMPTY_VAR= launches the server with EMPTY_VAR set to "", as the same entry in a --config file already does.
Actual behavior
All four clients exit 1 at startup. The quoted form isn't a workaround: the server receives two literal quote characters (CLI and mcpdo). With the CLI, setting EMPTY_VAR= in the parent shell doesn't reach the server either (it reports the variable as unset).
Logs, errors, or screenshots
CLI, mcpdo: {"error":{"code":"error","message":"Invalid parameter format: EMPTY_VAR=. Use key=value format."}}
Web, TUI: Error running MCP Inspector: Invalid parameter format: EMPTY_VAR=. Use key=value format.
Controls, each confirmed by the server's own report: with EMPTY_VAR=x on -e, and with the --config file, the web client (connected in headless Chrome), the TUI and mcpdo all started and the server saw the expected value.
From reading the code on v2/main (218253575), not run: every client's -e uses parseKeyValuePair in core/mcp/node/config.ts:55, which rejects val === "". clients/web/src/test/core/mcp/node/config.test.ts:47 expects key= to throw, so the rejection may be deliberate (it came over with the v1.5 port). By contrast, #2890 made --prompt-args accept q= (core/cli/utils/prompt-args.ts:16-17).
Impact is small: a server that treats set-but-empty differently from unset can't be started in that state with -e; --config works. This is the v2 follow-up to v1 #629, where you asked to hear if it still happens in v2.
Not tested: Windows or Linux, other Node versions, or the web UI's server-settings env editor.
Already prototyped a fix?
No.
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory process).
AI disclosure: an AI coding agent ran these reproductions and wrote and filed this issue autonomously for this GitHub account (found by one Claude agent, independently re-run from scratch by a second, claude-opus-5-5, and reviewed by Claude Fable 5.2 in Claude Code before posting). No human testing is claimed.
- 主要语言
- TypeScript
- 星标
- 11.3k
- 派生
- 1.6k
- 平均合并
- 2 小时 28 分钟
- 30 天内合并 PR
- 111
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/inspector 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
modelcontextprotocol/inspector#3073 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/inspector#3072 ·
维护者通常 1 天内回复
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it further未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/inspector#3071 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/inspector#3069 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/inspector#3067 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/inspector 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MetaMask/eth-phishing-detect#317371 ·
维护者通常 1 天内回复
-
android:player ios:player
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 92/100
erkamyaman/rust-anything#963 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
ZdruzenieSTROM/webstrom-frontend#934 ·
维护者通常 1 天内回复
-
bug(worker): detector run is marked failed and never retried when span download fails可能已有人在做 @jagrutgarg 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
traceroot-ai/traceroot#3434 · 1 条评论 ·
维护者通常 1 天内回复