Skip to content

bug: Streamable HTTP transport incorrectly logging error #507

@ethanoroshiba

Description

@ethanoroshiba

Description

When connecting an MCP client to server via Streamable HTTP under the 2025-06-18 spec, the transport logs an error if the most recent message cannot be unmarshaled:

if err := json.Unmarshal([]byte(data), &message); err != nil {
c.logger.Errorf("failed to unmarshal message: %v", err)
return
}

This behavior is incorrect, as the next response is not required to be a JSONRPC payload per the spec:

  1. If the server initiates an SSE stream:
  • The SSE stream SHOULD eventually include JSON-RPC response for the JSON-RPC request sent in the POST body.
  • The server MAY send JSON-RPC requests and notifications before sending the JSON-RPC response. These messages SHOULD relate to the originating client request.

Such is the case when connecting to the DeepWiki MCP server, for example, which sends pings on the SSE stream, producing the error log below. This may be helpful information to log, but it shouldn't be logged as an error, and more detailed information should be logged alongside it.

Logs or Error Messages

2025/07/24 14:31:15 ERROR: failed to unmarshal message: invalid character 'p' looking for beginning of value

Environment

  • Go version (see go.mod): 1.23.10 (project requirement), actual installed: go1.24.4
  • mcp-go version (see go.mod): 0.33.0
  • Other relevant environment details:
    • OS: macOS (darwin 24.5.0)
    • Architecture: arm64 (Apple Silicon)

Possible Solution

Make debug level log, include more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions