使用说明
Aster MCP服务器
一 模型上下文协议 服务器 Aster期货和现货 API,使AI代理(如Cursor、Claude、LangChain)能够安全地查询市场数据、下订单以及检查头寸和账户。
特性
- 配置和安全:多账户,本地Fernet-encrypted API密钥存储(
~/.config/aster-mcp/) - 认证: HMAC (API密钥/秘密)和 V3密钥签名 (EIP-712,用户/签名者/私钥;见 星号-未来-api-v3)
- MCP工具:
- 期货:市场数据、账户/头寸、下单/取消订单、杠杆和保证金、转账、收入、佣金率、杠杆等级
- 斑点:市场数据、账户、下单/取消订单、交易、交易历史、佣金率、现货-期货转账
- 命令行界面:
config/list/start/stop/status/test/backup
安装
pip install -e .
# or
pip install git+https://github.com/asterdex/aster-mcp.git
快速开始
# 1. Configure account (interactive, default HMAC)
aster-mcp config
# V3 key-signing account (EIP-712)
aster-mcp config --account-id main --auth-type v3
# 2. List accounts
aster-mcp list
# 3. Start MCP service (default stdio for Cursor/Claude)
aster-mcp start
# 4. Test connection
aster-mcp test main
与光标一起使用
- 至少配置一个帐户
aster-mcp config. - 在Cursor的MCP设置中添加Aster MCP;命令示例:
python -m aster_mcp.simple_server(使用Python环境aster_mcp已安装)。
- 在聊天中使用自然语言(例如“获取Aster BTC价格”,“下Aster订单”)。
工具列表(摘要)
| 类别 | 期货工具 | 现货工具 |
|---|---|---|
| 市场 | get_ticker, get_order_book, get_klines, get_funding_rate, get_funding_info, get_exchange_info, ping |
get_spot_ticker, get_spot_price, get_spot_order_book, get_spot_klines, get_spot_exchange_info |
账户 get_balance, get_positions, get_account_info, get_account_v4 |
get_spot_account |
|
| 订单 | create_order, cancel_order, cancel_all_orders, get_order, get_open_orders, get_all_orders, get_my_trades |
create_spot_order, cancel_spot_order, cancel_spot_all_orders, get_spot_order, get_spot_open_orders, get_spot_all_orders, get_spot_my_trades |
| 其他 | set_leverage, set_margin_mode, transfer_funds, get_income, get_commission_rate, get_leverage_bracket |
get_spot_transaction_history, get_spot_commission_rate, transfer_spot_futures |
| 系统 | get_server_info |
完整参数和集成细节: Aster MCP外部集成指南.
项目结构
aster-mcp/
├── aster_mcp/
│ ├── __init__.py
│ ├── config.py # Config & encryption
│ ├── client.py # Aster FAPI client (futures, HMAC)
│ ├── v3_client.py # Aster FAPI v3 client (EIP-712)
│ ├── spot_client.py # Aster SAPI client (spot)
│ ├── tools.py # MCP tool implementations
│ ├── simple_server.py
│ └── cli.py
├── docs/
│ └── Aster-MCP-External-Integration.md
├── tests/
├── pyproject.toml
├── requirements.txt
└── README.md
与Aster API的关系
- 此回购包括 阿斯特FAPI (
client.py,期货)和 语音应用程序编程接口 (spot_client.py,spot)客户。 - 认证:
- HMAC:的API密钥/机密
/fapi/v1,/fapi/v2等等。 - V3密钥签名:用户(主钱包)、签名者(API钱包)、私有密钥(签名者密钥)、EIP-712;为了
/fapi/v3。需要eth-account.
- HMAC:的API密钥/机密
- 期货基础URL:
https://fapi.asterdex.com;点基URL:https://sapi.asterdex.com(可在配置中为每个帐户覆盖)。 - API文件: aster金融期货api, 星号-未来-api-v3, aster金融现货api.
风险与合规
- 期货交易涉及风险;首先在测试环境中进行验证。
- API密钥以加密方式存储在本地;不要泄露或提交它们。
- 遵守当地法规和Aster平台条款。
许可证
麻省理工学院