fix: tolerate extra kwargs in _make_httpx_client_factory#5748
Closed
Oxygen56 wants to merge 1 commit into
Closed
Conversation
FastMCP transports pass extra keyword arguments (e.g. follow_redirects) to the httpx_client_factory callback. The factory returned by _make_httpx_client_factory did not accept **kwargs, causing a TypeError when MCPToolset was constructed with an explicit http_client=. Fixes pydantic#5688 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks for your interest in this issue! However, there are already open PRs addressing issue #5688: #5694. To avoid duplicate efforts, this PR has been closed. If you'd like to contribute, you can review the existing PRs or share your thoughts on issue #5688. If you believe the existing PRs are inactive, please comment on the issue and a maintainer can reassess. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
**_kwargs: Anyto the closure returned by_make_httpx_client_factoryso it tolerates extra keyword arguments (e.g.follow_redirects) that FastMCP transports may pass.Root Cause
When
http_client=is passed toMCPToolset, the_make_httpx_client_factoryfunction returns a closure with the signaturefactory(headers=None, timeout=None, auth=None)— no**kwargs. FastMCP'sStreamableHttpTransportandSSETransportcall this factory withfollow_redirects=True, which raises aTypeError.Fixes #5688
Test Plan
test_http_client_factory_tolerates_extra_kwargs— verifies the factory acceptsfollow_redirects=Trueand still returns the user-supplied client.TestMCPToolsetConstructiontests pass.