超液体信息MCP服务器
MCP服务器,提供来自Hyperliquit perp DEX的实时数据和见解,用于机器人、仪表板和分析。
特性
- 用户数据查询:
- get_user_state:获取永久或现货市场的用户头寸、保证金和可提取余额。 - get_user_open_orders:检索用户帐户的所有未结订单。 - get_user_trade_history:获取交易记录,填写交易品种、大小和价格等详细信息。 - get_user_funding_history:查询可自定义时间范围的资金支付历史记录。 - get_user_fees:获取用户特定的费用结构(制造商/接受者费率)。 - get_user_staking_summary & get_user_staking_rewards:访问质押详情和奖励。 - get_user_order_by_oid & get_user_order_by_cloid:按订单ID或客户订单ID检索特定订单详细信息。 - get_user_sub_accounts:列出与主帐户关联的子帐户。
- 市场数据工具:
- get_all_mids:获取所有交易对的中间价格。 - get_l2_snapshot:获取特定硬币的2级订单簿快照。 - get_candles_snapshot:使用可定制的间隔和时间范围检索烛台数据。 - get_coin_funding_history:查询特定硬币的融资率历史记录。 - get_perp_dexs:获取有关永续市场的元数据(使用 meta). - get_perp_metadata & get_spot_metadata:获取永久市场和现货市场的详细元数据,以及可选的资产上下文。
- 分析提示:
- analyze_positions:使用相关工具分析用户交易活动的指导提示。
- ISO 8601支持:基于时间的查询(
get_candles_snapshot,get_coin_funding_history,get_user_funding_history)接受ISO 8601时间字符串进行精确的数据过滤。
安装
先决条件
- Python 3.10:Hyperliquit Python SDK要求。
- 用于用户特定查询的有效Hyperliquit帐户地址。
步骤
- 克隆存储库:
git clone https://github.com/kukapay/hyperliquid-info-mcp.git
cd hyperliquid-info-mcp- 再进行:
使用 uv:
uv sync用法
运行服务器
使用MCP Inspector在开发模式下运行服务器:
mcp dev main.py或者安装它以在Claude Desktop中使用:
mcp install main.py --name "Hyperliquid Info"示例用法
使用MCP Inspector或Claude Desktop,您可以使用自然语言提示与服务器交互。以下是如何触发 analyze_positions 即时和个性化的工具对话。
- 分析交易头寸:
- 提示:\ “请分析我地址为0xYourAddress的Hyperliquit账户的交易活动。提供有关我的头寸、未结订单和最近交易的见解。” - 行为:\ 这会触发 analyze_positions prompt,它使用 get_user_state, get_user_open_orders, get_user_trade_history, get_user_funding_history,以及 get_user_fees 获取数据并生成风险/绩效分析。 - 输出示例:
For account 0xYourAddress:
- Current Positions: 0.1 BTC long at $50,000, unrealized PNL +$500.
- Open Orders: 1 limit order to sell 0.05 BTC at $52,000.
- Recent Trades: Bought 0.1 BTC at $50,000 on 2025-05-30.
- Funding Payments: Paid $10 in funding fees last week.
- Fees: Maker fee 0.02%, taker fee 0.05%.
Recommendation: Monitor BTC price closely due to high leverage.- 获取用户状态:
- 提示:\ “显示我的Hyperliquit帐户0xYourAddress的当前状态,包括我的永久头寸和保证金详细信息。” - 行为:\ 援引 get_user_state(account_address="0xYourAddress", check_spot=False). - 输出示例:
{
"assetPositions": [
{
"position": {
"coin": "BTC",
"szi": "0.1",
"entryPx": "50000.0",
"markPx": "50500.0",
"unrealizedPnl": "500.0"
}
}
],
"marginSummary": {
"accountValue": "10000.0",
"totalMarginUsed": "2000.0"
},
"withdrawable": "8000.0"
}- 获取烛台数据:
- 提示:\ “你能得到2025年1月1日至2025年1日期间以太坊在Hyperliquit上的1分钟烛台数据吗?” - 行为:\ 援引 get_candles_snapshot(coin_name="ETH", interval="1m", start_time="2025-01-01T00:00:00Z", end_time="2025-01-02T00:00:00Z"). - 输出示例:
[
{
"t": 1672531200000,
"o": "3000.0",
"h": "3010.0",
"l": "2995.0",
"c": "3005.0",
"v": "1000.0"
},
...
]- 查看交易历史记录:
- 提示:\ “我的账户0xYourAddress在Hyperliquit上最近有哪些交易?” - 行为:\ 援引 get_user_trade_history(account_address="0xYourAddress"). - 输出示例:
[
{
"coin": "ETH",
"px": "3000.0",
"sz": "0.5",
"time": 1672531200000,
"tid": "123456"
},
...
]- 获取市场元数据:
- 提示:\ “告诉我Hyperliquit上可用的永久市场,包括交易对。” - 行为:\ 援引 get_perp_metadata(include_asset_ctxs=False). - 输出示例:
{
"universe": [
{
"name": "BTC-PERP",
"maxLeverage": 50,
"szDecimals": 4,
"tickSz": "0.1"
},
...
]
}许可证
该项目根据 MIT许可证.
