Provider SDKs and REST
The provider SDKs are server-side libraries for services published in MCP Market. They are separate from the Agentic Scraper client REST API and client SDKs used to run agents and automations.
Event charge flow
For a provider_event marketplace entry, the MCP Market proxy forwards these
headers to your service:
x-agentic-charge-tokenx-agentic-charge-run-idx-agentic-charge-mcp-idx-agentic-charge-selection-idx-agentic-charge-max-total-usdRead the token, report one of the active event names configured on your
submission, and use the returned chargedCount as the maximum number of
billable units you return or process.
Node.js
npm install agentic-scraper-provider-sdkimport { AgenticProviderClient, getChargeTokenFromHeaders,} from 'agentic-scraper-provider-sdk';
const provider = new AgenticProviderClient({ apiKey: process.env.AGENTIC_PROVIDER_API_KEY!,});
const chargeToken = getChargeTokenFromHeaders(request.headers);const result = await provider.charge({ chargeToken: chargeToken ?? undefined, eventName: 'record-returned', count: records.length, idempotencyKey: `records:${requestId}`, metadata: { requestedCount: records.length },});
return records.slice(0, result.chargedCount);Python async
pip install agentic-scraper-provider-sdkfrom agentic_scraper_provider import AsyncAgenticProviderClient
provider = AsyncAgenticProviderClient( api_key=os.environ["AGENTIC_PROVIDER_API_KEY"],)
result = await provider.charge( charge_token=request.headers["x-agentic-charge-token"], event_name="record-returned", count=len(records), idempotency_key=f"records:{request_id}", metadata={"requestedCount": len(records)},)
return records[:result["chargedCount"]]Use AgenticProviderClient with the same arguments for synchronous Flask,
Django, or other WSGI code.
REST and cURL
The SDKs call the provider endpoint below:
curl --request POST \ --url "https://api.agenticscraper.com/api/v1/provider/runs/${RUN_ID}/charge" \ --header "Content-Type: application/json" \ --header "X-API-Key: ${AGENTIC_PROVIDER_API_KEY}" \ --header "x-agentic-charge-token: ${CHARGE_TOKEN}" \ --header "idempotency-key: records-${REQUEST_ID}" \ --data '{ "eventName": "record-returned", "count": 25, "metadata": { "requestedCount": 25 } }'Required rules
- Keep the provider API key and charge token on your server.
- Use a stable idempotency key for each logical event.
- Only return or process
chargedCountunits. - The event name must be active on the marketplace entry.
- Network, HTTP
429, and5xxretries must preserve the idempotency key. - Verification and production call the same charge endpoint. Verification
returns
verification: truewithout billing activity.
The default SDK base URL is https://api.agenticscraper.com/api/v1. The
provider charge operation is part of the same public REST API and OpenAPI
document as all other Agentic Scraper endpoints; the provider SDK remains a
separate server-side package so it is not confused with consumer client SDKs.