@aicoin/opendata-mcp 1.0.21 → 1.0.22
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/build/index.js +5 -5
- 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---
|
|
35
|
-
var AUTH_GUIDE = "\n\n---
|
|
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 || "
|
|
53
|
+
const errMsg = String(obj.error || obj.message || "Unknown error");
|
|
54
54
|
if (BIZ_AUTH_CODES.has(code)) {
|
|
55
55
|
throw new Error(
|
|
56
|
-
|
|
56
|
+
`Permission denied: ${errMsg}` + UPGRADE_GUIDE + `
|
|
57
57
|
Endpoint: ${path}`
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
throw new Error(
|
|
61
|
-
`API
|
|
61
|
+
`API error (${code}): ${errMsg}
|
|
62
62
|
Endpoint: ${path}`
|
|
63
63
|
);
|
|
64
64
|
}
|