modelcontextprotocol / modelcontextprotocol/inspector
CLI's long-lived stream path can crash with an uncaught EPIPE
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.9k
- Forks
- 1.5k
- Avg merge
- 6h 17m
- Merged PRs (30d)
- 151
Description
Which version line?
v2 — current (@modelcontextprotocol/inspector@latest)
Which client?
CLI
Inspector version
2.7.0 (git tag) — static code-review finding, not run locally
Node version
N/A — static code review, no live run performed
Operating system (and browser, for the web client)
N/A — static code review
Transport
stdio
MCP server under inspection
N/A — this is a static code-review finding against the 2.7.0 tag source (clients/cli/src/handlers/consume-outcome.ts), not a live reproduction against a running MCP server.
Steps to reproduce
Found via static review of the 2.7.0 tag source, not a live run.
clients/cli/src/handlers/consume-outcome.tscarries its ownTODO(#1432)acknowledging the stream path doesn't yet handle EPIPE/stdout errors.- A very ordinary shell habit — piping CLI output to
head,grep, orless— closes stdout early. - Against a subscribe/stream method, this can throw an uncaught EPIPE and crash the CLI process instead of exiting cleanly.
I have not run mcp-inspector --cli <server> --method <a subscribe/stream method> | head -n 5 live to observe the crash; flagging based on the code's own acknowledged TODO. I reviewed issue #1432 and this looks like a narrower, still-open gap within that broader CLI-v2 epic, not a duplicate of it.
Expected behavior
Piping CLI output into a program that exits early (head, grep, less) against a subscribe/stream method causes the CLI to exit cleanly — the same common pattern that's already handled for non-streaming output.
Actual behavior
The long-lived stream consumer path (clients/cli/src/handlers/consume-outcome.ts) does not yet handle EPIPE/stdout errors, per its own TODO(#1432), so it can throw an uncaught EPIPE and crash instead of exiting gracefully.
Suggested fix: handle EPIPE on stdout (a common pattern: swallow it and exit 0) in the long-lived stream consumer path referenced by TODO(#1432).
Logs, errors, or screenshots
No response
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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in clients/cli/src/handlers/consume-outcome.ts and read the TODO(#1432) alongside the existing non-streaming output handling. Exercise the long-lived stream path with stdout closed early, then verify that an EPIPE exits cleanly rather than becoming uncaught; add or update focused CLI coverage if the surrounding test entry point identifies one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100