🌐 机场财务MCP服务器v0.1
 ](https://nodejs.org)    ](https://www.docker.com)
用于基础链上机场财务DEX操作的生产就绪模型上下文协议(MCP)服务器
特性 • 快速开始 • API • 工具 • 例子 • 提示 • 安全
______________________________________________________________________
🚀 特性
🎯 完整的DEX集成
- 完整的机场财务V2 DEX支持,具有集中的流动性
- 具有滑点保护的实时代币交换
- 流动性池管理和分析
- 多路径优化以获得最佳速率
- Base链上的气体优化交易
- 支持稳定和波动池
🧠 智能交易引擎
- 通过多个DEX池进行智能路由
- 自动令牌检测和验证
- 实时价格反馈和报价
- 防滑保护和耐MEV
- 执行前的交易模拟
- 价格影响计算
🤖 MCP协议实现
- 11+DEX自动化专用工具
- 与Claude Desktop和AI助手兼容
- HTTP和stdio传输支持
- 实时交易执行
- 全面的错误处理和重试逻辑
- 针对LLM优化的结构化响应
🏛️ 企业就绪架构
- 使用Express.js构建可扩展性
- Ethers.js v5用于区块链交互
- 用于输入验证的Zod模式
- Docker容器化支持
- 全面的日志记录和监控
- 生产测试组件
______________________________________________________________________
📦 快速开始
✅ 先决条件
# Required
Node.js >= 18.0.0
npm >= 9.0.0
# Optional
Docker & Docker Compose (for containerized deployment)
Private key for transaction execution📥 安装
# Clone the repository
git clone https://github.com/Tairon-ai/aerodrome-finance-mcp.git
cd aerodrome-finance-mcp
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Start the server
npm start
# Development mode
npm run dev
# MCP stdio server for Claude Desktop
npm run mcp🐳 Docker部署
# Build and run with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down🤖 Claude桌面集成
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"aerodrome-finance": {
"command": "node",
"args": ["/path/to/aerodrome-finance-mcp/mcp/index.js"],
"env": {
"BASE_RPC_URL": "https://mainnet.base.org",
"WALLET_PRIVATE_KEY": "your_private_key_without_0x"
}
}
}
}______________________________________________________________________
🛠 可用工具
🏦 DEX运营
| 工具 | 说明 | 参数 |
|---|---|---|
getServiceInfo | 获取服务器功能和配置 | - |
getTokenInfo | 获取令牌详细信息(符号、小数、供应) | tokenAddress |
getPoolInfo | 获取池分析(储备、TVL) | poolAddress |
getPoolByTokens | 按令牌对查找池 | tokenA, tokenB, stable |
getAllPools | 列出所有可用池 | limit |
getQuote | 获取详细的掉期报价 | tokenIn, tokenOut, amountIn, stable |
getQuoteSimple | 快速估算价格 | tokenIn, tokenOut, amountIn |
getQuoteRest | 通过REST获取准确报价 | tokenIn, tokenOut, amountIn, stable |
executeSwap | 执行令牌交换 | tokenIn, tokenOut, amountIn, slippage, deadline |
addLiquidity | 向池中添加流动性 | tokenA, tokenB, amountA, amountB, stable |
getWalletBalances | 获取钱包代币余额 | walletAddress, tokens |
______________________________________________________________________
🔗 API终点
🌐 核心终点
GET / # Server status and info
GET /health # Health check
GET /mcp # MCP server information
POST /mcp # MCP protocol endpoint
GET /mcp/tools # List available tools______________________________________________________________________
💡 例子
💰 获取令牌信息
// Get USDC token details
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "getTokenInfo",
"arguments": {
"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
},
"id": 1
}🔄 执行交换
// Swap 1000 USDC for WETH
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "executeSwap",
"arguments": {
"tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"tokenOut": "0x4200000000000000000000000000000000000006",
"amountIn": "1000",
"slippage": 0.5,
"deadline": 20
}
},
"id": 1
}📊 获取掉期报价
// Get quote for swapping 1 ETH to USDC
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "getQuoteRest",
"arguments": {
"tokenIn": "0x4200000000000000000000000000000000000006",
"tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amountIn": "1.0",
"stable": false
}
},
"id": 1
}______________________________________________________________________
🤖 提示
💬 Claude、ChatGPT或其他AI助手的示例提示
这些提示演示了如何在与AI助手集成时通过自然语言与MCP服务器交互:
💱 代币交换
"What's the current price of ETH in USDC on Aerodrome?"
"Swap 100 USDC to AERO tokens with 0.5% slippage"
"Execute a swap of 0.5 ETH to USDC with maximum slippage protection"
"Find the best route to swap 10,000 USDC to WETH"💧 流动性管理
"Add liquidity to the WETH/USDC pool with 1 ETH and equivalent USDC"
"What's the current TVL in the WETH/USDC volatile pool?"
"Show me the top 10 pools by volume on Aerodrome"
"Calculate the optimal ratio for adding liquidity to AERO/USDC"📊 市场分析
"Get the 24h volume for WETH/USDC pair"
"Show me all available pools for AERO token"
"What's the price impact of swapping 50 ETH to USDC?"
"Compare rates between stable and volatile pools for USDC/DAI"💼 投资组合管理
"Check my wallet balances for all tokens"
"What's my total portfolio value in USD?"
"Show me my liquidity positions and their current values"
"Monitor my transactions on Base chain"🔧 AI助手的集成技巧
在MCP服务器上使用这些提示时:
- 始终指定令牌地址或符号 用于精确操作
- 设置适当的滑动 (通常为0.5-2%)
- 监控天然气价格 大型交易前
- 检查余额 在尝试交换之前
- 先用引号 在执行实际掉期交易之前
______________________________________________________________________
🧪 测试
🔍 使用cURL进行API测试
# Check server health
curl http://localhost:8080/health
# Get MCP server info
curl http://localhost:8080/mcp
# List all available tools
curl http://localhost:8080/mcp/tools
# Execute a tool
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "getTokenInfo",
"arguments": {
"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
},
"id": 1
}'______________________________________________________________________
🔒 安全
🔐 最佳实践
- 私钥管理:永远不要提交私钥。使用环境变量
- 交易模拟:执行前的测试操作
- 防滑保护:设定适当的限制(通常为0.5-2%)
- 天然气管理:监控天然气价格并设定合理的限制
- 访问控制:实施生产认证
- 监控:使用Basescan跟踪所有交易
🛡️ 安全功能
- 带缓冲器的自动气体估算
- 执行前的交易模拟
- 所有掉期都有防滑保护
- 使用Zod模式进行输入验证
- 全面的错误处理
- 速率限制支持
______________________________________________________________________
📊 支持的网络和代币
🌐 网络
- 基础 主网 (链ID:8453)
- RPC:
https://mainnet.base.org - 浏览器: Basescan 的
🪙 关键代币
- WETH:
0x4200000000000000000000000000000000000006 - 航空:
0x940181a94A35A4569E4529A3CDfB74e38FD98631 - 美元:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 - 戴:
0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb
📜 关键合同
- 路由器:
0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43 - 工厂:
0x420DD381b31aEf6683db6B902084cB0FFECe40Da - 选民:
0x16613524e02ad97eDfeF371bC883F2F5d6C480A5
______________________________________________________________________
🚀 部署
🏭 生产部署
# Build for production
npm run build
# Start production server
NODE_ENV=production npm start
# With PM2
pm2 start server.js --name aerodrome-mcp
# With Docker
docker build -t aerodrome-mcp .
docker run -d -p 8080:8080 --env-file .env aerodrome-mcp🔑 环境变量
# Required for transactions
WALLET_PRIVATE_KEY=your_private_key_without_0x
# Optional
PORT=8080
BASE_RPC_URL=https://mainnet.base.org
NODE_ENV=production______________________________________________________________________
📈 演出
- 响应时间:读取操作小于100ms
- 交易速度:在基础网络上约2秒
- 吞吐量:每秒100+个请求
- 气体优化:Base的超低费用
- 缓存:针对重复查询进行了优化
______________________________________________________________________
🤝 贡献
我们欢迎捐款!请查看我们的 贡献指南 了解详情。
# Fork and clone
git fork https://github.com/Tairon-ai/aerodrome-finance-mcp
git clone https://github.com/Tairon-ai/aerodrome-finance-mcp
# Create feature branch
git checkout -b feature/amazing-feature
# Make changes and test
npm test
# Commit and push
git commit -m 'feat: add amazing feature'
git push origin feature/amazing-feature
# Open Pull Request______________________________________________________________________
📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
______________________________________________________________________
🙏 致谢
______________________________________________________________________
建造于 Tairon.ai 在克劳德的帮助下
