#!/usr/bin/env bash
# Check whether the GhidraMCP SSE bridge is listening on the host.
set -euo pipefail
echo "Probing GhidraMCP SSE bridge on 127.0.0.1:8081 ..."
if timeout 3 bash -c "exec 3<>/dev/tcp/127.0.0.1/8081" 2>/dev/null; then
    echo "OK: port 8081 is open. Point an MCP client at: http://127.0.0.1:8081/sse"
else
    echo "FAIL: nothing listening on 127.0.0.1:8081."
    echo "      Run ./re-up, wait for Ghidra, then check ./work/mcp-bridge.log."
    exit 1
fi
