hvip-mcp-server 0.2.54 → 0.2.56

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.
Files changed (2) hide show
  1. package/dist/index.js +110 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -35379,6 +35379,7 @@ function registerAgentUtils(server, auth) {
35379
35379
  async ({ domain }) => {
35380
35380
  try {
35381
35381
  const detail = DOMAIN_DETAILS[domain];
35382
+ const hasAuth = auth !== null;
35382
35383
  if (!detail) {
35383
35384
  return toResult({
35384
35385
  found: false,
@@ -35388,9 +35389,14 @@ function registerAgentUtils(server, auth) {
35388
35389
  tsIso: (/* @__PURE__ */ new Date()).toISOString()
35389
35390
  });
35390
35391
  }
35392
+ const needsKey = detail.authRequired && !hasAuth;
35391
35393
  return toResult({
35392
35394
  found: true,
35393
35395
  domain,
35396
+ authRequired: detail.authRequired,
35397
+ keyAvailable: hasAuth,
35398
+ usable: !detail.authRequired || hasAuth,
35399
+ _authWarning: needsKey ? "\u26A0\uFE0F \u6B64\u57DF\u9700\u8981 API Key\uFF0C\u5F53\u524D\u672A\u914D\u7F6E\u3002\u544A\u8BC9\u7528\u6237\u53BB OKX \u5B98\u7F51\u521B\u5EFA Key \u540E\u91CD\u8FDE\u3002" : null,
35394
35400
  ...detail,
35395
35401
  tsIso: (/* @__PURE__ */ new Date()).toISOString()
35396
35402
  });
@@ -37017,11 +37023,55 @@ var AgentHub = class {
37017
37023
  rooms = /* @__PURE__ */ new Map();
37018
37024
  heartbeatTimer = null;
37019
37025
  version = "0.0.0";
37026
+ port = 0;
37020
37027
  // ── 启动 ──
37021
37028
  start(port, host = "0.0.0.0", version2 = "0.0.0") {
37022
37029
  this.version = version2;
37023
- this.wss = new import_websocket_server.default({ port, host });
37024
- console.log(`[AgentHub] WS Server v${version2} started on ws://${host}:${port}`);
37030
+ const startWss = (p) => {
37031
+ return new Promise((resolve2) => {
37032
+ const wss = new import_websocket_server.default({ port: p, host });
37033
+ let resolved = false;
37034
+ const done = (ok) => {
37035
+ if (!resolved) {
37036
+ resolved = true;
37037
+ resolve2(ok);
37038
+ }
37039
+ };
37040
+ wss.on("listening", () => {
37041
+ this.wss = wss;
37042
+ this.port = p;
37043
+ done(true);
37044
+ });
37045
+ wss.on("error", () => {
37046
+ try {
37047
+ wss.close();
37048
+ } catch {
37049
+ }
37050
+ done(false);
37051
+ });
37052
+ setTimeout(() => done(false), 1e3);
37053
+ });
37054
+ };
37055
+ const ports = [port, port + 1, port + 2];
37056
+ startWss(ports[0]).then((ok) => {
37057
+ if (!ok) return startWss(ports[1]);
37058
+ return true;
37059
+ }).then((ok) => {
37060
+ if (!ok) return startWss(ports[2]);
37061
+ return ok === true ? true : false;
37062
+ }).then((ok) => {
37063
+ if (!ok) {
37064
+ process.stderr.write(`[AgentHub] WS Hub \u8DF3\u8FC7\uFF08\u7AEF\u53E3 ${ports.join("/")} \u4E0D\u53EF\u7528\uFF09
37065
+ `);
37066
+ return;
37067
+ }
37068
+ process.stderr.write(`[AgentHub] WS Hub v${version2} ws://${host}:${this.port}
37069
+ `);
37070
+ this.setupHub();
37071
+ });
37072
+ }
37073
+ setupHub() {
37074
+ if (!this.wss) return;
37025
37075
  this.ensureRoom("#lobby");
37026
37076
  this.ensureRoom("#review");
37027
37077
  this.wss.on("connection", (ws) => {
@@ -37046,7 +37096,7 @@ var AgentHub = class {
37046
37096
  if (now - a.lastSeen > 12e4) {
37047
37097
  a.ws.close();
37048
37098
  this.agents.delete(id);
37049
- console.log(`[AgentHub] Agent \u5FC3\u8DF3\u8D85\u65F6: ${id}`);
37099
+ console.log("[AgentHub] Agent \u5FC3\u8DF3\u8D85\u65F6: " + id);
37050
37100
  }
37051
37101
  }
37052
37102
  }, 3e4);
@@ -37990,6 +38040,50 @@ function resolveTransportMode() {
37990
38040
  if (arg === "start:stdio" || arg === "" || arg.startsWith("-")) return "stdio";
37991
38041
  return "stdio";
37992
38042
  }
38043
+ function printHelpAndExit(version2) {
38044
+ process.stdout.write([
38045
+ ``,
38046
+ ` hvip-mcp v${version2} \u2014 OKX MCP \u670D\u52A1\u5668\uFF08\u975E OKX \u5B98\u65B9\u4EA7\u54C1\uFF09`,
38047
+ ``,
38048
+ ` \u{1F517} \u4ED3\u5E93: https://github.com/okx-wallet-H/hvip-mcp`,
38049
+ ``,
38050
+ ` \u26A0\uFE0F \u8FD9\u4E0D\u662F\u547D\u4EE4\u884C\u5DE5\u5177\uFF0C\u800C\u662F MCP (Model Context Protocol) \u670D\u52A1\u5668\u3002`,
38051
+ ` \u4F60\u4E0D\u80FD\u76F4\u63A5\u5728\u7EC8\u7AEF\u91CC\u8FD0\u884C\u5B83\u2014\u2014\u9700\u8981\u914D\u7F6E\u5230 MCP \u5BA2\u6237\u7AEF\uFF08Claude Desktop\u3001VS Code\u3001Cline \u7B49\uFF09\u4E2D\u3002`,
38052
+ ``,
38053
+ ` \u2500\u2500 \u5FEB\u901F\u5F00\u59CB \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
38054
+ ``,
38055
+ ` Claude Desktop\uFF08\u63A8\u8350\uFF09:`,
38056
+ ` 1. \u6253\u5F00 Claude Desktop \u2192 \u8BBE\u7F6E \u2192 Developer \u2192 Edit Config`,
38057
+ ` 2. \u5728 mcpServers \u4E2D\u6DFB\u52A0:`,
38058
+ ``,
38059
+ ` {`,
38060
+ ` "hvip": {`,
38061
+ ` "command": "npx",`,
38062
+ ` "args": ["-y", "hvip-mcp-server"]`,
38063
+ ` }`,
38064
+ ` }`,
38065
+ ``,
38066
+ ` VS Code / Cline:`,
38067
+ ` \u5728 MCP \u914D\u7F6E\u4E2D\u6DFB\u52A0\u540C\u6837\u7684 JSON\u3002`,
38068
+ ``,
38069
+ ` \u2500\u2500 \u53EF\u7528\u53C2\u6570 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
38070
+ ``,
38071
+ ` npx hvip-mcp-server \u542F\u52A8 MCP stdio \u670D\u52A1\u5668`,
38072
+ ` npx hvip-mcp-server start:http \u542F\u52A8 HTTP \u6A21\u5F0F (localhost:3000)`,
38073
+ ` npx hvip-mcp-server --help \u663E\u793A\u6B64\u5E2E\u52A9`,
38074
+ ` npx hvip-mcp-server --version \u663E\u793A\u7248\u672C\u53F7`,
38075
+ ``,
38076
+ ` \u2500\u2500 \u73AF\u5883\u53D8\u91CF \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`,
38077
+ ``,
38078
+ ` OKX_API_KEY API Key\uFF08\u83B7\u53D6\uFF1AOKX \u5B98\u7F51 \u2192 \u4E2A\u4EBA\u4E2D\u5FC3 \u2192 API\uFF09`,
38079
+ ` OKX_SECRET_KEY Secret Key`,
38080
+ ` OKX_PASSPHRASE Passphrase`,
38081
+ ` PORT=3000 HTTP \u6A21\u5F0F\u7AEF\u53E3\uFF08\u9ED8\u8BA4 3000\uFF09`,
38082
+ ` HOST=127.0.0.1 HTTP \u6A21\u5F0F\u7ED1\u5B9A\u5730\u5740`,
38083
+ ``
38084
+ ].join("\n") + "\n");
38085
+ process.exit(0);
38086
+ }
37993
38087
  function registerAllTools(server, auth, readOnly) {
37994
38088
  let skipped = 0;
37995
38089
  const skipLog = [];
@@ -38162,7 +38256,14 @@ async function startStdio(server, version2, auth, readOnly, skipped, skipLog) {
38162
38256
  await server.connect(transport);
38163
38257
  }
38164
38258
  async function main() {
38165
- const VERSION = "0.2.54";
38259
+ const VERSION = "0.2.56";
38260
+ const argv = process.argv.slice(2);
38261
+ if (argv.includes("--help") || argv.includes("-h")) printHelpAndExit(VERSION);
38262
+ if (argv.includes("--version") || argv.includes("-v")) {
38263
+ process.stdout.write(`hvip-mcp v${VERSION}
38264
+ `);
38265
+ process.exit(0);
38266
+ }
38166
38267
  const auth = getAuth();
38167
38268
  const mode = resolveTransportMode();
38168
38269
  const exec = resolveExecutionMode();
@@ -38176,6 +38277,11 @@ async function main() {
38176
38277
  if (mode === "http") {
38177
38278
  await startHttp(server, VERSION, auth, readOnly, skipped);
38178
38279
  } else {
38280
+ if (process.stdin.isTTY && process.env.NODE_ENV !== "production") {
38281
+ process.stderr.write("\n[hint] \u68C0\u6D4B\u5230\u4F60\u5728\u7EC8\u7AEF\u76F4\u63A5\u8FD0\u884C hvip-mcp\u3002\n");
38282
+ process.stderr.write("[hint] hvip-mcp \u662F MCP \u670D\u52A1\u5668\uFF0C\u9700\u8981\u5728 MCP \u5BA2\u6237\u7AEF\uFF08\u5982 Claude Desktop\uFF09\u4E2D\u914D\u7F6E\u3002\n");
38283
+ process.stderr.write("[hint] \u8FD0\u884C npx hvip-mcp-server --help \u67E5\u770B\u914D\u7F6E\u65B9\u6CD5\u3002\n\n");
38284
+ }
38179
38285
  await startStdio(server, VERSION, auth, readOnly, skipped, skipLog);
38180
38286
  }
38181
38287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvip-mcp-server",
3
- "version": "0.2.54",
3
+ "version": "0.2.56",
4
4
  "description": "hvip MCP Server — 365 工具覆盖 97.7% OKX REST API,含交易/行情/资金/策略/预测市场/技术指标/Smart Money(非 OKX 官方产品)",
5
5
  "homepage": "https://github.com/okx-wallet-H/hvip-mcp",
6
6
  "repository": {