async function scan(url) {
const res = await fetch("https://testwebmcp.com/api/v1/scan", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }),
});
const started = await res.json();
if (!res.ok) throw new Error(started.error);
while (true) {
await new Promise((r) => setTimeout(r, 3000));
const poll = await fetch(started.statusUrl);
if (poll.status !== 202) return poll.json();
}
}