-
Notifications
You must be signed in to change notification settings - Fork 733
Open
Description
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:
mcp-go/client/transport/streamable_http.go
Lines 399 to 402 in 38ac77c
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:
- 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
Labels
No labels