Skip to content

mcp-server-fetch: Server crashes on any malformed input due to raise_exceptions=True #3359

@manthanghasadiya

Description

@manthanghasadiya

Describe the bug

mcp-server-fetch terminates on any malformed JSON-RPC message. A single invalid byte on stdin kills the server process. This happens because server.py passes raise_exceptions=True to server.run(), which causes parse errors to propagate as unhandled ExceptionGroups.

Other reference servers (like mcp-server-sqlite) use the default raise_exceptions=False and handle malformed input gracefully.

fuzz_fetch_report.json

To Reproduce

pip install mcp-server-fetch  # v2025.4.7, MCP SDK v1.26.0
echo "NOT VALID JSON" | mcp-server-fetch

Server exits with ExceptionGroup traceback.

Fuzz test comparison
Protocol fuzzer sent 65 identical test cases to three servers:

Server MCP SDK Crashes Survives
mcp-server-fetch 1.26.0 61 4
mcp-server-sqlite 1.26.0 0 65
test server 1.26.0 0 65

Root cause
mcp_server_fetch/server.py line 287-288:

await server.run(read_stream, write_stream, options, raise_exceptions=True)

Suggested fix
Change to raise_exceptions=False (consistent with other reference servers), or add exception handling around the serve() call.

Environment

  • mcp-server-fetch: 2025.4.7
  • mcp SDK: 1.26.0
  • Python: 3.12.2
  • OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions