@okx_ai/okx-trade-mcp 1.2.8-beta.6 → 1.2.8
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 +3 -309
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -964,14 +964,13 @@ var OkxRestClient = class _OkxRestClient {
|
|
|
964
964
|
rateLimit
|
|
965
965
|
});
|
|
966
966
|
}
|
|
967
|
-
async privateGet(path4, query, rateLimit
|
|
967
|
+
async privateGet(path4, query, rateLimit) {
|
|
968
968
|
return this.request({
|
|
969
969
|
method: "GET",
|
|
970
970
|
path: path4,
|
|
971
971
|
auth: "private",
|
|
972
972
|
query,
|
|
973
|
-
rateLimit
|
|
974
|
-
extraHeaders
|
|
973
|
+
rateLimit
|
|
975
974
|
});
|
|
976
975
|
}
|
|
977
976
|
async publicPost(path4, body, rateLimit) {
|
|
@@ -1179,11 +1178,6 @@ var OkxRestClient = class _OkxRestClient {
|
|
|
1179
1178
|
if (this.config.demo) {
|
|
1180
1179
|
headers.set("x-simulated-trading", "1");
|
|
1181
1180
|
}
|
|
1182
|
-
if (reqConfig.extraHeaders) {
|
|
1183
|
-
for (const [key, value] of Object.entries(reqConfig.extraHeaders)) {
|
|
1184
|
-
headers.set(key, value);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
1181
|
return headers;
|
|
1188
1182
|
}
|
|
1189
1183
|
// ---------------------------------------------------------------------------
|
|
@@ -1498,7 +1492,6 @@ var MODULES = [
|
|
|
1498
1492
|
"futures",
|
|
1499
1493
|
"option",
|
|
1500
1494
|
"account",
|
|
1501
|
-
"news",
|
|
1502
1495
|
...EARN_SUB_MODULE_IDS,
|
|
1503
1496
|
...BOT_SUB_MODULE_IDS,
|
|
1504
1497
|
"skills"
|
|
@@ -5472,304 +5465,6 @@ function registerMarketTools() {
|
|
|
5472
5465
|
}
|
|
5473
5466
|
];
|
|
5474
5467
|
}
|
|
5475
|
-
var NEWS_SEARCH = "/api/v5/orbit/news-search";
|
|
5476
|
-
var NEWS_DETAIL = "/api/v5/orbit/news-detail";
|
|
5477
|
-
var NEWS_DOMAINS = "/api/v5/orbit/news-platform";
|
|
5478
|
-
var SENTIMENT_QUERY = "/api/v5/orbit/currency-sentiment-query";
|
|
5479
|
-
var SENTIMENT_RANKING = "/api/v5/orbit/currency-sentiment-ranking";
|
|
5480
|
-
var NEWS_LANGUAGE = ["en_US", "zh_CN"];
|
|
5481
|
-
function langHeader(lang) {
|
|
5482
|
-
if (lang === "zh_CN" || lang === "en_US") return { "Accept-Language": lang };
|
|
5483
|
-
return void 0;
|
|
5484
|
-
}
|
|
5485
|
-
var NEWS_DETAIL_LVL = ["brief", "summary", "full"];
|
|
5486
|
-
var NEWS_IMPORTANCE = ["high", "medium", "low"];
|
|
5487
|
-
var NEWS_SENTIMENT = ["bullish", "bearish", "neutral"];
|
|
5488
|
-
var NEWS_SORT = ["latest", "relevant"];
|
|
5489
|
-
var SENTIMENT_PERIOD = ["1h", "4h", "24h"];
|
|
5490
|
-
var D_COINS_NEWS = 'Comma-separated uppercase ticker symbols (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
|
|
5491
|
-
var D_COINS_SENTIMENT = 'Comma-separated uppercase ticker symbols, max 20 (e.g. "BTC,ETH"). Normalize names/aliases to standard tickers.';
|
|
5492
|
-
var D_LANGUAGE = "Content language: zh_CN or en_US. Infer from user's message. No server default.";
|
|
5493
|
-
var D_BEGIN = "Start time, Unix epoch milliseconds. Parse relative time if given (e.g. 'yesterday', 'last 7 days').";
|
|
5494
|
-
var D_END = "End time, Unix epoch milliseconds. Parse relative time if given. Omit for no upper bound.";
|
|
5495
|
-
var D_IMPORTANCE = "Importance filter: high (server default), medium, low. Omit unless user wants broader coverage.";
|
|
5496
|
-
var D_LIMIT = "Number of results (default 10, max 50).";
|
|
5497
|
-
function registerNewsTools() {
|
|
5498
|
-
return [
|
|
5499
|
-
// -----------------------------------------------------------------------
|
|
5500
|
-
// News browsing tools
|
|
5501
|
-
// -----------------------------------------------------------------------
|
|
5502
|
-
{
|
|
5503
|
-
name: "news_get_latest",
|
|
5504
|
-
module: "news",
|
|
5505
|
-
description: "Get crypto news sorted by time. Omitting importance still returns only high-importance news (server default). Pass importance='medium' or 'low' explicitly to broaden results. Use when user asks 'what happened recently', 'latest news', 'any big news today', or wants to browse without a keyword.",
|
|
5506
|
-
isWrite: false,
|
|
5507
|
-
inputSchema: {
|
|
5508
|
-
type: "object",
|
|
5509
|
-
properties: {
|
|
5510
|
-
coins: { type: "string", description: D_COINS_NEWS + " Optional." },
|
|
5511
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5512
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5513
|
-
end: { type: "number", description: D_END },
|
|
5514
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5515
|
-
detailLvl: {
|
|
5516
|
-
type: "string",
|
|
5517
|
-
enum: [...NEWS_DETAIL_LVL],
|
|
5518
|
-
description: "Content level: summary (AI summary, default), full (original text), brief (title only)."
|
|
5519
|
-
},
|
|
5520
|
-
limit: { type: "number", description: D_LIMIT },
|
|
5521
|
-
after: { type: "string", description: "Pagination cursor from previous response nextCursor." }
|
|
5522
|
-
},
|
|
5523
|
-
required: []
|
|
5524
|
-
},
|
|
5525
|
-
handler: async (rawArgs, context) => {
|
|
5526
|
-
const args = asRecord(rawArgs);
|
|
5527
|
-
const response = await context.client.privateGet(
|
|
5528
|
-
NEWS_SEARCH,
|
|
5529
|
-
compactObject({
|
|
5530
|
-
sortBy: "latest",
|
|
5531
|
-
importance: readString(args, "importance"),
|
|
5532
|
-
ccyList: readString(args, "coins"),
|
|
5533
|
-
begin: readNumber(args, "begin"),
|
|
5534
|
-
end: readNumber(args, "end"),
|
|
5535
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5536
|
-
limit: readNumber(args, "limit") ?? 10,
|
|
5537
|
-
cursor: readString(args, "after")
|
|
5538
|
-
}),
|
|
5539
|
-
publicRateLimit("news_get_latest", 20),
|
|
5540
|
-
langHeader(readString(args, "language"))
|
|
5541
|
-
);
|
|
5542
|
-
return normalizeResponse(response);
|
|
5543
|
-
}
|
|
5544
|
-
},
|
|
5545
|
-
{
|
|
5546
|
-
name: "news_get_by_coin",
|
|
5547
|
-
module: "news",
|
|
5548
|
-
description: "Get news for specific coins or tokens. Use when user mentions a coin: 'BTC news', 'any SOL updates'. Supports multiple coins (comma-separated).",
|
|
5549
|
-
isWrite: false,
|
|
5550
|
-
inputSchema: {
|
|
5551
|
-
type: "object",
|
|
5552
|
-
properties: {
|
|
5553
|
-
coins: { type: "string", description: D_COINS_NEWS + " Required." },
|
|
5554
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5555
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5556
|
-
end: { type: "number", description: D_END },
|
|
5557
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5558
|
-
detailLvl: { type: "string", enum: [...NEWS_DETAIL_LVL] },
|
|
5559
|
-
limit: { type: "number", description: D_LIMIT }
|
|
5560
|
-
},
|
|
5561
|
-
required: ["coins"]
|
|
5562
|
-
},
|
|
5563
|
-
handler: async (rawArgs, context) => {
|
|
5564
|
-
const args = asRecord(rawArgs);
|
|
5565
|
-
const coins = readString(args, "coins");
|
|
5566
|
-
if (!coins) {
|
|
5567
|
-
throw new Error(`Missing required parameter "coins".`);
|
|
5568
|
-
}
|
|
5569
|
-
const response = await context.client.privateGet(
|
|
5570
|
-
NEWS_SEARCH,
|
|
5571
|
-
compactObject({
|
|
5572
|
-
sortBy: "latest",
|
|
5573
|
-
ccyList: coins,
|
|
5574
|
-
importance: readString(args, "importance"),
|
|
5575
|
-
begin: readNumber(args, "begin"),
|
|
5576
|
-
end: readNumber(args, "end"),
|
|
5577
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5578
|
-
limit: readNumber(args, "limit") ?? 10
|
|
5579
|
-
}),
|
|
5580
|
-
publicRateLimit("news_get_by_coin", 20),
|
|
5581
|
-
langHeader(readString(args, "language"))
|
|
5582
|
-
);
|
|
5583
|
-
return normalizeResponse(response);
|
|
5584
|
-
}
|
|
5585
|
-
},
|
|
5586
|
-
{
|
|
5587
|
-
name: "news_search",
|
|
5588
|
-
module: "news",
|
|
5589
|
-
description: "Search crypto news by keyword with optional filters. Use when user provides specific search terms: 'SEC ETF news', 'stablecoin regulation', 'Bitcoin halving'. For coin-only queries prefer news_get_by_coin.",
|
|
5590
|
-
isWrite: false,
|
|
5591
|
-
inputSchema: {
|
|
5592
|
-
type: "object",
|
|
5593
|
-
properties: {
|
|
5594
|
-
keyword: {
|
|
5595
|
-
type: "string",
|
|
5596
|
-
description: "Search keyword(s) extracted from user query (topic/entity). Multiple words are AND-combined. Omit to browse by filters only."
|
|
5597
|
-
},
|
|
5598
|
-
coins: { type: "string", description: D_COINS_NEWS + " Optional." },
|
|
5599
|
-
importance: { type: "string", enum: [...NEWS_IMPORTANCE], description: D_IMPORTANCE },
|
|
5600
|
-
sentiment: {
|
|
5601
|
-
type: "string",
|
|
5602
|
-
enum: [...NEWS_SENTIMENT],
|
|
5603
|
-
description: "Filter by sentiment if mentioned alongside the keyword."
|
|
5604
|
-
},
|
|
5605
|
-
sortBy: {
|
|
5606
|
-
type: "string",
|
|
5607
|
-
enum: [...NEWS_SORT],
|
|
5608
|
-
description: "Sort order: relevant (by relevance, default for keyword search), latest (by time)."
|
|
5609
|
-
},
|
|
5610
|
-
begin: { type: "number", description: D_BEGIN },
|
|
5611
|
-
end: { type: "number", description: D_END },
|
|
5612
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE },
|
|
5613
|
-
detailLvl: { type: "string", enum: [...NEWS_DETAIL_LVL] },
|
|
5614
|
-
limit: { type: "number", description: D_LIMIT },
|
|
5615
|
-
after: { type: "string", description: "Pagination cursor from previous response nextCursor." }
|
|
5616
|
-
},
|
|
5617
|
-
required: []
|
|
5618
|
-
},
|
|
5619
|
-
handler: async (rawArgs, context) => {
|
|
5620
|
-
const args = asRecord(rawArgs);
|
|
5621
|
-
const response = await context.client.privateGet(
|
|
5622
|
-
NEWS_SEARCH,
|
|
5623
|
-
compactObject({
|
|
5624
|
-
keyword: readString(args, "keyword") || void 0,
|
|
5625
|
-
sortBy: readString(args, "sortBy") ?? "relevant",
|
|
5626
|
-
importance: readString(args, "importance"),
|
|
5627
|
-
ccyList: readString(args, "coins"),
|
|
5628
|
-
sentiment: readString(args, "sentiment"),
|
|
5629
|
-
begin: readNumber(args, "begin"),
|
|
5630
|
-
end: readNumber(args, "end"),
|
|
5631
|
-
detailLvl: readString(args, "detailLvl"),
|
|
5632
|
-
limit: readNumber(args, "limit") ?? 10,
|
|
5633
|
-
cursor: readString(args, "after")
|
|
5634
|
-
}),
|
|
5635
|
-
publicRateLimit("news_search", 20),
|
|
5636
|
-
langHeader(readString(args, "language"))
|
|
5637
|
-
);
|
|
5638
|
-
return normalizeResponse(response);
|
|
5639
|
-
}
|
|
5640
|
-
},
|
|
5641
|
-
{
|
|
5642
|
-
name: "news_get_detail",
|
|
5643
|
-
module: "news",
|
|
5644
|
-
description: "Get full article content by news ID (returns title + summary + full original text). Use when user says 'show full article', 'read more', or provides a specific news ID from a previous result.",
|
|
5645
|
-
isWrite: false,
|
|
5646
|
-
inputSchema: {
|
|
5647
|
-
type: "object",
|
|
5648
|
-
properties: {
|
|
5649
|
-
id: {
|
|
5650
|
-
type: "string",
|
|
5651
|
-
description: "News article ID from a previous news_get_latest / news_get_by_coin / news_search result. Required."
|
|
5652
|
-
},
|
|
5653
|
-
language: { type: "string", enum: [...NEWS_LANGUAGE], description: D_LANGUAGE }
|
|
5654
|
-
},
|
|
5655
|
-
required: ["id"]
|
|
5656
|
-
},
|
|
5657
|
-
handler: async (rawArgs, context) => {
|
|
5658
|
-
const args = asRecord(rawArgs);
|
|
5659
|
-
const id = readString(args, "id");
|
|
5660
|
-
if (!id) {
|
|
5661
|
-
throw new Error(`Missing required parameter "id".`);
|
|
5662
|
-
}
|
|
5663
|
-
const response = await context.client.privateGet(
|
|
5664
|
-
NEWS_DETAIL,
|
|
5665
|
-
{ id },
|
|
5666
|
-
publicRateLimit("news_get_detail", 20),
|
|
5667
|
-
langHeader(readString(args, "language"))
|
|
5668
|
-
);
|
|
5669
|
-
return normalizeResponse(response);
|
|
5670
|
-
}
|
|
5671
|
-
},
|
|
5672
|
-
{
|
|
5673
|
-
name: "news_get_domains",
|
|
5674
|
-
module: "news",
|
|
5675
|
-
description: "List available news source domains (e.g. coindesk, cointelegraph). Use when user asks what news sources are available or which platforms are covered.",
|
|
5676
|
-
isWrite: false,
|
|
5677
|
-
inputSchema: {
|
|
5678
|
-
type: "object",
|
|
5679
|
-
properties: {},
|
|
5680
|
-
required: []
|
|
5681
|
-
},
|
|
5682
|
-
handler: async (_rawArgs, context) => {
|
|
5683
|
-
const response = await context.client.privateGet(
|
|
5684
|
-
NEWS_DOMAINS,
|
|
5685
|
-
{},
|
|
5686
|
-
publicRateLimit("news_get_domains", 20)
|
|
5687
|
-
);
|
|
5688
|
-
return normalizeResponse(response);
|
|
5689
|
-
}
|
|
5690
|
-
},
|
|
5691
|
-
// -----------------------------------------------------------------------
|
|
5692
|
-
// Token sentiment tools
|
|
5693
|
-
// -----------------------------------------------------------------------
|
|
5694
|
-
{
|
|
5695
|
-
name: "news_get_coin_sentiment",
|
|
5696
|
-
module: "news",
|
|
5697
|
-
description: "Get sentiment snapshot or time-series trend for coins. Returns bullish/bearish ratios and mention counts. Pass trendPoints for trend data (1h\u219224 points, 4h\u21926, 24h\u21927). Use when user asks about coin sentiment, sentiment trend, or how bullish/bearish a coin is.",
|
|
5698
|
-
isWrite: false,
|
|
5699
|
-
inputSchema: {
|
|
5700
|
-
type: "object",
|
|
5701
|
-
properties: {
|
|
5702
|
-
coins: { type: "string", description: D_COINS_SENTIMENT + " Required." },
|
|
5703
|
-
period: {
|
|
5704
|
-
type: "string",
|
|
5705
|
-
enum: [...SENTIMENT_PERIOD],
|
|
5706
|
-
description: "Aggregation granularity: 1h, 4h, 24h. Snapshot default: 24h. Trend default: 1h."
|
|
5707
|
-
},
|
|
5708
|
-
trendPoints: {
|
|
5709
|
-
type: "number",
|
|
5710
|
-
description: "Trend data points. Pass for time-series trend; omit for snapshot. Guide: 1h\u219224, 4h\u21926, 24h\u21927."
|
|
5711
|
-
}
|
|
5712
|
-
},
|
|
5713
|
-
required: ["coins"]
|
|
5714
|
-
},
|
|
5715
|
-
handler: async (rawArgs, context) => {
|
|
5716
|
-
const args = asRecord(rawArgs);
|
|
5717
|
-
const coins = readString(args, "coins");
|
|
5718
|
-
if (!coins) {
|
|
5719
|
-
throw new Error(`Missing required parameter "coins".`);
|
|
5720
|
-
}
|
|
5721
|
-
const trendPoints = readNumber(args, "trendPoints");
|
|
5722
|
-
const inclTrend = trendPoints !== void 0;
|
|
5723
|
-
const response = await context.client.privateGet(
|
|
5724
|
-
SENTIMENT_QUERY,
|
|
5725
|
-
compactObject({
|
|
5726
|
-
ccy: coins,
|
|
5727
|
-
period: readString(args, "period") ?? (inclTrend ? "1h" : "24h"),
|
|
5728
|
-
...inclTrend ? { inclTrend: true, limit: trendPoints } : {}
|
|
5729
|
-
}),
|
|
5730
|
-
publicRateLimit("news_get_coin_sentiment", 20)
|
|
5731
|
-
);
|
|
5732
|
-
return normalizeResponse(response);
|
|
5733
|
-
}
|
|
5734
|
-
},
|
|
5735
|
-
{
|
|
5736
|
-
name: "news_get_sentiment_ranking",
|
|
5737
|
-
module: "news",
|
|
5738
|
-
description: "Get coin ranking by social hotness or sentiment direction. Use when user asks which coins are trending, most bullish/bearish coins. Sort by hot (mention count), bullish, or bearish.",
|
|
5739
|
-
isWrite: false,
|
|
5740
|
-
inputSchema: {
|
|
5741
|
-
type: "object",
|
|
5742
|
-
properties: {
|
|
5743
|
-
period: {
|
|
5744
|
-
type: "string",
|
|
5745
|
-
enum: [...SENTIMENT_PERIOD],
|
|
5746
|
-
description: "Aggregation granularity: 1h, 4h, 24h (default)."
|
|
5747
|
-
},
|
|
5748
|
-
sortBy: {
|
|
5749
|
-
type: "string",
|
|
5750
|
-
enum: ["hot", "bullish", "bearish"],
|
|
5751
|
-
description: "Sort: hot=by mentions (default), bullish=most bullish, bearish=most bearish."
|
|
5752
|
-
},
|
|
5753
|
-
limit: { type: "number", description: D_LIMIT }
|
|
5754
|
-
},
|
|
5755
|
-
required: []
|
|
5756
|
-
},
|
|
5757
|
-
handler: async (rawArgs, context) => {
|
|
5758
|
-
const args = asRecord(rawArgs);
|
|
5759
|
-
const response = await context.client.privateGet(
|
|
5760
|
-
SENTIMENT_RANKING,
|
|
5761
|
-
compactObject({
|
|
5762
|
-
period: readString(args, "period") ?? "24h",
|
|
5763
|
-
sortBy: readString(args, "sortBy") ?? "hot",
|
|
5764
|
-
limit: readNumber(args, "limit") ?? 10
|
|
5765
|
-
}),
|
|
5766
|
-
publicRateLimit("news_get_sentiment_ranking", 20)
|
|
5767
|
-
);
|
|
5768
|
-
return normalizeResponse(response);
|
|
5769
|
-
}
|
|
5770
|
-
}
|
|
5771
|
-
];
|
|
5772
|
-
}
|
|
5773
5468
|
function registerOptionAlgoTools() {
|
|
5774
5469
|
return [
|
|
5775
5470
|
{
|
|
@@ -7243,7 +6938,6 @@ function allToolSpecs() {
|
|
|
7243
6938
|
...registerOptionAlgoTools(),
|
|
7244
6939
|
...registerAlgoTradeTools(),
|
|
7245
6940
|
...registerAccountTools(),
|
|
7246
|
-
...registerNewsTools(),
|
|
7247
6941
|
...registerBotTools(),
|
|
7248
6942
|
...registerAllEarnTools(),
|
|
7249
6943
|
...registerAuditTools(),
|
|
@@ -7690,7 +7384,7 @@ var _require = createRequire(import.meta.url);
|
|
|
7690
7384
|
var pkg = _require("../package.json");
|
|
7691
7385
|
var SERVER_NAME = "okx-trade-mcp";
|
|
7692
7386
|
var SERVER_VERSION = pkg.version;
|
|
7693
|
-
var GIT_HASH = true ? "
|
|
7387
|
+
var GIT_HASH = true ? "0b9b3b7" : "dev";
|
|
7694
7388
|
|
|
7695
7389
|
// src/server.ts
|
|
7696
7390
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|