CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it further

Đang mở Phù hợp với người mới
#3,071 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nodejs, typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ bộ phân tích --connect-timeout trong clients/cli/src/cli.ts quanh dòng 1581-1589, bộ phân tích này chỉ kiểm tra giá trị có hữu hạn và không âm. Cũng kiểm tra cách connectionTimeout từ catalog và giá trị --wait-for-auth được truyền vào setTimeout. Hoàn thành khi các giá trị trên 2147483647 ms được giới hạn lại hoặc bị từ chối với lỗi sử dụng, và không có TimeoutOverflowWarning nào xuất hiện trong quá trình polling.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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/list --connect-timeout 2147483648

Also:

  • "connectionTimeout": 2147483648 in a --config / catalog entry
  • mcpdo connect @h --connect-timeout 2147483648 -- node server.mjs
  • --wait-for-auth 3000000 (seconds, > 2^31 ms)
Expected behavior

Clamp to 2^31-1 ms (≈24.8 days, effectively unbounded) or reject values above it as a usage error. A huge value means "very long"; 0 already means "no timeout".

Actual behavior

Exits 4 after ~0.4 s against a healthy server:

(node) TimeoutOverflowWarning: 2147483648 does not fit into a 32-bit signed integer.
Timeout duration was set to 1.
{"error":{"code":"unreachable","message":"Connection timed out after 2147483648 ms. To accommodate a slower server, pass a larger --connect-timeout <ms>, or set connectionTimeout on the server's catalog or config entry."}}

The remedy makes it worse. 2147483647 works. The config connectionTimeout and mcpdo connect fail the same way (mcpdo after ~2 s). --wait-for-auth 3000000 does not fail but prints a TimeoutOverflowWarning on every poll (40 in 20 s), flooding the stderr that carries the one-line envelope.

Logs, errors, or screenshots

Cause: the --connect-timeout parser (clients/cli/src/cli.ts:1581–1589) only checks Number.isFinite(n) && n >= 0; the catalog connectionTimeout is not range-checked either. Node's setTimeout treats anything above 2^31-1 as 1.

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).
Ngôn ngữ chính
TypeScript
Star
11.3k
Fork
1.6k
Merge trung bình
2 giờ 28 phút
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/inspector

Tất cả issue của modelcontextprotocol/inspector

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.