CLI and mcpdo silently round integers beyond 2^53 in --tool-arg, --tool-args-json, --metadata, --tool-metadata
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- cli
調査の方向性
Start with parseKeyValuePair in clients/cli/src/cli.ts, where the existing 1e400 rejection shows the expected pattern, then trace the --tool-args-json path and mcpdo's parseKeyValue, parseJsonObject and positional parser, all of which call JSON.parse unchecked. Reproduce by sending an echo_raw call with id=12345678901234567890 and inspecting the wire payload. Done means unsafe integers are rejected with a message naming the key, not the value, and a test covers each flag path.
索引モデルが issue の本文から書いたものです。
説明
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 id=12345678901234567890 --metadata trace=12345678901234567890
mcp-inspector --cli node probe-echo.mjs --method tools/call --tool-name echo_raw \
--tool-args-json '{"id":12345678901234567890}'
mcpdo, same commit: mcpdo tools/call echo_raw --tool-arg id=12345678901234567890, --tool-args-json '{"id":12345678901234567890}' and positional id:=12345678901234567890.
Expected behavior
The value reaches the server as typed, or the CLI refuses it. The CLI already takes that position for 1e400 ("Rejecting is better than accepting the flag and silently transmitting a different value" in parseKeyValuePair), and the README says --tool-args-json is "Passed verbatim".
Actual behavior
Exit 0 in every case. The value on the wire is rounded:
{"method":"tools/call","params":{"name":"echo_raw","arguments":{"id":12345678901234567000}},"jsonrpc":"2.0","id":2}
_meta.trace is rounded the same way. This silently corrupts real IDs (Snowflake/Discord/Twitter IDs, int64 keys, nanosecond timestamps): the call succeeds against the wrong record.
Logs, errors, or screenshots
Cause: JSON.parse turns every number into a float64. #2859 fixed this class for --prompt-args (now verbatim strings); the JSON-typed flags still go through JSON.parse unchecked (parseKeyValuePair in clients/cli/src/cli.ts, the --tool-args-json path, mcpdo's parseKeyValue / parseJsonObject / positional parser).
Suggested fix: Node 22 passes the source text to the JSON.parse reviver ((key, value, { source }) => …), so a number token whose digits don't round-trip can be detected. Reject it with a message that names the key (not the value), consistent with 1e400.
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
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mckinsey/agents-at-scale-ark#4091 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
factory:subtask
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
NUS-Project-SaBai/project-sabai#386 ·
メンテナーはふだん 3 日以内に返信
-
android needs clarification
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
super-productivity/super-productivity#12105 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信