💎 Aster MCP 服务器 v0.1.0
 ](https://nodejs.org)  ](https://www.docker.com)
适用于AsterDEX的生产就绪模型上下文协议(MCP)服务器
特点/特性 • 快速入门 • 工具 • 提示 • 安全 • 做出贡献
______________________________________________________________________
🚀 功能
🏗️ 翻译成中文是:🏗️(建筑工地/正在建设中) 多链支持
- 以太坊 - 与EVM兼容的智能合约
- Arbitrum(注:这是一个区块链平台或技术的名称,直接翻译为中文可能不常见,但在此处保留原名以体现其专有名词的特性) - 第二层扩展解决方案
- BNB Chain(币安智能链) 高性能区块链
- 索拉纳 - 超高速区块链,费用低廉
- 无缝跨链操作
🛠️(扳手) 全面的交易工具
- 为所有支持的网络创建钱包
- 链上余额检查(原生币及代币)
- 在AsterDEX上的市价买单
- 实时价格数据
- 存款与取款操作
- 一键完成跨链交换与桥接
🔧 修理工具或扳手的符号 开发者友好型
- 简单的JSON-RPC接口
- 全面的错误处理
- 基于环境的每个网络配置
- Docker 容器化支持
- MCP协议2024-11-05的实施
- 自动代币符号解析(如USDT、ARB等)
🎯(目标/瞄准) 生产就绪架构
- 双服务器设计(HTTP + MCP stdio)
- 内置速率限制
- 用于安全提取的EIP-712签名
- 自动处理ERC20代币的批准流程
- 每个网络的钱包配置
- 优雅的错误处理和日志记录
______________________________________________________________________
📦 快速入门
✅ 前提条件
# Required
Node.js >= 18.0.0
npm >= 9.0.0🔑 配置
创建一个 .env 与您的配置一起保存的文件:
交易所需:
- ASTER_API_KEY: 您的AsterDEX API密钥
- ASTER_API_SECRET: 您的AsterDEX API密钥
- ASTER_API_BASE_URL: AsterDEX API 端点(默认:https://sapi.asterdex.com)
每个网络的钱包配置(用于存款/取款):
- 以太坊钱包私钥 或者 以太坊钱包助记词
- ARBITRUM_WALLET_PRIVATE_KEY 翻译为中文是:“Arbitrum钱包私钥” 或者 ARBITRUM_WALLET_MNEMONIC 翻译为中文是:“Arbitrum 钱包助记词”
- BNB_WALLET_PRIVATE_KEY 翻译为中文是:“BNB钱包私钥” 或者 BNB_WALLET_MNEMONIC 翻译为中文是:“BNB钱包助记词”
- SOLANA_WALLET_PRIVATE_KEY 翻译为中文是:“SOLANA钱包私钥” 或者 SOLANA助记词钱包
RPC 端点(可选,默认值已提供):
- 以太坊RPC URL (默认:https://eth.llamarpc.com)
- ARBITRUM_RPC_URL(注:这通常是一个用于连接以太坊Layer 2扩展解决方案Arbitrum的RPC(远程过程调用)端点URL,在中文中可直接表述为“Arbitrum RPC端点URL”,但具体翻译可能根据上下文有所调整,此处保留原英文表述以体现技术术语的准确性) (默认:https://arbitrum-one-rpc.publicnode.com)
- BNB_RPC_URL 翻译为中文是:“BNB网络的RPC(远程过程调用)URL” (默认:https://bsc-rpc.publicnode.com)
- SOLANA_RPC_URL 翻译成中文是:“SOLANA 网络RPC URL” (默认:https://solana-rpc.publicnode.com)
调试模式(可选):
- DEBUG_FULL 翻译为中文是“全面调试”或“详细调试” - 设置为
true用于详细记录交易日志,包括燃气使用量、额度、区块号和交易哈希(默认:false)
📥 安装
# Clone the repository
git clone https://github.com/Tairon-ai/aster-mcp.git
cd aster-mcp
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your API credentials and wallet keys
# Start the HTTP server
npm start
# MCP stdio server for Claude Desktop
npm run mcpClaude 桌面集成
在Claude Desktop设置中,前往 开发者 按制表符键并编辑配置,添加以下内容:
{
"mcpServers": {
"aster-dex": {
"command": "node",
"args": ["/path/to/aster-mcp/mcp/index.js"],
"env": {
"ASTER_API_KEY": "your_api_key_here",
"ASTER_API_SECRET": "your_api_secret_here",
"ETHEREUM_WALLET_PRIVATE_KEY": "0x...",
"ARBITRUM_WALLET_PRIVATE_KEY": "0x...",
"BNB_WALLET_PRIVATE_KEY": "0x...",
"SOLANA_WALLET_PRIVATE_KEY": "base58_key_here"
}
}
}
}______________________________________________________________________
🛠 可用工具
💼 这个符号通常代表“文件夹”或“办公用品”,在中文中可以翻译为“文件夹”或根据上下文翻译为“办公用品”等。 钱包管理
| 工具 | 描述 | 参数 | 返回值 | |||
|---|---|---|---|---|---|---|
| (无) | (无) | (无) | (无) | create_evm_wallet | network | 创建新的EVM钱包(以太坊/Arbitrum/BNB) |
| (Ethereum/Arbitrum/BNB) | 地址、私钥、助记词 | create_solana_wallet |
| 创建新的Solana钱包 | 无 | 地址、私钥、助记词 | 💰(钱的符号,常用于表示金钱或价格)
余额与投资组合 | 工具 | 描述 | 参数 | 返回值 | |------|-------------|------------|---------| get_network_balance |(无)| (无) | (无) | (无) | network| address | 检查链上钱包余额 | tokenAddress , (可选), get_account_balance (可选)| 余额、小数位、符号 |
| | 获取AsterDEX交易所余额 | 无 | 所有资产的可用余额和锁定余额 |
📊(图表/数据表格) 市场数据 | 工具 | 描述 | 参数 | 返回值 | get_price |------|-------------|------------|---------| symbol |(无)| (无) | (无) | (无) | | get_exchange_info | 获取当前市场价格 | symbol (例如,ETHUSDT)| 当前价格及24小时数据 |
| | 获取交易所交易规则 |
(可选)| 交易对、过滤器、限制 | 🛒 翻译为中文是“购物车”。这个表情符号通常用来表示购物或购物车的概念。 交易 market_buy | 工具 | 描述 | 参数 | 返回值 | symbol |------|-------------|------------|---------| quoteAmount |(无)|(无)|(无)|(无)|
| | 执行市价买入订单 |
(例如,BTCUSDT), (例如,“100”)| 订单详情及执行价格 | 📥 信封/收件箱 deposit 存款与取款 network| 工具 | 描述 | 参数 | 返回值 | token|------|-------------|------------|---------| amount|(无)| (无) | (无) | (无) | privateKey | | 将代币存入AsterDEX | get_withdraw_fee , token, network , (可选)| 交易哈希 & 状态 | withdraw | network| 获取提现费用预估 | token, amount| 费用金额及网络 | toAddress | privateKey | 从AsterDEX提现至钱包 |
, ,
, (可选), (可选)| 交易详情及状态 | swap_and_bridge 🌉(桥) fromNetwork跨链操作 fromToken| 工具 | 描述 | 参数 | 返回值 | fromAmount|------|-------------|------------|---------| targetToken|(无)| (无) | (无) | (无) | toNetwork| toAddress| 一键跨链兑换 | privateKey ,
______________________________________________________________________
,
, ,
"Create a new Ethereum wallet"
"Generate a Solana wallet for me"
"Create an Arbitrum wallet", ,
"Check my Ethereum balance"
"What's my USDT balance on Arbitrum?"
"Show balance of 0x... on Ethereum"
"Check SOL balance of [solana_address]"(可选)| 完成交易流程详情 | 🤖 提示词
"Show my AsterDEX account balance"
"What's my balance on the exchange?"
"Get exchange info for BTCUSDT"
"Show all available trading pairs"💼 简称“文件夹”或“商务文件夹”,也可泛指与办公、工作相关的物品或场景。 钱包管理
"What's the current price of BTCUSDT?"
"Get ETH price in USDT"
"Show me ASTER price"💰(钱的符号,无实际文字对应,可理解为“钱”或“金钱”) 余额核对
"Buy BTC for 2 USDT"
"Market buy ETHUSDT with 1 USDT"
"Buy ASTER for 3 USDT"
"Execute market buy of 2 USDT worth of BTC"📊(图表) 交换余额及信息
"Deposit 1 USDT from Ethereum to AsterDEX"
"Deposit 2 SOL from Solana"
"Deposit 3 USDC from Arbitrum"
"Transfer 1.5 BNB from BNB Chain to exchange"💹(股票/上升趋势的箭头) 价格检查
"What's the withdrawal fee for USDT on Ethereum?"
"Get withdrawal fee for BTC on Arbitrum"
"Withdraw 2 USDT to 0x... on Ethereum"
"Send 1 USDC to my Arbitrum wallet 0x..."
"Withdraw 1 USDT to my wallet on BNB Chain"
"Withdraw 0.5 ETH on Ethereum (to my env wallet)"🛒 篮子(购物车) 交易
"Deposit 2 USDT from BNB, buy USDC, and withdraw to Arbitrum address 0x..."
"Swap 1 USDC from Ethereum to BTC and bridge to Arbitrum"
"Deposit 3 USDT from Arbitrum, swap to ASTER, withdraw to BSC 0x..."📥 这个符号本身在中文中没有直接对应的翻译,它通常代表“收件箱”或“输入”等意思,具体翻译需结合上下文。如果作为一个独立的符号,可以简单描述为“信箱”或“输入框”。
# Test with curl (HTTP endpoint)
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_price", "arguments": {"symbol": "BTCUSDT"}}, "id": 1}'
# Health check
curl http://localhost:8080/health
# Server info
curl http://localhost:8080/info______________________________________________________________________
存款
📤 表示“传出”或“发送出去”,在中文中常用来描述将信息、文件或物品从一个地方传送到另一个地方的动作。
- 提款 🌉(桥)
.env跨链兑换 - 🔧 测试工具 🔒 安全
- 🛡️ 安全最佳实践 API密钥保护
- - 永远不要提交(代码/更改等) 文件或API密钥到版本控制
- 按网络划分的钱包 - 每个网络都有独立的钱包配置
- 私钥安全 - 私钥永远不会离开您的环境,仅用于签名
- 环境变量 - 所有敏感数据均存储在环境变量中
- 输入验证 - 所有输入在处理前均经过验证
- EIP-712 签名 - 根据以太坊标准确保安全的提现签名
速率限制
内置的速率限制可防止滥用API
- 安全通信 - 所有外部API调用均使用HTTPS
- 错误处理 - 错误信息不会泄露敏感信息
NETWORK_WALLET_PRIVATE_KEY🔐 钱包配置优先级 - 服务器使用以下优先级顺序来验证钱包凭据: 用户提供的私钥
NETWORK_WALLET_MNEMONIC(在工具参数中)
特定网络的私钥
- (来自 环境变量)
- 特定于网络的助记符 (来自
- 环境变量)
- ⚠️ 重要的安全注意事项
- Solana私钥
______________________________________________________________________
必须是base58格式(不要0x前缀!)
EVM私钥
# Start production HTTP server
NODE_ENV=production npm start
# With PM2
pm2 start server.js --name aster-mcp
# With Docker
docker build -t aster-mcp .
docker run -d -p 8080:8080 --env-file .env aster-mcp
# Docker Compose
docker-compose up -d必须是带有0x前缀的十六进制格式
# Aster DEX API Configuration
ASTER_API_KEY=your_api_key_here
ASTER_API_SECRET=your_api_secret_here
ASTER_API_BASE_URL=https://sapi.asterdex.com
ASTER_RECV_WINDOW=5000
# Ethereum Wallet (EVM - hex format with 0x prefix)
ETHEREUM_WALLET_PRIVATE_KEY=0x_your_ethereum_private_key_here
ETHEREUM_WALLET_MNEMONIC=your twelve word ethereum mnemonic phrase here
ETHEREUM_RPC_URL=https://eth.llamarpc.com
# Arbitrum Wallet (EVM - hex format with 0x prefix)
ARBITRUM_WALLET_PRIVATE_KEY=0x_your_arbitrum_private_key_here
ARBITRUM_WALLET_MNEMONIC=your twelve word arbitrum mnemonic phrase here
ARBITRUM_RPC_URL=https://arbitrum-one-rpc.publicnode.com
# BNB Chain Wallet (EVM - hex format with 0x prefix)
BNB_WALLET_PRIVATE_KEY=0x_your_bnb_private_key_here
BNB_WALLET_MNEMONIC=your twelve word bnb mnemonic phrase here
BNB_RPC_URL=https://bsc-rpc.publicnode.com
# Solana Wallet (base58 format - NO 0x prefix!)
SOLANA_WALLET_PRIVATE_KEY=your_solana_private_key_base58_here
SOLANA_WALLET_MNEMONIC=your twelve word solana mnemonic phrase here
SOLANA_RPC_URL=https://solana-rpc.publicnode.com
# Server Configuration
PORT=8080
NODE_ENV=production
# Rate Limiting
RATE_LIMIT_REQUESTS_PER_SECOND=10
# Debug Mode (set to 'true' for detailed transaction logging)
# Enables verbose logging for deposits, approvals, and transactions
# Shows: RPC URLs, gas usage, allowances, block numbers, tx hashes
DEBUG_FULL=false______________________________________________________________________
如有需要,请为不同网络分别使用不同的钱包
在生产环境中使用硬件钱包或安全密钥管理 切勿分享您的私钥或助记词 🚀 部署
# Fork the repository
git clone https://github.com/Tairon-ai/aster-mcp.git
# Create feature branch
git checkout -b feature/amazing-feature
# Make changes and commit
git commit -m 'feat: add amazing feature'
git push origin feature/amazing-feature
# Open Pull Request🏭 生产部署
- 🔑 环境变量
- 🤝 贡献
- 我们欢迎投稿!请阅读
- CONTRIBUTING.md 翻译为中文是:“贡献指南.md” 或 “如何贡献.md”(具体翻译可能根据上下文有所调整,但基本意思是指向一个关于如何为项目做出贡献的指南文件)
- 关于我们的开发过程详情。
______________________________________________________________________
📝 开发指南
遵循现有的代码风格和结构 为新功能添加测试 更新API变更的文档
______________________________________________________________________
确保遵循最佳安全实践
______________________________________________________________________
MCP SDK 文档
AsterDEX 文档 AsterDEX现货API Express.js 文档 ethers.js 文档 Solana Web3.js 文档 🎯 支持的网络与链
______________________________________________________________________
| 网络 | 链ID | 类型 | 原生代币 |
- |---------|----------|------|--------------| | 中文翻译 | 项目/列1 | 项目/列2 | 项目/列3 |
- | 以太坊 | 1 | 以太坊虚拟机(EVM) | ETH | | Arbitrum | 42161 | EVM L2(以太坊虚拟机二层网络) | ETH(以太坊) |
- | BNB链 | 56 | EVM(以太坊虚拟机) | BNB(币安币) | | Solana | mainnet-beta | 非以太坊虚拟机(Non-EVM) | SOL |
- 🔗 链接 网站:
______________________________________________________________________
asterdex.com(注:该网址本身无特定中文含义,直接按音译可译为“阿斯特德克斯点康”,但实际使用中通常保留原网址形式,不进行翻译。) 文档: docs.asterdex.com 翻译为中文可以是“asterdex文档网站”或“asterdex的文档中心”,具体翻译可能根据上下文和网站的具体内容有所调整
