MCP server exits instead of returning MethodNotFound for unknown JSON-RPC methods
Summary
MCP clients using the official Go SDK >= 1.7 (e.g. Charm Crush) send server/discover (SEP-2575, protocol 2026-07-28) before the legacy initialize handshake. Per the MCP/JSON-RPC spec, a server that does not implement server/discover must reply with -32601 Method not found so the client falls back to initialize. This server instead exits with rc=1, killing the stdio connection.
Repro
printf '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{}}\n' | browser39 mcp
Expected: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}} and the process keeps running.
Actual: process exits (rc=1), no response on stdout:
MCP server error: expect initialized request, but received: Some(Request(JsonRpcRequest { jsonrpc: JsonRpcVersion2_0, id: Number(1), request: CustomRequest(CustomRequest { method: "server/discover", ...
Downstream effect: clients that probe with server/discover fail the whole connection with connection closed: calling "initialize": client is closing: EOF.
Suggested fix
Treat any unknown JSON-RPC method (before initialization) as MethodNotFound (-32601) instead of exiting. Note the same crash also occurs for any custom request before initialize is received, so unknown-method handling during the pre-init state is the general fix.
Hey @viirak, thanks a lot for the clear report and the repro, it made this easy to track down. Sorry it took me so long to get to it.
Fixed in v1.9.0. Requests that arrive before initialize no longer kill the process. server/discover (and any other unknown method) now gets -32601 Method not found, so Crush and other Go SDK clients fall back to initialize like they should.
Let me know if you still hit anything after updating. Thanks again!