Skip to content

fix(mcp): route assemble-npm output to stderr to keep stdout protocol-safe (#225)#257

Closed
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5:fix/issue-225-package-stdout
Closed

fix(mcp): route assemble-npm output to stderr to keep stdout protocol-safe (#225)#257
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5:fix/issue-225-package-stdout

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented Apr 30, 2026

Summary

Fixes #225. The tnmsm binary's primary mode is the MCP stdio server, where stdout is reserved for JSON-RPC framing. The hidden assemble-npm build subcommand was using println! to log copied paths, which writes to stdout — protocol-unsafe if the binary is ever invoked from a wrapped/redirected MCP context.

Change

mcp/src/commands/package.rs:45 — switch println!(\"Hydrated …\") to eprintln!. The error path on :50 was already eprintln. CLI users running tnmsm assemble-npm interactively still see the messages; the stream just changes from fd 1 → fd 2.

Test plan

  • cargo build --manifest-path mcp/Cargo.toml — clean
  • No behavior change for users running the subcommand interactively (terminals show stderr)
  • Stdout now contains zero non-JSON-RPC bytes from this subcommand

TrueNine and others added 2 commits April 25, 2026 10:10
Fix two CI failures from previous merge
@SAY-5 SAY-5 requested a review from TrueNine as a code owner April 30, 2026 03:35
@TrueNine TrueNine changed the base branch from main to dev April 30, 2026 08:08
@TrueNine
Copy link
Copy Markdown
Owner

Merged into dev via cherry-pick. The PR base was changed from main to dev, which caused conflicts because dev had diverged significantly. All commits have been cherry-picked onto dev and pushed. Thanks for the contributions!

@TrueNine TrueNine closed this Apr 30, 2026
@TrueNine
Copy link
Copy Markdown
Owner

Thank you for the contribution! All commits have been cherry-picked and merged into the dev branch. 🙏

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.

[MCP] println!/eprintln! 可能破坏 MCP JSON-RPC 协议

2 participants