DocsCleave for agents

Cleave for agents

AI agents can swap tokens, move them between chains and top up gas through Cleave, with the same quotes the app uses. Cleave plans the trade and returns unsigned calls; the user's own wallet signs them. No API key is needed.

What an agent can do

  • Plan a swap on one chain, or a cross-chain swap or bridge between any two of Ethereum, Arbitrum, Base, BNB Chain, Polygon and Optimism. The plan returns the calls to sign, in order.
  • Track a swap, transfer or gas top-up after it is sent: whether it is pending, on its way, delivered or refunded, and what arrived.
  • Find a token by symbol or address, with a flag when a token looks like a listed one.
  • Get gas: a wallet that holds USDC but no native coin gets ETH, BNB or POL by signing one USDC authorization. Signing costs no gas.

Cleave never signs and never sends a user's transaction. The one thing it sends is a gas order the wallet has already signed.

What every plan states

A plan leads with what can go wrong, then the outcome:

  • Notices first: a blocking notice returns no calls; a warning, or a recipient other than the wallet, sets requiresConfirmation.
  • The outcome kind: an exact amount, or at least a minimum; with a swap on arrival, the requested token, else a named fallback token; where a transfer can go unfilled, a refund of the bridged token on the source chain hours later.
  • Costs: every cost charged by others, except network gas. Cleave's fees are inside the price.
  • Time: the expected time for a cross-chain route, and validUntil, after which the calls are stale and the agent should plan again.

Routes that need a claim step on the destination are not offered to agents.

Three ways in

PointMCPRESTx402
What it servesAll four toolsAll four toolsGas top-ups only
Endpointhttps://api.cleave.fi/mcphttps://api.cleave.fi/agent/v1/{tool}https://api.cleave.fi/x402/gas
TransportStreamable HTTP, JSON-RPCPOST with a JSON bodyGET and the HTTP 402 payment flow
KeyNoneNone; a partner key is optionalNone
Limits the user can setWallet pin, USD cap, listed tokens onlyNone: the token to receive must be listedNone
How the user pays gasTheir wallet sends the callsTheir wallet sends the callsOne USDC payment authorization

Choosing one

  • MCP fits an agent that runs in an MCP client. The connection URL can carry the user's limits, so they apply to every tool call. See MCP server.
  • REST fits your own code: an agent framework, a bot or a backend. The tools take the same JSON input as over MCP. See Agent REST API.
  • x402 fits an agent that already pays for HTTP resources with x402. It covers gas top-ups only. See x402 gas top-up.

The usual flow

  1. cleave_find_token, when a symbol is ambiguous.
  2. cleave_plan_swap, with the wallet, the tokens and the amount.
  3. The wallet signs the returned calls in order, before validUntil.
  4. cleave_track_swap, with the chain, the transaction hash and the plan's requestId.

Check with cleave_track_swap before sending a plan again: a plan still in flight that is sent twice can pay twice.

Finding Cleave

Cleave publishes a server card, OpenAPI documents and an ERC-8004 agent registration, is listed in the MCP registry as fi.cleave/swap, and its gas top-up is listed in the x402 Bazaar. See Discovery.