Developer Tools
Integrate ChainBridge into your application. Access 0x, KyberSwap and ParaSwap quotes on 8 EVM networks, cross-chain swap quotes (Relay, LI.FI, THORChain), bridge quotes, and real-time pricing through a unified API, or connect an AI agent through the MCP server.
AI agents (MCP)
ChainBridge runs a Model Context Protocol server, so Claude, Cursor and any other MCP client can quote and prepare swaps without glue code. Streamable HTTP transport, JSON responses, no API key. Live sources: 0x, KyberSwap and ParaSwap on Ethereum, Arbitrum, Base, Optimism, Polygon, BNB Chain, Avalanche and Linea (Linea: 0x and KyberSwap).
build_swap_transaction returns an unsigned transaction that the wallet owner reviews, signs and sends. Quotes include the platform fee, reported per source as feeBps; see the fee schedule.Client config
Endpoint: https://www.chainbridge.trading/api/mcp. Add it to your client's MCP configuration (Claude Desktop, Cursor, VS Code and others):
Claude Code:
Or call a tool directly (JSON-RPC 2.0 over POST):
Tools
get_quoteArguments: chainId, sellToken, buyToken, sellAmount (base units) or amount (e.g. "1.5"), slippageBps?
Returns: Quotes ranked by amount received after gas, the fee each source applies (feeBps) and the best source.
build_swap_transactionArguments: chainId, sellToken, buyToken, sellAmount or amount, taker, slippageBps?, aggregator?
Returns: Unsigned transaction {to, data, value}, the ERC-20 approval it needs (if any) and, for 0x Permit2 routes, the EIP-712 payload to sign. Never signs or broadcasts.
list_tokensArguments: chainId, query?
Returns: Curated tokens for the chain: address, symbol, name, decimals.
get_token_priceArguments: chainId, address
Returns: USD price from CoinGecko, or null when unknown.
Tokens accept an address or a symbol from list_tokens. Tool calls share the per-IP rate limits of the REST API.
API Reference
All endpoints return JSON. Errors follow the format { "error": "message" } with appropriate HTTP status codes.
/api/sor/quotesQuery the Smart Order Router for quotes across multiple aggregators (0x including 0x Gasless, KyberSwap and ParaSwap). Returns the best quote and all individual aggregator quotes for comparison. Quotes include the platform fee (feeBps); fee schedule at /about#fees.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sellToken | string | Yes | Address of the token to sell (0x-prefixed) |
buyToken | string | Yes | Address of the token to buy (0x-prefixed) |
sellAmount | string | Yes | Amount to sell in base units (wei) |
chainId | number | Yes | Chain ID (1, 42161, 8453, 10, 137, 56, 43114, 59144) |
slippageBps | number | No | Slippage tolerance in basis points (default: 100 = 1%) |
takerAddress | string | No | Address of the taker (for gasless quotes) |
Example Request
Example Response
/api/sor/swapBuild a swap transaction. Returns the same envelope as /sor/quotes, with executable calldata in bestQuote.to / bestQuote.data / bestQuote.value / bestQuote.gas, ready to sign and broadcast from the user's wallet. POST requests need an x-csrf-token header obtained from GET /api/csrf-token.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
preferredAggregator | string | No | Aggregator to try first (0x, paraswap, kyber) |
sellToken | string | Yes | Token to sell address |
buyToken | string | Yes | Token to buy address |
sellAmount | string | Yes | Amount in base units |
chainId | number | Yes | Chain ID |
takerAddress | string | Yes | User wallet address |
slippageBps | number | No | Slippage in basis points |
Example Request
Example Response
/api/crosschain/quoteCross-chain swap quotes, ranked by net amount received: EVM to EVM via Relay and LI.FI, EVM (Ethereum, Base, BNB Chain, Avalanche) to native BTC, LTC, DOGE or BCH via THORChain. Native BTC, LTC, DOGE or BCH to EVM is quote only (executable: false). Each quote lists the steps to sign (exact-amount approval when needed) and any ChainBridge fee as platformFeeBps. Track delivery with GET /api/crosschain/status.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fromChainId | number | Yes | EVM source chain (1, 42161, 8453, 10, 137, 56, 43114, 59144, 324), or pass fromChain=BTC|LTC|DOGE|BCH instead |
toChainId | number | Yes | EVM destination chain, or pass toChain=BTC|LTC|DOGE|BCH instead |
fromToken | string | Yes | Source token address |
toToken | string | No | Destination token address (EVM destinations) |
fromTokenDecimals | number | Yes | Source token decimals |
toTokenDecimals | number | Yes | Destination token decimals |
amount | string | Yes | Amount in base units |
fromAddress | string | No | Sender wallet (required for EVM sources) |
toAddress | string | No | Recipient; a BTC/LTC/DOGE/BCH address for native destinations |
slippageBps | number | No | Slippage in basis points (default: 100) |
Example Request
Example Response
/api/bridge/quoteGet cross-chain bridge quotes from LI.FI and Socket (API only, no bridge UI). Compares routes across Ethereum, Arbitrum, Optimism, Base, Polygon, BNB Chain and zkSync Era.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fromChainId | number | Yes | Source chain ID |
toChainId | number | Yes | Destination chain ID |
fromToken | string | Yes | Source token address |
toToken | string | Yes | Destination token address |
fromAmount | string | Yes | Amount in base units |
fromAddress | string | Yes | Sender wallet address |
Example Request
Example Response
/api/bridge/transactionBuild a bridge transaction for a route returned by GET /bridge/quote. Pass the full route object from the quote response. Returns calldata for the user to sign.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
route | object | Yes | Route object returned by GET /bridge/quote (routes[] or bestRoute) |
fromAddress | string | Yes | Sender wallet address |
toAddress | string | No | Receiver address (defaults to fromAddress) |
slippageBps | number | No | Slippage in basis points (default: 100) |
Example Request
Example Response
/api/priceGet real-time USD token prices from CoinGecko. Pass token contract addresses; prices are keyed by lowercased address and are null when unknown.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tokens | string | Yes | Comma-separated token contract addresses (max 100) |
chainId | number | No | Chain ID (default: 1) |
Example Request
Example Response
/api/healthHealth check endpoint. Returns service status and version information.
Example Request
Example Response
Widget Integration
Embed the ChainBridge swap widget directly into your website. The widget provides a fully functional token swap interface with access to multiple aggregators, powered by the same Smart Order Router as the main application.
Embed Code
Add this snippet to your HTML to embed the swap widget. Customize the default chain and tokens via query parameters.
chainId-- Default chain (1, 42161, 8453, 10, 137, 56, 43114, 59144)sellToken-- Default sell token symbolbuyToken-- Default buy token symboltheme-- Widget theme (light, dark, auto)
SDKComing Soon
The @jaleltounsi/chainbridge-sdk package will provide a typed TypeScript client for all ChainBridge APIs. Install via npm and start building in minutes.