@okx_ai/okx-trade-mcp 1.3.3 → 1.3.4-beta.1
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/dist/index.js +271 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2131,14 +2131,16 @@ var OKX_INST_TYPES = [
|
|
|
2131
2131
|
function publicRateLimit(key, rps = 20) {
|
|
2132
2132
|
return {
|
|
2133
2133
|
key: `public:${key}`,
|
|
2134
|
-
capacity: rps,
|
|
2134
|
+
capacity: Math.max(1, rps),
|
|
2135
|
+
// capacity >= 1 so the token bucket can fire at least once before refilling
|
|
2135
2136
|
refillPerSecond: rps
|
|
2136
2137
|
};
|
|
2137
2138
|
}
|
|
2138
2139
|
function privateRateLimit(key, rps = 10) {
|
|
2139
2140
|
return {
|
|
2140
2141
|
key: `private:${key}`,
|
|
2141
|
-
capacity: rps,
|
|
2142
|
+
capacity: Math.max(1, rps),
|
|
2143
|
+
// capacity >= 1 so the token bucket can fire at least once before refilling
|
|
2142
2144
|
refillPerSecond: rps
|
|
2143
2145
|
};
|
|
2144
2146
|
}
|
|
@@ -9332,6 +9334,219 @@ var NEWS_DETAIL = "/api/v5/orbit/news-detail";
|
|
|
9332
9334
|
var NEWS_DOMAINS = "/api/v5/orbit/news-platform";
|
|
9333
9335
|
var SENTIMENT_QUERY = "/api/v5/orbit/currency-sentiment-query";
|
|
9334
9336
|
var SENTIMENT_RANKING = "/api/v5/orbit/currency-sentiment-ranking";
|
|
9337
|
+
var ECONOMIC_CALENDAR = "/api/v5/public/economic-calendar";
|
|
9338
|
+
var CALENDAR_REGIONS = [
|
|
9339
|
+
"afghanistan",
|
|
9340
|
+
"albania",
|
|
9341
|
+
"algeria",
|
|
9342
|
+
"andorra",
|
|
9343
|
+
"angola",
|
|
9344
|
+
"antigua_and_barbuda",
|
|
9345
|
+
"argentina",
|
|
9346
|
+
"armenia",
|
|
9347
|
+
"aruba",
|
|
9348
|
+
"australia",
|
|
9349
|
+
"austria",
|
|
9350
|
+
"azerbaijan",
|
|
9351
|
+
"bahamas",
|
|
9352
|
+
"bahrain",
|
|
9353
|
+
"bangladesh",
|
|
9354
|
+
"barbados",
|
|
9355
|
+
"belarus",
|
|
9356
|
+
"belgium",
|
|
9357
|
+
"belize",
|
|
9358
|
+
"benin",
|
|
9359
|
+
"bermuda",
|
|
9360
|
+
"bhutan",
|
|
9361
|
+
"bolivia",
|
|
9362
|
+
"bosnia_and_herzegovina",
|
|
9363
|
+
"botswana",
|
|
9364
|
+
"brazil",
|
|
9365
|
+
"brunei",
|
|
9366
|
+
"bulgaria",
|
|
9367
|
+
"burkina_faso",
|
|
9368
|
+
"burundi",
|
|
9369
|
+
"cambodia",
|
|
9370
|
+
"cameroon",
|
|
9371
|
+
"canada",
|
|
9372
|
+
"cape_verde",
|
|
9373
|
+
"cayman_islands",
|
|
9374
|
+
"central_african_republic",
|
|
9375
|
+
"chad",
|
|
9376
|
+
"chile",
|
|
9377
|
+
"china",
|
|
9378
|
+
"colombia",
|
|
9379
|
+
"comoros",
|
|
9380
|
+
"congo",
|
|
9381
|
+
"costa_rica",
|
|
9382
|
+
"croatia",
|
|
9383
|
+
"cuba",
|
|
9384
|
+
"cyprus",
|
|
9385
|
+
"czech_republic",
|
|
9386
|
+
"denmark",
|
|
9387
|
+
"djibouti",
|
|
9388
|
+
"dominica",
|
|
9389
|
+
"dominican_republic",
|
|
9390
|
+
"east_timor",
|
|
9391
|
+
"ecuador",
|
|
9392
|
+
"egypt",
|
|
9393
|
+
"el_salvador",
|
|
9394
|
+
"equatorial_guinea",
|
|
9395
|
+
"eritrea",
|
|
9396
|
+
"estonia",
|
|
9397
|
+
"ethiopia",
|
|
9398
|
+
"euro_area",
|
|
9399
|
+
"european_union",
|
|
9400
|
+
"faroe_islands",
|
|
9401
|
+
"fiji",
|
|
9402
|
+
"finland",
|
|
9403
|
+
"france",
|
|
9404
|
+
"g20",
|
|
9405
|
+
"g7",
|
|
9406
|
+
"gabon",
|
|
9407
|
+
"gambia",
|
|
9408
|
+
"georgia",
|
|
9409
|
+
"germany",
|
|
9410
|
+
"ghana",
|
|
9411
|
+
"greece",
|
|
9412
|
+
"greenland",
|
|
9413
|
+
"grenada",
|
|
9414
|
+
"guatemala",
|
|
9415
|
+
"guinea",
|
|
9416
|
+
"guinea_bissau",
|
|
9417
|
+
"guyana",
|
|
9418
|
+
"haiti",
|
|
9419
|
+
"honduras",
|
|
9420
|
+
"hong_kong",
|
|
9421
|
+
"hungary",
|
|
9422
|
+
"iceland",
|
|
9423
|
+
"imf",
|
|
9424
|
+
"india",
|
|
9425
|
+
"indonesia",
|
|
9426
|
+
"iran",
|
|
9427
|
+
"iraq",
|
|
9428
|
+
"ireland",
|
|
9429
|
+
"isle_of_man",
|
|
9430
|
+
"israel",
|
|
9431
|
+
"italy",
|
|
9432
|
+
"ivory_coast",
|
|
9433
|
+
"jamaica",
|
|
9434
|
+
"japan",
|
|
9435
|
+
"jordan",
|
|
9436
|
+
"kazakhstan",
|
|
9437
|
+
"kenya",
|
|
9438
|
+
"kiribati",
|
|
9439
|
+
"kosovo",
|
|
9440
|
+
"kuwait",
|
|
9441
|
+
"kyrgyzstan",
|
|
9442
|
+
"laos",
|
|
9443
|
+
"latvia",
|
|
9444
|
+
"lebanon",
|
|
9445
|
+
"lesotho",
|
|
9446
|
+
"liberia",
|
|
9447
|
+
"libya",
|
|
9448
|
+
"liechtenstein",
|
|
9449
|
+
"lithuania",
|
|
9450
|
+
"luxembourg",
|
|
9451
|
+
"macau",
|
|
9452
|
+
"macedonia",
|
|
9453
|
+
"madagascar",
|
|
9454
|
+
"malawi",
|
|
9455
|
+
"malaysia",
|
|
9456
|
+
"maldives",
|
|
9457
|
+
"mali",
|
|
9458
|
+
"malta",
|
|
9459
|
+
"mauritania",
|
|
9460
|
+
"mauritius",
|
|
9461
|
+
"mexico",
|
|
9462
|
+
"micronesia",
|
|
9463
|
+
"moldova",
|
|
9464
|
+
"monaco",
|
|
9465
|
+
"mongolia",
|
|
9466
|
+
"montenegro",
|
|
9467
|
+
"morocco",
|
|
9468
|
+
"mozambique",
|
|
9469
|
+
"myanmar",
|
|
9470
|
+
"namibia",
|
|
9471
|
+
"nepal",
|
|
9472
|
+
"netherlands",
|
|
9473
|
+
"new_caledonia",
|
|
9474
|
+
"new_zealand",
|
|
9475
|
+
"nicaragua",
|
|
9476
|
+
"niger",
|
|
9477
|
+
"nigeria",
|
|
9478
|
+
"north_korea",
|
|
9479
|
+
"northern_mariana_islands",
|
|
9480
|
+
"norway",
|
|
9481
|
+
"oman",
|
|
9482
|
+
"opec",
|
|
9483
|
+
"pakistan",
|
|
9484
|
+
"palau",
|
|
9485
|
+
"palestine",
|
|
9486
|
+
"panama",
|
|
9487
|
+
"papua_new_guinea",
|
|
9488
|
+
"paraguay",
|
|
9489
|
+
"peru",
|
|
9490
|
+
"philippines",
|
|
9491
|
+
"poland",
|
|
9492
|
+
"portugal",
|
|
9493
|
+
"puerto_rico",
|
|
9494
|
+
"qatar",
|
|
9495
|
+
"republic_of_the_congo",
|
|
9496
|
+
"romania",
|
|
9497
|
+
"russia",
|
|
9498
|
+
"rwanda",
|
|
9499
|
+
"samoa",
|
|
9500
|
+
"san_marino",
|
|
9501
|
+
"sao_tome_and_principe",
|
|
9502
|
+
"saudi_arabia",
|
|
9503
|
+
"senegal",
|
|
9504
|
+
"serbia",
|
|
9505
|
+
"seychelles",
|
|
9506
|
+
"sierra_leone",
|
|
9507
|
+
"singapore",
|
|
9508
|
+
"slovakia",
|
|
9509
|
+
"slovenia",
|
|
9510
|
+
"solomon_islands",
|
|
9511
|
+
"somalia",
|
|
9512
|
+
"south_africa",
|
|
9513
|
+
"south_korea",
|
|
9514
|
+
"south_sudan",
|
|
9515
|
+
"spain",
|
|
9516
|
+
"sri_lanka",
|
|
9517
|
+
"st_kitts_and_nevis",
|
|
9518
|
+
"st_lucia",
|
|
9519
|
+
"sudan",
|
|
9520
|
+
"suriname",
|
|
9521
|
+
"swaziland",
|
|
9522
|
+
"sweden",
|
|
9523
|
+
"switzerland",
|
|
9524
|
+
"syria",
|
|
9525
|
+
"taiwan",
|
|
9526
|
+
"tajikistan",
|
|
9527
|
+
"tanzania",
|
|
9528
|
+
"thailand",
|
|
9529
|
+
"togo",
|
|
9530
|
+
"tonga",
|
|
9531
|
+
"trinidad_and_tobago",
|
|
9532
|
+
"tunisia",
|
|
9533
|
+
"turkey",
|
|
9534
|
+
"turkmenistan",
|
|
9535
|
+
"uganda",
|
|
9536
|
+
"ukraine",
|
|
9537
|
+
"united_arab_emirates",
|
|
9538
|
+
"united_kingdom",
|
|
9539
|
+
"united_states",
|
|
9540
|
+
"uruguay",
|
|
9541
|
+
"uzbekistan",
|
|
9542
|
+
"vanuatu",
|
|
9543
|
+
"venezuela",
|
|
9544
|
+
"vietnam",
|
|
9545
|
+
"world",
|
|
9546
|
+
"yemen",
|
|
9547
|
+
"zambia",
|
|
9548
|
+
"zimbabwe"
|
|
9549
|
+
];
|
|
9335
9550
|
var NEWS_LANGUAGE = ["en-US", "zh-CN"];
|
|
9336
9551
|
function langHeader(lang) {
|
|
9337
9552
|
if (lang === "zh-CN" || lang === "zh_CN") return { "Accept-Language": "zh-CN" };
|
|
@@ -9629,12 +9844,61 @@ function registerNewsTools() {
|
|
|
9629
9844
|
);
|
|
9630
9845
|
return normalizeResponse(response);
|
|
9631
9846
|
}
|
|
9847
|
+
},
|
|
9848
|
+
// -----------------------------------------------------------------------
|
|
9849
|
+
// Economic calendar
|
|
9850
|
+
// -----------------------------------------------------------------------
|
|
9851
|
+
{
|
|
9852
|
+
name: "news_list_calendar_regions",
|
|
9853
|
+
module: "news",
|
|
9854
|
+
description: "List all valid region values for the economic calendar. Returns a string array of snake_case region codes. Call this when economic-calendar returns empty results to verify the region value, or to help the user pick a valid region. Do NOT use to list news source platforms \u2014 use news_get_domains instead.",
|
|
9855
|
+
isWrite: false,
|
|
9856
|
+
inputSchema: { type: "object", properties: {}, required: [] },
|
|
9857
|
+
handler: async () => ({ data: CALENDAR_REGIONS })
|
|
9858
|
+
},
|
|
9859
|
+
{
|
|
9860
|
+
name: "news_get_economic_calendar",
|
|
9861
|
+
module: "news",
|
|
9862
|
+
description: "Get macro-economic calendar data (GDP, CPI, NFP, interest rate decisions, PMI, etc.). Returns scheduled and released economic events with forecast, previous, and actual values. Use when user asks about economic calendar, macro data, or specific indicators like NFP/CPI/GDP/FOMC. Do NOT use for news articles or sentiment \u2014 use news_get_latest or news_search instead.",
|
|
9863
|
+
isWrite: false,
|
|
9864
|
+
inputSchema: {
|
|
9865
|
+
type: "object",
|
|
9866
|
+
properties: {
|
|
9867
|
+
region: { type: "string", description: "Country/region filter in snake_case (e.g. united_states, euro_area, japan). Invalid values return empty results silently. If empty results, call news_list_calendar_regions to verify the value." },
|
|
9868
|
+
importance: { type: "string", enum: ["1", "2", "3"], description: "Importance level: 1=low, 2=medium, 3=high. Omit for all levels." },
|
|
9869
|
+
before: { type: "string", description: "Lower time bound \u2014 returns events NEWER than this timestamp (reversed semantics). Pair with 'after' for future-event windows. Unix ms." },
|
|
9870
|
+
after: { type: "string", description: "Upper time bound \u2014 returns events OLDER than this timestamp (reversed semantics). Default=now (returns past events). Pair with 'before' for a bounded window. Unix ms." },
|
|
9871
|
+
limit: { type: "number", minimum: 1, maximum: 100, description: "Number of results (default 100, max 100)." }
|
|
9872
|
+
},
|
|
9873
|
+
required: []
|
|
9874
|
+
},
|
|
9875
|
+
handler: async (rawArgs, context) => {
|
|
9876
|
+
const args = asRecord(rawArgs);
|
|
9877
|
+
const rawLimit = readNumber(args, "limit");
|
|
9878
|
+
const limit = rawLimit !== void 0 ? Math.min(rawLimit, 100) : void 0;
|
|
9879
|
+
const response = await context.client.privateGet(
|
|
9880
|
+
ECONOMIC_CALENDAR,
|
|
9881
|
+
compactObject({
|
|
9882
|
+
region: readString(args, "region"),
|
|
9883
|
+
importance: readString(args, "importance"),
|
|
9884
|
+
before: readString(args, "before"),
|
|
9885
|
+
after: readString(args, "after"),
|
|
9886
|
+
limit
|
|
9887
|
+
}),
|
|
9888
|
+
publicRateLimit("news_get_economic_calendar", 0.2)
|
|
9889
|
+
);
|
|
9890
|
+
return normalizeResponse(response);
|
|
9891
|
+
}
|
|
9632
9892
|
}
|
|
9633
9893
|
];
|
|
9634
|
-
const
|
|
9635
|
-
|
|
9636
|
-
const
|
|
9637
|
-
|
|
9894
|
+
const exempt = /* @__PURE__ */ new Set(["news_get_domains", "news_list_calendar_regions"]);
|
|
9895
|
+
const exempted = [];
|
|
9896
|
+
const guarded = [];
|
|
9897
|
+
for (const t of tools) {
|
|
9898
|
+
if (exempt.has(t.name)) exempted.push(t);
|
|
9899
|
+
else guarded.push(t);
|
|
9900
|
+
}
|
|
9901
|
+
return [...guarded.map(withNewsDemoGuard), ...exempted];
|
|
9638
9902
|
}
|
|
9639
9903
|
var NEWS_DEMO_MESSAGE = "News features are not available in demo/simulated trading mode.";
|
|
9640
9904
|
var NEWS_DEMO_SUGGESTION = "Switch to a live profile to use News features.";
|
|
@@ -11752,7 +12016,7 @@ var _require = createRequire(import.meta.url);
|
|
|
11752
12016
|
var pkg = _require("../package.json");
|
|
11753
12017
|
var SERVER_NAME = "okx-trade-mcp";
|
|
11754
12018
|
var SERVER_VERSION = pkg.version;
|
|
11755
|
-
var GIT_HASH = true ? "
|
|
12019
|
+
var GIT_HASH = true ? "cd99d487" : "dev";
|
|
11756
12020
|
|
|
11757
12021
|
// src/server.ts
|
|
11758
12022
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|