binance-futures-mcp 1.0.3__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {binance_futures_mcp-1.0.3.dist-info → binance_futures_mcp-1.0.6.dist-info}/METADATA +49 -35
- binance_futures_mcp-1.0.6.dist-info/RECORD +9 -0
- {binance_futures_mcp-1.0.3.dist-info → binance_futures_mcp-1.0.6.dist-info}/WHEEL +1 -1
- binance_mcp/server.py +66 -8
- binance_futures_mcp-1.0.3.dist-info/RECORD +0 -9
- {binance_futures_mcp-1.0.3.dist-info/licenses → binance_futures_mcp-1.0.6.dist-info}/LICENSE +0 -0
- {binance_futures_mcp-1.0.3.dist-info → binance_futures_mcp-1.0.6.dist-info}/entry_points.txt +0 -0
- {binance_futures_mcp-1.0.3.dist-info → binance_futures_mcp-1.0.6.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: binance-futures-mcp
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.6
|
4
4
|
Summary: A Model Context Protocol server for Binance Futures API
|
5
5
|
Home-page: https://github.com/alexcandrabersiva/bin-mcp
|
6
6
|
Author: Binance MCP Server
|
@@ -20,20 +20,9 @@ Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
20
20
|
Requires-Python: >=3.8
|
21
21
|
Description-Content-Type: text/markdown
|
22
22
|
License-File: LICENSE
|
23
|
-
Requires-Dist: mcp>=1.0.0
|
24
|
-
Requires-Dist: aiohttp>=3.8.0
|
25
|
-
Requires-Dist: pydantic>=2.0.0
|
26
|
-
Dynamic: author
|
27
|
-
Dynamic: classifier
|
28
|
-
Dynamic: description
|
29
|
-
Dynamic: description-content-type
|
30
|
-
Dynamic: home-page
|
31
|
-
Dynamic: keywords
|
32
|
-
Dynamic: license-file
|
33
|
-
Dynamic: project-url
|
34
|
-
Dynamic: requires-dist
|
35
|
-
Dynamic: requires-python
|
36
|
-
Dynamic: summary
|
23
|
+
Requires-Dist: mcp (>=1.0.0)
|
24
|
+
Requires-Dist: aiohttp (>=3.8.0)
|
25
|
+
Requires-Dist: pydantic (>=2.0.0)
|
37
26
|
|
38
27
|
# Binance MCP Server
|
39
28
|
|
@@ -54,10 +43,12 @@ A Model Context Protocol (MCP) server that provides comprehensive access to Bina
|
|
54
43
|
3. **Or configure in VS Code** by adding to your `settings.json`:
|
55
44
|
```json
|
56
45
|
{
|
57
|
-
"mcp
|
58
|
-
"
|
59
|
-
"
|
60
|
-
|
46
|
+
"mcp": {
|
47
|
+
"servers": {
|
48
|
+
"binance": {
|
49
|
+
"command": "uvx",
|
50
|
+
"args": ["--from", "binance-futures-mcp", "binance-mcp-server.exe", "--binance-api-key", "your_key", "--binance-secret-key", "your_secret"]
|
51
|
+
}
|
61
52
|
}
|
62
53
|
}
|
63
54
|
}
|
@@ -120,11 +111,12 @@ Add to your VS Code `settings.json`:
|
|
120
111
|
|
121
112
|
```json
|
122
113
|
{
|
123
|
-
"mcp
|
124
|
-
"
|
125
|
-
"
|
126
|
-
|
127
|
-
|
114
|
+
"mcp": {
|
115
|
+
"servers": {
|
116
|
+
"binance": {
|
117
|
+
"command": "uvx",
|
118
|
+
"args": ["--from", "binance-futures-mcp", "binance-mcp-server.exe", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
119
|
+
}
|
128
120
|
}
|
129
121
|
}
|
130
122
|
}
|
@@ -139,8 +131,7 @@ Add to your Cursor configuration file (`.cursor/mcp.json`):
|
|
139
131
|
"servers": {
|
140
132
|
"binance": {
|
141
133
|
"command": "uvx",
|
142
|
-
"args": ["binance-futures-mcp", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
143
|
-
"env": {}
|
134
|
+
"args": ["--from", "binance-futures-mcp", "binance-mcp-server.exe", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
144
135
|
}
|
145
136
|
}
|
146
137
|
}
|
@@ -155,8 +146,7 @@ Add to your Windsurf configuration (`.windsurf/mcp.json`):
|
|
155
146
|
"mcpServers": {
|
156
147
|
"binance": {
|
157
148
|
"command": "uvx",
|
158
|
-
"args": ["binance-futures-mcp", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
159
|
-
"env": {}
|
149
|
+
"args": ["--from", "binance-futures-mcp", "binance-mcp-server.exe", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
160
150
|
}
|
161
151
|
}
|
162
152
|
}
|
@@ -174,8 +164,7 @@ Add to your Claude Desktop configuration file:
|
|
174
164
|
"mcpServers": {
|
175
165
|
"binance": {
|
176
166
|
"command": "uvx",
|
177
|
-
"args": ["binance-futures-mcp", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
178
|
-
"env": {}
|
167
|
+
"args": ["--from", "binance-futures-mcp", "binance-mcp-server.exe", "--binance-api-key", "your_api_key", "--binance-secret-key", "your_secret_key"]
|
179
168
|
}
|
180
169
|
}
|
181
170
|
}
|
@@ -187,9 +176,10 @@ Add to your Claude Desktop configuration file:
|
|
187
176
|
|
188
177
|
2. **Set API credentials**: Replace `your_api_key` and `your_secret_key` with your actual Binance API credentials.
|
189
178
|
|
190
|
-
|
179
|
+
2. **Alternative commands**: You can also use:
|
180
|
+
- `uvx binance-futures-mcp` (direct package execution)
|
181
|
+
- `uvx --from binance-futures-mcp binance-mcp-server.exe` (explicit executable)
|
191
182
|
- `pip install binance-futures-mcp && python -m binance_mcp`
|
192
|
-
- `binance-mcp-server` (if installed globally and on PATH)
|
193
183
|
|
194
184
|
4. **Python environment**: Using `uvx` automatically handles the Python environment.
|
195
185
|
|
@@ -231,7 +221,7 @@ uvx binance-futures-mcp --binance-api-key "your_key" --binance-secret-key "your_
|
|
231
221
|
|
232
222
|
### Available Tools
|
233
223
|
|
234
|
-
The server provides
|
224
|
+
The server provides 37 tools organized into categories:
|
235
225
|
|
236
226
|
#### Account Information (5 tools)
|
237
227
|
- `get_account_info` - Get futures account information
|
@@ -264,10 +254,12 @@ The server provides 32 tools organized into categories:
|
|
264
254
|
- `change_position_mode` - Change position mode
|
265
255
|
- `modify_position_margin` - Modify position margin
|
266
256
|
|
267
|
-
#### Market Data (
|
257
|
+
#### Market Data (8 tools)
|
268
258
|
- `get_exchange_info` - Get trading rules and symbol info
|
269
259
|
- `get_book_ticker` - Get best bid/ask prices
|
270
260
|
- `get_price_ticker` - Get latest prices
|
261
|
+
- `get_24hr_ticker` - Get 24hr price change statistics
|
262
|
+
- `get_taker_buy_sell_volume` - Get taker buy/sell volume ratio
|
271
263
|
- `get_order_book` - Get order book depth
|
272
264
|
- `get_klines` - Get candlestick data
|
273
265
|
- `get_mark_price` - Get mark price and funding rate
|
@@ -332,6 +324,28 @@ The server provides 32 tools organized into categories:
|
|
332
324
|
}
|
333
325
|
```
|
334
326
|
|
327
|
+
### Get 24hr Price Statistics
|
328
|
+
|
329
|
+
```json
|
330
|
+
{
|
331
|
+
"tool": "get_24hr_ticker",
|
332
|
+
"arguments": {
|
333
|
+
"symbol": "BTCUSDT"
|
334
|
+
}
|
335
|
+
}
|
336
|
+
```
|
337
|
+
|
338
|
+
### Get Taker Buy/Sell Volume Ratio
|
339
|
+
|
340
|
+
```json
|
341
|
+
{
|
342
|
+
"tool": "get_taker_buy_sell_volume",
|
343
|
+
"arguments": {
|
344
|
+
"symbol": "BTCUSDT"
|
345
|
+
}
|
346
|
+
}
|
347
|
+
```
|
348
|
+
|
335
349
|
## Security
|
336
350
|
|
337
351
|
### API Key Security
|
@@ -0,0 +1,9 @@
|
|
1
|
+
binance_mcp/__init__.py,sha256=ExUxc1kp3GoSwmEtC7eGgFMZlvSQ4IdW1T5xhw-NT98,106
|
2
|
+
binance_mcp/__main__.py,sha256=_9DBrtv0PAvjLjCqKk_cMfGtkqSUOcmU6HeQKFjuFMQ,214
|
3
|
+
binance_mcp/server.py,sha256=phF-od_mUEusWHdWJhaXimxKF8SlS6NltlQNglRsy7U,41669
|
4
|
+
binance_futures_mcp-1.0.6.dist-info/LICENSE,sha256=zqfwopvOi7kOx5YVOnehgmRFR-IU3x1n9JEShr3QOYg,1075
|
5
|
+
binance_futures_mcp-1.0.6.dist-info/METADATA,sha256=yQiqDxpSDb3ln5Tlbj4Zu-fV6w1dHxK151HZIvdlOyU,11417
|
6
|
+
binance_futures_mcp-1.0.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
7
|
+
binance_futures_mcp-1.0.6.dist-info/entry_points.txt,sha256=-1iVs9AF7JQBS-xMichP9hQhbCY7YfLFRJVaNKwuN34,69
|
8
|
+
binance_futures_mcp-1.0.6.dist-info/top_level.txt,sha256=RqGhe1caZUvBF_ezvTiLZD8kVS25eiWVkfJfmoND9m8,12
|
9
|
+
binance_futures_mcp-1.0.6.dist-info/RECORD,,
|
binance_mcp/server.py
CHANGED
@@ -27,14 +27,31 @@ class BinanceConfig:
|
|
27
27
|
|
28
28
|
|
29
29
|
class BinanceClient:
|
30
|
-
"""Binance Futures API client"""
|
30
|
+
"""Binance Futures API client with improved connectivity"""
|
31
31
|
|
32
32
|
def __init__(self, config: BinanceConfig):
|
33
33
|
self.config = config
|
34
34
|
self.session: Optional[aiohttp.ClientSession] = None
|
35
35
|
|
36
36
|
async def __aenter__(self):
|
37
|
-
|
37
|
+
# Create session with better connectivity settings
|
38
|
+
timeout = aiohttp.ClientTimeout(total=30, connect=10)
|
39
|
+
connector = aiohttp.TCPConnector(
|
40
|
+
ttl_dns_cache=300,
|
41
|
+
use_dns_cache=True,
|
42
|
+
limit=100,
|
43
|
+
limit_per_host=10,
|
44
|
+
enable_cleanup_closed=True
|
45
|
+
)
|
46
|
+
|
47
|
+
self.session = aiohttp.ClientSession(
|
48
|
+
timeout=timeout,
|
49
|
+
connector=connector,
|
50
|
+
headers={
|
51
|
+
'User-Agent': 'binance-mcp-server/1.0.6',
|
52
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
53
|
+
}
|
54
|
+
)
|
38
55
|
return self
|
39
56
|
|
40
57
|
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
@@ -78,17 +95,24 @@ class BinanceClient:
|
|
78
95
|
|
79
96
|
try:
|
80
97
|
if method == "GET":
|
81
|
-
async with self.session.get(url, params=params, headers=headers) as response:
|
98
|
+
async with self.session.get(url, params=params, headers=headers, ssl=False) as response:
|
99
|
+
response.raise_for_status()
|
82
100
|
return await response.json()
|
83
101
|
elif method == "POST":
|
84
|
-
async with self.session.post(url, data=params, headers=headers) as response:
|
102
|
+
async with self.session.post(url, data=params, headers=headers, ssl=False) as response:
|
103
|
+
response.raise_for_status()
|
85
104
|
return await response.json()
|
86
105
|
elif method == "DELETE":
|
87
|
-
async with self.session.delete(url, data=params, headers=headers) as response:
|
106
|
+
async with self.session.delete(url, data=params, headers=headers, ssl=False) as response:
|
107
|
+
response.raise_for_status()
|
88
108
|
return await response.json()
|
89
109
|
else:
|
90
110
|
raise ValueError(f"Unsupported HTTP method: {method}")
|
91
111
|
|
112
|
+
except aiohttp.ClientError as e:
|
113
|
+
raise Exception(f"Network error connecting to Binance API: {str(e)}")
|
114
|
+
except asyncio.TimeoutError:
|
115
|
+
raise Exception("Request timeout - please check your internet connection")
|
92
116
|
except Exception as e:
|
93
117
|
raise Exception(f"Request failed: {str(e)}")
|
94
118
|
|
@@ -448,6 +472,17 @@ class BinanceMCPServer:
|
|
448
472
|
"required": []
|
449
473
|
}
|
450
474
|
),
|
475
|
+
Tool(
|
476
|
+
name="get_24hr_ticker",
|
477
|
+
description="Get 24hr ticker price change statistics",
|
478
|
+
inputSchema={
|
479
|
+
"type": "object",
|
480
|
+
"properties": {
|
481
|
+
"symbol": {"type": "string", "description": "Trading pair symbol (optional, if not provided returns all symbols)"}
|
482
|
+
},
|
483
|
+
"required": []
|
484
|
+
}
|
485
|
+
),
|
451
486
|
Tool(
|
452
487
|
name="get_order_book",
|
453
488
|
description="Get order book for a symbol",
|
@@ -515,6 +550,21 @@ class BinanceMCPServer:
|
|
515
550
|
"required": []
|
516
551
|
}
|
517
552
|
),
|
553
|
+
Tool(
|
554
|
+
name="get_taker_buy_sell_volume",
|
555
|
+
description="Get taker buy/sell volume ratio statistics",
|
556
|
+
inputSchema={
|
557
|
+
"type": "object",
|
558
|
+
"properties": {
|
559
|
+
"symbol": {"type": "string", "description": "Trading pair symbol"},
|
560
|
+
"period": {"type": "string", "description": "Period for the data (5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d)"},
|
561
|
+
"start_time": {"type": "integer", "description": "Start timestamp in ms"},
|
562
|
+
"end_time": {"type": "integer", "description": "End timestamp in ms"},
|
563
|
+
"limit": {"type": "integer", "description": "Number of entries (max 500, default 30)"}
|
564
|
+
},
|
565
|
+
"required": ["symbol", "period"]
|
566
|
+
}
|
567
|
+
),
|
518
568
|
|
519
569
|
# Trading History Tools
|
520
570
|
Tool(
|
@@ -555,9 +605,9 @@ class BinanceMCPServer:
|
|
555
605
|
|
556
606
|
# Check if API credentials are configured for authenticated endpoints
|
557
607
|
unauthenticated_tools = [
|
558
|
-
"get_exchange_info", "get_price_ticker", "get_book_ticker",
|
608
|
+
"get_exchange_info", "get_price_ticker", "get_24hr_ticker", "get_book_ticker",
|
559
609
|
"get_order_book", "get_klines", "get_mark_price",
|
560
|
-
"get_aggregate_trades", "get_funding_rate_history"
|
610
|
+
"get_aggregate_trades", "get_funding_rate_history", "get_taker_buy_sell_volume"
|
561
611
|
]
|
562
612
|
|
563
613
|
if not self.config.api_key or not self.config.secret_key:
|
@@ -689,6 +739,11 @@ class BinanceMCPServer:
|
|
689
739
|
if "symbol" in arguments:
|
690
740
|
params["symbol"] = arguments["symbol"]
|
691
741
|
result = await client._make_request("GET", "/fapi/v1/ticker/price", params)
|
742
|
+
elif name == "get_24hr_ticker":
|
743
|
+
params = {}
|
744
|
+
if "symbol" in arguments:
|
745
|
+
params["symbol"] = arguments["symbol"]
|
746
|
+
result = await client._make_request("GET", "/fapi/v1/ticker/24hr", params)
|
692
747
|
elif name == "get_order_book":
|
693
748
|
params = {
|
694
749
|
"symbol": arguments["symbol"],
|
@@ -709,6 +764,9 @@ class BinanceMCPServer:
|
|
709
764
|
elif name == "get_funding_rate_history":
|
710
765
|
params = {k: v for k, v in arguments.items() if v is not None}
|
711
766
|
result = await client._make_request("GET", "/fapi/v1/fundingRate", params)
|
767
|
+
elif name == "get_taker_buy_sell_volume":
|
768
|
+
params = {k: v for k, v in arguments.items() if v is not None}
|
769
|
+
result = await client._make_request("GET", "/futures/data/takerlongshortRatio", params)
|
712
770
|
|
713
771
|
# Trading History Tools
|
714
772
|
elif name == "get_account_trades":
|
@@ -758,7 +816,7 @@ async def main():
|
|
758
816
|
write_stream,
|
759
817
|
InitializationOptions(
|
760
818
|
server_name="binance-futures-mcp-server",
|
761
|
-
server_version="1.0.
|
819
|
+
server_version="1.0.6",
|
762
820
|
capabilities={
|
763
821
|
"tools": {}
|
764
822
|
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
binance_futures_mcp-1.0.3.dist-info/licenses/LICENSE,sha256=zqfwopvOi7kOx5YVOnehgmRFR-IU3x1n9JEShr3QOYg,1075
|
2
|
-
binance_mcp/__init__.py,sha256=ExUxc1kp3GoSwmEtC7eGgFMZlvSQ4IdW1T5xhw-NT98,106
|
3
|
-
binance_mcp/__main__.py,sha256=_9DBrtv0PAvjLjCqKk_cMfGtkqSUOcmU6HeQKFjuFMQ,214
|
4
|
-
binance_mcp/server.py,sha256=aSlbwCFr5EV9X_vt70eK6-ACVkMl6IxNDkNA4yaRW1o,38583
|
5
|
-
binance_futures_mcp-1.0.3.dist-info/METADATA,sha256=xXqrBUjb3_r22RJD9l6FWRjC__4ygDfjcwz3KlkXTXg,11022
|
6
|
-
binance_futures_mcp-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
binance_futures_mcp-1.0.3.dist-info/entry_points.txt,sha256=-1iVs9AF7JQBS-xMichP9hQhbCY7YfLFRJVaNKwuN34,69
|
8
|
-
binance_futures_mcp-1.0.3.dist-info/top_level.txt,sha256=RqGhe1caZUvBF_ezvTiLZD8kVS25eiWVkfJfmoND9m8,12
|
9
|
-
binance_futures_mcp-1.0.3.dist-info/RECORD,,
|
{binance_futures_mcp-1.0.3.dist-info/licenses → binance_futures_mcp-1.0.6.dist-info}/LICENSE
RENAMED
File without changes
|
{binance_futures_mcp-1.0.3.dist-info → binance_futures_mcp-1.0.6.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|