CLI/mcpdo: server JSON-RPC errors and stdio servers that fail to start still exit 1 (usage); bad URL scheme exits 4 (retryable) — follow-up to #2842
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 62/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, typescript
Direção de pesquisa
The misclassified cases all fall through to the catch-all at the end of classifyError in core/cli/error-handler.ts (around line 375). Read how the OAuth and fetch-guard branches added in #2842 and #2940 are handled, then reproduce the listed commands against a small echo server and a process.exit(3) script. Done when a JSON-RPC error, a stdio server that dies during startup, and an ftp:// URL each get their own code and exit status, and the URL is rejected as a usage error before any fetch.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
All against probe-echo.mjs (tools + one prompt, no resources):
mcp-inspector --cli node probe-echo.mjs --method prompts/get --prompt-name nope
mcp-inspector --cli node probe-echo.mjs --method resources/read --uri x://nope
mcp-inspector --cli no-such-binary --method tools/list
mcp-inspector --cli node exit3.mjs --method tools/list # exit3.mjs: process.exit(3)
mcp-inspector --cli --server-url ftp://x/mcp --method tools/list
mcpdo prompts/get nope
Expected behavior
As #2842 put it, exit 1 / "error" should mean "the command line is wrong", so a CI smoke job (docs/cli-smoke-testing.md) can tell it apart from "the server answered with an error" and "the server never came up". Suggested:
- JSON-RPC error response → a distinct code (e.g.
server_error) carrying the JSON-RPCcode/data, with its own exit code or5(already "the server said no" for tools). - ENOENT / child exited before initialize → e.g.
server_exited(orunreachable, 4) with the child's exit code/signal and the tail of its stderr incause. - Unsupported URL scheme → usage error up front, like
--transport websocketalready is.
mcpdo already labels its usage errors "code":"usage"; the CLI using the same would also help.
Actual behavior
| Scenario | Envelope | Exit |
|---|---|---|
unknown prompt (server -32602) |
{"code":"error","message":"Prompt nope not found"} |
1 |
| method the server lacks | {"code":"error","message":"Method not found"} |
1 |
| stdio command not found | {"code":"error","message":"spawn no-such-binary ENOENT"} |
1 |
| stdio server exits during startup | {"code":"error","message":"Connection closed"} |
1 |
ftp:// server URL |
{"code":"unreachable","message":"fetch failed","cause":"unknown scheme"} |
4 |
mcpdo prompts/get nope |
{"code":"error","message":"Prompt nope not found"} |
1 |
Compare --tool-name nope → tool_not_found, exit 5. The README says 4 means retry via a proxy, so a CI wrapper that retries on 4 retries the ftp:// case forever.
Logs, errors, or screenshots
Cause: the catch-all at the end of classifyError (core/cli/error-handler.ts:375). #2842 / #2940 moved OAuth and fetch-guard failures out of it; these cases are still in it.
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).
- Linguagem predominante
- TypeScript
- Estrelas
- 11.3k
- Forks
- 1.6k
- Merge médio
- 2h 28min
- PRs com merge (30d)
- 111
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/inspector
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
modelcontextprotocol/inspector#3073 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
modelcontextprotocol/inspector#3072 ·
Mantenedores costumam responder em até 1 dia
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it furtherAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
modelcontextprotocol/inspector#3071 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/inspector#3069 ·
Mantenedores costumam responder em até 1 dia
-
CLI --tool-args-json silently sends 1e400 as null (round-trip guard missing; mcpdo rejects it)Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/inspector#3067 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/inspector
Issues semelhantes
-
Flaky test: selecting a portion just after inserting it can also match its Change and Delete buttonsAbertaready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
linagora/dcs-onlyoffice#172 ·
-
bug follow-up
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
nightly-tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
BlackBeltTechnology/pi-agent-dashboard#1226 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
danielmiessler/LifeOS#3028 ·
Mantenedores costumam responder em até 5 dias
-
execute_sql cannot create a SQLite trigger or a PostgreSQL BEGIN ATOMIC function: the statement is cut at the semicolons inside its bodyTalvez já em andamento @goranai assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia