Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcp_proxy_for_aws/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def setup_mcp_mode(local_mcp: FastMCP, args) -> None:
transport = create_transport_with_sigv4(
args.endpoint, service, region, metadata, timeout, profile
)
async with Client(transport=transport) as client:
async with Client(transport=transport, auto_initialize=False) as client:
# Create proxy with the transport
proxy = FastMCP.as_proxy(client)
add_logging_middleware(proxy, args.log_level)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ description = "MCP Proxy for AWS"
readme = "README.md"
requires-python = ">=3.10,<3.14"
dependencies = [
"fastmcp>=2.13.0.2",
"fastmcp>=2.13.1",
"boto3>=1.34.0",
"botocore>=1.34.0",
]
Expand Down
8 changes: 6 additions & 2 deletions tests/integ/mcp/simple_mcp_server/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ async def elicit_for_my_name(elicitation_expected: str, ctx: Context):
@mcp.tool
def echo_metadata(ctx: Context):
"""MCP Tool that echoes back the _meta field from the request."""
meta = ctx.request_context.meta
return {'received_meta': meta}
if ctx.request_context:
meta = ctx.request_context.meta
return {'received_meta': meta}
else:
# should not happen, trying to make typechecker happy
raise RuntimeError('MCP tool invoked before session is initialized')


#### Server Setup
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def test_setup_mcp_mode(
assert call_args[0][3] == {'AWS_REGION': 'us-east-1'} # metadata
# call_args[0][4] is the Timeout object
assert call_args[0][5] is None # profile
mock_client_class.assert_called_once_with(transport=mock_transport)
mock_client_class.assert_called_once_with(transport=mock_transport, auto_initialize=False)
mock_as_proxy.assert_called_once_with(mock_client)
mock_add_filtering.assert_called_once_with(mock_proxy, True)
mock_add_retry.assert_called_once_with(mock_proxy, 1)
Expand Down Expand Up @@ -173,7 +173,7 @@ async def test_setup_mcp_mode_no_retries(
} # metadata
# call_args[0][4] is the Timeout object
assert call_args[0][5] == 'test-profile' # profile
mock_client_class.assert_called_once_with(transport=mock_transport)
mock_client_class.assert_called_once_with(transport=mock_transport, auto_initialize=False)
mock_as_proxy.assert_called_once_with(mock_client)
mock_add_filtering.assert_called_once_with(mock_proxy, False)
mock_proxy.run_async.assert_called_once()
Expand Down
Loading
Loading