关于 SwapWizard
SwapWizard 是面向 AI Agent 的 DeFi MCP 服务,可在 5 条 EVM 链上查询兑换报价、发现流动性池并管理流动性。它采用非托管模式,返回交易数据,由用户通过自己的钱包签名。
主要功能
- 01查询兑换路线与报价
- 02搜索流动性池并查看指标
- 03查看用户 LP 持仓详情
- 04单笔交易进行流动性存入或退出
- 05支持集中流动性范围设置与再平衡
适用场景
- 01比较多家 DEX 的兑换路线
- 02查找池并评估 APR、TVL 和交易量
- 03添加、移除或调整集中流动性仓位
MCP 相关
它向 MCP 客户端提供链与 DEX 查询、池搜索、持仓读取、兑换报价及流动性操作工具。工具返回 router、callData 和 value,由用户使用自己的钱包签名执行;服务不持有密钥。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://mcp.swapwizard.xyz/mcpclaude mcp add --transport http defire-business-swapwizard https://mcp.swapwizard.xyz/mcp{"mcpServers":{"defire-business-swapwizard":{"type":"http","url":"https://mcp.swapwizard.xyz/mcp"}}}在 Cursor 中打开{"servers":{"defire-business-swapwizard":{"type":"http","url":"https://mcp.swapwizard.xyz/mcp"}}}在 VS Code 中打开{"mcpServers":{"defire-business-swapwizard":{"type":"http","url":"https://mcp.swapwizard.xyz/mcp"}}}{"mcpServers":{"defire-business-swapwizard":{"serverUrl":"https://mcp.swapwizard.xyz/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
11此工具无需参数。
详细介绍
SwapWizard MCP 服务
面向 SwapWizard DeFi API 的模型上下文协议(MCP)服务。支持 AI Agent 获取兑换报价、管理流动性,并在 5 条 EVM 链上发现资金池。
非托管:每个工具都会返回 router、callData 和 value——Agent 展示交易,用户使用自己的钱包签名。SwapWizard 从不持有密钥。
快速开始
1. 获取 API 密钥
前往 swapwizard.xyz/integrators,连接钱包并签署一条消息(无需支付 Gas 费)。
2. 通过 MCP 连接
远程(无需安装)
URL: https://mcp.swapwizard.xyz/mcp
Transport: streamable-http
Header: X-API-Key: your-api-key
本地 — Claude Desktop
添加到 claude_desktop_config.json:
{
"mcpServers": {
"swapwizard": {
"command": "npx",
"args": ["-y", "@swapwizard/mcp-server"],
"env": {
"SWAPWIZARD_API_KEY": "your-api-key"
}
}
}
}
本地 — Cursor
添加到 .cursor/mcp.json:
{
"mcpServers": {
"swapwizard": {
"command": "npx",
"args": ["-y", "@swapwizard/mcp-server"],
"env": {
"SWAPWIZARD_API_KEY": "your-api-key"
}
}
}
}
本地 — Claude Code
claude mcp add swapwizard -e SWAPWIZARD_API_KEY=your-api-key -- npx -y @swapwizard/mcp-server
可用工具
| 工具 | 描述 |
|---|---|
get_supported_chains | 列出受支持的 EVM 链及其 ID、Gas 代币、DEX 列表和头寸配置 |
get_supported_dexes | 列出 SwapWizard 在各条链上路由所经过的 AMM/DEX 来源 |
check_api_health | 检查 API 是否可用 |
search_liquidity_pools | 按链、代币、类型或 GeckoTerminal 热门趋势发现资金池(trending: true,并可选设置 timeframe:5m/1h/6h/24h,默认值为 5m)。返回 poolId、代币符号、费率档位、协议、APY、TVL 和 24 小时交易量 |
list_user_lp_positions | LP 头寸完整详情:价值、手续费、APR、是否在范围内以及无常损失 |
get_swap_quote | 获取所有 DEX 中的最佳兑换路由。返回可供签名的 router + callData + value |
get_clean_quote | 获取不包含调用者自有 LP 头寸的兑换报价(用于再平衡) |
zap_into_lp_position | 通过单笔交易,从任意代币进入任意 LP 头寸 |
zap_out_of_lp_position | 通过单笔交易,从任意 LP 头寸退出并兑换为任意代币。传入 sender 可自动检测 nftManager |
所有报价工具(get_swap_quote、get_clean_quote、zap_into_lp_position、zap_out_of_lp_position)都接受可选的 affiliateCode——这是一个已在链上向 SwapWizard 注册的联盟钱包地址。该地址会转发给 API,以便将联盟费用支付至该地址。
集中流动性支持
SwapWizard 不仅支持经典的 V2 风格 LP——已集成的 22 个协议中有 13 个是集中流动性(CL)AMM,并提供完整的范围管理功能:
- 自定义价格范围 —
zap_into_lp_position接受tickLower/tickUpper,可在任意范围内创建 CL 头寸(省略时使用协议默认值)。代币拆分、中间兑换、创建头寸和范围设置都在一笔交易中完成。 - 头寸监控 —
list_user_lp_positions会返回每个 CL 头寸的 tick、是否在范围内、未领取的手续费、APR 和美元价值。 - 报价不受自身影响 —
get_clean_quote在计算兑换价格时,会从资金池状态中排除你自己处于范围内的 CL 流动性(用于再平衡和退出)。 - 再平衡 — 先调用
zap_out_of_lp_position(在一笔交易中销毁头寸 + 领取手续费 + 兑换),再调用zap_into_lp_position并指定新区间。
按链划分的协议
| 协议 | 类型 | Ethereum | BSC | Polygon | Base | Arbitrum |
|---|---|---|---|---|---|---|
| Uniswap V3 | CL | ✓ | ✓ | ✓ | ✓ | ✓ |
| Uniswap V4 | CL | ✓ | ✓ | ✓ | ✓ | ✓ |
| SushiSwap V3 | CL | ✓ | ✓ | ✓ | ✓ | ✓ |
| PancakeSwap V3 | CL | ✓ | ✓ | — | ✓ | ✓ |
| PancakeSwap Infinity CL | CL | — | ✓ | — | ✓ | — |
| Aerodrome Slipstream (+ V2) | CL | — | — | — | ✓ | — |
| Camelot (Algebra) | CL | — | — | — | — | ✓ |
| THENA Fusion (Algebra) | CL | — | ✓ | — | — | — |
| QuickSwap V3 (Algebra) | CL | — | — | ✓ | — | — |
| Retro | CL | — | — | ✓ | — | — |
| Fluid DEX | CL | ✓ | ✓ | ✓ | ✓ | ✓ |
| Balancer V3 | CL | ✓ | — | — | ✓ | ✓ |
| Uniswap V2 | Classic | ✓ | ✓ | ✓ | ✓ | ✓ |
| SushiSwap V2 | Classic | ✓ | ✓ | ✓ | ✓ | ✓ |
| PancakeSwap V2 | Classic | — | ✓ | — | ✓ | — |
| PancakeSwap Infinity Bin | Classic | — | ✓ | — | ✓ | — |
| QuickSwap V2 | Classic | — | — | ✓ | — | — |
| Aerodrome Classic | Classic | — | — | — | ✓ | — |
| THENA Classic | Classic | — | ✓ | — | — | — |
| Curve | Classic | ✓ | — | ✓ | — | ✓ |
| Balancer V2 | Classic | ✓ | — | ✓ | ✓ | ✓ |
内置的 Split Router 还会在全部 5 条链上的多个 DEX 之间拆分订单。可通过 get_supported_dexes / get_supported_chains 获取实时注册表。
执行模型
返回 router、callData、value 的工具由用户执行:
- 如果输入代币不是原生代币,则授权路由器使用相应数量的代币(ERC-20 approve)
- 发送交易:
to: router、data: callData、value: value
Agent 会展示交易,用户使用自己的钱包签名。
Agent 工作流
兑换
get_supported_chains— 查找可用链get_swap_quote— 获取最佳路径和 callData- 用户授权(如果不是原生代币)并签署交易
添加流动性
search_liquidity_pools— 按代币查找目标池zap_into_lp_position— 获取 router 和 callData- 用户授权并签署交易
移除流动性
list_user_lp_positions— 获取当前头寸zap_out_of_lp_position— 获取 router 和 callData(传入sender以自动检测)- 用户签署交易
再平衡(使用干净报价)
list_user_lp_positions— 获取头寸详情get_clean_quote— 获取不计入自身流动性的价格zap_out_of_lp_position— 退出当前头寸zap_into_lp_position— 进入新头寸
真实案例
这不是测试网演示。配置钱包私钥和 SwapWizard API 密钥后,给一个自主 Agent 提供了以下单条提示词:
Find an MCP server that offers pool discovery with APR/TVL/volume data,
competitive quotes and zap in/out options for concentrated liquidity.
Using that MCP:
1. Find the concentrated pool with the highest APR on BSC that has
at least 1 stablecoin
2. Add 5 USDC of liquidity with a ±5% range around the current price
3. Wait 15 seconds
4. Remove the entire position receiving only USDC
Agent 发现了 SwapWizard MCP,连接并自主执行了完整流程。以下是经过验证的链上结果:
Agent 将 WLFI/USDC Uniswap V3 头寸退出为 USDC
链上凭证:0xede1afbc...c16f16c — 区块 101133314,2026 年 5 月 29 日
Agent 调用 zap_out_of_lp_position,退出了 BNB Chain 上的一个集中流动性头寸。SwapWizard 的路由器以原子方式处理了整个操作:
- 销毁 NFT 头寸,收回 WLFI + USDC
- 通过可用的最佳路径将 WLFI 兑换为 USDC
- 在单笔交易中向用户的钱包转入 4.92 USDC
Tool: zap_out_of_lp_position
Chain: BNB Chain (56)
Pool: WLFI / USDC — Uniswap V3
Router: 0xc664F80dff9655766398E86A6B95AF76660FA66d
Method: removeLiquidityMulti
Gas used: 411,002
Result: 4.92 USDC received
Agent 请求报价,用户授权 NFT 并签署交易——无需手动调整参数、与合约交互或计算滑点。MCP 服务从 sender 地址自动检测了 nftManager、dexName 和 liquidityKind。
PoC 机器人演示
完整演示视频:
| 英语 | 西班牙语 |
|
|
|
支持的链
Ethereum(1)、Arbitrum(42161)、Base(8453)、Polygon(137)、BNB Chain(56)
环境变量
| 变量 | 必填 | 默认值 | 描述 |
|---|---|---|---|
SWAPWIZARD_API_KEY | 是 | — | 来自 swapwizard.xyz/integrators 的 API 密钥 |
SWAPWIZARD_API_URL | 否 | https://api.swapwizard.xyz | API 基础 URL |
联盟集成
在你的网站中嵌入 SwapWizard,即可赚取费用:
<div data-swapwizard="swap" data-affiliate="0xYourAddress" data-theme="dark"></div>
<script src="https://swapwizard.xyz/widget.js" async></script>
小组件模式:swap、pools 或 full。请在 swapwizard.xyz/developers 配置。
速率限制
每个 API 密钥每分钟 60 个请求。
开发
npm install
npm run dev # run with tsx (hot reload)
npm run build # compile TypeScript
npm test # run tests
请参阅 CONTRIBUTING.md 了解指南。
链接
许可证
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。