File size: 4,625 Bytes
cb5ac6b
a5b16cd
 
c75d570
 
cb5ac6b
 
 
 
a5b16cd
c75d570
a5b16cd
c75d570
a5b16cd
 
c75d570
a5b16cd
c75d570
a5b16cd
 
 
 
c75d570
a5b16cd
 
 
 
c75d570
a5b16cd
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
c75d570
a5b16cd
 
 
 
 
 
 
 
c75d570
a5b16cd
c75d570
a5b16cd
c75d570
 
a5b16cd
c75d570
a5b16cd
c75d570
a5b16cd
c75d570
 
a5b16cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c75d570
a5b16cd
 
 
c75d570
a5b16cd
 
 
 
 
c75d570
a5b16cd
 
c75d570
 
 
a5b16cd
 
 
c75d570
a5b16cd
c75d570
 
a5b16cd
c75d570
 
a5b16cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c75d570
a5b16cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
title: Hyperliquid MCP Server & Trading Dashboard
emoji: πŸ“Š
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---

# πŸš€ Hyperliquid MCP Server & Trading Dashboard

A production-ready **Model Context Protocol (MCP)** server with an interactive **Gradio dashboard** providing real-time trading data from **Hyperliquid** - the leading decentralized perpetual exchange.

## 🌐 Live Demo
**URL**: https://huggingface.co/spaces/rzvn/hyperliquid-mcp-server

## 🎯 Features

### βœ… MCP Server
- **8 Trading Tools** with RESTful API
- **Model Context Protocol** compliance
- **Real-time data** from Hyperliquid

### βœ… Interactive Dashboard
- **5 Interactive Tabs** with live data
- **Real-time charts** and visualizations
- **User-friendly interface** for all tools

## πŸ“Š Available Trading Tools

### 1. **Market Prices** πŸ“ˆ
Get real-time prices for 200+ trading pairs
- Live price feed
- Top 20 by value
- Interactive data table

### 2. **Recent Trades** πŸ’±
View recent trading activity
- Customizable trade count (1-1000)
- Real-time trade history
- Symbol-based filtering

### 3. **Candlestick Charts** πŸ“Š
Interactive price charts
- Multiple timeframes (1m, 5m, 1h, 4h, 1d)
- Customizable candle count
- Professional charting with Plotly

### 4. **Order Book** πŸ“‹
Live order book visualization
- Bid/ask depth charts
- Real-time updates
- Symbol-based lookup

### 5. **Funding Rates** πŸ’°
Perpetual contract funding rates
- All markets overview
- Individual symbol focus
- Historical rate tracking

## πŸ”§ API Usage

### MCP Endpoints
- **Health Check**: `GET /health`
- **List Tools**: `POST /mcp/tools`
- **Execute Tool**: `POST /mcp/call`

### Example API Calls

#### Get All Market Prices
```bash
curl -X POST https://rzvn-hyperliquid-mcp-server.hf.space/mcp/call \
  -H "Content-Type: application/json" \
  -d '{"name": "get_all_mids", "arguments": {}}'
```

#### Get Recent BTC Trades
```bash
curl -X POST https://rzvn-hyperliquid-mcp-server.hf.space/mcp/call \
  -H "Content-Type: application/json" \
  -d '{"name": "get_recent_trades", "arguments": {"coin": "BTC", "n": 50}}'
```

## πŸ–₯️ Interactive Dashboard Usage

### Dashboard Tabs

#### πŸ“ˆ **Market Prices Tab**
- Click "Get All Market Prices" to load live data
- View top 20 cryptocurrencies by price
- Interactive sorting and filtering

#### πŸ’± **Recent Trades Tab**
- Enter coin symbol (e.g., "BTC", "ETH")
- Adjust number of trades with slider
- View detailed trade history table

#### πŸ“Š **Candlestick Charts Tab**
- Enter coin symbol
- Select timeframe (1m to 1d)
- Adjust number of candles
- Interactive zoom and pan

#### πŸ“‹ **Order Book Tab**
- Enter coin symbol
- View live bid/ask depth
- Visual order book representation

#### πŸ’° **Funding Rates Tab**
- Optional coin symbol input
- View all funding rates or specific symbol
- Real-time rate updates

## πŸ› οΈ Development

### Local Setup
```bash
# Clone the repository
git clone https://huggingface.co/spaces/rzvn/hyperliquid-mcp-server
cd hyperliquid-mcp-server

# Install dependencies
pip install -r requirements.txt

# Run locally
python app.py
```

### Access Points
- **Gradio Dashboard**: http://localhost:7860
- **MCP API**: http://localhost:3001

### Docker Build
```bash
docker build -t hyperliquid-mcp .
docker run -p 7860:7860 -p 3001:3001 hyperliquid-mcp
```

## πŸ”— MCP Integration

This server follows the **Model Context Protocol (MCP)** standard, making it compatible with:
- Claude Desktop
- Cursor AI
- Any MCP-compatible client
- Custom applications

## πŸ“ˆ Data Coverage

- **200+ Trading Pairs**: All major cryptocurrencies and altcoins
- **Real-time Data**: Live prices, trades, and order books
- **Historical Data**: Candlestick charts with multiple timeframes
- **Perpetual Contracts**: Funding rates and open interest
- **Account Analytics**: Portfolio tracking and position management

## 🎯 Use Cases

### For Traders
- **Real-time market monitoring**
- **Technical analysis with charts**
- **Order book analysis**
- **Funding rate tracking**

### For Developers
- **MCP server integration**
- **RESTful API access**
- **Real-time data feeds**
- **Trading bot development**

### For Analysts
- **Market research**
- **Historical data analysis**
- **Trading strategy backtesting**
- **Market sentiment analysis**

## 🀝 Contributing

Feel free to open issues or submit pull requests to enhance the server with additional Hyperliquid endpoints or features.

## πŸ“„ License

MIT License - Feel free to use this server for your own projects and applications.

---

**Built with ❀️ for the Hyperliquid trading community**