Get paid per request
Standard HTTP payment headers, an EVM wallet, and canonical USDG.
claude mcp add ordinal -- npx -y @ordinal402/ordinal-mcp@latestStart here
#introductionThe model
Ordinal coordinates discovery, provider selection, and paid execution. Providers publish a JSON capability and a per-call USDG price. Agents select a service from the registry, satisfy its x402 challenge on Robinhood Chain, and receive the provider result.
Publish an HTTPS endpoint
Keep your business logic on your server. Ordinal validates, meters, and settles each accepted call to your Robinhood Chain wallet.
Give an agent a paid fetch
One npx command connects your client. The agent discovers services, reads their schemas, and pays per call from a wallet you control.
Trust boundary
Ordinal never asks for a seed phrase or private key. The payer signs through its own EVM signer, while the provider receives USDG at the registered payout address. Live routes fail closed when the facilitator is missing or does not advertise exact support for Robinhood Chain.
Settlement
#paymentsProtocol flow
- The agent posts valid JSON to
/api/services/[id]/call. - Ordinal responds
402with a base64 x402 v2 challenge inPAYMENT-REQUIRED. - The wallet signs the exact EVM token payment and retries with
PAYMENT-SIGNATURE. - The facilitator verifies the signed transaction before Ordinal invokes the provider.
- After a valid provider response, the facilitator settles it and Ordinal returns
PAYMENT-RESPONSE.
Input schema validation runs before the payment challenge. Invalid input returns400 and never reaches payment verification.
Challenge fields
| Field | Ordinal value | Meaning |
|---|---|---|
| x402Version | 2 | Protocol version. |
| scheme | exact | Exact fixed-price settlement. |
| network | eip155:4663 | Robinhood Chain mainnet CAIP-2 identifier. |
| asset | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 | Canonical Robinhood Chain USDG contract. |
| amount | 50000 | Atomic USDG units; 50,000 = 0.05 USDG. |
| payTo | EVM address | Provider payout wallet. |
| maxTimeoutSeconds | 60 | Maximum authorization window. |
| extra.feePayer | Facilitator address | Supplied by the selected facilitator. |
Canonical IDs
1{
2 "network": "eip155:4663",
3 "asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
4 "symbol": "USDG",
5 "decimals": 6,
6 "scheme": "exact"
7}Testnet uses eip155:46630. Its USDG contract must be supplied through ROBINHOOD_TESTNET_USDG_ADDRESS; Ordinal hides testnet listings until that address is configured and valid.
Providers
#providersPublish a service
- Connect an EVM wallet through Privy and switch to Robinhood Chain.
- Publish a reachable HTTPS endpoint that accepts and returns JSON.
- Provide input and output JSON Schemas plus a per-call USDG price.
- Use the connected EVM address as the payout address.
- Submit for review; only approved services enter public discovery.
The upstream URL remains private in public registry responses. Agents call the Ordinal gateway, which applies validation, payment, and provider-output checks.
Production checks
| Check | Required behavior |
|---|---|
| Payout address | Valid EVM address; Ordinal stores checksum casing. |
| Currency | USDG only, six decimals. |
| Facilitator | Must advertise exact support for eip155:4663. |
| RPC | Use a production Robinhood Chain provider; the public RPC is rate-limited. |
| Failure mode | No facilitator or invalid challenge means no provider execution. |
Agents
#agentsInstall the bridge
@ordinal402/ordinal-mcp connects an agent to the marketplace and lets it pay from its own wallet. It runs on your machine, and that is the point: the exact scheme needs an EIP-712 signature from the payer for every payment, so a hosted server could only pay for you by holding your key. Browsing is forwarded to Ordinal untouched. Signing happens locally, and only the signature ever leaves your machine.
It needs Node 18 or newer and nothing else — no global install, no build step, no account. Every client below runs the same command and differs only in where its configuration lives.
1npx -y @ordinal402/ordinal-mcp@latest| Variable | Required | Purpose |
|---|---|---|
| ORDINAL_PRIVATE_KEY | for paid calls | Payer key: 0x followed by 64 hex characters. Leave it out and browsing and free trials still work. |
| ORDINAL_URL | no | Marketplace origin. Defaults to https://ordinal402.xyz. |
| ORDINAL_MCP_TOKEN | no | Bearer token, only for a self-hosted marketplace that gates its own MCP endpoint. |
Set up your client
Pick your client, paste the block, restart it. Replace 0xYOUR_KEY with the payer key. Any client not listed here almost certainly accepts the JSON shape at the bottom.
1claude mcp add ordinal \
2 -e ORDINAL_PRIVATE_KEY=0xYOUR_KEY \
3 -- npx -y @ordinal402/ordinal-mcp@latest
4
5# verify
6claude mcp list1[mcp_servers.ordinal]
2command = "npx"
3args = ["-y", "@ordinal402/ordinal-mcp@latest"]
4
5[mcp_servers.ordinal.env]
6ORDINAL_PRIVATE_KEY = "0xYOUR_KEY"Restart Codex after editing the file. The env table must come after args: in TOML every key/value pair belongs to the section above it, so a key placed under [mcp_servers.ordinal.env] and then followed by more server settings will not load.
1{
2 "mcpServers": {
3 "ordinal": {
4 "command": "npx",
5 "args": ["-y", "@ordinal402/ordinal-mcp@latest"],
6 "env": { "ORDINAL_PRIVATE_KEY": "0xYOUR_KEY" }
7 }
8 }
9}macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. Windows: %APPDATA%\Claude\claude_desktop_config.json. Quit and reopen the app — a window reload is not enough.
1{
2 "mcpServers": {
3 "ordinal": {
4 "command": "npx",
5 "args": ["-y", "@ordinal402/ordinal-mcp@latest"],
6 "env": { "ORDINAL_PRIVATE_KEY": "0xYOUR_KEY" }
7 }
8 }
9}Use .cursor/mcp.json inside a repository to scope it to one project instead. Windsurf takes the same shape at ~/.codeium/windsurf/mcp_config.json, and Gemini CLI reads it from ~/.gemini/settings.json.
1{
2 "servers": {
3 "ordinal": {
4 "type": "stdio",
5 "command": "npx",
6 "args": ["-y", "@ordinal402/ordinal-mcp@latest"],
7 "env": { "ORDINAL_PRIVATE_KEY": "0xYOUR_KEY" }
8 }
9 }
10}VS Code names the object servers rather than mcpServers and wants an explicit "type": "stdio". Ordinal's tools appear in agent mode.
1ORDINAL_PRIVATE_KEY=0xYOUR_KEY npx -y @ordinal402/ordinal-mcp@latestThe bridge speaks JSON-RPC 2.0 over stdin and stdout. Any MCP client that can launch a command works, including your own.
Fund the payer wallet
Three things make a wallet able to pay: it must be a plain externally owned account, it must hold USDG, and it must have approved Permit2 once.
- Generate or pick an EOA. Not a smart-contract wallet, and not an account carrying an EIP-7702 delegation — see what a paid call costs.
- Send it USDG on Robinhood Chain, plus a small amount of ETH for step three.
- Approve Permit2 to spend that USDG. One transaction, once per wallet, ever.
1# USDG -> Permit2, once per wallet. Approves a fixed 25 USDG;
2# raise it or use type(uint256).max if you would rather not repeat this.
3cast send 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 \
4 "approve(address,uint256)" \
5 0x000000000022D473030F116dDEE9F6B43aC78BA3 \
6 25000000 \
7 --rpc-url https://rpc.mainnet.chain.robinhood.com \
8 --private-key 0xYOUR_KEYAfter that every payment is gasless for the payer. Ordinal's relayer broadcasts each settlement and pays its gas; the payer only ever signs. The approval is what a payment draws against, so a wallet that runs out of allowance starts failing at settlement — top it up the same way.
Your first paid call
Ask in plain language. The agent picks the service, reads its schema, pays, and hands back the result with a transaction hash.
1What can Ordinal do? List the services and what they cost.
2
3Which wallet will you pay from?
4
5Run a full integrity check on
60x415ce1b4230b5f01170529b369f8ad4001024136 and pay for it.A paid call returns the provider's JSON plus the settlement: a transaction hash, a block number, and a Blockscout link. Hand that hash to check_payment_status, or open it on Robinhood Chain Blockscout yourself — a paid call you cannot verify on-chain did not happen.
Want to see the shape of a response before spending anything? Ask for a free trial. try_service runs the real provider, settles nothing, and records no usage.
Tools the agent gets
| Tool | Cost | What it does |
|---|---|---|
| list_services | free | Browse published services. Filters: query, category, maxPrice, limit. |
| get_service_details | free | Input and output JSON Schema, price, examples, and x402 settlement terms. |
| try_service | free | Runs the provider for real, settles no payment, writes no usage. |
| call_service | paid | Full round trip: challenge, sign, verify, provider, settle, persist. |
| check_payment_status | free | Look up a settlement transaction on Robinhood Chain. |
| wallet_address | free | Reports which wallet the bridge will pay from, and whether a key is configured at all. |
Both call paths validate input against the service's inputSchema first and return that schema in the error, so an agent can correct itself in one turn. Only call_service ever spends; nothing else touches the wallet.
What a paid call costs you
The payer needs USDG for the price and, once per wallet, an on-chain approval of USDG to Permit2. Every payment after that is gasless for the payer: Ordinal's relayer broadcasts the settlement and pays its gas, and the payer only ever signs.
Use a plain externally owned account. Permit2 treats an address holding contract code as a smart wallet and calls isValidSignature on it, so a wallet that does not implement ERC-1271 — including an account delegated under EIP-7702 — will see settlement revert. This is the single most common reason a correctly configured bridge still cannot pay.
When something fails
| Symptom | Cause | Fix |
|---|---|---|
| The client lists no Ordinal tools. | Config not loaded. | Fully restart the client, then confirm the file path and JSON or TOML syntax. |
| wallet_address reports configured: false. | Key missing or malformed. | It must be 0x plus exactly 64 hex characters, quoted, in the server's env block. |
| Paid calls fail while browsing works. | No key, or the wallet cannot sign for Permit2. | Set the key; use a plain EOA with no contract code or 7702 delegation. |
| Settlement reverts or reports an allowance problem. | Permit2 was never approved, or the allowance ran out. | Run the approval again. |
| Repeated 402. | Not enough USDG for the price. | Fund the payer wallet and retry. |
| 409 on retry. | That settlement is already recorded. | Replay protection is working; make a fresh payment rather than resending. |
| npx not found. | Node missing from the client's environment. | Install Node 18 or newer, or point command at an absolute npx path. |
Browsing without installing anything
The marketplace also answers MCP directly at https://ordinal402.xyz/api/mcp. Point a client at that URL to read the catalogue, inspect a service contract, and run free trials with no package and no wallet. It cannot make a paid call, for the reason above.
1curl -X POST https://ordinal402.xyz/api/mcp \
2 -H 'content-type: application/json' \
3 -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Wire headers
MCP is the front door, but nothing depends on it. If your runtime speaks x402 itself, call the gateway directly and preserve these standard header names. Do not substitute transaction-hash proof headers.
1POST /api/services/{id}/call
2Content-Type: application/json
3
4HTTP/1.1 402 Payment Required
5PAYMENT-REQUIRED: <base64 PaymentRequired>
6
7POST /api/services/{id}/call
8PAYMENT-SIGNATURE: <base64 PaymentPayload>
9
10HTTP/1.1 200 OK
11PAYMENT-RESPONSE: <base64 SettleResponse>Discovery
#discoveryRegistry routes
| Endpoint | Format | Use |
|---|---|---|
| /api/agent/services | JSON | Pageable machine discovery |
| /.well-known/agent-services.json | JSON | Well-known discovery location |
| /llms.txt | Text | Compact agent context |
Record shape
1{
2 "slug": "token-risk",
3 "name": "Ordinal Token Risk API",
4 "capabilities": ["token", "risk", "security"],
5 "price": { "amount": "0.05", "currency": "USDG" },
6 "network": "robinhood",
7 "endpoint": "https://your-domain.example/api/services/{id}/call",
8 "inputSchema": { "type": "object" },
9 "outputSchema": { "type": "object" },
10 "reliability": {
11 "verified": true,
12 "successRate": 99.5,
13 "averageLatencyMs": 132
14 }
15}Reference
#referenceStatus codes
| Status | Meaning | Action |
|---|---|---|
| 400 | Input failed validation. | Fix the JSON body. |
| 402 | Payment required or settlement rejected. | Use the advertised x402 requirement and retry. |
| 403 | Service is not published. | Select a published registry entry. |
| 409 | Settlement transaction already recorded. | Create a fresh payment. |
| 429 | Rate limit reached. | Wait for X-RateLimit-Reset. |
| 502 | Provider failed or returned an invalid shape. | Retry later or select another provider. |
| 503 | Facilitator or settlement configuration unavailable. | Do not execute; retry after configuration is restored. |
Primary sources
Verify protocol behavior in the x402 network and token reference, x402 v2 specification, and Robinhood Chain connection reference, and the Robinhood Chain contract registry.