-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add streamable_http_client which accepts httpx.AsyncClient instead of httpx_client_factory
#1177
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
646a0d5
Rename `streamablehttp_client` to `streamable_http_client`
Kludex 433da3e
Apply pre-commit
Kludex bcc4b19
Add missing paramters
Kludex 8196fec
Replace httpx_client_factory with httpx_client parameter
felixweinberger 51e6a9a
Fix test failures from httpx_client API changes
felixweinberger ac0e3df
Add missing imports to test_integration.py
felixweinberger 0f373e4
Add missing type annotations to test functions
felixweinberger 80a48bf
Simplify test_session_group.py mocking
felixweinberger e0f7807
refactor: Address API design improvements in StreamableHTTP client
felixweinberger 5004eda
refactor: Remove header mutation in streamable_http_client
felixweinberger 862c22f
Add overload for deprecation
Kludex d64d191
Fix StreamableHTTP transport API for backwards compatibility and clea…
felixweinberger f897932
Add pragma comments for coverage on anyio 4.12.0
felixweinberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix StreamableHTTP transport API for backwards compatibility and clea…
…ner header handling This commit addresses three issues identified in PR review: 1. **Restore RequestContext fields for backwards compatibility** - Re-add `headers` and `sse_read_timeout` fields as optional with None defaults - Mark them as deprecated in docstring since they're no longer used internally - Prevents breaking changes for any code accessing these fields 2. **Add runtime deprecation warnings for StreamableHTTPTransport constructor** - Use sentinel value pattern to detect when deprecated parameters are passed - Issue DeprecationWarning at runtime when headers, timeout, sse_read_timeout, or auth are provided - Complements existing @deprecated decorator for type checkers with actual runtime warnings - Improve deprecation message clarity 3. **Simplify header handling by removing redundant client parameter** - Remove `client` parameter from `_prepare_headers()` method - Stop extracting and re-passing client.headers since httpx automatically merges them - Only build MCP-specific headers (Accept, Content-Type, session headers) - httpx merges these with client.headers automatically, with our headers taking precedence - Reduces code complexity and eliminates unnecessary header extraction The header handling change leverages httpx's built-in header merging behavior, similar to how headers were handled before the refactoring but without the redundant extraction-and-repass pattern.
- Loading branch information
commit d64d191b6aaf59dbafb5f8d7015a77fb8f8069b5
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also be breaking if anyone was directly instantiating these classes and relying on the config here.