CLI: warn when a misspelled Inspector flag after a stdio target is forwarded to the server (--tool-agr → "did you mean --tool-arg?")

Aperta
#3,074 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cli, node.js, typescript
Ambito
cli

Direzione di ricerca

The payload names no source file, so start with the CLI argument parsing that forwards unknown -- tokens to the server argv, and with docs/cli-smoke-testing.md for the CI context. Add a check that compares each forwarded token against the Inspector's own option names by edit distance 1-2, and print one stderr warning. Done when the example command still exits 0 and prints the "did you mean --tool-arg?" line, and a test covers both a near-miss and an unrelated forwarded flag.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement v2
Which client?

CLI

The problem

A one-letter typo in an Inspector flag after a stdio target is silently forwarded to the server's argv, and the run still passes:

mcp-inspector --cli node server.mjs --method tools/call --tool-name echo --tool-agr a=1

Exit 0; the tool is called with {} and --tool-agr a=1 is appended to the server's arguments. Forwarding unknown flags is documented and intentional, but in CI (docs/cli-smoke-testing.md) this gives a green job that tested nothing. A tool with only optional arguments never reveals the mistake. Verified on 2.17.0 (main @ 2069a1a), Linux, Node v22.23.5.

Solution you have in mind (optional)

Keep forwarding as is, but when a forwarded token starts with -- and is within edit distance 1–2 of an Inspector option, print one stderr line:

warning: --tool-agr was passed to the server; did you mean --tool-arg?

Optionally add --strict-flags (or an env var) to make it a usage error for CI. The same check would help mcpdo's positional forwarding.

Alternatives or workarounds you have tried

Placing -- between the target and the Inspector options makes ordering explicit, but it doesn't catch typos: a misspelled option after -- is still unknown to the Inspector.

Already built it locally?

No response

Before you submit
  • I searched existing issues and this is not a duplicate.
  • This is a request for the Inspector itself, not for the MCP specification or an SDK.
Lingua principale
TypeScript
Stelle
11.3k
Fork
1.6k
Merge medio
2h 28m
PR unite (30g)
111

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/inspector

Tutte le issue di modelcontextprotocol/inspector

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.