Skip to content

Commit 6e8c62b

Browse files
committed
fix: do not automatically connect the session, wait for stdio client initialize session
1 parent fc3a257 commit 6e8c62b

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

mcp_proxy_for_aws/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def setup_mcp_mode(local_mcp: FastMCP, args) -> None:
8484
transport = create_transport_with_sigv4(
8585
args.endpoint, service, region, metadata, timeout, profile
8686
)
87-
async with Client(transport=transport) as client:
87+
async with Client(transport=transport, auto_initialize=False) as client:
8888
# Create proxy with the transport
8989
proxy = FastMCP.as_proxy(client)
9090
add_logging_middleware(proxy, args.log_level)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description = "MCP Proxy for AWS"
1616
readme = "README.md"
1717
requires-python = ">=3.10,<3.14"
1818
dependencies = [
19-
"fastmcp>=2.13.0.2",
19+
"fastmcp>=2.13.1",
2020
"boto3>=1.34.0",
2121
"botocore>=1.34.0",
2222
]

tests/unit/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async def test_setup_mcp_mode(
9999
assert call_args[0][3] == {'AWS_REGION': 'us-east-1'} # metadata
100100
# call_args[0][4] is the Timeout object
101101
assert call_args[0][5] is None # profile
102-
mock_client_class.assert_called_once_with(transport=mock_transport)
102+
mock_client_class.assert_called_once_with(transport=mock_transport, auto_initialize=False)
103103
mock_as_proxy.assert_called_once_with(mock_client)
104104
mock_add_filtering.assert_called_once_with(mock_proxy, True)
105105
mock_add_retry.assert_called_once_with(mock_proxy, 1)
@@ -173,7 +173,7 @@ async def test_setup_mcp_mode_no_retries(
173173
} # metadata
174174
# call_args[0][4] is the Timeout object
175175
assert call_args[0][5] == 'test-profile' # profile
176-
mock_client_class.assert_called_once_with(transport=mock_transport)
176+
mock_client_class.assert_called_once_with(transport=mock_transport, auto_initialize=False)
177177
mock_as_proxy.assert_called_once_with(mock_client)
178178
mock_add_filtering.assert_called_once_with(mock_proxy, False)
179179
mock_proxy.run_async.assert_called_once()

uv.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)