File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
mcp_proxy_for_aws/middleware Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,17 @@ async def on_initialize(
2828 client = await self ._client_factory .get_client ()
2929 # connect the http client, fail and don't succeed the stdio connect
3030 # if remote client cannot be connected
31- await client ._connect ()
31+ client_name = context .message .params .clientInfo .name .lower ()
32+ if 'kiro cli' not in client_name and 'q dev cli' not in client_name :
33+ # q cli / kiro cli uses the rust SDK which does not handle json rpc error
34+ # properly during initialization.
35+ # https://github.com/modelcontextprotocol/rust-sdk/pull/569
36+ # if calling _connect below raise mcp error, the q cli will skip the message
37+ # and containue wait for the json rpc response message, which will not come.
38+ # luckily, q cli calls list tool immediately after being connected to a mcp server
39+ # the list_tool call will require the client to be connected again, so the mcp error
40+ # will be displayed in the q cli logs.
41+ await client ._connect ()
3242 return await call_next (context )
3343 except Exception :
3444 logger .exception ('Initialize failed in middleware.' )
You can’t perform that action at this time.
0 commit comments