coinopai-mcp 1.2.5 → 1.2.6

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 (3) hide show
  1. package/index.js +22 -18
  2. package/package.json +1 -1
  3. package/server.json +2 -2
package/index.js CHANGED
@@ -25,10 +25,12 @@ const USDC_ABI = parseAbi([
25
25
  ]);
26
26
  // Paths with registered Pyrimid product IDs — other paths fall back to standard x402
27
27
  const PYRIMID_PRODUCTS = {
28
- "/api/kronos/signals": { productId: 1n, priceUsdc: 50000n },
28
+ "/api/kronos/signals": { productId: 1n, priceUsdc: 50000n },
29
29
  "/api/kronos/decision": { productId: 2n, priceUsdc: 150000n },
30
- "/api/kronos/preflight": { productId: 4n, priceUsdc: 50000n },
31
- "/api/kronos/audit": { productId: 5n, priceUsdc: 70000n },
30
+ "/api/kronos/preflight": { productId: 4n, priceUsdc: 50000n },
31
+ "/api/kronos/audit": { productId: 5n, priceUsdc: 70000n },
32
+ "/api/kronos/risk": { productId: 6n, priceUsdc: 20000n },
33
+ "/api/kronos/history": { productId: 7n, priceUsdc: 50000n },
32
34
  };
33
35
  const IMAGEGEN_URL = "https://imagegen.coinopai.com";
34
36
  const PYRIMID_PRODUCTS_IMAGEGEN = {
@@ -221,15 +223,13 @@ async function callPaid(ctx, path, affiliateId, opts = {}) {
221
223
 
222
224
  async function main() {
223
225
  let ctx;
224
- try {
225
- ctx = buildHttpClient();
226
- } catch (e) {
227
- process.stderr.write("[coinopai-mcp] " + e.message + "\n");
228
- process.exit(1);
226
+ function getPaymentContext() {
227
+ if (!ctx) ctx = buildHttpClient();
228
+ return ctx;
229
229
  }
230
230
 
231
231
  const server = new Server(
232
- { name: "coinopai-mcp", version: "1.2.5" },
232
+ { name: "coinopai-mcp", version: "1.2.6" },
233
233
  { capabilities: { tools: {} } }
234
234
  );
235
235
 
@@ -240,36 +240,37 @@ async function main() {
240
240
  try {
241
241
  // Affiliate ID: tool arg takes precedence, then env fallback, then none
242
242
  const affiliateId = args.affiliate_id || process.env.PYRIMID_AFFILIATE_ID || null;
243
+ const paymentContext = getPaymentContext();
243
244
  let data;
244
245
  switch (name) {
245
246
  // Low-value utility endpoints — no affiliate routing
246
247
  case "search_agent_automations":
247
- data = await callPaid(ctx, `/api/search?q=${encodeURIComponent(args.query || "")}&limit=${args.limit || 20}`, null);
248
+ data = await callPaid(paymentContext, `/api/search?q=${encodeURIComponent(args.query || "")}&limit=${args.limit || 20}`, null);
248
249
  break;
249
250
  case "get_agent_automation":
250
- data = await callPaid(ctx, `/api/automation/${encodeURIComponent(args.slug)}`, null);
251
+ data = await callPaid(paymentContext, `/api/automation/${encodeURIComponent(args.slug)}`, null);
251
252
  break;
252
253
  case "list_automation_categories":
253
- data = await callPaid(ctx, "/api/categories", null);
254
+ data = await callPaid(paymentContext, "/api/categories", null);
254
255
  break;
255
256
  case "get_crypto_risk":
256
- data = await callPaid(ctx, "/api/kronos/risk", null);
257
+ data = await callPaid(paymentContext, "/api/kronos/risk", affiliateId);
257
258
  break;
258
259
  // High-value endpoints — affiliate routing enabled
259
260
  case "get_crypto_signals":
260
- data = await callPaid(ctx, "/api/kronos/signals", affiliateId);
261
+ data = await callPaid(paymentContext, "/api/kronos/signals", affiliateId);
261
262
  break;
262
263
  case "get_crypto_signal_history":
263
- data = await callPaid(ctx, `/api/kronos/history?hours=${args.hours || 24}`, affiliateId);
264
+ data = await callPaid(paymentContext, `/api/kronos/history?hours=${args.hours || 24}`, affiliateId);
264
265
  break;
265
266
  case "get_crypto_decision":
266
- data = await callPaid(ctx, `/api/kronos/decision?symbol=${encodeURIComponent(args.symbol || "BTC")}`, affiliateId);
267
+ data = await callPaid(paymentContext, `/api/kronos/decision?symbol=${encodeURIComponent(args.symbol || "BTC")}`, affiliateId);
267
268
  break;
268
269
  case "check_trade_preflight":
269
- data = await callPaid(ctx, `/api/kronos/preflight?symbol=${encodeURIComponent(args.symbol || "BTC")}`, affiliateId);
270
+ data = await callPaid(paymentContext, `/api/kronos/preflight?symbol=${encodeURIComponent(args.symbol || "BTC")}`, affiliateId);
270
271
  break;
271
272
  case "audit_trade_decision":
272
- data = await callPaid(ctx, `/api/kronos/audit?decision_id=${encodeURIComponent(args.decision_id)}&window=${encodeURIComponent(args.window || "4h")}`, affiliateId);
273
+ data = await callPaid(paymentContext, `/api/kronos/audit?decision_id=${encodeURIComponent(args.decision_id)}&window=${encodeURIComponent(args.window || "4h")}`, affiliateId);
273
274
  break;
274
275
  default:
275
276
  throw new Error("Unknown tool: " + name);
@@ -282,6 +283,9 @@ async function main() {
282
283
 
283
284
  const transport = new StdioServerTransport();
284
285
  await server.connect(transport);
286
+ process.stdin.resume();
287
+ process.stdin.on("end", () => process.exit(0));
288
+ setInterval(() => {}, 1 << 30);
285
289
  }
286
290
 
287
291
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coinopai-mcp",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "mcpName": "io.github.forgemeshlabs/coinopai-mcp",
5
5
  "description": "MCP server for CoinOpAI — agent automation prompts and crypto signals via x402 micropayments on Base",
6
6
  "main": "index.js",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/forgemeshlabs/coinopai-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.2.5",
9
+ "version": "1.2.6",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "coinopai-mcp",
14
- "version": "1.2.5",
14
+ "version": "1.2.6",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },