
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 分