BASE="http://127.0.0.1:8006"
curl -s -N -m 15 "$BASE/sse" > /tmp/sse6.txt &
CP=$!
sleep 2
SID=$(grep -oP 'session_id=\K[^/]+' /tmp/sse6.txt | head -1)
echo SID=$SID
echo '-- init POST:'
curl -s -i -m 4 -X POST "$BASE/messages/?session_id=$SID" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' 2>&1
sleep 2
echo '-- tools POST:'
curl -s -i -m 4 -X POST "$BASE/messages/?session_id=$SID" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' 2>&1
sleep 3
kill $CP 2>/dev/null
echo '-- SSE content:'
cat /tmp/sse6.txt
