Skip to content

Do not raise discard McpError when got unrecognized SSE event type #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ziscloud
Copy link

@ziscloud ziscloud commented Jul 24, 2025

Do not raise discard McpError when got unrecognized SSE event type, otherwise it will fail the MCP client function

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

…therwise it will fail the MCP client function
@tzolov
Copy link
Contributor

tzolov commented Jul 24, 2025

likely related to the #413

@tzolov
Copy link
Contributor

tzolov commented Jul 24, 2025

@ziscloud it is not safe to discard request response messages. This could lead to hanging requests.
As with #413 we can safely discard responses for notifications (that are not suppose to have responses anyway).
But in the case of SSE we don't have a reliable mechanism to distinct if this response originated from a request or is a bogus notification response.

Can you please elaborate how to reproduce this issue?

@tzolov
Copy link
Contributor

tzolov commented Jul 24, 2025

@ziscloud ignore my previous comment. I've misunderstood the context.

The #423 addresses this issue for all client transports.

tzolov added a commit that referenced this pull request Jul 25, 2025
…nts (#423)

- Replace McpError exceptions with debug/warning logs for unrecognized SSE event types
- Continue processing instead of failing when encountering unknown SSE events
- Update transport implementations:
  - WebClientStreamableHttpTransport: return empty tuple instead of throwing
  - WebFluxSseClientTransport: complete stream instead of erroring
  - HttpClientSseClientTransport: call sink.success() instead of sink.error()
  - HttpClientStreamableHttpTransport: return empty Flux for unknown events

This improves client resilience when servers send non-standard or future SSE event types.

Resolves #272 , #223 , #93, #421

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov
Copy link
Contributor

tzolov commented Jul 25, 2025

Closing as addressed by the #423
Feel free to reopen if the issue is not resolved.

@tzolov tzolov closed this Jul 25, 2025
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.

2 participants