binance-futures-mcp 1.0.2__py3-none-any.whl → 1.0.4__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.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/METADATA +1 -1
- binance_futures_mcp-1.0.4.dist-info/RECORD +9 -0
- binance_mcp/server.py +39 -7
- binance_futures_mcp-1.0.2.dist-info/RECORD +0 -9
- {binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/WHEEL +0 -0
- {binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/entry_points.txt +0 -0
- {binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/licenses/LICENSE +0 -0
- {binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
binance_futures_mcp-1.0.4.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=ApB26p9GyoEoJzc0AyZhDG_Z6BMq2i43irVgf88hoFw,39605
|
5
|
+
binance_futures_mcp-1.0.4.dist-info/METADATA,sha256=uIvIKbrdj81WlYcXyRgxFsUd8ZyWEYPZ6-AvLHv0bVU,11022
|
6
|
+
binance_futures_mcp-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
binance_futures_mcp-1.0.4.dist-info/entry_points.txt,sha256=-1iVs9AF7JQBS-xMichP9hQhbCY7YfLFRJVaNKwuN34,69
|
8
|
+
binance_futures_mcp-1.0.4.dist-info/top_level.txt,sha256=RqGhe1caZUvBF_ezvTiLZD8kVS25eiWVkfJfmoND9m8,12
|
9
|
+
binance_futures_mcp-1.0.4.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.3',
|
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
|
|
@@ -248,7 +272,11 @@ class BinanceMCPServer:
|
|
248
272
|
inputSchema={
|
249
273
|
"type": "object",
|
250
274
|
"properties": {
|
251
|
-
"orders": {
|
275
|
+
"orders": {
|
276
|
+
"type": "array",
|
277
|
+
"description": "List of order parameters",
|
278
|
+
"items": {"type": "object"}
|
279
|
+
},
|
252
280
|
"quantity_precision": {"type": "integer", "description": "Quantity precision for validation"},
|
253
281
|
"price_precision": {"type": "integer", "description": "Price precision for validation"}
|
254
282
|
},
|
@@ -274,7 +302,11 @@ class BinanceMCPServer:
|
|
274
302
|
"type": "object",
|
275
303
|
"properties": {
|
276
304
|
"symbol": {"type": "string", "description": "Trading pair symbol"},
|
277
|
-
"order_id_list": {
|
305
|
+
"order_id_list": {
|
306
|
+
"type": "array",
|
307
|
+
"description": "List of order IDs to cancel (up to 10 orders per batch)",
|
308
|
+
"items": {"type": "integer"}
|
309
|
+
}
|
278
310
|
},
|
279
311
|
"required": ["symbol", "order_id_list"]
|
280
312
|
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
binance_futures_mcp-1.0.2.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=FZt8rs22u-37xeZg5Rg7uMVYsNDLZt99DG8EG5YN-k8,38270
|
5
|
-
binance_futures_mcp-1.0.2.dist-info/METADATA,sha256=bUTTzWuLNtsHdDt4K2F3sFEhDt-rHU5zKF6y3UQ_ORc,11022
|
6
|
-
binance_futures_mcp-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
binance_futures_mcp-1.0.2.dist-info/entry_points.txt,sha256=-1iVs9AF7JQBS-xMichP9hQhbCY7YfLFRJVaNKwuN34,69
|
8
|
-
binance_futures_mcp-1.0.2.dist-info/top_level.txt,sha256=RqGhe1caZUvBF_ezvTiLZD8kVS25eiWVkfJfmoND9m8,12
|
9
|
-
binance_futures_mcp-1.0.2.dist-info/RECORD,,
|
File without changes
|
{binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/entry_points.txt
RENAMED
File without changes
|
{binance_futures_mcp-1.0.2.dist-info → binance_futures_mcp-1.0.4.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|