blofin-mcp 1.1.6 → 1.2.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/README.md +10 -5
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,14 @@ Current implementation registers **40 tools** in total:
|
|
|
68
68
|
- Trading: 17 tools
|
|
69
69
|
- Asset Management: 6 tools
|
|
70
70
|
|
|
71
|
+
## Getting Your API Key
|
|
72
|
+
|
|
73
|
+
1. Go to [blofin.com](https://blofin.com/) and log in (or create an account)
|
|
74
|
+
2. Navigate to **APIs** page
|
|
75
|
+
3. Click **Create API Key** and select **BloFin MCP** as the API type
|
|
76
|
+
4. Set your permissions (read-only for market data, or enable trading as needed)
|
|
77
|
+
5. Save your **API Key**, **Secret Key**, and **Passphrase** — you'll need them for configuration below
|
|
78
|
+
|
|
71
79
|
## Environment Variables
|
|
72
80
|
|
|
73
81
|
| Variable | Required | Description |
|
|
@@ -76,7 +84,6 @@ Current implementation registers **40 tools** in total:
|
|
|
76
84
|
| `BLOFIN_API_SECRET` | Yes | Your BloFin API secret |
|
|
77
85
|
| `BLOFIN_PASSPHRASE` | Yes | Your BloFin API passphrase |
|
|
78
86
|
| `BLOFIN_BASE_URL` | No | API base URL (defaults to demo trading) |
|
|
79
|
-
| `BLOFIN_BROKER_ID` | No | Broker ID provided by BloFin (auto-injected into trading requests) |
|
|
80
87
|
|
|
81
88
|
### Base URLs
|
|
82
89
|
|
|
@@ -107,8 +114,7 @@ Add to your Claude Desktop config (`Settings → Developer → Edit Config`):
|
|
|
107
114
|
"BLOFIN_API_KEY": "your-api-key",
|
|
108
115
|
"BLOFIN_API_SECRET": "your-api-secret",
|
|
109
116
|
"BLOFIN_PASSPHRASE": "your-passphrase",
|
|
110
|
-
"BLOFIN_BASE_URL": "https://openapi.blofin.com"
|
|
111
|
-
"BLOFIN_BROKER_ID": "your-broker-id"
|
|
117
|
+
"BLOFIN_BASE_URL": "https://openapi.blofin.com"
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
}
|
|
@@ -137,8 +143,7 @@ Add `"mcpServers"` to your `~/.openclaw/openclaw.json` (top-level field, alongsi
|
|
|
137
143
|
"BLOFIN_API_KEY": "your-api-key",
|
|
138
144
|
"BLOFIN_API_SECRET": "your-api-secret",
|
|
139
145
|
"BLOFIN_PASSPHRASE": "your-passphrase",
|
|
140
|
-
"BLOFIN_BASE_URL": "https://openapi.blofin.com"
|
|
141
|
-
"BLOFIN_BROKER_ID": "your-broker-id"
|
|
146
|
+
"BLOFIN_BASE_URL": "https://openapi.blofin.com"
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { registerTradingTools } from "./tools/trading.js";
|
|
|
8
8
|
import { registerAssetTools } from "./tools/asset.js";
|
|
9
9
|
const DEMO_BASE_URL = "https://demo-trading-openapi.blofin.com";
|
|
10
10
|
const PROD_BASE_URL = "https://openapi.blofin.com";
|
|
11
|
+
const DEFAULT_BROKER_ID = "dd3511977f23cc87";
|
|
11
12
|
function getEnvOrThrow(name) {
|
|
12
13
|
const val = process.env[name];
|
|
13
14
|
if (!val) {
|
|
@@ -15,12 +16,26 @@ function getEnvOrThrow(name) {
|
|
|
15
16
|
}
|
|
16
17
|
return val;
|
|
17
18
|
}
|
|
19
|
+
function resolveBrokerId(baseUrl) {
|
|
20
|
+
// Demo trading does not require broker ID
|
|
21
|
+
if (baseUrl === DEMO_BASE_URL)
|
|
22
|
+
return undefined;
|
|
23
|
+
const raw = process.env.BLOFIN_BROKER_ID;
|
|
24
|
+
// Transaction API users: set BLOFIN_BROKER_ID=none to disable
|
|
25
|
+
if (raw === "none")
|
|
26
|
+
return undefined;
|
|
27
|
+
// Custom broker ID: use as-is
|
|
28
|
+
if (raw)
|
|
29
|
+
return raw;
|
|
30
|
+
// Default: use built-in broker ID for Broker API users
|
|
31
|
+
return DEFAULT_BROKER_ID;
|
|
32
|
+
}
|
|
18
33
|
async function main() {
|
|
19
34
|
const apiKey = getEnvOrThrow("BLOFIN_API_KEY");
|
|
20
35
|
const secretKey = getEnvOrThrow("BLOFIN_API_SECRET");
|
|
21
36
|
const passphrase = getEnvOrThrow("BLOFIN_PASSPHRASE");
|
|
22
37
|
const baseUrl = process.env.BLOFIN_BASE_URL || DEMO_BASE_URL;
|
|
23
|
-
const brokerId =
|
|
38
|
+
const brokerId = resolveBrokerId(baseUrl);
|
|
24
39
|
const client = new BlofinClient({ apiKey, secretKey, passphrase, baseUrl, brokerId });
|
|
25
40
|
const server = new McpServer({
|
|
26
41
|
name: "blofin-mcp",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,aAAa,GAAG,yCAAyC,CAAC;AAChE,MAAM,aAAa,GAAG,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAA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