@aicoin/opendata-mcp 1.0.21 → 1.0.23

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/build/index.js +17 -13
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -31,8 +31,8 @@ function generateSignature(accessKeyId, accessSecret) {
31
31
  // src/client/api.ts
32
32
  var DOMAIN = process.env.AICOIN_BASE_URL || "https://open.aicoin.com";
33
33
  var TIMEOUT_MS = 3e4;
34
- var UPGRADE_GUIDE = "\n\n--- \u5982\u4F55\u89E3\u51B3 ---\n\u5F53\u524D API \u5957\u9910\u65E0\u6743\u8BBF\u95EE\u6B64\u63A5\u53E3\uFF0C\u8BF7\u5347\u7EA7\u5957\u9910\u3002\n1. \u524D\u5F80 https://www.aicoin.com/opendata \u8D2D\u4E70/\u5347\u7EA7\u5957\u9910\n2. \u5957\u9910\u7B49\u7EA7: Basic(\u514D\u8D39) | Normal(\xA599) | Premium(\xA5299) | Professional(\xA5999)\n3. \u5347\u7EA7\u540E\u5728 MCP \u914D\u7F6E\u4E2D\u8BBE\u7F6E AICOIN_ACCESS_KEY_ID \u548C AICOIN_ACCESS_SECRET\n4. \u91CD\u542F MCP \u5BA2\u6237\u7AEF";
35
- var AUTH_GUIDE = "\n\n--- \u5982\u4F55\u89E3\u51B3 ---\n\u9700\u8981 API Key \u624D\u80FD\u8BBF\u95EE\u6B64\u63A5\u53E3\u3002\n1. \u524D\u5F80 https://www.aicoin.com/opendata \u6CE8\u518C\u5E76\u521B\u5EFA API Key\n2. \u5728 MCP \u914D\u7F6E\u4E2D\u8BBE\u7F6E AICOIN_ACCESS_KEY_ID \u548C AICOIN_ACCESS_SECRET\n3. \u91CD\u542F MCP \u5BA2\u6237\u7AEF";
34
+ var UPGRADE_GUIDE = "\n\n--- How to fix ---\nYour current API tier does not have access to this endpoint. Please upgrade your plan.\n1. Visit https://www.aicoin.com/opendata to purchase or upgrade\n2. Tiers: Basic(free) | Normal(\xA599) | Premium(\xA5299) | Professional(\xA5999)\n3. Set AICOIN_ACCESS_KEY_ID and AICOIN_ACCESS_SECRET in your MCP config\n4. Restart your MCP client";
35
+ var AUTH_GUIDE = "\n\n--- How to fix ---\nAn API key is required to access this endpoint.\n1. Visit https://www.aicoin.com/opendata to register and create an API key\n2. Set AICOIN_ACCESS_KEY_ID and AICOIN_ACCESS_SECRET in your MCP config\n3. Restart your MCP client";
36
36
  function throwApiError(status, body, path) {
37
37
  let msg = `API ${status}: ${body}`;
38
38
  if (status === 401) {
@@ -50,15 +50,15 @@ function checkBizError(data, path) {
50
50
  const obj = data;
51
51
  if (obj.success === false) {
52
52
  const code = Number(obj.errorCode ?? 0);
53
- const errMsg = String(obj.error || obj.message || "\u672A\u77E5\u9519\u8BEF");
53
+ const errMsg = String(obj.error || obj.message || "Unknown error");
54
54
  if (BIZ_AUTH_CODES.has(code)) {
55
55
  throw new Error(
56
- `\u6743\u9650\u4E0D\u8DB3: ${errMsg}` + UPGRADE_GUIDE + `
56
+ `Permission denied: ${errMsg}` + UPGRADE_GUIDE + `
57
57
  Endpoint: ${path}`
58
58
  );
59
59
  }
60
60
  throw new Error(
61
- `API \u4E1A\u52A1\u9519\u8BEF (${code}): ${errMsg}
61
+ `API error (${code}): ${errMsg}
62
62
  Endpoint: ${path}`
63
63
  );
64
64
  }
@@ -1258,15 +1258,17 @@ function registerMarketTools(server2) {
1258
1258
  "get_latest_coin_treasury_entities",
1259
1259
  "Get latest coin treasury entity data",
1260
1260
  {
1261
- coin: z4.string().describe("Coin ticker, e.g. BTC, ETH")
1261
+ coin: z4.string().describe("Coin ticker, e.g. BTC, ETH"),
1262
+ ...maxItemsParam
1262
1263
  },
1263
- async ({ coin }) => {
1264
+ async ({ coin, _max_items }) => {
1264
1265
  try {
1265
- return ok(
1266
+ return okList(
1266
1267
  await apiGet(
1267
1268
  "/api/upgrade/v2/coin-treasuries/latest/entities",
1268
1269
  { coin }
1269
- )
1270
+ ),
1271
+ parseMax(_max_items, 20)
1270
1272
  );
1271
1273
  } catch (e) {
1272
1274
  return err(e);
@@ -1277,15 +1279,17 @@ function registerMarketTools(server2) {
1277
1279
  "get_latest_coin_treasury_history",
1278
1280
  "Get latest coin treasury history data",
1279
1281
  {
1280
- coin: z4.string().describe("Coin ticker, e.g. BTC, ETH")
1282
+ coin: z4.string().describe("Coin ticker, e.g. BTC, ETH"),
1283
+ ...maxItemsParam
1281
1284
  },
1282
- async ({ coin }) => {
1285
+ async ({ coin, _max_items }) => {
1283
1286
  try {
1284
- return ok(
1287
+ return okList(
1285
1288
  await apiGet(
1286
1289
  "/api/upgrade/v2/coin-treasuries/latest/history",
1287
1290
  { coin }
1288
- )
1291
+ ),
1292
+ parseMax(_max_items, 20)
1289
1293
  );
1290
1294
  } catch (e) {
1291
1295
  return err(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicoin/opendata-mcp",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "AiCoin OpenData MCP Server - crypto market data via AiCoin Open API",
5
5
  "main": "build/index.js",
6
6
  "type": "module",