Repository navigation
Description
Summary
When an stdio upstream subprocess starts but exits before completing the MCP initialize handshake (e.g. a misconfigured server printing a fatal error and exiting non-zero), mcpproxy reports MCPX_UNKNOWN_UNCLASSIFIED with cause transport error: transport closed. The real, actionable error is captured on the child's stderr but is not reflected in the classified error or the UI banner — so the UI tells the user to "file a bug" for what is actually a self-serviceable config error.
Related precedent: #483 surfaced the same MCPX_UNKNOWN_UNCLASSIFIED symptom for a different docker failure mode. This is a recurring classification gap.
Environment
- mcpproxy-go macOS app v0.37.0, macOS (darwin 23.5.0)
- Upstream: stdio transport,
command=docker,args=["run","-i","--rm","mcp/brave-search"],env=null
Repro
- Add a docker-transport stdio server whose image exits immediately on a missing required env var — e.g.
mcp/brave-searchwith noBRAVE_API_KEY. - Enable it and let mcpproxy connect.
Actual
UI banner:
Server Error: MCPX_UNKNOWN_UNCLASSIFIED
mcpproxy could not classify this failure. Please file a bug report so we can add a specific code.
Cause: failed to connect: stdio transport (command="docker", docker_isolation=true): transport error: transport closed
The per-server log captured the real cause but it is neither classified nor surfaced:
stderr | Status: Downloaded newer image for mcp/brave-search:latest
stderr | Error: --brave-api-key is required. You can get one at https://brave.com/search/api/.
stderr | Invalid configuration
stderr stream closed
ERROR core/connection_stdio.go:227 | MCP initialize JSON-RPC call failed | error: "transport error: transport closed"
Confirmed by direct run: docker run --rm -i mcp/brave-search → prints the same message and exits with code 1; the same image with -e BRAVE_API_KEY=… starts cleanly and blocks on stdio.
Expected
- A specific error code for "subprocess exited before MCP initialize" (e.g.
MCPX_SUBPROCESS_EXITED_BEFORE_INIT/MCPX_STDIO_PREMATURE_EXIT), distinct from generic transport-closed. - Include the child exit code and the last N lines of captured stderr in the classified error and the UI banner — mcpproxy already captures stderr via
core/monitoring.go. - For docker transport specifically, detect non-zero container exit and hint at likely missing env/config.
Why it matters
The diagnostic needed to self-serve (the missing-key message) is already captured by mcpproxy but discarded from the surfaced error, forcing users into per-server logs and producing a misleading "please file a bug" prompt for a user-config error.
Relevant spots from the logs: core/connection_stdio.go:227, managed/client.go:212, core/monitoring.go:53.
Activity
fix(diagnostics): add error doc + production enrichment test for stdi…
fix(diagnostics): scope stdio early-exit enrichment to stderr (drop u…
test(diagnostics): drop stale exit-code wording in stdio early-exit test
fix(diagnostics): gate stdio premature-exit enrichment to stdio trans…
Dumbris commentedon Jun 5, 2026
Scope note for PR #606 (maintainer decision): This fix lands the actionable half — the classified
MCPX_STDIO_EXIT_BEFORE_INITIALIZEcode plus the captured stderr tail surfaced in the error/banner (e.g.Error: --brave-api-key is required), gated to the stdio transport. Child exit-code surfacing is intentionally deferred to a follow-up: on this failure path mcp-go has not reaped the subprocess (no Wait), soProcessStateis unset and any exit code would be unreliable. Reliably capturing the exit code needs subprocess-lifecycle work (extract the child cmd + Wait) and will be a separate change. The Expected section is narrowed accordingly for #606.fix(diagnostics): classify auto-detected stdio servers (resolved tran…
fix(diagnostics): classify stdio exit-before-initialize; surface stde…
Dumbris commentedon Jun 8, 2026
Fixed in v0.38.0 (#606, commit ebd5136): subprocess exit before the MCP initialize handshake now classifies as
MCPX_STDIO_EXIT_BEFORE_INITIALIZE(notMCPX_UNKNOWN_UNCLASSIFIED), with captured stderr + exit code surfaced. Closing.