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

Offen Anfängerfreundlich
#3,072 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
cli

Rechercherichtung

Der fehlerhafte Wert wird in clients/cli/src/cli.ts etwa in Zeile 1584 geparst, wo Number(v) ohne Prüfung auf leere Eingaben ausgeführt wird. Vergleiche ihn mit den --load-*-Parsern in core/cli/handlers/load-parsers.ts und load-thresholds.ts, die einen leeren oder nur aus Leerzeichen bestehenden Wert bereits als ungültig behandeln. Führe den Repro mit --connect-timeout "" aus und bestätige, dass er nun mit einem Usage-Fehler endet, statt hängen zu bleiben. Dieselbe Prüfung sollte auch --connect-timeout von mcpdo abdecken.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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).
Vorherrschende Sprache
TypeScript
Sterne
11.3k
Forks
1.6k
Ø Merge
2 Std. 28 Min.
Gemergte PRs (30 T.)
111

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/inspector

Alle Issues in modelcontextprotocol/inspector

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.