CLI: method-specific flags given to another method are silently ignored (--cursor / --tool-arg on tools/list, …)

Aperta Adatta ai principianti
#3,073 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript
Ambito
cli

Direzione di ricerca

I flag vengono analizzati nella gestione degli argomenti della CLI per la modalità --cli dell'inspector, dove --load-scenario e --advertise-apps already rifiutano i flag incompatibili con un errore di utilizzo. Parti da lì e cerca la validazione esistente tra metodo e flag. Aggiungi un controllo simile così che --cursor, --tool-arg e gli altri flag specifici dei metodi falliscano con un messaggio che indichi i metodi a cui si applicano. È completato quando tools/list --cursor abc termina con un codice di uscita diverso da zero e con quel messaggio, e le combinazioni valide continuano a essere eseguite.

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

Descrizione

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 --cursor abc     # exit 0, full list
mcp-inspector --cli node probe-echo.mjs --method tools/list --tool-arg a=1  # exit 0
Expected behavior

A usage error naming the methods the flag applies to. The CLI already follows this rule elsewhere: --advertise-apps and --strict are rejected where they would be ignored (the code comment: an invocation "cannot accept the flag and ignore it"), and --load-scenario rejects --tool-name / --tool-arg because they "would be silently overridden".

Actual behavior

Exit 0; the flag has no effect. This matters most for --cursor: tools/list, resources/list and prompts/list take a cursor in MCP, so a script paging with --cursor appears to work but gets the same page every time.

Logs, errors, or screenshots

Suggested fix: a table from each method-specific flag (--tool-name, --tool-arg, --tool-args-json, --tool-metadata, --prompt-name, --prompt-args, --uri, --cursor, --event-name, --event-arg, --log-level) to the methods that use it, rejecting any other combination. Alternatively, support --cursor on the */list methods.

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).
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.