# Letting an AI agent pay a creator: Sendclap's x402 endpoint and MCP server, tested

> Sendclap's stateless MCP server and x402 v2 USDC endpoint on Base tested live on 2026-11-22: 9 tools, every 402 rejection code, server timings, and CREATE2 split verification.

Published November 22, 2026 on Sendclap Notes: https://blog.sendclap.com/sendclap-x402-and-mcp-server-tested/

[Sendclap](https://sendclap.com) gives an AI agent two ways to pay a creator without a browser: an HTTP 402 payment endpoint at `https://sendclap.com/x402/{handle}/...` for paying directly in USDC on Base at a flat 1% fee, and a stateless MCP server at `https://sendclap.com/mcp` for discovering what a creator sells, creating checkout links for humans, and reading a creator's own ledger. Neither endpoint asks the payer for an account, and on Base mainnet the agent does not even need ETH for gas because Sendclap submits the signed USDC transfer itself.

I tested both endpoints live against `sendclap.com` on 2026-11-22 and read the server code (`app/src/mcp.ts`, `app/src/x402.ts`, `app/src/server.ts`, `app/src/chain.ts`, and `contracts/src/SendclapSplit.sol` at commit `8432e113` of `backmeupplz/sendclap`). Below are the exact requests, responses, timings, and error codes I got back, plus what the code does once a payment settles.

## What an agent can do with the MCP server

The [Sendclap MCP server](https://sendclap.com/docs#mcp) sits at `POST https://sendclap.com/mcp`. It speaks JSON-RPC 2.0 over HTTP with one JSON response per POST and no session state. `GET /mcp` returns `405 Method Not Allowed` with `Allow: POST`. Notifications without an `id`, like `notifications/initialized`, return `202 Accepted` with an empty body.

Here is the live `initialize` call I ran on 2026-11-22:

```sh
curl -sS -X POST https://sendclap.com/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl-test","version":"1.0"}}}'
```

The server echoed `protocolVersion` (`2025-03-26`, defaulting to `2025-06-18` if omitted), returned `serverInfo` (`sendclap` v1.0.0), and reported `server-timing: app;dur=0.20` (0.20 ms of app time):

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-03-26",
    "capabilities": { "tools": {} },
    "serverInfo": { "name": "sendclap", "title": "Sendclap", "version": "1.0.0" },
    "instructions": "Sendclap (https://sendclap.com) lets people and agents pay creators. Use get_creator to see what a creator offers; its x402 URLs can be paid directly by an agent with USDC on Base, and create_checkout makes a link for a person to pay by card or crypto. Tools about \"your\" payments need the creator's API key."
  }
}
```

Calling `tools/list` (0.32 ms app time) returns all 9 tools even without an API key. Three are public and six require a creator's `Authorization: Bearer sc_…` header:

| Tool | Auth | Purpose |
| --- | --- | --- |
| `get_creator` | Public | Creator info, payment methods, tiers, products, x402 URLs |
| `create_checkout` | Public | Card or crypto checkout URL for a human payer |
| `get_checkout` | Public | Pending or paid status (email omitted) |
| `get_stats` | API key | 30-day and all-time totals, MRR, open disputes |
| `list_payments` | API key | Cursor-paged payments by status, type, or email |
| `get_payment` | API key | Payment detail, IP/device, activity log, evidence PDF |
| `list_members` | API key | Members with tier, interval, and period end |
| `list_licenses` | API key | License keys, device counts, and expiry |
| `list_disputes` | API key | Card disputes, status, and response deadline |

Two choices in the 87-line `app/src/mcp.ts` stood out when I read it and poked it live.

First, `get_checkout` strips the payer's `email` before returning the order. Because `get_checkout` needs no API key and crypto order IDs are visible on-chain, anyone watching Base could otherwise look up a checkout ID and pull out the buyer's email address. Leaving it out closes that leak.

Second, every error carries the same machine-readable `code` as the REST API. Protocol errors put it in `error.data.code`: an unknown tool returns `-32602` (`not_found`), invalid JSON returns HTTP 400 with `-32700` (`bad_request`), and batching more than 20 requests in one POST array returns HTTP 400 with `-32600` (`at most 20 requests per batch`). A batch of two (`ping` plus `get_creator` for `"@demo"`, which strips the leading `@`) answered HTTP 200 with a two-element array.

Tool-level errors return HTTP 200 with `isError: true` and `structuredContent: { error, code }`. Calling `get_stats` without a token returned `invalid_api_key`, calling `get_creator` on a missing handle returned `not_found`, and calling `create_checkout` with `method: "card"` on the [demo page](https://sendclap.com/demo) (which has crypto and x402 enabled, not Stripe) returned `method_unavailable`.

Discovery starts with `get_creator`. Passing `"demo"` returned `payment_methods: { card: false, crypto: true, ton: false, x402: true }` plus ready-to-call x402 URLs for a $5 tip, two membership tiers (`/x402/demo/memberships/1` and `/2`), and the $29 Pro license (`/x402/demo/products/1`). Calling `get_creator` on `borodutch` showed `card: true, crypto: true, x402: true` and its tip URL.

## How the x402 payment flow works

[x402](https://www.x402.org) puts payments on HTTP status `402 Payment Required` so a client can fetch a URL, read the price, sign a transfer, and repeat the request. Sendclap implements x402 v2 (`exact` scheme, USDC on Base) across three routes on both `GET` and `POST`:

- `/x402/{handle}/tip?amount=5` (optional `message`; defaults to the creator's suggested tip; `$1` to `$10,000` USD)
- `/x402/{handle}/products/{id}?email=buyer@example.com` (`?email=` required)
- `/x402/{handle}/memberships/{id}?email=buyer@example.com` (`?email=` required; optional `period` must match the tier's interval)

Running `curl -i "https://sendclap.com/x402/demo/tip?amount=5"` with no payment header returned HTTP 402 in 0.79 ms, with the terms base64-encoded in `PAYMENT-REQUIRED` and repeated in JSON in the body:

```json
{
  "x402Version": 2,
  "error": "PAYMENT-SIGNATURE header is required",
  "resource": {
    "url": "https://sendclap.com/x402/demo/tip?amount=5",
    "mimeType": "application/json",
    "description": "A $5 tip for Ada Builds"
  },
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:8453",
    "amount": "5000000",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "payTo": "0x356fA73928F97900F923B503515F93dB7Ab82eB3",
    "maxTimeoutSeconds": 120,
    "extra": { "name": "USD Coin", "version": "2" }
  }],
  "extensions": {}
}
```

`/x402/demo/products/1?email=agent@example.com` returned `"amount": "29000000"` ($29 in 6-decimal USDC), and `/x402/demo/memberships/1?email=agent@example.com` returned `"amount": "5000000"` for one month of Supporter. Leaving `?email=` off the product returned HTTP 400 (`bad_request`), passing `period=year` on that monthly tier returned HTTP 400 (`this tier is paid per month, so period must be month`), and passing `amount=0` or `amount=10001` returned HTTP 400 (`amount must be between 1 and 10000 (USD)`).

That $1 minimum exists because of how settlement works on mainnet. On Base Sepolia testnet, Sendclap defaults to `https://x402.org/facilitator`. On Base mainnet, `X402_FACILITATOR` is blank by default, so Sendclap runs `settleOurselves()` in `app/src/x402.ts` and acts as its own facilitator.

