sarrafa-mcp 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/index.js +42869 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Saeed Sakib
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# sarrafa-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/sarrafa-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
MCP server for AI agents to interact with Binance -- trading, transfers, and market data.
|
|
7
|
+
|
|
8
|
+
**Sarrafa** (Arabic: صرّافة) means "exchange" or "money changer."
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
claude mcp add sarrafa-mcp -e BINANCE_API_KEY=your_key -e BINANCE_API_SECRET=your_secret -- npx -y sarrafa-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or add manually to your MCP client configuration:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"sarrafa-mcp": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "sarrafa-mcp"],
|
|
24
|
+
"env": {
|
|
25
|
+
"BINANCE_API_KEY": "your_key",
|
|
26
|
+
"BINANCE_API_SECRET": "your_secret"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
| Variable | Required | Description |
|
|
36
|
+
|----------|----------|-------------|
|
|
37
|
+
| `BINANCE_API_KEY` | Yes | Your Binance API key |
|
|
38
|
+
| `BINANCE_API_SECRET` | Yes | Your Binance API secret |
|
|
39
|
+
|
|
40
|
+
## Available Tools
|
|
41
|
+
|
|
42
|
+
### Account (Read)
|
|
43
|
+
|
|
44
|
+
| Tool | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| `get_account_info` | Account balances, permissions, and commission rates |
|
|
47
|
+
| `get_account_status` | Account status (normal/locked) |
|
|
48
|
+
| `get_api_permissions` | Current API key permissions |
|
|
49
|
+
| `get_trade_fee` | Trading fee rates for symbol(s) |
|
|
50
|
+
|
|
51
|
+
### Market Data (Read)
|
|
52
|
+
|
|
53
|
+
| Tool | Description |
|
|
54
|
+
|------|-------------|
|
|
55
|
+
| `get_ticker_price` | Latest price for one or all symbols |
|
|
56
|
+
| `get_ticker_24hr` | 24hr price change statistics |
|
|
57
|
+
| `get_order_book` | Order book depth (bids/asks) |
|
|
58
|
+
| `get_klines` | Candlestick/kline data |
|
|
59
|
+
| `get_recent_trades` | Recent trades for a symbol |
|
|
60
|
+
| `get_exchange_info` | Trading rules, symbol info, filters |
|
|
61
|
+
| `get_avg_price` | Current average price |
|
|
62
|
+
| `get_book_ticker` | Best bid/ask price and quantity |
|
|
63
|
+
|
|
64
|
+
### Order Queries (Read)
|
|
65
|
+
|
|
66
|
+
| Tool | Description |
|
|
67
|
+
|------|-------------|
|
|
68
|
+
| `get_order` | Query a specific order |
|
|
69
|
+
| `get_open_orders` | All open orders |
|
|
70
|
+
| `get_all_orders` | All orders for a symbol |
|
|
71
|
+
| `get_my_trades` | Trade history for a symbol |
|
|
72
|
+
|
|
73
|
+
### Asset Info (Read)
|
|
74
|
+
|
|
75
|
+
| Tool | Description |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| `get_deposit_history` | Deposit history |
|
|
78
|
+
| `get_withdraw_history` | Withdrawal history |
|
|
79
|
+
| `get_asset_detail` | Asset details (fees, limits) |
|
|
80
|
+
| `get_all_coins_info` | All coin network info |
|
|
81
|
+
|
|
82
|
+
### Margin Account (Read)
|
|
83
|
+
|
|
84
|
+
| Tool | Description |
|
|
85
|
+
|------|-------------|
|
|
86
|
+
| `get_margin_account` | Cross margin account details |
|
|
87
|
+
| `get_margin_all_assets` | All margin assets |
|
|
88
|
+
| `get_margin_all_pairs` | All margin trading pairs |
|
|
89
|
+
| `get_margin_price_index` | Margin price index |
|
|
90
|
+
| `get_isolated_margin_account` | Isolated margin account info |
|
|
91
|
+
| `get_margin_open_orders` | Open margin orders |
|
|
92
|
+
| `get_margin_all_orders` | All margin orders for a symbol |
|
|
93
|
+
| `get_margin_my_trades` | Margin trade history |
|
|
94
|
+
|
|
95
|
+
### Transfer Queries (Read)
|
|
96
|
+
|
|
97
|
+
| Tool | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `get_transfer_history` | Universal transfer history |
|
|
100
|
+
|
|
101
|
+
### Spot Trading (Destructive)
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `place_order` | Place a spot order (market, limit, stop-loss, etc.) |
|
|
106
|
+
| `cancel_order` | Cancel an active order |
|
|
107
|
+
| `cancel_all_orders` | Cancel all open orders for a symbol |
|
|
108
|
+
| `cancel_replace_order` | Atomically cancel and replace an order |
|
|
109
|
+
| `place_oco_order` | Place an OCO order |
|
|
110
|
+
| `place_oto_order` | Place an OTO order |
|
|
111
|
+
| `place_otoco_order` | Place an OTOCO order |
|
|
112
|
+
|
|
113
|
+
### Margin Trading (Destructive)
|
|
114
|
+
|
|
115
|
+
| Tool | Description |
|
|
116
|
+
|------|-------------|
|
|
117
|
+
| `margin_borrow` | Borrow assets on margin |
|
|
118
|
+
| `margin_repay` | Repay margin loan |
|
|
119
|
+
| `place_margin_order` | Place a margin trade order |
|
|
120
|
+
| `cancel_margin_order` | Cancel a margin order |
|
|
121
|
+
| `cancel_all_margin_orders` | Cancel all open margin orders |
|
|
122
|
+
| `isolated_margin_transfer` | Transfer between spot and isolated margin |
|
|
123
|
+
|
|
124
|
+
### Universal Transfer (Destructive)
|
|
125
|
+
|
|
126
|
+
| Tool | Description |
|
|
127
|
+
|------|-------------|
|
|
128
|
+
| `universal_transfer` | Transfer assets between any wallets |
|
|
129
|
+
|
|
130
|
+
## Usage Examples
|
|
131
|
+
|
|
132
|
+
**Check your portfolio:**
|
|
133
|
+
> "What's my current USDT balance?"
|
|
134
|
+
|
|
135
|
+
The agent calls `get_account_info` and returns your balances.
|
|
136
|
+
|
|
137
|
+
**Place a market order:**
|
|
138
|
+
> "Buy 0.001 BTC at market price"
|
|
139
|
+
|
|
140
|
+
The agent calls `place_order` with `{ symbol: "BTCUSDT", side: "BUY", type: "MARKET", quantity: 0.001 }`. You'll see a confirmation prompt before execution.
|
|
141
|
+
|
|
142
|
+
**Transfer between wallets:**
|
|
143
|
+
> "Move 500 USDT from my spot wallet to margin"
|
|
144
|
+
|
|
145
|
+
The agent calls `universal_transfer` with `{ type: "MAIN_MARGIN", asset: "USDT", amount: 500 }`.
|
|
146
|
+
|
|
147
|
+
## Security
|
|
148
|
+
|
|
149
|
+
- API keys are passed via environment variables and never logged or stored
|
|
150
|
+
- All trading and transfer operations are marked as **destructive** in MCP annotations, which triggers a confirmation prompt in Claude before execution
|
|
151
|
+
- No withdrawal support is included -- only trading and transfers between your own wallets
|
|
152
|
+
- This server connects to production Binance API only
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Install dependencies
|
|
158
|
+
bun install
|
|
159
|
+
|
|
160
|
+
# Run in development
|
|
161
|
+
bun run dev
|
|
162
|
+
|
|
163
|
+
# Run tests
|
|
164
|
+
bun test
|
|
165
|
+
|
|
166
|
+
# Build for publishing
|
|
167
|
+
bun run build
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT
|