(body)
| 63 | |
| 64 | // ── SSE helper (mirrors mcp.spec.js) ───────────────────────────────────────── |
| 65 | function parseSseBody (body) { |
| 66 | const dataLine = (typeof body === 'string' ? body : JSON.stringify(body)) |
| 67 | .split('\n').find(l => l.startsWith('data: ')) |
| 68 | if (!dataLine) return null |
| 69 | return JSON.parse(dataLine.slice(6)) |
| 70 | } |
| 71 | |
| 72 | async function mcpPost (port, body, sid) { |
| 73 | const headers = { |