import json, time, urllib.request, random
MCP="https://mcp.nonceprotocol.xyz/mcp"
def call():
    body=json.dumps({"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"protocol_info","arguments":{}}}).encode()
    req=urllib.request.Request(MCP,data=body,headers={"Content-Type":"application/json","Accept":"application/json, text/event-stream","User-Agent":"curl/8.7.1"})
    with urllib.request.urlopen(req,timeout=25) as r:
        p=json.loads(r.read().decode())
    if "error" in p: raise RuntimeError(str(p["error"]))
    return json.loads(p["result"]["content"][0]["text"])
for i in range(20):
    try:
        d=call()
        print(i, time.strftime("%H:%M:%S"), "admission=",d.get("admission"), "remaining=",d.get("remainingSupply"), "signer=","yes" if d.get("signer") else "no", flush=True)
    except Exception as e:
        print(i, time.strftime("%H:%M:%S"), "ERR", type(e).__name__, e, flush=True)
    time.sleep(random.uniform(3,7))
