Integrate without the SDK
You can call Assay from any language that speaks HTTP. Free calls are plain MCP requests. Paid calls add one signed voucher, built from the protocol spec in the public assay-sdk repository. This page is the overview; the protocol spec is the full contract.
MCP over HTTP
Section titled “MCP over HTTP”Each request is one POST of one JSON-RPC 2.0 request to an MCP URL: https://mcp.goassay.ai/ (Everything), or a tool set or single-tool URL (see Tool sets and single tools). The answer is one JSON-RPC response. There is no session and no handshake to keep.
| Header | Value |
|---|---|
Authorization |
Bearer <API key> |
Content-Type |
application/json |
Accept |
application/json, text/event-stream |
MCP-Protocol-Version |
The MCP revision your client speaks. The reference SDKs send 2026-07-28. |
The API key needs the Call tools permission. Send it only to the Assay hosts, and do not follow redirects with it attached.
The three tools
Section titled “The three tools”| Tool | What it does | Charge |
|---|---|---|
search_tools |
Find tools by what they do. | Free |
get_tool |
Read one tool’s schemas, version and price. | Free |
call_tool |
Run a tool by name, with name and arguments. |
The tool’s price |
You can also call a catalogue tool directly by its name, as the SDKs do. Arguments and results are in MCP tools.
curl -s https://mcp.goassay.ai/ \ -H "Authorization: Bearer $ASSAY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "MCP-Protocol-Version: 2026-07-28" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_tools","arguments":{"query":"weather","detail":"names","limit":3}}}'A free call is the same tools/call with the tool’s name and arguments. Add an idempotency key in params._meta, beside name and arguments:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "weather_forecast", "arguments": { "city": "Lisbon" }, "_meta": { "assay/idempotency-key": "7f8c1f9e-3c1a-4c55-9a51-2b8f3d0f6a10" } }}The result carries _meta["assay/receipt"] with what the call cost; a free call’s charge is zero.
Tool sets and single tools
Section titled “Tool sets and single tools”The same requests work on every MCP URL; only the URL changes. The URL types are in Choose a URL. On a tool set URL, tools/list returns the set’s tools with their prices in _meta["assay/price"]:
URL="https://mcp.goassay.ai/my/research"curl -s "$URL" \ -H "Authorization: Bearer $ASSAY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "MCP-Protocol-Version: 2026-07-28" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'A single-tool URL lists and calls one tool. Quote it in the shell, because of the ?:
URL="https://mcp.goassay.ai/?tools=get_weather"curl -s "$URL" \ -H "Authorization: Bearer $ASSAY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "MCP-Protocol-Version: 2026-07-28" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
curl -s "$URL" \ -H "Authorization: Bearer $ASSAY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "MCP-Protocol-Version: 2026-07-28" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_weather","arguments":{"city":"Lisbon"},"_meta":{"assay/idempotency-key":"b1d4e0a2-6f0e-4b8e-9d0c-1a2b3c4d5e6f"}}}'Call a tool set’s tools the same way, by name, on the tool set URL. A provider tool’s name is {handle}__{tool}, sent unchanged. When your agent’s access is a tool set, its tools work only through that tool set’s URL; through / they get TOOL_NOT_ALLOWED.
The tools/list result’s _meta may carry:
| Key | Meaning |
|---|---|
assay/toolsetVersion |
The tool set version served, on a URL without @n. |
assay/sharingEnds |
Sharing of this tool set is ending, and when. |
assay/renamed |
The handle in the URL was renamed. Use the new one. |
assay/ignoredTools |
Names in ?tools= that this URL does not serve. |
The same tool can quote a different price on two URLs, because a tool set’s entry rules apply. Keep quotes per URL. A link-only URL (/u/{token}) holds a secret: never print or log it.
Refusals
Section titled “Refusals”| Where | What it looks like |
|---|---|
| A tool result | isError: true and _meta["assay/error"] with code, message, retryable and, when given, retryAfter or retryAfterMs, fixUrl, intentId, details. A result with isError: true and no assay/error is the provider’s own tool error. |
| A missing permission | A plain HTTP 403 with a REST error body, sent before any JSON-RPC is read: {"success": false, "error": {"code": "AUTH_SCOPE_MISSING", "context": {"requiredScope": "tools:call"}, ...}}. Read any answer that is not JSON-RPC as a REST error. |
| An unknown URL | A plain HTTP 404 with MCP_URL_NOT_FOUND in a REST error body, sent before any JSON-RPC is read. The host serves no such URL to this key. |
| A rate limit | JSON-RPC error -32029 with data.code: "RATE_LIMITED" and, when given, retryAfterMs. |
Branch on the code, never on the message.
The paid-call flow
Section titled “The paid-call flow”Bind your payment key once
Section titled “Bind your payment key once”The payment key is an EVM key you hold. Prove you hold it with the binding challenge in spec section 5: check every field of the challenge, sign the DelegateBinding typed data you rebuilt yourself, and send the signature. A person then approves the key once in the web app at https://portal.goassay.ai/agents/enable-paid?credential=<credential id>#key=<address>, comparing the fingerprint. Binding needs the Pay permission.
Call the tool without a voucher
Section titled “Call the tool without a voucher”Send tools/call with an assay/idempotency-key. A paid tool answers isError: true with _meta["assay/error"].code = "PAYMENT_REQUIRED" and the requirement in _meta["x402/paymentRequired"]: the network, payer, escrow (payTo), provider, exact amount, resource, requestHash, seq and maxTimeoutSeconds. Nothing is charged, and the idempotency key is free for the next step.
A key without the Pay permission gets AUTH_SCOPE_MISSING with requiredScope: "payments" instead. Do not sign or resend: only a key with Pay fixes it.
Check the requirement, then sign the voucher
Section titled “Check the requirement, then sign the voucher”Check the requirement on your side before signing (spec section 9). The minimum is:
- The network, escrow, asset and decimals equal your own pinned network table, never values from the server.
- The requirement accepts a
delegatesigner and names your key. - The amount fits your local limits per call and per 24 hours.
resourceis exactly/mcp/tools/<the tool you called>.
Then build and sign the EIP-712 Voucher (spec section 6): domain Assay Settlement, version 2, the chain id of the network, and the escrow as verifyingContract. issuedAt is your clock corrected by the server’s Date header, at most 120 seconds either way (spec section 7). expiresAt is issuedAt plus at most 240 seconds.
Resend the same call with the voucher
Section titled “Resend the same call with the voucher”Send the same tools/call again: the same name, the same arguments and the same assay/idempotency-key, plus the signed envelope in _meta["assay/voucher"]:
{ "_meta": { "assay/idempotency-key": "7f8c1f9e-3c1a-4c55-9a51-2b8f3d0f6a10", "assay/voucher": { "voucher": { "payer": "...", "payTo": "...", "provider": "...", "amount": { "amount": "100000", "asset": "...", "decimals": 6 }, "resource": "/mcp/tools/weather_forecast", "requestHash": "sha256:...", "seq": "42", "issuedAt": 1785999800, "expiresAt": 1786000040 }, "signature": "0x...", "providerId": "..." } }}Add contractVersion when the requirement had one. The server checks the voucher, serves the call and returns the result with its receipt.
Sign at most one voucher per call. If the signed resend fails on the network, resend the same envelope; never sign a second one for that attempt. Remove any assay/voucher you did not build yourself before sending a request.
Channel vouchers
Section titled “Channel vouchers”On Robinhood Chain, Assay pays calls on a payment channel: instead of one voucher per call, the client signs one running total per channel, and Assay settles many calls on chain in one transaction. The per-call voucher above stays as the fallback, so a client that only signs per-call vouchers keeps working, but each of its calls costs more on chain. The wire format is in section 12 of the protocol spec, with test vectors in vectors/eip155/channel.json; this is the overview.
| Step | What to send or read |
|---|---|
| Offer channels | Add params._meta["assay/paymentSchemes"] = ["channel-v1", "voucher"] to every tools/call, the unsigned attempt and the signed resend. Without it, Assay never offers a channel. |
| Read the offer | PAYMENT_REQUIRED always carries the per-call requirement. With a channel offer it adds _meta["assay/channelRequired"]. Run every check on the per-call requirement first, then check that the offer names the same network, payer, provider, provider id, payment key and price, and exactly your own escrow domain (name: "Assay Settlement", version: "2"). If any check fails, pay that call per call. |
| Send the voucher | Put { voucher, signature, providerId, contractVersion } under params._meta["assay/channelVoucher"] on the signed resend. |
The EIP-712 type is ChannelVoucher(address payer,address provider,bytes32 channelId,uint64 cumulative,uint32 calls,uint64 issuedAt,uint64 expiresAt), under the same domain as Voucher. A lane is one channelId (32 random bytes you choose) for one payer, signer and provider. cumulative is the running total you authorize on that lane, and calls the running call count. A voucher lives at most 240 seconds (expiresAt - issuedAt).
| Rule | Detail |
|---|---|
| Your own record | Keep the lane’s last signed cumulative and calls yourself, and save them before you sign, so they survive a restart. Never take a cumulative, call count or “last accepted” value from the server. |
| Next voucher | cumulative = previous cumulative + price, calls = previous calls + 1, in integer arithmetic. |
| Spend guards | Your per-call and per-24-hour limits count the increase only: cumulative − previous cumulative. Show that increase to the person, not the running total. |
| Check against the chain | Before you continue a lane after a restart, or after 10 minutes, read channelBooks(key, payer) on the escrow at one pinned block (settled is bits 0 to 55 of state, calls bits 56 to 79; key is keccak256(abi.encode(payer, signer, provider, channelId))). If the chain shows more than your record, retire the lane and open a new one. Without a reliable read, pay that call per call. |
| One lane, one call at a time | A lane signs one in-flight call at a time. Use more lanes for parallel calls. |
CHANNEL_ROTATE |
Retire the lane (do not count it as a failure). Nothing was charged. You may pay the next call on a new lane with a new channelId; the official clients sign nothing more in the refused call and report a retryable error. |
CHANNEL_LIMIT, CHANNEL_SIGNER_EXPIRING, CHANNEL_NOT_OFFERED |
The voucher was not stored. You may keep the lane (its next voucher re-signs the same pair) or retire it; both are safe. The official clients keep it and pay per call for an hour. |
CHANNEL_DESYNC |
Retire the lane. |
PAYMENT_UNSETTLED_LIMIT |
Earlier payments are still settling. Nothing was charged. Retry the call after retryAfter, following the lane rules in the protocol spec. |
| Any other refusal or an unknown outcome | Retire the lane. A network retry resends the same envelope. |
PAYMENT_DEBT_OUTSTANDING |
An earlier payment is owed. For a debt with voucherFormat: "CHANNEL" in GET /escrow/debts, re-sign the stored (cumulative, calls) pair on the lane it names, with fresh times, and send it as { "channelVoucher": { voucher, signature } } to POST /escrow/debts/{intentId}/voucher. Never sign a larger pair, a pair the server refused, or another lane. See section 12.6 of the spec. |
A channel lane settles on chain about 30 minutes after its first call not yet recorded, sooner when that amount reaches $5 or a voucher nears its deadline. The receipt shows the refund deadline once it does.
Idempotency rules
Section titled “Idempotency rules”| Rule | Detail |
|---|---|
| Format | 1 to 128 printable ASCII characters. Anything else is refused with MCP_IDEMPOTENCY_KEY_INVALID. |
| One key, one call | Send the same key on the unsigned attempt, the signed resend and every network retry. The same key with another tool or other arguments is refused with IDEMPOTENCY_KEY_REUSED. |
| Replay | A key whose call returned a result answers with the stored result, marked _meta["assay/replayed"] = true, and charges nothing again. |
| In flight | While the first attempt runs, a retry gets IDEMPOTENCY_IN_PROGRESS with retryAfter in seconds. |
| No key | Every request is a new call. The server never derives a key from the arguments. |
Test your client
Section titled “Test your client”The test vectors are the conformance suite. The Node and Python SDKs run the same files.
| File | Spec | What it checks |
|---|---|---|
vectors/eip155/vouchers.json |
Section 6 | The wire voucher, typed data, hashes and signature you build from a requirement |
vectors/eip155/binding.json |
Section 5 | Valid binding challenges to sign and invalid ones to refuse, naming the field |
vectors/eip155/guards.json |
Section 9 | The local checks G1 to G12, their order and codes |
vectors/eip155/seq.json |
Section 9 | The bounds of seq |
A client conforms when it passes vouchers.json and binding.json. Passing guards.json and seq.json too is strongly advised. The chain id, escrow and asset in the vectors are placeholders, and the test key is a public test account: never fund it.
Errors
Section titled “Errors”The codes a client must handle for this flow are in the Errors reference and in spec section 10.
