Skip to content

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-token
x-agentic-charge-run-id
x-agentic-charge-mcp-id
x-agentic-charge-selection-id
x-agentic-charge-max-total-usd

Read 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

Terminal window
npm install agentic-scraper-provider-sdk
import {
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

Terminal window
pip install agentic-scraper-provider-sdk
from 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:

Terminal window
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 chargedCount units.
  • The event name must be active on the marketplace entry.
  • Network, HTTP 429, and 5xx retries must preserve the idempotency key.
  • Verification and production call the same charge endpoint. Verification returns verification: true without 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.