Skip to content

AWS IAM MCP client with SigV4 auth#65

Merged
wzxxing merged 22 commits into
aws:mainfrom
DennisTraub:feature/aws-iam-mcp-client
Nov 6, 2025
Merged

AWS IAM MCP client with SigV4 auth#65
wzxxing merged 22 commits into
aws:mainfrom
DennisTraub:feature/aws-iam-mcp-client

Conversation

@DennisTraub

Copy link
Copy Markdown
Contributor

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

@wzxxing wzxxing left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread mcp_proxy_for_aws/client.py Outdated
auth = SigV4HTTPXAuth(session.get_credentials(), aws_service, region)

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

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

Copy link
Copy Markdown
Contributor 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
Comment thread mcp_proxy_for_aws/client.py Outdated
Comment thread mcp_proxy_for_aws/client.py Outdated
@wzxxing

wzxxing commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Comment thread mcp_proxy_for_aws/client.py Outdated

@arangatang arangatang left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread examples/mcp-client/agent-framework/main.py Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread examples/mcp-client/strands/main.py Outdated
Comment thread examples/mcp-client/strands/main.py Outdated
Comment thread examples/mcp-client/strands/README.md Outdated
Comment thread examples/mcp-client/llamaindex/main.py Outdated
Comment thread examples/mcp-client/langchain/main.py Outdated
@wzxxing

wzxxing commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread uv.lock Outdated
@DennisTraub

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

@arangatang arangatang left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread examples/mcp-client/agent-framework/main.py
Comment thread examples/mcp-client/langchain/main.py
Comment thread examples/mcp-client/llamaindex/main.py
Comment thread examples/mcp-client/strands/main.py
Comment thread examples/mcp-client/langchain/pyproject.toml Outdated
Comment thread examples/mcp-client/llamaindex/pyproject.toml Outdated
Comment thread examples/mcp-client/strands/pyproject.toml Outdated
Comment thread tests/unit/examples/README.md Outdated
@@ -0,0 +1,58 @@
# MCP Client Example Tests

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

Choose a reason for hiding this comment

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

DennisTraub and others added 15 commits November 5, 2025 17:14
Co-authored-by: wzxxing <169175349+wzxxing@users.noreply.github.com>
Signed-off-by: Dennis Traub <dennis.traub@gmail.com>
Co-authored-by: Leonardo Araneda Freccero <arangatang@users.noreply.github.com>
Signed-off-by: Dennis Traub <dennis.traub@gmail.com>
Co-authored-by: Leonardo Araneda Freccero <arangatang@users.noreply.github.com>
Signed-off-by: Dennis Traub <dennis.traub@gmail.com>
Comment thread mcp_proxy_for_aws/client.py Outdated
Comment thread .github/workflows/python.yml Outdated
Signed-off-by: Dennis Traub <dennis.traub@gmail.com>
@DennisTraub DennisTraub requested a review from wzxxing November 5, 2025 20:58
@wzxxing wzxxing enabled auto-merge (squash) November 5, 2025 22:40
@wzxxing wzxxing merged commit eebee32 into aws:main Nov 6, 2025
3 checks passed
@arangatang

Copy link
Copy Markdown
Contributor

Thank you @DennisTraub for the contribution (and handling all our comments)!

@DennisTraub DennisTraub deleted the feature/aws-iam-mcp-client branch November 6, 2025 18:49
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