Skip to content

Conversation

@bjoaquinc
Copy link

@bjoaquinc bjoaquinc commented Nov 3, 2025

This implements fixes to the StreamingASGITransport to properly handle SSE streaming and disconnect signaling. The key changes were:

  • Added disconnect signaling via receive() to fix SSE hanging
  • Fixed memory stream cleanup in SseServerTransport to eliminate ResourceWarnings
  • Handle duplicate http.response.start gracefully during teardown

I also modified one test in tests/shared/test_sse.py to validate this methodology. I'll be updating all tests after validation.

Motivation and Context

Partially resolves #857

How Has This Been Tested?

Since I updated the testing methodology I made sure to run the test in batches of 20 (to check for race conditions). After the updates I was able to get it working for the modified test.

Screenshot 2025-11-02 at 8 08 21 PM

Breaking Changes

None. StreamingASGITransport is only meant for testing. Also before this PR, it was not implemented anywhere in the codebase. The only change I made to SseServerTransport was to properly clean up sse_stream_reader which is best practice and doesn't break functionality. The modified test_request_context_propagation functions as expected.

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

@maxisbey maxisbey added P3 Nice to haves, rare edge cases needs more work Not ready to be merged yet, needs additional changes. labels Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs more work Not ready to be merged yet, needs additional changes. P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop uvicorn from test suite

2 participants