From 9f9492991ef4567118750c889fb9ad7cd889e655 Mon Sep 17 00:00:00 2001 From: Anshul Garg Date: Wed, 11 Mar 2026 03:05:41 +0530 Subject: [PATCH] fix(fetch): handle malformed input without crashing mcp-server-fetch crashes on any malformed JSON-RPC input because server.run() is called with raise_exceptions=True. A single invalid byte on stdin terminates the server process via unhandled ExceptionGroup. Change to raise_exceptions=False to match the behavior of other reference servers (e.g., mcp-server-time, mcp-server-sqlite) which handle parse errors gracefully and continue serving. Fuzz testing showed fetch crashed on 61/65 test cases while other servers using raise_exceptions=False survived all 65. Fixes #3359 --- src/fetch/src/mcp_server_fetch/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fetch/src/mcp_server_fetch/server.py b/src/fetch/src/mcp_server_fetch/server.py index d128987351..b42c7b1f6b 100644 --- a/src/fetch/src/mcp_server_fetch/server.py +++ b/src/fetch/src/mcp_server_fetch/server.py @@ -285,4 +285,4 @@ async def get_prompt(name: str, arguments: dict | None) -> GetPromptResult: options = server.create_initialization_options() async with stdio_server() as (read_stream, write_stream): - await server.run(read_stream, write_stream, options, raise_exceptions=True) + await server.run(read_stream, write_stream, options, raise_exceptions=False)