Log to stderr so stdio MCP transport stays clean - #21
Open
Bornoz wants to merge 1 commit into
Open
Conversation
The server connects over StdioServerTransport, where stdout is reserved for MCP protocol messages. tools.ts and sidebar.ts wrote operational logs to stdout with console.log, which interleaves non-protocol text into the same stream the client parses as JSON-RPC and can break initialization or tool calls. Move those logs to console.error, which writes to stderr and leaves stdout for the protocol. No log information is lost; it just goes to the stream meant for it. Closes base#15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The server connects over
StdioServerTransport, wherestdoutis reserved for MCP protocol messages.tools.ts(5 calls) andsidebar.ts(2 calls) wrote operational logs to stdout withconsole.log, interleaving non-protocol text into the JSON-RPC stream the client parses — which can break initialization or tool calls.Moved those to
console.error, which writes to stderr and leaves stdout for the protocol. No log information is lost.npx tscstill compiles cleanly, and there are noconsole.logcalls left in the source.Closes #15