Skip to content

Commit 9f94929

Browse files
committed
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 modelcontextprotocol#3359
1 parent a97aba1 commit 9f94929

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/fetch/src/mcp_server_fetch/server.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,4 @@ async def get_prompt(name: str, arguments: dict | None) -> GetPromptResult:
285285

286286
options = server.create_initialization_options()
287287
async with stdio_server() as (read_stream, write_stream):
288-
await server.run(read_stream, write_stream, options, raise_exceptions=True)
288+
await server.run(read_stream, write_stream, options, raise_exceptions=False)

0 commit comments

Comments
 (0)