Skip to content

Is it possible to support consuming an event stream that includes comments? #443

@rwang-parasoft

Description

@rwang-parasoft

Expected Behavior

Handle comments in event stream. Do nothing when there is a comment line.

Current Behavior

Throw McpError in ResponseSubscribers class

Log:

McpError: Invalid SSE response. Status code: 200 Line: : keep-alive

Context

I have an MCP server that periodically sends heartbeat packets to the MCP client (using comments way, refer to event_stream_format). In theory, the client should ignore these comments. However, starting from version 0.11.0 and in the main branch, an else branch was added in the ResponseSubscribers class, which causes the client to throw an exception upon receiving comments.

Can we add an else-if branch to skip processing when line.startsWith(":") to support consuming an event stream that includes comments?

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