chore: using updated aws_iam_streamable_http_client#135
chore: using updated aws_iam_streamable_http_client#135andreyyoshuamanik wants to merge 2 commits intoaws:mainfrom
Conversation
|
The direction is right - upstream deprecated Keep Upstream did this same pattern. Let's not break existing code without a migration window. |
1a5bada to
3d2d45a
Compare
Makes sense! Thanks for the suggestion. Adjusted the approach |
mcp_proxy_for_aws/client.py
Outdated
| This is a deprecated alias for aws_iam_streamable_http_client. | ||
| Please update your code to use aws_iam_streamable_http_client instead. | ||
| """ | ||
| warnings.warn( |
There was a problem hiding this comment.
I suggest using the @deprecated decorator:
from typing_extensions import deprecated
...
@deprecated("Use `aws_iam_streamable_http_client` instead.")
def aws_iam_streamablehttp_client(
...
mcp_proxy_for_aws/client.py
Outdated
|
|
||
|
|
||
| def aws_iam_streamablehttp_client( | ||
| def aws_iam_streamable_http_client( |
There was a problem hiding this comment.
If we change the API to match the upstream naming convention, we should also match the signature. It wouldn't make much sense to introduce a breaking change just to keep naming consistent while letting the signature drift.
async def aws_iam_streamable_http_client(
# Specific to the IAM client, replacing upstream's `url: str`
endpoint: str,
aws_service: str,
aws_region: str | None = None,
aws_profile: str | None = None,
credentials: Credentials | None = None,
# Remaining upstream parameters following the new pattern
*,
http_client: httpx.AsyncClient | None = None,
terminate_on_close: bool = True,
) -> AsyncGenerator[
tuple[
MemoryObjectReceiveStream[SessionMessage | Exception],
MemoryObjectSendStream[SessionMessage],
GetSessionIdCallback,
],
None,
]:
...
There was a problem hiding this comment.
This makes sense. Thanks for point this out. i match the signature with the upstream in this commit 24f4bcc
Summary
This pull request introduces a new, improved AWS IAM streamable HTTP client function, deprecates the old function, and updates the package to align with upstream MCP (Managed Control Plane) conventions. The changes modernize the API, improve consistency with upstream libraries, and enhance test coverage. There are also minor improvements to environment variable handling and dependency requirements.
Changes
API Modernization & Deprecation
aws_iam_streamable_http_clientfunction to replace the deprecatedaws_iam_streamablehttp_client, aligning with upstream MCP naming and signature patterns. The new function uses keyword-only arguments, accepts a pre-configuredhttpx.AsyncClient, and drops several legacy parameters. The return type is nowAsyncGeneratorfor consistency. (mcp_proxy_for_aws/client.py,CHANGELOG.md) [1] [2]aws_iam_streamablehttp_clientas deprecated; it now wraps the new function for backward compatibility and will be removed in a future major release. (mcp_proxy_for_aws/client.py,CHANGELOG.md) [1] [2]Dependency and Version Updates
fastmcpto 2.14.2 to support the new client interface and MCP features. (pyproject.toml,CHANGELOG.md) [1] [2]Testing and Internal Refactoring
aws_iam_streamable_http_clientand updated mocks to patchstreamable_http_clientinstead of the old function. Tests now verify the correct use of HTTP client factories, parameter passing, and backward compatibility of the deprecated API. (tests/unit/test_client.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Utilities and Environment Handling
AWS_SESSION_TOKENis now only set if present in credentials, supporting both permanent and temporary credentials. (tests/integ/mcp/simple_mcp_client.py)fastmcpfeatures. (mcp_proxy_for_aws/utils.py)User experience
Before: there will be a deprecation message because using deprecated streamablehttp_client
After: no deprecation message anymore
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change? (Y/N)
Please add details about how this change was tested.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.