Skip to content

StreamableHTTPClientTransport cleanup / fixes #300

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

Conversation

beaulac
Copy link
Contributor

@beaulac beaulac commented Apr 10, 2025

  • always send headers specified in requestInit option
  • avoid doubled onerror call
  • use for-await to iterate SSE stream
  • remove outdated comments
  • simplify requestId tracking
  • throw error when response Content-Type is out of spec

Motivation and Context

suggests changes for #299 ( cc @ihrpr )
Simplifies and fixes some inconsistencies in StreamableHTTPClientTransport.

How Has This Been Tested?

Existing StreamableHTTPClientTransport tests pass, two new tests added:

  • should throw error when invalid content-type is received
  • should always send specified custom headers

Breaking Changes

None

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

* always send headers specified in requestInit option
* avoid doubled onerror call
* use for-await to iterate SSE stream
* remove outdated comments
* simplify requestId tracking
* throw error when response Content-Type is out of spec
@beaulac beaulac force-pushed the streamable-http-client-fixes branch from 5b9de6a to a76004c Compare April 10, 2025 01:18
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! thank you!

@ihrpr ihrpr merged commit 77352db into modelcontextprotocol:ihrpr/response-returns-json Apr 10, 2025
2 checks passed
Pizzaface pushed a commit to RewstApp/mcp-inspector that referenced this pull request May 2, 2025
…ol-error-is-not-highlighted-for-sample-llm-tool-call-rejection

fix: missing condition for lengthy strings
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