netintel-mcp 1.1.63 → 1.1.64

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/dist/client.js CHANGED
@@ -4,6 +4,7 @@ import { privateKeyToAccount } from "viem/accounts";
4
4
  import { createPublicClient, http, formatUnits } from "viem";
5
5
  import { base } from "viem/chains";
6
6
  import axios from "axios";
7
+ import { VIA_HEADER } from "./pay-handoff.js";
7
8
  // Canonical domain. The legacy netintel-production-440c.up.railway.app host
8
9
  // still serves the same app as a fallback, but new clients target netintel.dev.
9
10
  const BASE_URL = "https://netintel.dev";
@@ -65,7 +66,9 @@ export function configuredWallet() {
65
66
  */
66
67
  export async function createClient() {
67
68
  const key = process.env.EVM_PRIVATE_KEY?.trim();
68
- const plain = axios.create({ baseURL: BASE_URL });
69
+ // "mcp" = this server paid with its own key (the wallet-less handoff tells the
70
+ // agent's wallet to send "mcp-handoff" instead) — see pay-handoff.ts.
71
+ const plain = axios.create({ baseURL: BASE_URL, headers: { [VIA_HEADER]: "mcp" } });
69
72
  if (!key) {
70
73
  console.error("[netintel-mcp] No EVM_PRIVATE_KEY set — running wallet-less. " +
71
74
  (FREE_TOOLS.length ? `Free-tier tools work (${FREE_TOOLS.join(", ")}); ` : "") +
@@ -12,6 +12,13 @@ import axios from "axios";
12
12
  // limits apply; this server never signs anything in this mode.
13
13
  /** USDC on Base — the only rail all three wallets pay on. */
14
14
  const BASE = "eip155:8453";
15
+ /**
16
+ * Tells NetIntel's paid-call ledger which integration the call came from; the
17
+ * buyer's own client otherwise shows only a generic UA (AgentCash = "node").
18
+ * Changes nothing about the call or its price.
19
+ */
20
+ export const VIA_HEADER = "X-NetIntel-Via";
21
+ export const VIA_HANDOFF = "mcp-handoff";
15
22
  /** The Base quote from a 402 body (v2 `amount` atomic, v1 `price` "$0.002"). */
16
23
  export function priceFrom402(body) {
17
24
  const accepts = body?.accepts;
@@ -45,7 +52,7 @@ export function requestFromAxios(config, body402) {
45
52
  }
46
53
  }
47
54
  const price = priceFrom402(body402);
48
- return { url, method, ...(body !== undefined ? { body } : {}), ...(price ? { price_usd: price.usd, max_amount_atomic: price.atomic } : {}) };
55
+ return { url, method, ...(body !== undefined ? { body } : {}), headers: { [VIA_HEADER]: VIA_HANDOFF }, ...(price ? { price_usd: price.usd, max_amount_atomic: price.atomic } : {}) };
49
56
  }
50
57
  /** Single-quote for a POSIX shell (agents paste these into a terminal). */
51
58
  const sq = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
@@ -53,16 +60,20 @@ const sq = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
53
60
  export function payHandoffText(r) {
54
61
  const usd = r.price_usd !== undefined ? `$${r.price_usd}` : undefined;
55
62
  const json = r.body !== undefined ? JSON.stringify(r.body) : undefined;
56
- const fetchArgs = { url: r.url, method: r.method, ...(json ? { body: json } : {}) };
63
+ // Each wallet takes headers in its own shape: AgentCash "Name: value" strings,
64
+ // awal a JSON object string, Wallet MCP an object.
65
+ const fetchArgs = { url: r.url, method: r.method, ...(json ? { body: json } : {}), headers: Object.entries(r.headers).map(([k, v]) => `${k}: ${v}`) };
57
66
  const awal = [
58
67
  "npx awal@latest x402 pay", sq(r.url),
59
68
  ...(r.method === "POST" ? ["-X POST"] : []),
60
69
  ...(json ? ["-d", sq(json)] : []),
70
+ "-h", sq(JSON.stringify(r.headers)),
61
71
  ...(r.max_amount_atomic ? ["--max-amount", r.max_amount_atomic] : []),
62
72
  ].join(" ");
63
73
  const initiate = {
64
74
  url: r.url, method: r.method,
65
75
  ...(r.body !== undefined ? { body: r.body } : {}),
76
+ headers: r.headers,
66
77
  maxPayment: r.price_usd !== undefined ? String(r.price_usd) : "0.01",
67
78
  };
68
79
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netintel-mcp",
3
- "version": "1.1.63",
3
+ "version": "1.1.64",
4
4
  "mcpName": "io.github.kjgueye/netintel-mcp",
5
5
  "repository": {
6
6
  "type": "git",