feat: Add SigV4A authentication support for global AWS endpoints with auto-detection #81
+1,146
−37
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
Adds AWS Signature Version 4A (SigV4A) authentication support to the MCP Proxy for AWS, enabling seamless connections to global and multi-region AWS endpoints. The implementation includes intelligent auto-detection that automatically upgrades from SigV4 to SigV4A when required by the endpoint.
What is SigV4A?
SigV4A is an extension of AWS Signature Version 4 that supports multi-region signatures, allowing a single signed request to be valid across multiple AWS regions. This is essential for:
Key Features
1. Automatic Detection & Fallback
2. Global Endpoint Detection
service.global.api.awsglobal.service.api.awsservice.api.aws(without region)us-east-1region for global endpoints3. Transparent Integration
SigV4HTTPXAuthclassImplementation Details
Core Changes
mcp_proxy_for_aws/sigv4_helper.py:SigV4HTTPXAuthwith auto-detection logic_requires_sigv4a()to detect SigV4A requirement from error responsesmcp_proxy_for_aws/utils.py:is_global_endpoint()to detect global endpoint patternsdetermine_aws_region()to handle global endpointsmcp_proxy_for_aws/client.py:SigV4HTTPXAuthwith auto-detectionTest Coverage
Usage Examples
Global Endpoint (Auto-detected)
Regional Endpoint (Existing behavior)
Requirements Satisfied
✅ Requirement 1: Support for global AWS endpoints with SigV4A
✅ Requirement 2: Automatic detection without explicit configuration
✅ Requirement 3: Programmatic client library support
✅ Requirement 4: Clear error messages and logging
✅ Requirement 5: Maintains backward compatibility
Dependencies
Backward Compatibility
✅ Fully backward compatible - All existing code continues to work without changes. Regional endpoints use SigV4 as before, and global endpoints automatically upgrade to SigV4A when needed.
Testing