# mcp

SwapAPI's MCP server hands your agent executable calldata for token swaps on EVM chains. Useful when the swap has to be assembled inside the chat.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 22
- Author: Swap-API
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Swap-API/swap-api/tree/HEAD/mcp
- Updated: 2026-04-03
- HTML: https://affpapa.org/en/nevibecode/mcp/swap-api-mcp

## What it does

There is one tool, `swap_tokens`. It takes a `chainId`, the `tokenIn` and `tokenOut` addresses, `amountIn` in the smallest units, the `sender` wallet, and optionally `maxSlippage` from 0 to 1 (0.005 by default). What comes back: the router address in `to`, ABI-encoded `data`, a `value` field for native coins, an estimated gas limit and the guaranteed output after slippage.

No transaction leaves the server. It only builds the payload; your wallet signs and broadcasts. The README's checklist follows from that: approve an ERC-20 first, confirm the balance, run `eth_estimateGas` with headroom, dry-run with `eth_call`. Timing matters too. Calldata expires, so act on a quote quickly rather than parking it in a queue.

For a native coin on either side, pass `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` as the token address. The server never needs a private key, which keeps signing keys out of your MCP config. Default slippage of 0.5% is a tight fit for volatile pairs; set it yourself when the trade calls for it.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp -- npx -y @swapapi/mcp
```

### Codex

**Platform CLI**
```bash
codex mcp add mcp -- npx -y @swapapi/mcp
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@swapapi/mcp"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@swapapi/mcp"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add mcp npx -y @swapapi/mcp
```

## When to use it
- build swap calldata for a given EVM chain
- turn ETH into USDC from inside an agent chat
- work out the minimum output after slippage
- get router address and gas estimate for a Base or Arbitrum trade

## Example prompts
- Build the calldata to swap 0.001 ETH for USDC on Base, my wallet is 0xYourAddress
- Prepare a USDC to ETH swap on Arbitrum with 1% slippage
- Call `swap_tokens` for chainId 1 with 1000000000000000 wei

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

## Other versions with the same name
- [mcp · kubeshark](https://affpapa.org/en/nevibecode/mcp/kubeshark-mcp.md) — ★ 12109
- [mcp · butterbase-ai](https://affpapa.org/en/nevibecode/mcp/butterbase-ai-mcp.md) — ★ 3031
- [mcp · medplum](https://affpapa.org/en/nevibecode/mcp/mcp.md) — ★ 2760
- [mcp · sceneview](https://affpapa.org/en/nevibecode/mcp/sceneview-mcp.md) — ★ 1348
- [mcp · buoy-gg](https://affpapa.org/en/nevibecode/mcp/buoy-gg-mcp.md) — ★ 691

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
