ClaudeCodeMod

All shelves / MCP servers

Mcp

io.github.swap-api/mcp · 22 stars · TypeScript · MIT

MCP server MCP (Model Context Protocol) server for SwapAPI. Enables AI agents to get executable token swap calldata for any EVM chain.

Install

The repo has no one-line install. Follow its README.

Published as

  • npm@swapapi/mcpstdio

From the server's entry in the official MCP Registry.

Open the repo

Files

mcp/README.md

SwapAPI MCP Server

MCP (Model Context Protocol) server for SwapAPI. Enables AI agents to get executable token swap calldata for any EVM chain.

Installation

npm install -g @swapapi/mcp

Or use directly with npx:

npx @swapapi/mcp

Client Configuration

Claude Desktop

Add to your Claude Desktop config:

{
  "mcpServers": {
    "swapapi": {
      "command": "npx",
      "args": ["@swapapi/mcp"]
    }
  }
}

Or with a local install:

{
  "mcpServers": {
    "swapapi": {
      "command": "npx",
      "args": ["tsx", "/path/to/swap-api/mcp/mcp-server.ts"]
    }
  }
}
Cursor

Add to your Cursor settings (Settings → MCP):

{
  "mcpServers": {
    "swapapi": {
      "command": "npx",
      "args": ["@swapapi/mcp"]
    }
  }
}
Other Clients

Any MCP-compatible client can use the same configuration format. Check your client's documentation for where to add MCP server settings.

Available Tools

swap_tokens

Get executable transaction data to swap tokens on EVM chains.

Parameters:

Parameter Type Required Description
chainId number Yes Chain ID (1=Ethereum, 8453=Base, 42161=Arbitrum, etc.)
tokenIn string Yes Input token address. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token (ETH, MATIC, etc.)
tokenOut string Yes Output token address
amountIn string Yes Amount in smallest unit (wei for 18-decimal tokens, micro-units for 6-decimal tokens)
sender string Yes Wallet address that will sign and send the transaction
maxSlippage number No Max slippage tolerance 0-1 (default: 0.005 = 0.5%)

Returns:

{
  "to": "0x...",           // Router contract address to call
  "data": "0x...",         // ABI-encoded swap calldata
  "value": "1000000000000000000",  // Native token value (if swapping from native)
  "gas": "150000",         // Estimated gas limit
  "guaranteedOut": "..."   // Minimum output amount after slippage
}

Examples

Swap 0.001 ETH to USDC on Base
{
  "chainId": 8453,
  "tokenIn": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
  "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "amountIn": "1000000000000000",
  "sender": "0xYourAddress"
}
Swap USDC to ETH on Arbitrum with 1% slippage
{
  "chainId": 42161,
  "tokenIn": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
  "tokenOut": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
  "amountIn": "10000000",
  "sender": "0xYourAddress",
  "maxSlippage": 0.01
}

Pre-flight Checklist

Before submitting any swap transaction:

  1. ERC-20 Approval: If tokenIn is not native token, ensure sender has approved the router for at least amountIn
  2. Balance Check: Verify sender has sufficient balance for amountIn (plus value if native token)
  3. Gas Estimation: Call eth_estimateGas on the transaction and add 20% buffer
  4. Simulation: Run eth_call to verify the transaction won't revert
  5. Timing: Submit within 30 seconds of fetching the quote (calldata has expiry)

See the main README.md for full API documentation.

Development

cd mcp
npm install
npm start
Testing

Run the test suite:

npm test

Or use the MCP Inspector:

npx @modelcontextprotocol/inspector tsx mcp-server.ts

License

MIT

Facts

Kind
MCP server
Repo
Swap-API/swap-api
Group
Uncategorized
Stars
22
License
MIT
Language
TypeScript
Last push
2026-04-03
Forks
1
MCP Registry
io.github.Swap-API/mcp

Same name on this shelf 28

  1. 55Mcpio.github.kubeshark/mcpeBPF-powered network observability for Kubernetes. Indexes L4/L7 traffic with full K8s context, decrypts TLS without keys. Queryable by AI agents via MCP and humans via dashboard.12.1k
  2. 126Mcpcloudflare/mcp-server-cloudflareModel Context Protocol (MCP) is a new, standardized protocol for managing context between large language models (LLMs) and external systems. In this repository, you can find several MCP servers allowing you to connect to Cloudflare's service from an MCP client (e.g.4.5k
  3. 163Mcpio.github.butterbase-ai/mcpButterbase MCP server — manage your backend: schemas, auth, functions, storage, RAG, deploys.3k
  4. 202Mcpcom.stripe/mcpMCP server integrating with Stripe - tools for customers, products, payments, and more.2.1k
  5. 896Mcpio.github.agenticmail/mcp257
  6. 1043Mcpzomato/mcp-server-manifest188

Search the shelf for “Mcp”

Next on this shelf

  1. 4275Container-MCP54rt1n/container-mcpA podman ubuntu 24.04 container that serves a MCP server; with file, code execution, bash shell, knowledgebase, and more.22
  2. 4276Limitless MCP Server (v0.1.0)boyleryan/mcp-limitless-serverThis is an MCP (Model Context Protocol) server that connects your Limitless Pendant data to AI tools like Claude, Windsurf, and others via the Limitless API. It lets AI apps and agents interact with your Lifelog in a structured, programmable way.22
  3. 4277File Operations MCP Serverbsmi021/mcp-file-operations-serverA Model Context Protocol (MCP) server that provides enhanced file operation capabilities with streaming, patching, and change tracking support.22
  4. 4278Image Downloadercced3000/mcp-image-downloader一个支持图片下载和处理的 MCP (Model Context Protocol) 服务器,具有进度跟踪、批量下载和图片处理功能。22
  5. 4279Todoist MCP Server ExtendedChrusic/todoist-mcp-server-extendedTodoist MCP Server Extended - Enabling natural language management of todoist via Claude, MCP and todoist REST APIv2. Featuring LLM optimized Tools including batch operations and robust error handling.22
  6. 4280MCP Server Cookie Cutter Templatecodingthefuturewithai/mcp-cookie-cutterA cookiecutter template for creating MCP (Model Control Protocol) servers22