Skip to content

Commit 90e478c

Browse files
committed
fix: catch-all for exceptions in adapter
1 parent e37b7a8 commit 90e478c

File tree

1 file changed

+10
-0
lines changed
  • src/python/src/mcp_lambda/server_adapter

1 file changed

+10
-0
lines changed

src/python/src/mcp_lambda/server_adapter/adapter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ def stdio_server_adapter(server_params: StdioServerParameters, event, context):
2525
error = unwrap_exception_group(eg)
2626
logger.error("Exception from exception group: %s", error, exc_info=error)
2727
raise error
28+
except BaseException as error:
29+
logger.error("General exception: %s", error, exc_info=True)
30+
return types.JSONRPCError(
31+
jsonrpc="2.0",
32+
id=0,
33+
error=types.ErrorData(
34+
code=500,
35+
message="Internal failure, please check Lambda function logs",
36+
),
37+
).model_dump(by_alias=True, mode="json", exclude_none=True)
2838

2939

3040
async def handle_request(server_params: StdioServerParameters, event, context):

0 commit comments

Comments
 (0)