bykaranteli-mcp 0.23.0 → 0.24.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.
Files changed (2) hide show
  1. package/dist/tools.js +40 -3
  2. package/package.json +1 -1
package/dist/tools.js CHANGED
@@ -37,6 +37,24 @@ export function registerByKaranteliTools(server, options) {
37
37
  }
38
38
  /* Every answer carries where it came from and when (README promise; audit
39
39
  * P3 #416): routes that already emit these keep their own values. */
40
+ /* API stems whose public page has a different name. Stripping /api/public off
41
+ * the route gave nine tools a `source` that 404s on the site (2026-09-04
42
+ * audit: /borrow-rates, /oi, /recent, /venues/markets ...). */
43
+ const PAGE_FOR_STEM = {
44
+ "/borrow-rates": "/borrow",
45
+ "/oi": "/oi-leaderboard",
46
+ "/recent": "/signals",
47
+ "/leaderboard": "/strategies",
48
+ "/venues/markets": "/venues",
49
+ "/venues/lead-lag": "/venues",
50
+ "/venues/profile": "/venues",
51
+ "/datasets/etf-flows": "/etf",
52
+ "/datasets/liquidations-daily": "/liquidations",
53
+ };
54
+ function pageForApiPath(path) {
55
+ const stem = path.replace(/^\/api\/(?:v1\/)?public/, "").split("?")[0] || "/";
56
+ return PAGE_FOR_STEM[stem] ?? stem;
57
+ }
40
58
  function withProvenance(data, path) {
41
59
  if (!data || typeof data !== "object" || Array.isArray(data))
42
60
  return data;
@@ -44,11 +62,30 @@ export function registerByKaranteliTools(server, options) {
44
62
  return {
45
63
  ...record,
46
64
  generatedAt: typeof record.generatedAt === "string" ? record.generatedAt : new Date().toISOString(),
47
- source: typeof record.source === "string" ? record.source : `${PUBLIC_URL}${path.replace(/^\/api\/public/, "").split("?")[0] || "/"}`,
65
+ source: typeof record.source === "string" ? record.source : `${PUBLIC_URL}${pageForApiPath(path)}`,
48
66
  };
49
67
  }
68
+ /* Compact JSON (pretty-printing cost ~35% of the budget) and a hard ceiling:
69
+ * a few argument combinations produced 400k+ characters, more than an LLM
70
+ * context window, with no signal that anything was cut (audit 2026-09-04
71
+ * #41). Above the ceiling the tool answers with guidance instead of a
72
+ * payload the caller could not use anyway. */
73
+ const MAX_RESULT_CHARS = 240_000;
50
74
  function ok(data) {
51
- return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
75
+ const text = JSON.stringify(data);
76
+ if (text.length <= MAX_RESULT_CHARS)
77
+ return { content: [{ type: "text", text }] };
78
+ return {
79
+ content: [{
80
+ type: "text",
81
+ text: JSON.stringify({
82
+ truncated: true,
83
+ chars: text.length,
84
+ limit: MAX_RESULT_CHARS,
85
+ note: "Result too large for one context window. Narrow the call: fewer hours or days, a single symbol, or include_points=false, then call again.",
86
+ }),
87
+ }],
88
+ };
52
89
  }
53
90
  function fail(err) {
54
91
  const message = err instanceof Error ? err.message : String(err);
@@ -813,7 +850,7 @@ export function registerByKaranteliTools(server, options) {
813
850
  });
814
851
  server.registerTool("get_network_health", {
815
852
  title: "Bitcoin network health from our own node",
816
- description: "Call this when the user asks about Bitcoin hashrate, difficulty, fees or mempool congestion. Returns the recorded daily series and latest values measured on ByKaranteli's own node.",
853
+ description: "Call this when the user asks about Bitcoin hashrate, difficulty or block fees (our node runs blocksonly, so there is no mempool series). Returns the recorded daily series and latest values measured on ByKaranteli's own node.",
817
854
  inputSchema: { days: z.number().int().min(1).max(730).optional().describe("Window in days, 1-730 (default 365).") },
818
855
  annotations: READ_ONLY,
819
856
  }, async (args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bykaranteli-mcp",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "MCP server for live crypto derivatives data from bykaranteli.com: funding rates, funding arbitrage, open interest pressure, Fear & Greed, BTC dominance and verified signal performance. Free, no API key.",
5
5
  "type": "module",
6
6
  "bin": {