Skip to content

Log to stderr so stdio MCP transport stays clean - #21

Open
Bornoz wants to merge 1 commit into
base:masterfrom
Bornoz:fix/stdio-logs-to-stderr
Open

Log to stderr so stdio MCP transport stays clean#21
Bornoz wants to merge 1 commit into
base:masterfrom
Bornoz:fix/stdio-logs-to-stderr

Conversation

@Bornoz

@Bornoz Bornoz commented Aug 31, 2026

Copy link
Copy Markdown

The server connects over StdioServerTransport, where stdout is reserved for MCP protocol messages. tools.ts (5 calls) and sidebar.ts (2 calls) wrote operational logs to stdout with console.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 tsc still compiles cleanly, and there are no console.log calls left in the source.

Closes #15

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
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.

bug: stdout logging can corrupt MCP stdio transport

1 participant