all scenarios

initialize returns an error

init-error · Protocol negotiation

Endpoint (Streamable HTTP)
https://chaos-mcp.thomascdnns.com/s/init-error/mcp
On the wire — recorded from a real request
your clientchaos-mcp01initializePOST /s/init-error/mcp200 OK · application/json · 2 ms"jsonrpc""2.0""id"null"error""code"-32603"message""initialization failed: could not connect to database"no Mcp-Session-Id header02tools/listPOST /s/init-error/mcp200 OK · application/json · 1 ms"jsonrpc""2.0""id"2"result""tools""name""echo""description""Echo back the provided message.""inputSchema""type""object""properties""message""type""string""description""Text to echo"… 40 more lines

Symptom

what you'll observe

Handshake fails immediately with a JSON-RPC error; nothing else is reachable.

Cause

what this reproduces

A dependency the server needs at startup (DB, secret) is missing, so initialize throws.

Fix

how you'd resolve it

Make initialize cheap and dependency-free; defer heavy setup to first real use.

Try it with curl
bash
curl -sS -X POST \
  https://chaos-mcp.thomascdnns.com/s/init-error/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '
"jsonrpc""2.0"
"id"1
"method""initialize"
"params"
"protocolVersion""2024-11-05"
"capabilities"
"clientInfo""name""curl""version""1"

'