Swap Api
About
Free token swaps for AI agents. No API keys. Returns executable transaction calldata for 40+ EVM chains.
Details
- Author
- Swap-API
- Downloads
- 355
- Categories
- Developer Tools, Other
Jump to
- Single tool: swap_tokens for swap calldata
- Supports any EVM chain (Ethereum, Base, Arbitrum, etc.)
- Returns raw transaction data (to, data, value, gas, guaranteedOut)
- Configurable slippage tolerance (default 0.5%)
- Includes native token address constant for ETH/MATIC/etc.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Swap ApiCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install the package globally with npm install -g @swapapi/mcp or run it on the fly with npx @swapapi/mcp. Configure the server in any MCP‑compatible client (e.g., Claude Desktop, Cursor) using the command npx @swapapi/mcp. The server exposes a single tool, swap_tokens, which accepts parameters such as chain ID, token addresses, amount, sender address, and optional slippage.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"swap api": {
"swapapi": {
"command": "npx",
"args": [
"@swapapi/mcp"
]
}
}
}
}
McpServers
{
"swapapi": {
"command": "npx",
"args": [
"@swapapi/mcp"
]
}
}
Executable token swap calldata in one GET request.No API keys. No accounts. No SDK bloat.
curl "https://api.swapapi.dev/v1/swap/1?\ tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&\ tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\ amount=1000000000000000000&\ sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
That's it. The response contains everything you need to sign and broadcast.
{ "success": true, "data": { "status": "Successful", "tokenFrom": { "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "symbol": "ETH", "name": "Ether", "decimals": 18 }, "tokenTo": { "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "symbol": "USDC", "name": "USD Coin", "decimals": 6 }, "swapPrice": 2435.12, "priceImpact": 0.0003, "amountIn": "1000000000000000000", "expectedAmountOut": "2435120000", "minAmountOut": "2422947280", "tx": { "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "to": "0x011E52E4E40CF9498c79e329EBc29ed08c8B5abB", "data": "0x2646478b...", "value": "1000000000000000000", "gasPrice": 30000000000, "gas": "250000" } }, "timestamp": "2026-03-12T00:00:00.000Z" }
- 200— Quote ready
- 400— Invalid params or unsupported chain
- 429— Rate limit exceeded (60/min per IP)
- 502— Upstream service error
curl "https://api.swapapi.dev/v1/swap/8453?\ tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&\ tokenOut=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&\ amount=500000000000000000&\ sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
curl "https://api.swapapi.dev/v1/swap/42161?\ tokenIn=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&\ tokenOut=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&\ amount=1000000000&\ sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&\ maxSlippage=0.01"
curl "https://api.swapapi.dev/v1/swap/1?\ tokenIn=0x6B175474E89094C44Da98b954EedeAC495271d0F&\ tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\ amount=1000000000000000000000&\ sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
curl "https://api.swapapi.dev/v1/swap/137?\ tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&\ tokenOut=0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174&\ amount=10000000000000000000&\ sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
The API gives you an unsigned transaction. Sign it and broadcast:
# 1. Set swap parameters CHAIN_ID=8453 TOKEN_IN=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE TOKEN_OUT=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 AMOUNT=1000000000000000000 SENDER=0x... # Your address PRIVATE_KEY=0x... # Your private key RPC_URL=https://mainnet.base.org # 2. Get swap quote RESPONSE=$(curl -s "https://api.swapapi.dev/v1/swap/$CHAIN_ID?\ tokenIn=$TOKEN_IN&\ tokenOut=$TOKEN_OUT&\ amount=$AMOUNT&\ sender=$SENDER") # 3. Parse the tx fields TX_TO=$(echo "$RESPONSE" | jq -r '.data.tx.to') TX_DATA=$(echo "$RESPONSE" | jq -r '.data.tx.data') TX_VALUE=$(echo "$RESPONSE" | jq -r '.data.tx.value') TX_GAS=$(echo "$RESPONSE" | jq -r '.data.tx.gas') # 4. Sign and send cast send \ --rpc-url "$RPC_URL" \ --private-key "$PRIVATE_KEY" \ "$TX_TO" \ --value "$TX_VALUE" \ --gas-limit "$TX_GAS" \ --data "$TX_DATA"
import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { base } from 'viem/chains' const account = privateKeyToAccount('0x...') const client = createWalletClient({ account, chain: base, transport: http() }) const response = await fetch( 'https://api.swapapi.dev/v1/swap/8453?' + 'tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&' + 'tokenOut=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&' + 'amount=1000000000000000000&' + 'sender=' + account.address ) const { data } = await response.json() const hash = await client.sendTransaction({ to: data.tx.to, data: data.tx.data, value: BigInt(data.tx.value), gas: BigInt(data.tx.gas) }) await client.waitForTransactionReceipt({ hash })
For AI agents, Claude Desktop, Cursor, Cline, and other MCP clients:
{ "mcpServers": { "swapapi": { "command": "npx", "args": ["@swapapi/mcp"] } } }
Seemcp/README.mdfor full MCP documentation.
Seeopenapi.jsonfor the full OpenAPI specification.
- Rate limit:60 requests/minute per IP
- No authentication required
- Free to use
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Server-side EVM wallet for Ai agents. Send transactions, manage tokens, and interact with smart contracts across multiple chains.
Read/write to over 2k blockchains, enabling data querying, contract analysis/deployment, and transaction execution, powered by Thirdweb.
Abstraxn Agent Kit's public MCP server gives any AI agent instant access to Web3 and market data with no signup or API key required. Query live blockchain data including block numbers, gas prices, transaction status, and ERC-20 token information and prices across major EVM chains and Solana. You can also access x402engine's pay-per-call APIs for crypto market data, wallet, token and ENS lookups, on-chain transaction simulation, and flight and hotel search. Paid calls are settled directly from the caller's own crypto wallet through the x402 protocol, while Abstraxn never holds or custodies funds. Ideal for AI agents that need real-time blockchain, Web3, and market data without onboarding friction.
Interact with the Borrow Automated Market Maker (BAMM) protocol on the Fraxtal blockchain.
An MCP server providing onchain tools for AI applications to interact with the Base Network and Coinbase API.
An AI gateway for the Blend Protocol on Stellar, enabling DeFi actions like lending, borrowing, and pool creation through AI assistants or apps.
A server for blockchain interactions, offering Ethereum vanity address generation, 4byte lookup, ABI encoding, and multi-chain RPC calls.
A comprehensive toolkit for Ethereum blockchain analysis directly within Claude AI.
Provides blockchain services for over 30 EVM-compatible networks through a unified interface.
Interact with the Futarchy protocol on the Solana blockchain.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





