Serisly's picture
Sync sample dataset, Croissant YAML, JSON Schema, and MCP manifest
21dac4f verified
Raw History Blame Contribute Delete
1.03 kB
"""Minimal Python client for the Apify Standby HTTP & Streamable HTTP MCP endpoint."""
import json
import os
import urllib.request
STANDBY_URL = "https://mrTHhreuuBNgcAaIQ.apify.actor"
TOKEN = os.environ["APIFY_TOKEN"]
def call_mcp_tool(arguments: dict) -> dict:
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "query_ecommerce_brands",
"arguments": arguments,
},
}
req = urllib.request.Request(
f"{STANDBY_URL}/mcp",
data=json.dumps(payload).encode("utf-8"),
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(req, timeout=30) as resp:
return json.loads(resp.read().decode("utf-8"))
if __name__ == "__main__":
res = call_mcp_tool({'platforms': ['shopify'], 'verifiedCorporateOnly': True, 'maxItems': 25})
print(json.dumps(res, indent=2)[:2000])