When an agent repeats the request with a base64-encoded `PAYMENT-SIGNATURE` header, the payload holds an EIP-3009 `transferWithAuthorization` signature for Base USDC (EIP-712 domain `"USD Coin"`, version `"2"`). Sendclap's keeper simulates the call against Base, submits the transaction, and pays the gas. Because the signature binds sender, recipient, amount, time window, and nonce, the keeper cannot redirect funds or change the amount. The agent wallet only needs USDC on Base and zero ETH for gas, and the $1 floor ensures the 1% fee (at least 1¢) covers settlement gas.

## Testing every x402 rejection path live

Without spending USDC, I sent eight malformed or tampered `PAYMENT-SIGNATURE` headers to `https://sendclap.com/x402/demo/tip?amount=5` to see what fails locally versus on Base:

| Input | HTTP | Returned `error` | App time |
| --- | --- | --- | --- |
| Garbage base64 | 402 | `invalid_payload` | <1 ms |
| Wrong network (`eip155:84532`) | 402 | `invalid_network` | 0.81 ms |
| Tampered `payTo` | 402 | `invalid_exact_evm_payload_recipient_mismatch` | 1.11 ms |
| Underpaid `value` (4 vs 5 USDC) | 402 | `invalid_exact_evm_payload_authorization_value_mismatch` | 0.50 ms |
| `validBefore` 2 s out | 402 | `invalid_exact_evm_payload_authorization_valid_before` | 1.21 ms |
| `validAfter` 60 s ahead | 402 | `invalid_exact_evm_payload_authorization_valid_after` | 0.79 ms |
| Bad sig, funded addr (`0x…dEaD`) | 402 | `invalid_exact_evm_payload_signature` | 35.90 ms |
| Bad sig, empty addr (`0x9999…1234`) | 402 | `insufficient_funds` | 23.06 ms |

The first six checks stay in memory: `settle()` ignores the client's copy of the terms, validates `accepted` and `authorization` against Sendclap's own freshly built requirement, and enforces a 6-second buffer on `validBefore`. Those all reject in roughly a millisecond.

Once the fields match, `settleOurselves()` runs `simulateContract` on Base mainnet USDC's `transferWithAuthorization`. When that reverts, Sendclap calls `balanceOf(from)` to distinguish a short wallet (`insufficient_funds`, 23.06 ms for the empty address) from a bad signature (`invalid_exact_evm_payload_signature`, 35.90 ms for `0x…dEaD`, which holds more than 5 burned USDC on Base). That extra read makes debugging an agent wallet far clearer than a generic revert.

