
Swap API
io.github.Swap-API由 GitHub 账号 Swap-API 发布v0.1.0更新于 Oct 24, 2026
MCP server for SwapAPI - get executable token swap calldata for EVM chains
概览
本地 MCP 服务器,通过 SwapAPI 为 EVM 链生成可执行的代币兑换 calldata,仅提供一个 swap_tokens 工具。
- 可以做什么
- 获取指定 EVM 链上代币兑换的可执行交易数据(路由合约地址、calldata、原生币金额、gas 估算、滑点后最小输出)
- 指定链 ID、输入与输出代币地址、以最小单位表示的金额、发送方钱包地址,以及可选的滑点容忍度(默认 0.5%)
- 使用原生代币占位地址处理 ETH、MATIC 等原生币的兑换
- 只返回 calldata,签名、授权与提交交易仍需由助手或用户完成
- 适用场景
- 适合需要为以太坊、Base、Arbitrum 等 EVM 链准备代币兑换并返回可直接签名交易数据的场景,例如交易或 DeFi 工作流。若只需报价,或不打算提交链上交易,则无需使用。
- 运行要求
- 以 stdio 方式在本地运行,通过 npm 包 @swapapi/mcp 安装(需要 Node.js/npx),并在 Claude Desktop、Cursor 等 MCP 客户端中配置。未声明任何环境变量、请求头或身份验证;需能访问 SwapAPI 服务的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Swap API,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
SwapAPI MCP Server
MCP (Model Context Protocol) server for SwapAPI. Enables AI agents to get executable token swap calldata for any EVM chain.
Installation
Or use directly with npx:
Client Configuration
Claude Desktop
Add to your Claude Desktop config:
Or with a local install:
Cursor
Add to your Cursor settings (Settings → 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:
Returns:
Examples
Swap 0.001 ETH to USDC on Base
Swap USDC to ETH on Arbitrum with 1% slippage
Pre-flight Checklist
Before submitting any swap transaction:
- ERC-20 Approval: If
tokenInis not native token, ensure sender has approved the router for at leastamountIn - Balance Check: Verify sender has sufficient balance for
amountIn(plusvalueif native token) - Gas Estimation: Call
eth_estimateGason the transaction and add 20% buffer - Simulation: Run
eth_callto verify the transaction won't revert - Timing: Submit within 30 seconds of fetching the quote (calldata has expiry)
See the main README.md for full API documentation.
Development
Testing
Run the test suite:
Or use the MCP Inspector:
License
MIT
来源:mcp/README.md,提交 bdfd033
工具
0版本历史
1- v0.1.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分