cryptoquant-mcp 0.2.0 → 1.0.0
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/README.md +84 -118
- package/dist/api-key.js +76 -0
- package/dist/api-key.js.map +1 -0
- package/dist/config.js +24 -18
- package/dist/config.js.map +1 -1
- package/dist/index.js +33 -40
- package/dist/index.js.map +1 -1
- package/dist/proxy.js +133 -0
- package/dist/proxy.js.map +1 -0
- package/dist/utils.js +6 -64
- package/dist/utils.js.map +1 -1
- package/package.json +16 -11
- package/dist/auth/storage.d.ts +0 -11
- package/dist/auth/storage.d.ts.map +0 -1
- package/dist/auth/storage.js +0 -53
- package/dist/auth/storage.js.map +0 -1
- package/dist/cache/storage.d.ts +0 -47
- package/dist/cache/storage.d.ts.map +0 -1
- package/dist/cache/storage.js +0 -140
- package/dist/cache/storage.js.map +0 -1
- package/dist/cache/summary.d.ts +0 -16
- package/dist/cache/summary.d.ts.map +0 -1
- package/dist/cache/summary.js +0 -85
- package/dist/cache/summary.js.map +0 -1
- package/dist/cache/types.d.ts +0 -76
- package/dist/cache/types.d.ts.map +0 -1
- package/dist/cache/types.js +0 -6
- package/dist/cache/types.js.map +0 -1
- package/dist/config.d.ts +0 -18
- package/dist/config.d.ts.map +0 -1
- package/dist/data/metrics.toon +0 -293
- package/dist/discovery.d.ts +0 -70
- package/dist/discovery.d.ts.map +0 -1
- package/dist/discovery.js +0 -171
- package/dist/discovery.js.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.d.ts.map +0 -1
- package/dist/permissions.d.ts +0 -36
- package/dist/permissions.d.ts.map +0 -1
- package/dist/permissions.js +0 -159
- package/dist/permissions.js.map +0 -1
- package/dist/plan-limits.d.ts +0 -71
- package/dist/plan-limits.d.ts.map +0 -1
- package/dist/plan-limits.js +0 -416
- package/dist/plan-limits.js.map +0 -1
- package/dist/tools/auth.d.ts +0 -3
- package/dist/tools/auth.d.ts.map +0 -1
- package/dist/tools/auth.js +0 -196
- package/dist/tools/auth.js.map +0 -1
- package/dist/tools/core.d.ts +0 -3
- package/dist/tools/core.d.ts.map +0 -1
- package/dist/tools/core.js +0 -546
- package/dist/tools/core.js.map +0 -1
- package/dist/utils.d.ts +0 -45
- package/dist/utils.d.ts.map +0 -1
package/dist/utils.js
CHANGED
|
@@ -1,76 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
// =============================================================================
|
|
5
|
-
// Logger - Debug logging controlled by DEBUG environment variable
|
|
6
|
-
// =============================================================================
|
|
7
|
-
/**
|
|
8
|
-
* Check if debug logging is enabled.
|
|
9
|
-
* Set DEBUG=true or DEBUG=1 to enable debug output.
|
|
2
|
+
* stderr logger. stdout is reserved for JSON-RPC messages.
|
|
3
|
+
* Set DEBUG=true or DEBUG=1 for debug output.
|
|
10
4
|
*/
|
|
11
5
|
function isDebugEnabled() {
|
|
12
6
|
const debug = process.env.DEBUG;
|
|
13
7
|
return debug === "true" || debug === "1";
|
|
14
8
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Logger with level-based output.
|
|
17
|
-
* - debug: Only shown when DEBUG=true (use for detailed tracing)
|
|
18
|
-
* - info: Always shown (use for important status messages)
|
|
19
|
-
* - warn: Always shown (use for warnings)
|
|
20
|
-
* - error: Always shown (use for errors)
|
|
21
|
-
*/
|
|
22
9
|
export const logger = {
|
|
23
10
|
debug: (...args) => {
|
|
24
|
-
if (isDebugEnabled())
|
|
11
|
+
if (isDebugEnabled())
|
|
25
12
|
console.error("[DEBUG]", ...args);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
info: (...args) => {
|
|
29
|
-
console.error("[INFO]", ...args);
|
|
30
|
-
},
|
|
31
|
-
warn: (...args) => {
|
|
32
|
-
console.error("[WARN]", ...args);
|
|
33
|
-
},
|
|
34
|
-
error: (...args) => {
|
|
35
|
-
console.error("[ERROR]", ...args);
|
|
36
13
|
},
|
|
14
|
+
info: (...args) => console.error("[INFO]", ...args),
|
|
15
|
+
warn: (...args) => console.error("[WARN]", ...args),
|
|
16
|
+
error: (...args) => console.error("[ERROR]", ...args),
|
|
37
17
|
};
|
|
38
|
-
/**
|
|
39
|
-
* Create a JSON response for MCP tools.
|
|
40
|
-
*/
|
|
41
|
-
export function jsonResponse(data) {
|
|
42
|
-
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Create an error response for MCP tools.
|
|
46
|
-
*/
|
|
47
|
-
export function errorResponse(error, extra) {
|
|
48
|
-
return jsonResponse({ success: false, error, ...extra });
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get a human-readable note for a plan type.
|
|
52
|
-
* Plan hierarchy: basic < advanced < professional < premium < custom
|
|
53
|
-
*/
|
|
54
|
-
export function getPlanNote(plan) {
|
|
55
|
-
switch (plan) {
|
|
56
|
-
case "custom":
|
|
57
|
-
return "Custom enterprise plan with tailored access";
|
|
58
|
-
case "premium":
|
|
59
|
-
return "Full access to all data";
|
|
60
|
-
case "professional":
|
|
61
|
-
return "3-year data history limit on most endpoints";
|
|
62
|
-
case "advanced":
|
|
63
|
-
return "Extended endpoint access with some data limits";
|
|
64
|
-
case "basic":
|
|
65
|
-
return "Limited endpoint access. Upgrade for more data.";
|
|
66
|
-
default:
|
|
67
|
-
return "Plan not detected";
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Capitalize the first letter of a string.
|
|
72
|
-
*/
|
|
73
|
-
export function capitalizeFirst(str) {
|
|
74
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
75
|
-
}
|
|
76
18
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,SAAS,cAAc;IACrB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;IAChC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;QAC5B,IAAI,cAAc,EAAE;YAAE,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC9D,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC9D,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cryptoquant-mcp",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"mcpName": "com.cryptoquant/mcp-server",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "CryptoQuant MCP stdio proxy - connects MCP clients to the remote CryptoQuant MCP server",
|
|
5
6
|
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
7
|
"bin": {
|
|
9
8
|
"cryptoquant-mcp": "dist/index.js"
|
|
10
9
|
},
|
|
@@ -12,11 +11,14 @@
|
|
|
12
11
|
"dist"
|
|
13
12
|
],
|
|
14
13
|
"scripts": {
|
|
15
|
-
"build": "
|
|
14
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc",
|
|
16
15
|
"start": "node dist/index.js",
|
|
17
16
|
"dev": "tsx watch src/index.ts",
|
|
18
|
-
"lint": "eslint src/",
|
|
19
|
-
"
|
|
17
|
+
"lint": "eslint src/ test/",
|
|
18
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:watch": "vitest",
|
|
21
|
+
"sync:metric-ids": "tsx test/helpers/sync-metric-ids.ts",
|
|
20
22
|
"prepare": "husky",
|
|
21
23
|
"prepublishOnly": "npm run build"
|
|
22
24
|
},
|
|
@@ -31,7 +33,9 @@
|
|
|
31
33
|
"ethereum",
|
|
32
34
|
"crypto",
|
|
33
35
|
"analytics",
|
|
34
|
-
"ai-agent"
|
|
36
|
+
"ai-agent",
|
|
37
|
+
"mcp-server",
|
|
38
|
+
"on-chain-analytics"
|
|
35
39
|
],
|
|
36
40
|
"author": "CryptoQuant",
|
|
37
41
|
"license": "MIT",
|
|
@@ -47,18 +51,19 @@
|
|
|
47
51
|
"access": "public"
|
|
48
52
|
},
|
|
49
53
|
"dependencies": {
|
|
50
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
51
|
-
"zod": "^3.23.0"
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.31.0"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@eslint/js": "^9.39.2",
|
|
55
58
|
"@types/node": "^20.0.0",
|
|
59
|
+
"ajv": "^8.20.0",
|
|
56
60
|
"eslint": "^9.0.0",
|
|
57
61
|
"husky": "^9.0.0",
|
|
58
62
|
"tsx": "^4.0.0",
|
|
59
63
|
"typescript": "^5.5.0",
|
|
60
64
|
"typescript-eslint": "^8.54.0",
|
|
61
|
-
"vitest": "^2.0.0"
|
|
65
|
+
"vitest": "^2.0.0",
|
|
66
|
+
"zod": "^3.23.0"
|
|
62
67
|
},
|
|
63
68
|
"engines": {
|
|
64
69
|
"node": ">=18.0.0"
|
package/dist/auth/storage.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface StoredCredentials {
|
|
2
|
-
api_key: string;
|
|
3
|
-
created_at: string;
|
|
4
|
-
validated_at: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function getStoredApiKey(): string | null;
|
|
7
|
-
export declare function saveApiKey(apiKey: string): void;
|
|
8
|
-
export declare function updateValidatedAt(): void;
|
|
9
|
-
export declare function clearCredentials(): void;
|
|
10
|
-
export declare function getCredentialsPath(): string;
|
|
11
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/auth/storage.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAQ/C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAa/C;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CASxC;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
package/dist/auth/storage.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { homedir } from "os";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync, chmodSync } from "fs";
|
|
4
|
-
const CREDENTIALS_DIR = join(homedir(), ".cryptoquant");
|
|
5
|
-
const CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials");
|
|
6
|
-
export function getStoredApiKey() {
|
|
7
|
-
try {
|
|
8
|
-
if (!existsSync(CREDENTIALS_FILE))
|
|
9
|
-
return null;
|
|
10
|
-
const data = JSON.parse(readFileSync(CREDENTIALS_FILE, "utf-8"));
|
|
11
|
-
return data.api_key || null;
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export function saveApiKey(apiKey) {
|
|
18
|
-
if (!existsSync(CREDENTIALS_DIR)) {
|
|
19
|
-
mkdirSync(CREDENTIALS_DIR, { recursive: true, mode: 0o700 });
|
|
20
|
-
}
|
|
21
|
-
const data = {
|
|
22
|
-
api_key: apiKey,
|
|
23
|
-
created_at: new Date().toISOString(),
|
|
24
|
-
validated_at: new Date().toISOString(),
|
|
25
|
-
};
|
|
26
|
-
writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2), { encoding: "utf-8" });
|
|
27
|
-
chmodSync(CREDENTIALS_FILE, 0o600);
|
|
28
|
-
}
|
|
29
|
-
export function updateValidatedAt() {
|
|
30
|
-
try {
|
|
31
|
-
if (!existsSync(CREDENTIALS_FILE))
|
|
32
|
-
return;
|
|
33
|
-
const data = JSON.parse(readFileSync(CREDENTIALS_FILE, "utf-8"));
|
|
34
|
-
data.validated_at = new Date().toISOString();
|
|
35
|
-
writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2), { encoding: "utf-8" });
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
// Validation timestamp update is non-critical
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export function clearCredentials() {
|
|
42
|
-
try {
|
|
43
|
-
if (existsSync(CREDENTIALS_FILE))
|
|
44
|
-
unlinkSync(CREDENTIALS_FILE);
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// Already deleted or inaccessible
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function getCredentialsPath() {
|
|
51
|
-
return CREDENTIALS_FILE;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=storage.js.map
|
package/dist/auth/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":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AO,EAAE,CAAC,CAAC;IACtF,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;YAAE,OAAO;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAsB,CAAC;QACtF,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC7C,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,8CAA8C;IAChD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,gBAAgB,CAAC;YAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,kCAAkC;IACpC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
package/dist/cache/storage.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache storage operations for discovery response caching
|
|
3
|
-
*/
|
|
4
|
-
import { type DiscoveryCacheSchema, type MyDiscoveryRawResponse, type DiscoverySummaryData } from "./types.js";
|
|
5
|
-
import type { UserPlan, PlanLimits, ApiRateLimit } from "../plan-limits.js";
|
|
6
|
-
/**
|
|
7
|
-
* Get cache file path.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getCacheFilePath(_apiUrl: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Check if cache is still valid (not expired and version matches).
|
|
12
|
-
*/
|
|
13
|
-
export declare function isCacheValid(cache: DiscoveryCacheSchema, apiUrl: string, apiKeyPrefix: string): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Read cache from file.
|
|
16
|
-
* Returns null if cache doesn't exist or is invalid JSON.
|
|
17
|
-
*/
|
|
18
|
-
export declare function readCache(apiUrl: string): DiscoveryCacheSchema | null;
|
|
19
|
-
/**
|
|
20
|
-
* Write cache to file with secure permissions.
|
|
21
|
-
*/
|
|
22
|
-
export declare function writeCache(apiUrl: string, apiKey: string, rawResponse: MyDiscoveryRawResponse, parsed: {
|
|
23
|
-
limits: PlanLimits | null;
|
|
24
|
-
statics: string[];
|
|
25
|
-
apiRateLimit: ApiRateLimit | null;
|
|
26
|
-
}, summary: DiscoverySummaryData, plan: UserPlan): void;
|
|
27
|
-
/**
|
|
28
|
-
* Delete cache file.
|
|
29
|
-
*/
|
|
30
|
-
export declare function invalidateCache(apiUrl: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Delete the cache file.
|
|
33
|
-
*/
|
|
34
|
-
export declare function clearAllCaches(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Calculate cache age in days.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getCacheAgeDays(cache: DiscoveryCacheSchema): number;
|
|
39
|
-
/**
|
|
40
|
-
* Get human-readable cache status string.
|
|
41
|
-
*/
|
|
42
|
-
export declare function getCacheStatus(cache: DiscoveryCacheSchema | null, fromCache: boolean): string;
|
|
43
|
-
/**
|
|
44
|
-
* Get cache file path for user display.
|
|
45
|
-
*/
|
|
46
|
-
export declare function getCachePath(): string;
|
|
47
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/cache/storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAG1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAK5E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAuBvG;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAmBrE;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,sBAAsB,EACnC,MAAM,EAAE;IACN,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;CACnC,EACD,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,QAAQ,GACb,IAAI,CA2BN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAUpD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAQrC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAKnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAM7F;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
package/dist/cache/storage.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache storage operations for discovery response caching
|
|
3
|
-
*/
|
|
4
|
-
import { homedir } from "os";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync, chmodSync } from "fs";
|
|
7
|
-
import { CACHE_VERSION, CACHE_TTL_DAYS, } from "./types.js";
|
|
8
|
-
const CACHE_DIR = join(homedir(), ".cryptoquant");
|
|
9
|
-
const CACHE_FILE = join(CACHE_DIR, "discovery-cache.json");
|
|
10
|
-
/**
|
|
11
|
-
* Get cache file path.
|
|
12
|
-
*/
|
|
13
|
-
export function getCacheFilePath(_apiUrl) {
|
|
14
|
-
return CACHE_FILE;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Check if cache is still valid (not expired and version matches).
|
|
18
|
-
*/
|
|
19
|
-
export function isCacheValid(cache, apiUrl, apiKeyPrefix) {
|
|
20
|
-
// Version check
|
|
21
|
-
if (cache.version !== CACHE_VERSION) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
// API URL must match
|
|
25
|
-
if (cache.metadata.api_url !== apiUrl) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
// API key prefix must match (detects account switch)
|
|
29
|
-
if (cache.metadata.api_key_prefix !== apiKeyPrefix) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
// TTL check
|
|
33
|
-
const expiresAt = new Date(cache.metadata.expires_at);
|
|
34
|
-
if (isNaN(expiresAt.getTime()) || expiresAt < new Date()) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Read cache from file.
|
|
41
|
-
* Returns null if cache doesn't exist or is invalid JSON.
|
|
42
|
-
*/
|
|
43
|
-
export function readCache(apiUrl) {
|
|
44
|
-
const cachePath = getCacheFilePath(apiUrl);
|
|
45
|
-
try {
|
|
46
|
-
if (!existsSync(cachePath)) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
const data = JSON.parse(readFileSync(cachePath, "utf-8"));
|
|
50
|
-
// Basic structure validation
|
|
51
|
-
if (!data.version || !data.metadata || !data.raw_response || !data.summary) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Write cache to file with secure permissions.
|
|
62
|
-
*/
|
|
63
|
-
export function writeCache(apiUrl, apiKey, rawResponse, parsed, summary, plan) {
|
|
64
|
-
// Ensure directory exists
|
|
65
|
-
if (!existsSync(CACHE_DIR)) {
|
|
66
|
-
mkdirSync(CACHE_DIR, { recursive: true, mode: 0o700 });
|
|
67
|
-
}
|
|
68
|
-
const now = new Date();
|
|
69
|
-
const expiresAt = new Date(now);
|
|
70
|
-
expiresAt.setDate(expiresAt.getDate() + CACHE_TTL_DAYS);
|
|
71
|
-
const cache = {
|
|
72
|
-
version: CACHE_VERSION,
|
|
73
|
-
metadata: {
|
|
74
|
-
api_url: apiUrl,
|
|
75
|
-
api_key_prefix: apiKey.slice(0, 8),
|
|
76
|
-
cached_at: now.toISOString(),
|
|
77
|
-
expires_at: expiresAt.toISOString(),
|
|
78
|
-
plan,
|
|
79
|
-
},
|
|
80
|
-
raw_response: rawResponse,
|
|
81
|
-
parsed,
|
|
82
|
-
summary,
|
|
83
|
-
};
|
|
84
|
-
const cachePath = getCacheFilePath(apiUrl);
|
|
85
|
-
writeFileSync(cachePath, JSON.stringify(cache, null, 2), { encoding: "utf-8" });
|
|
86
|
-
chmodSync(cachePath, 0o600);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Delete cache file.
|
|
90
|
-
*/
|
|
91
|
-
export function invalidateCache(apiUrl) {
|
|
92
|
-
const cachePath = getCacheFilePath(apiUrl);
|
|
93
|
-
try {
|
|
94
|
-
if (existsSync(cachePath)) {
|
|
95
|
-
unlinkSync(cachePath);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
// Already deleted or inaccessible
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Delete the cache file.
|
|
104
|
-
*/
|
|
105
|
-
export function clearAllCaches() {
|
|
106
|
-
try {
|
|
107
|
-
if (existsSync(CACHE_FILE)) {
|
|
108
|
-
unlinkSync(CACHE_FILE);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
// Ignore errors
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Calculate cache age in days.
|
|
117
|
-
*/
|
|
118
|
-
export function getCacheAgeDays(cache) {
|
|
119
|
-
const cachedAt = new Date(cache.metadata.cached_at);
|
|
120
|
-
const now = new Date();
|
|
121
|
-
const diffMs = now.getTime() - cachedAt.getTime();
|
|
122
|
-
return Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Get human-readable cache status string.
|
|
126
|
-
*/
|
|
127
|
-
export function getCacheStatus(cache, fromCache) {
|
|
128
|
-
if (!fromCache || !cache) {
|
|
129
|
-
return "fresh";
|
|
130
|
-
}
|
|
131
|
-
const days = getCacheAgeDays(cache);
|
|
132
|
-
return `cached (${days}d old)`;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Get cache file path for user display.
|
|
136
|
-
*/
|
|
137
|
-
export function getCachePath() {
|
|
138
|
-
return CACHE_DIR;
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/cache/storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,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G,eAAe,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,WAAW,IAAI,QAAQ,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/cache/summary.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Summary generation for cached discovery data
|
|
3
|
-
*/
|
|
4
|
-
import type { DiscoverySummaryData, MyDiscoveryRawResponse } from "./types.js";
|
|
5
|
-
import type { PlanLimits } from "../plan-limits.js";
|
|
6
|
-
/**
|
|
7
|
-
* Generate summary from parsed plan limits.
|
|
8
|
-
* Counts endpoints and organizes by asset/category.
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateSummary(limits: PlanLimits | null, statics: string[]): DiscoverySummaryData;
|
|
11
|
-
/**
|
|
12
|
-
* Extract raw response structure for caching.
|
|
13
|
-
* Only keeps necessary fields.
|
|
14
|
-
*/
|
|
15
|
-
export declare function extractRawResponse(apiResponse: Record<string, unknown>): MyDiscoveryRawResponse | null;
|
|
16
|
-
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/cache/summary.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAiElG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,sBAAsB,GAAG,IAAI,CAqB/B"}
|
package/dist/cache/summary.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Summary generation for cached discovery data
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Generate summary from parsed plan limits.
|
|
6
|
-
* Counts endpoints and organizes by asset/category.
|
|
7
|
-
*/
|
|
8
|
-
export function generateSummary(limits, statics) {
|
|
9
|
-
const assetData = new Map();
|
|
10
|
-
// Count endpoints from limits
|
|
11
|
-
if (limits) {
|
|
12
|
-
for (const [asset, categories] of Object.entries(limits)) {
|
|
13
|
-
if (!assetData.has(asset)) {
|
|
14
|
-
assetData.set(asset, { endpoint_count: 0, categories: new Set() });
|
|
15
|
-
}
|
|
16
|
-
const data = assetData.get(asset);
|
|
17
|
-
for (const [category, metrics] of Object.entries(categories)) {
|
|
18
|
-
data.categories.add(category);
|
|
19
|
-
if (metrics) {
|
|
20
|
-
data.endpoint_count += Object.keys(metrics).length;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// Count static endpoints (parse asset from path)
|
|
26
|
-
for (const staticPath of statics) {
|
|
27
|
-
const parts = staticPath.split("/");
|
|
28
|
-
if (parts.length >= 4) {
|
|
29
|
-
const asset = parts[2];
|
|
30
|
-
const category = parts[3];
|
|
31
|
-
if (!assetData.has(asset)) {
|
|
32
|
-
assetData.set(asset, { endpoint_count: 0, categories: new Set() });
|
|
33
|
-
}
|
|
34
|
-
const data = assetData.get(asset);
|
|
35
|
-
data.endpoint_count++;
|
|
36
|
-
data.categories.add(category);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Build summary
|
|
40
|
-
const assets = [];
|
|
41
|
-
const categoryByAsset = {};
|
|
42
|
-
let totalEndpoints = 0;
|
|
43
|
-
for (const [asset, data] of assetData.entries()) {
|
|
44
|
-
assets.push({
|
|
45
|
-
name: asset,
|
|
46
|
-
endpoint_count: data.endpoint_count,
|
|
47
|
-
categories: Array.from(data.categories).sort(),
|
|
48
|
-
});
|
|
49
|
-
categoryByAsset[asset] = Array.from(data.categories).sort();
|
|
50
|
-
totalEndpoints += data.endpoint_count;
|
|
51
|
-
}
|
|
52
|
-
// Sort assets alphabetically
|
|
53
|
-
assets.sort((a, b) => a.name.localeCompare(b.name));
|
|
54
|
-
return {
|
|
55
|
-
total_endpoints: totalEndpoints,
|
|
56
|
-
assets,
|
|
57
|
-
category_by_asset: categoryByAsset,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Extract raw response structure for caching.
|
|
62
|
-
* Only keeps necessary fields.
|
|
63
|
-
*/
|
|
64
|
-
export function extractRawResponse(apiResponse) {
|
|
65
|
-
try {
|
|
66
|
-
const apiEndpoint = apiResponse.apiEndpoint;
|
|
67
|
-
const plan = apiResponse.plan;
|
|
68
|
-
const apiRateLimit = apiResponse.apiRateLimit;
|
|
69
|
-
if (!apiEndpoint || typeof apiEndpoint !== "object") {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
apiEndpoint: apiEndpoint,
|
|
74
|
-
plan: { name: plan?.name || "unknown" },
|
|
75
|
-
apiRateLimit: {
|
|
76
|
-
token: apiRateLimit?.token || 0,
|
|
77
|
-
window: apiRateLimit?.window || "day",
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=summary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/cache/summary.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAyB,EAAE,OAAiB;IAC1E,MAAM,SAAS,GAMX,IAAI,GAAG,EAAE,CAAC;IAEd,8BAA8B;IAC9B,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,MAAM,CAAC,KAAK,EAAE,UAA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,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,WAAW,EAAE,WAAsC;YACnD,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,SAAS,EAAE;YACvC,YAAY,EAAE;gBACZ,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;gBAC/B,MAAM,EAAE,YAAY,EAAE,MAAM,IAAI,KAAK;aACtC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/cache/types.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache schema types for CryptoQuant discovery caching
|
|
3
|
-
*/
|
|
4
|
-
import type { UserPlan, ApiRateLimit, PlanLimits } from "../plan-limits.js";
|
|
5
|
-
export declare const CACHE_VERSION = 1;
|
|
6
|
-
export declare const CACHE_TTL_DAYS = 7;
|
|
7
|
-
/**
|
|
8
|
-
* Raw API response structure from /my/discovery/endpoints
|
|
9
|
-
*/
|
|
10
|
-
export interface MyDiscoveryRawResponse {
|
|
11
|
-
apiEndpoint: Record<string, unknown>;
|
|
12
|
-
plan: {
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
apiRateLimit: {
|
|
16
|
-
token: number;
|
|
17
|
-
window: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Summary data generated from the raw response
|
|
22
|
-
*/
|
|
23
|
-
export interface DiscoverySummaryData {
|
|
24
|
-
total_endpoints: number;
|
|
25
|
-
assets: Array<{
|
|
26
|
-
name: string;
|
|
27
|
-
endpoint_count: number;
|
|
28
|
-
categories: string[];
|
|
29
|
-
}>;
|
|
30
|
-
category_by_asset: Record<string, string[]>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Cache metadata for validation
|
|
34
|
-
*/
|
|
35
|
-
export interface CacheMetadata {
|
|
36
|
-
api_url: string;
|
|
37
|
-
api_key_prefix: string;
|
|
38
|
-
cached_at: string;
|
|
39
|
-
expires_at: string;
|
|
40
|
-
plan: UserPlan;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Full cache schema stored in file
|
|
44
|
-
*/
|
|
45
|
-
export interface DiscoveryCacheSchema {
|
|
46
|
-
version: typeof CACHE_VERSION;
|
|
47
|
-
metadata: CacheMetadata;
|
|
48
|
-
raw_response: MyDiscoveryRawResponse;
|
|
49
|
-
parsed: {
|
|
50
|
-
limits: PlanLimits | null;
|
|
51
|
-
statics: string[];
|
|
52
|
-
apiRateLimit: ApiRateLimit | null;
|
|
53
|
-
};
|
|
54
|
-
summary: DiscoverySummaryData;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Compact response format for initialize() tool
|
|
58
|
-
*/
|
|
59
|
-
export interface CompactInitializeResponse {
|
|
60
|
-
success: boolean;
|
|
61
|
-
session: {
|
|
62
|
-
plan: UserPlan;
|
|
63
|
-
rate_limit: string;
|
|
64
|
-
cache_status: string;
|
|
65
|
-
};
|
|
66
|
-
scope: {
|
|
67
|
-
total_endpoints: number;
|
|
68
|
-
accessible: number;
|
|
69
|
-
assets: Record<string, {
|
|
70
|
-
endpoints: number;
|
|
71
|
-
categories: number;
|
|
72
|
-
}>;
|
|
73
|
-
note: string;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5E,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAA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,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;YACE,SAAS,EAAE,MAAM,CAAC;YAClB,UAAU,EAAE,MAAM,CAAC;SACpB,CACF,CAAC;QACF,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|
package/dist/cache/types.js
DELETED
package/dist/cache/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized configuration for CryptoQuant MCP Server
|
|
3
|
-
*
|
|
4
|
-
* API URL Priority:
|
|
5
|
-
* 1. CRYPTOQUANT_API_URL environment variable (optional override)
|
|
6
|
-
* 2. Default production URL
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Get the configured API URL.
|
|
10
|
-
* Returns the base URL with /v1 suffix (e.g., "https://api.cryptoquant.com/v1")
|
|
11
|
-
*/
|
|
12
|
-
export declare function getApiUrl(): string;
|
|
13
|
-
/**
|
|
14
|
-
* Get the API base URL without version suffix.
|
|
15
|
-
* Returns the base URL (e.g., "https://api.cryptoquant.com")
|
|
16
|
-
*/
|
|
17
|
-
export declare function getApiBaseUrl(): string;
|
|
18
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|