CLI/mcpdo reject empty values for --tool-arg k=, -e VAR= and --header "X:" (--prompt-args q= and config env accept them)

オープン 初心者向け
#3,069 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cli, typescript
領域
cli

調査の方向性

core/mcp/node/config.ts の parseKeyValuePair(55行目付近)から調査を始め、次に clients/cli/src/cli.ts にある CLI 側の複製と、clients/mcpdo/src/connection/mcp.ts の parseKeyValue(2033行目付近)、さらに parseHeaderPair を確認してください。issue に書かれた4つのコマンドで再現できます。プロンプト引数の経路はすでに空の値を受け付けており、想定される動作を示しています。k= と X-Empty: が空文字列として解析され、空のキーは引き続き拒否され、既存の CLI テストがすべて通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug
Which version line?

v2 — current (@modelcontextprotocol/inspector@latest)

Which client?

CLI

Inspector version

2.17.0 (main @ 2069a1a, built from source)

Node version

v22.23.5

Operating system (and browser, for the web client)

Linux

Transport

stdio

MCP server under inspection

Minimal echo server (probe-echo.mjs), SDK 2.4.0:

import * as z from "zod/v4";
import { McpServer } from "@modelcontextprotocol/server";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
const server = new McpServer({ name: "probe-echo", version: "1.0.0" });
server.registerTool("echo_raw", { description: "Echo raw arguments", inputSchema: z.object({}).passthrough() },
  async (args) => ({ content: [{ type: "text", text: JSON.stringify(args) }] }));
server.registerPrompt("echo_prompt", { description: "Echo", argsSchema: { a: z.string().optional(), b: z.string().optional() } },
  async (args) => ({ messages: [{ role: "user", content: { type: "text", text: JSON.stringify(args) } }] }));
await server.connect(new StdioServerTransport());
Steps to reproduce
mcp-inspector --cli node probe-echo.mjs --method tools/call --tool-name echo_raw --tool-arg s=
mcp-inspector --cli node server.mjs -e DEBUG= --method tools/list
mcp-inspector --cli --transport http --server-url http://127.0.0.1:8799/mcp --header "X-Empty:" --method tools/list
mcpdo tools/call echo_raw --tool-arg s=

These accept an empty value:

mcp-inspector --cli node probe-echo.mjs --method prompts/get --prompt-name echo_prompt --prompt-args b=   # sends {"b":""}

…and a --config entry with "env": {"EMPTY": ""} reaches the server as EMPTY="".

Expected behavior

k= means the empty string, as it already does for --prompt-args (README: "q= sends \"\""). An empty env var is legitimate (blank an inherited NODE_OPTIONS/DEBUG, satisfy a presence check), and the config file can already express it. An empty header field value is valid HTTP (RFC 9110 §5.5).

Actual behavior

Each is rejected as a syntax error, exit 1:

{"error":{"code":"error","message":"Invalid parameter format: s=. Use key=value format."}}
{"error":{"code":"error","message":"Invalid parameter format: DEBUG=. Use key=value format."}}
{"error":{"code":"error","message":"Invalid header format: X-Empty:. Use \"HeaderName: Value\" format."}}

--tool-arg has a workaround (s='""'); -e has none on the command line, so a server setup that works from --config cannot be expressed ad hoc.

Logs, errors, or screenshots

Cause: val === "" is rejected in parseKeyValuePair (core/mcp/node/config.ts:55, used for -e), in the CLI's own parseKeyValuePair (clients/cli/src/cli.ts), and in mcpdo's parseKeyValue (clients/mcpdo/src/connection/mcp.ts:2033); parseHeaderPair rejects an empty value too. Only the key/name needs to be non-empty.

Already prototyped a fix?

No response

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).
主要言語
TypeScript
スター
11.3k
フォーク
1.6k
平均マージ
2時間 28分
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/inspector のほかの issue

modelcontextprotocol/inspector の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。