CLI/mcpdo: --connect-timeout "" (e.g. an unset shell variable) silently disables the timeout and the run never ends

Đang mở Phù hợp với người mới
#3,072 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
82/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ệ
typescript
Lĩnh vực
cli

Hướng nghiên cứu

Giá trị sai được phân tích tại clients/cli/src/cli.ts quanh dòng 1584, nơi Number(v) chạy mà không kiểm tra giá trị rỗng. Hãy so sánh với các bộ phân tích --load-* trong core/cli/handlers/load-parsers.ts và load-thresholds.ts, vốn đã coi giá trị rỗng hoặc chỉ có khoảng trắng là không hợp lệ. Chạy repro với --connect-timeout "" và xác nhận rằng giờ nó thoát với lỗi sử dụng thay vì bị treo. Cùng một lớp kiểm tra cũng nên áp dụng cho --connect-timeout của mcpdo.

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
echo 'setInterval(()=>{},1000)' > hang.mjs     # stdio "server" that never answers
mcp-inspector --cli node hang.mjs --method tools/list --connect-timeout "$CONNECT_TIMEOUT"   # variable unset
mcpdo connect @h --connect-timeout "" -- node hang.mjs
Expected behavior

A blank value is a usage error. Number("") is 0, and 0 is documented as "no timeout", so the most common CI mistake turns off the safeguard docs/cli-smoke-testing.md says to always set ("Always bound the connect").

Actual behavior

Never exits (killed by timeout after 25 s, exit 124). Without the flag the same command exits 4 after the 15 s default. mcpdo hangs the same way (killed after 30 s).

Logs, errors, or screenshots

Cause: clients/cli/src/cli.ts:1584 does const n = Number(v) with no blank check. The --load-* parsers already guard this exact case: core/cli/handlers/load-parsers.ts:29 and load-thresholds.ts:57 use value.trim() === "" ? NaN : Number(value). The same one-liner fixes both clients.

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.