Skip to content

Inconsistent newlines in mcp logging #540

@chuckha

Description

@chuckha

What did you do?
I enabled a LoggingMessageHandler when connecting to my MCP servers

What did you see?
I saw the log lines of read/write to MCP servers working correctly, but write error and read error were missing new lines.

write error: sending "initialize": Post "http://localhost:9000": dial tcp 127.0.0.1:9000: connect: connection refusedread error: EOFMy custom log line here
write: {"jsonrpc":"2.0","..."}
read: {"jsonrpc":"2.0","..."}

What did you expect to see?

write error: sending "initialize": Post "http://localhost:9000": dial tcp 127.0.0.1:9000: connect: connection refused
read error: EOF
My custom log line here
write: {"jsonrpc":"2.0","..."}
read: {"jsonrpc":"2.0","..."}

What version of the Go MCP SDK are you using?

	github.com/modelcontextprotocol/go-sdk v0.8.0

What version of Go are you using (go version)?

% go version
go version go1.25.1 darwin/arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions