Skip to content

chore: using updated aws_iam_streamable_http_client#135

Open
andreyyoshuamanik wants to merge 2 commits intoaws:mainfrom
andreyyoshuamanik:main
Open

chore: using updated aws_iam_streamable_http_client#135
andreyyoshuamanik wants to merge 2 commits intoaws:mainfrom
andreyyoshuamanik:main

Conversation

@andreyyoshuamanik
Copy link

@andreyyoshuamanik andreyyoshuamanik commented Jan 7, 2026

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

  • Added a new aws_iam_streamable_http_client function to replace the deprecated aws_iam_streamablehttp_client, aligning with upstream MCP naming and signature patterns. The new function uses keyword-only arguments, accepts a pre-configured httpx.AsyncClient, and drops several legacy parameters. The return type is now AsyncGenerator for consistency. (mcp_proxy_for_aws/client.py, CHANGELOG.md) [1] [2]
  • Marked aws_iam_streamablehttp_client as 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

  • Updated the minimum required version of fastmcp to 2.14.2 to support the new client interface and MCP features. (pyproject.toml, CHANGELOG.md) [1] [2]

Testing and Internal Refactoring

  • Refactored all tests to use the new aws_iam_streamable_http_client and updated mocks to patch streamable_http_client instead 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

  • Improved environment variable handling in integration tests: AWS_SESSION_TOKEN is now only set if present in credentials, supporting both permanent and temporary credentials. (tests/integ/mcp/simple_mcp_client.py)
  • Updated the client factory utility to accept additional keyword arguments for compatibility with new fastmcp features. (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.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N)

  • Yes
  • No

Please add details about how this change was tested.

  • Did integration tests succeed?
  • If the feature is a new use case, is it necessary to add a new integration test case?

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@andreyyoshuamanik andreyyoshuamanik requested a review from a team as a code owner January 7, 2026 04:12
@DennisTraub
Copy link
Contributor

The direction is right - upstream deprecated streamablehttp_client. But this change needs a deprecation cycle.

Keep aws_iam_streamablehttp_client as a deprecated alias that wraps the new function and emits a warning. Then bump to minor version, add a CHANGELOG entry, and plan removal for the next major.

Upstream did this same pattern. Let's not break existing code without a migration window.

@andreyyoshuamanik
Copy link
Author

The direction is right - upstream deprecated streamablehttp_client. But this change needs a deprecation cycle.

Keep aws_iam_streamablehttp_client as a deprecated alias that wraps the new function and emits a warning. Then bump to minor version, add a CHANGELOG entry, and plan removal for the next major.

Upstream did this same pattern. Let's not break existing code without a migration window.

Makes sense! Thanks for the suggestion. Adjusted the approach

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(
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest using the @deprecated decorator:

from typing_extensions import deprecated

...

@deprecated("Use `aws_iam_streamable_http_client` instead.")
def aws_iam_streamablehttp_client(
    ...

Copy link
Author

Choose a reason for hiding this comment

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

Agree. updated in this commit ya 24f4bcc



def aws_iam_streamablehttp_client(
def aws_iam_streamable_http_client(
Copy link
Contributor

@DennisTraub DennisTraub Jan 8, 2026

Choose a reason for hiding this comment

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

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,
]:
    ...

Copy link
Author

Choose a reason for hiding this comment

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

This makes sense. Thanks for point this out. i match the signature with the upstream in this commit 24f4bcc

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.

3 participants