AgentKit x402
Pay-per-call utility API for agents over x402 (USDC on Base): email/domain checks, DMARC audit, site audit, URL to markdown, IBAN validators.
Hosted MCP Server
npx add-mcp 'https://agentkit-x402.erikssonanton2001.workers.dev/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
Pay-per-call utility API and remote MCP server for AI agents on Cloudflare Workers, paid in USDC via x402: email validation, SPF/DMARC, DNS, site contacts, URL to Markdown, IBAN, Swedish validators.
- JavaScript 100%
AgentKit x402
Give an AI agent small, composable tools without an account or API key: validate an email before sending, inspect SPF/DMARC/DKIM, look up DNS, turn a public page into Markdown, extract published contacts, audit SEO, validate IBANs, or handle Swedish personnummer, orgnr, bankgiro and bank-day calculations. Each request is an HTTP GET returning JSON and is paid in USDC on Base with x402 v2.
Prices and endpoints
| Endpoint | Price | Use case |
|---|---|---|
/v1/email-check?email= | $0.002 | Syntax, disposable/role/free-provider flags, typo suggestion and MX/A checks |
/v1/email-auth?domain= | $0.01 | SPF, DMARC, DKIM selector, MX, BIMI, MTA-STS and TLS-RPT audit |
/v1/domain-dns?domain= | $0.005 | A, AAAA, NS, MX, TXT, CAA, SOA, CNAME, DNSSEC records |
/v1/site-contacts?url= | $0.02 | Published emails, phones, socials, address hints and Swedish org numbers |
/v1/site-audit?url= | $0.02 | One-page technical SEO and technology audit |
/v1/url-markdown?url= | $0.005 | Static HTML to clean Markdown for an LLM |
/v1/se/validate?type=&value= | $0.001 | Swedish personnummer, samordningsnummer, orgnr, bankgiro, plusgiro and OCR |
/v1/iban?iban= | $0.001 | IBAN format and mod-97 validation |
/v1/se/account-to-iban?clearing=&account= | $0.002 | Swedish account to IBAN/BIC with checksum |
/v1/bank-days?from=&add= | $0.001 | Swedish bank-day arithmetic |
Static examples are free at /v1/demo/{slug}. Discovery documents are /openapi.json, /llms.txt and /.well-known/x402.
MCP
The remote MCP endpoint is https://agentkit-x402.erikssonanton2001.workers.dev/mcp (streamable HTTP, JSON-RPC 2.0). Claude Desktop or Cursor can use the mcp-remote bridge:
{
"mcpServers": {
"agentkit-x402": {
"command": "npx",
"args": ["mcp-remote", "https://agentkit-x402.erikssonanton2001.workers.dev/mcp"]
}
}
}
Free tools include pricing and demo. Paid tools return payment requirements when called without PAYMENT-SIGNATURE; resend the MCP request with an x402 v2 payment payload or call the REST endpoint directly. Most MCP clients cannot sign x402 payments, so use an x402-capable client (for example, an @x402/fetch wrapper) when calling paid tools.
Payment: 402 → sign → retry
An unpaid call intentionally returns 402 Payment Required; it does not charge anything.
# 1. Request the resource and save/read the PAYMENT-REQUIRED header.
curl -i 'https://agentkit-x402.erikssonanton2001.workers.dev/v1/email-check?email=anna@example.com'
# 2. Have an x402 v2 exact-scheme client sign that header's requirements
# with a wallet funded in USDC on Base. The signature is request-specific.
# 3. Retry with the client-produced header (placeholder shown here).
curl -i \
-H 'PAYMENT-SIGNATURE: <base64 x402 v2 payment signature>' \
'https://agentkit-x402.erikssonanton2001.workers.dev/v1/email-check?email=anna@example.com'
In JavaScript, the official x402 fetch wrapper performs steps 1–3:
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const signer = privateKeyToAccount(process.env.PRIVATE_KEY);
const client = new x402Client().register("eip155:*", new ExactEvmScheme(signer));
const payFetch = wrapFetchWithPayment(fetch, client);
const response = await payFetch(
"https://agentkit-x402.erikssonanton2001.workers.dev/v1/email-check?email=anna@example.com"
);
console.log(await response.json());
Python
Use any x402-compatible Python client/wallet library you already use. The protocol flow is ordinary HTTP: make the GET with requests, read the base64 PAYMENT-REQUIRED header on 402, sign its exact requirements with a Base wallet, then retry with PAYMENT-SIGNATURE.
import requests
url = "https://agentkit-x402.erikssonanton2001.workers.dev/v1/iban?iban=GB82WEST12345698765432"
first = requests.get(url)
if first.status_code == 402:
requirements = first.headers["PAYMENT-REQUIRED"]
signature = sign_x402_exact(requirements) # supplied by your x402 client
result = requests.get(url, headers={"PAYMENT-SIGNATURE": signature})
else:
result = first
result.raise_for_status()
print(result.json())
Funding USDC on Base
- Use a wallet that supports Base and the x402 exact scheme.
- Acquire USDC and select Base as the network when withdrawing or bridging; do not send on Ethereum or another chain.
- Fund the wallet address used by your signer with enough USDC for the calls you expect (plus a small amount of Base ETH for wallet transactions if your wallet requires it).
- Start with a free
/v1/demo/{slug}response, then make a paid request. The 402 requirements and/.well-known/x402identify the network, USDC contract and pay-to address for the deployment.
Errors and charging
Payment is settled only for HTTP 2xx responses. Every error JSON includes charged: false; a 402 is also uncharged because no payment has been accepted yet.
| HTTP status | Error codes | Charged? |
|---|---|---|
| 400 | missing_*, invalid_* (including invalid_url, invalid_email, invalid_domain, invalid_iban, invalid_input, invalid_type, invalid_value, invalid_from, invalid_add, invalid_mode) | No |
| 403 | blocked_by_robots | No |
| 404 | domain_not_found or unknown route | No |
| 402 | Payment required / invalid or missing payment | No |
| 502 | upstream_error, robots_unavailable, redirect_blocked, dns_unavailable | No |
| 504 | upstream_timeout | No |
| 500 | internal_error | No |
Limits and honest notes
- Email checks are syntax, lists and DNS (including MX/A) only; they do not make an SMTP connection, so mailbox deliverability is not confirmed.
- No JavaScript is rendered. Pages are limited to 1.5 MB, about 6 outbound requests per call and an 8-second timeout.
robots.txtis honoured. - Swedish validators check formats and checksums; they do not prove that a person, company or account exists. DNS uses one Cloudflare DoH resolver.
- The service has no application-level storage and no KV/D1 database. Contact extraction returns only information a site publishes; callers remain responsible for lawful use (including GDPR).
- It runs on the Cloudflare Workers free plan; rate limits, CPU limits and upstream failures can occur. Failed HTTP 4xx/5xx calls are not settled.
Development
npm test # builds dist/worker.js, then runs node --test (no network needed)
npm run build # esbuild bundle
npm run make-deploy
Optional Worker variables: PAY_TO, NETWORK (default eip155:8453), FACILITATOR_URL, and PUBLIC_BASE_URL. The bundle includes a minimal Buffer shim because the Worker is deployed without nodejs_compat.
Attribution and licence
Disposable-domain data comes from the bulk-email-verifier-mx project. Swedish validators, clearing data and calendar logic are adapted from SweKit (https://codeberg.org/moneyman-code/swekit-api). Source: https://codeberg.org/moneyman-code/agentkit-x402. MIT; see LICENSE.