Skip to content

Conversation

@DennisTraub
Copy link

Enables IAM (SigV4) authentication for MCP clients connecting to AWS-hosted MCP servers. This client is a drop-in replacement for existing MCP client usage and works with agent frameworks like Strands Agents, LangChain, LlamaIndex, and the Microsoft Agent Framework.

  • Adds aws_iam_mcp_client: an async context manager creating a streamable MCP HTTP client signed with SigV4
  • Establishes a boto3.Session with optional AWS region and profile
  • Uses existing SigV4HTTPXAuth with resolved credentials, service, and region
  • Connects via MCP’s streamablehttp_client
  • Allows injecting a custom httpx_client_factory for transport customization

Unit tests cover:

  • Parameterization of boto3.Session (region/profile)
  • Creation and wiring of SigV4HTTPXAuth
  • Forwarding of client parameters to the underlying streamable client
  • Proper cleanup behavior of the async context manager

Follow-ups:

  • Integration tests
  • Documentation update
  • Usage examples

Copy link
Contributor

@wzxxing wzxxing left a comment

Choose a reason for hiding this comment

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

Previously in our discussion, we were thinking if the mcp client or transport is the level of abstraction. But seems from the PR, in order to make this feature available to both mcp python sdk and fastmcp v2, the two SDKs needs to be handled separately.

Final comment, would you be able to update the README to include a section of using this feature with popular agent SDKs?

auth = SigV4HTTPXAuth(session.get_credentials(), aws_service, region)

# Establish connection using MCP SDK's streamable HTTP client
async with streamablehttp_client(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is using the official streamablehttp_client.

Do you know if this will be compatible for the users using fastmcp 2.0?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, the client uses the standard MCP SDK's streamablehttp_client, which speaks the core MCP protocol over HTTP. FastMCP 2.0 servers are MCP-compliant, so any standard MCP client, including this one, will work seamlessly.

If users want to use fastmcp.Client, they'd bypass aws_iam_mcp_client() and use SigV4HTTPXAuth directly.

@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from 789d63f to c4a7dd6 Compare November 4, 2025 15:56
@DennisTraub
Copy link
Author

@wzxxing re:

Final comment, would you be able to update the README to include a section of using this feature with popular agent SDKs?

Absolutely. I'll update the README and will switch the PR to "ready for review"

@DennisTraub DennisTraub marked this pull request as ready for review November 4, 2025 19:59
@DennisTraub DennisTraub requested a review from a team as a code owner November 4, 2025 19:59
@DennisTraub DennisTraub requested review from acmlau and kyoncal November 4, 2025 19:59
@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from 0820cf8 to 63091f7 Compare November 4, 2025 20:24
@wzxxing
Copy link
Contributor

wzxxing commented Nov 5, 2025

Copy link
Contributor

@arangatang arangatang left a comment

Choose a reason for hiding this comment

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

Heya thank you for the great examples and the readme in this pass! Codewise I think we are pretty much good to go, but I have concerns about the naming. Due to trademark we shouldn't really have this as a seperate entity in the package. I provided some suggestions of how we could rephrase examples and READMES.

tldr: We can use MCP Proxy for AWS but MCP Client Library and similar would i believe require a new trademark, so to keep it simple lets rephrase.

@wzxxing
Copy link
Contributor

wzxxing commented Nov 5, 2025

Hi Dennis, I forgot to point you to the contributing guide. https://github.com/aws/mcp-proxy-for-aws/blob/main/CONTRIBUTING.md

You need to run uv run pre-commit run --all-files to format all the files.

I see the CI failed because uv.lock file was deleted.

@DennisTraub
Copy link
Author

There are some issues found by the CI: https://github.com/aws/mcp-proxy-for-aws/actions/runs/19081826894/job/54560828478?pr=65

Should be fixed

@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from 16416bd to 0bcf608 Compare November 5, 2025 13:03
Copy link
Contributor

@arangatang arangatang left a comment

Choose a reason for hiding this comment

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

Some more changes:

  1. Add license header to examples
  2. Fix mcp-proxy-for-aws reference in examples.

@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from 0bcf608 to a9dd648 Compare November 5, 2025 15:27
@@ -0,0 +1,58 @@
# MCP Client Example Tests
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't need README in unit tests.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I guess I can remove it.



@pytest.mark.unit
class TestMcpClientExamples:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these should be covered by pyright, if the example code can be validated by pyright, we don't need to do these unit tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was the one who asked to add these. Imo lets leave them for now, we can pivot later?

Copy link
Contributor

Choose a reason for hiding this comment

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

@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from 2a05470 to be56338 Compare November 5, 2025 17:16
Signed-off-by: Dennis Traub <dennis.traub@gmail.com>
@DennisTraub DennisTraub force-pushed the feature/aws-iam-mcp-client branch from b67a57f to 82385bb Compare November 5, 2025 20:42
@DennisTraub DennisTraub requested a review from wzxxing November 5, 2025 20:58
@wzxxing wzxxing enabled auto-merge (squash) November 5, 2025 22:40
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