Skip to content

fix: only show server stderr in debug mode#247

Open
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/debug-gate-server-stderr
Open

fix: only show server stderr in debug mode#247
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/debug-gate-server-stderr

Conversation

@haosenwang1018
Copy link
Copy Markdown

Summary

  • stop forwarding MCP server stderr during successful stdio sessions by default
  • add a --debug CLI flag that enables the existing MCP_DEBUG behavior
  • keep captured stderr attached to connection errors for debugging failures

Problem

Issue #17 notes that mcp-cli always prints server stderr, which adds noisy output for agentic and scripted usage even when the command itself succeeds.

Fix

The stdio client now captures stderr for diagnostics but only forwards it live when debug mode is enabled. This preserves stderr context on connection failures while making normal command output quiet by default. The CLI also gains a --debug flag that sets MCP_DEBUG=1 for one-off debugging runs.

Fixes #17

Validation

  • git diff --check
  • npx tsc --noEmit
  • bun test tests/config.test.ts
  • bun test tests/output.test.ts
  • npx @biomejs/biome check src/client.ts src/index.ts

Signed-off-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

only show STDERR with -v or -debug

1 participant