Skip to content

Commit c4a7dd6

Browse files
committed
Add client tests
1 parent 9b3c93b commit c4a7dd6

File tree

2 files changed

+192
-729
lines changed

2 files changed

+192
-729
lines changed

mcp_proxy_for_aws/client.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from mcp.client.streamable_http import (
2626
GetSessionIdCallback,
2727
create_mcp_http_client,
28-
streamablehttp_client
28+
streamablehttp_client,
2929
)
3030
from mcp.shared._httpx_utils import McpHttpClientFactory
3131
from mcp.shared.message import SessionMessage
@@ -35,6 +35,7 @@
3535

3636
logger = logging.getLogger(__name__)
3737

38+
3839
@asynccontextmanager
3940
async def aws_iam_mcp_client(
4041
endpoint: str,
@@ -79,8 +80,8 @@ async def aws_iam_mcp_client(
7980
- get_session_id: Function to retrieve the current session ID
8081
"""
8182
# Create a SigV4 authentication handler with AWS credentials
82-
logger.info("Preparing AWS IAM MCP client for endpoint: %s", endpoint)
83-
83+
logger.info('Preparing AWS IAM MCP client for endpoint: %s', endpoint)
84+
8485
kwargs = {}
8586
if aws_region is not None:
8687
kwargs['region_name'] = aws_region
@@ -92,14 +93,14 @@ async def aws_iam_mcp_client(
9293

9394
profile = session.profile_name
9495
region = session.region_name
95-
96-
logger.debug("AWS profile: %s", profile)
97-
logger.debug("AWS region: %s", region)
98-
logger.debug("AWS service: %s", aws_service)
99-
96+
97+
logger.debug('AWS profile: %s', profile)
98+
logger.debug('AWS region: %s', region)
99+
logger.debug('AWS service: %s', aws_service)
100+
100101
# Create a SigV4 authentication handler with AWS credentials
101102
auth = SigV4HTTPXAuth(session.get_credentials(), aws_service, region)
102-
103+
103104
# Establish connection using MCP SDK's streamable HTTP client
104105
async with streamablehttp_client(
105106
url=endpoint,
@@ -111,5 +112,5 @@ async def aws_iam_mcp_client(
111112
httpx_client_factory=httpx_client_factory,
112113
) as (read_stream, write_stream, get_session_id):
113114
# Return transport components for external session management
114-
logger.info("Successfully prepared AWS IAM MCP client for endpoint: %s", endpoint)
115+
logger.info('Successfully prepared AWS IAM MCP client for endpoint: %s', endpoint)
115116
yield (read_stream, write_stream, get_session_id)

0 commit comments

Comments
 (0)