## Verifying the split address on Base mainnet

`payTo` in the 402 challenge is not the creator's own wallet. For `demo`, `payTo` is `0x356fA73928F97900F923B503515F93dB7Ab82eB3`; for `borodutch`, it is `0x75EaDB556bc923D92716BECD9CC039A9dc6CafF2`. Calling `eth_getCode` on both at Base block 60,757,165 returned `0x` (no bytecode deployed yet).

That is intentional. `SendclapSplitFactory` (`0xd701C33Cdd1A12eB559D2358300a196D670F5627`) computes a deterministic CREATE2 EIP-1167 minimal proxy address per creator wallet. Calling `addressOf(0x7DE1cf8ce35B7B5b784379dA038e011F26d4489B)` (the demo wallet from `app/src/server.ts`) on Base mainnet returned `0x356fa73928f97900f923b503515f93db7ab82eb3`, matching `payTo` byte for byte. Both `feeBps()` and `MAX_FEE_BPS()` returned `100` (1%, hard-capped on-chain).

Right after a payment settles, `server.ts` fires `releaseSplit(creatorWallet)` in the background so the agent gets its HTTP 200 without waiting for a second block. `release(creator)` deploys the 45-byte proxy on the first payment and sends 99% to the creator and 1% to Sendclap. If that call fails, `releaseWaiting` in `app/src/chain.ts` sweeps creators paid over x402 in the last 24 hours whenever the split holds at least 1 USDC, and anyone can call `release(creator)` directly on-chain. I covered the contract layout in [how Sendclap takes crypto payments without holding the money](https://blog.sendclap.com/taking-crypto-payments-without-holding-the-money/).

## What comes back after paying (and what I did not run)

Because this worker holds no funded Base wallet and no creator `sc_…` API key, I did not broadcast a live USDC transfer, call the 6 authenticated creator MCP tools, or create a live pending order with `create_checkout`. I also did not run `bun test` locally because Bun is not installed here. Post-settlement behavior comes from reading `x402Pay` in `app/src/server.ts` and `app/test/app.test.ts` at commit `8432e113`:

- **Tips** return `{ paid: true, amount, currency: "usd", to, payer, transaction, network, message }` and a base64 `PAYMENT-RESPONSE` header with the transaction hash.
- **Digital products** record `x402:<txHash>` (making retries idempotent), issue a per-device license key and download token when configured, and return `license_key` and `download_url` in JSON. Those keys work with the [per-device license validation API](https://blog.sendclap.com/software-license-keys-without-gumroad-curl-tested/).
- **Memberships** buy one prepaid period (`month` or `year`) for `?email=` and return `active_until` and `renews: false` (plus `license_key` if the tier includes one). Paying again before `active_until` extends from the current period end rather than from today.

## Wiring it into an agent

Adding the MCP server to Claude Code, Cursor, or another HTTP MCP client takes six lines of JSON (omit `headers` if the agent only needs the three public tools):

```json
{
  "mcpServers": {
    "sendclap": {
      "type": "http",
      "url": "https://sendclap.com/mcp",
      "headers": { "Authorization": "Bearer sc_your_key" }
    }
  }
}
```

For autonomous x402 payments in Node or TypeScript, [Sendclap's docs](https://sendclap.com/docs#x402) show `@x402/fetch` with `@x402/evm` and `viem`. Keep `spendControls.maxAmountPerPayment` set low so a stray prompt cannot drain the wallet.

To try the endpoints or set up a creator page that people and agents can pay at a flat 1% fee, start on [sendclap.com](https://sendclap.com) or read the [API, MCP, and x402 docs](https://sendclap.com/docs) and [how the 1% fee works](https://sendclap.com/fees). Sendclap is non-custodial and not a merchant of record, so creators handle their own taxes.

## FAQ

### Does an AI agent need ETH for gas to pay a Sendclap x402 URL?

No. On Base mainnet, the agent signs an off-chain EIP-3009 USDC authorization and sends it in `PAYMENT-SIGNATURE`. Sendclap's keeper submits the transaction on Base and pays the gas, so the wallet only needs USDC.

### Why is there a $1 minimum on x402 tips?

Sendclap's keeper pays Base gas to settle the transfer and forward the 99% / 1% split, so `/x402/{handle}/tip` enforces a `$1` to `$10,000` range to cover settlement costs.

### Can an AI agent buy a recurring membership over x402?

x402 authorizes one transfer at a time, so paying `/x402/{handle}/memberships/{id}?email=…` buys one prepaid month or year (`renews: false`). Paying again before `active_until` extends from the current period end.

### Does Sendclap collect VAT or sales tax on x402 or MCP checkouts?

No. Sendclap is non-custodial and not a merchant of record. Creators receive 99% straight to their own Stripe account (minus Stripe's card processing fee) or Base wallet and handle their own taxes.

