netintel-mcp 1.1.63 → 1.1.65

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 CHANGED
@@ -7,7 +7,7 @@ Plus 3 router tools that find the best x402 endpoint for a job from **any** prov
7
7
 
8
8
  ## Install as a Claude Code plugin (recommended)
9
9
 
10
- The plugin installs the MCP server **and** a skill that knows which NetIntel endpoint fits a task, what it costs and how to pay it from the agent's wallet. It asks for an optional agent wallet key (stored in Claude Code's secure storage, never in settings files) — leave it empty if you use AgentCash or the Coinbase Agentic Wallet:
10
+ The plugin installs the MCP server **and** a skill that knows which NetIntel endpoint fits a task, what it costs and how to pay it. It never holds a private key and never signs a payment: each paid tool hands the exact request and its price to the agent's own wallet (below), which pays it under that wallet's own approvals and limits. Nothing to configure:
11
11
 
12
12
  ```
13
13
  /plugin marketplace add kjgueye/netintel-mcp
@@ -26,12 +26,16 @@ With no `EVM_PRIVATE_KEY` set, every paid tool answers with the exact request
26
26
 
27
27
  That wallet's own spending limits apply. The bundled skill (`skills/netintel/SKILL.md`) calls NetIntel the same way even without this server.
28
28
 
29
+ ## What it connects to
30
+
31
+ The tools call only NetIntel's own hosts: `https://netintel.dev` (the API) and `https://router.netintel.dev` (the router tools). Requests carry the tool's input and, when this server pays with its own key, an x402 payment signature; nothing else from your machine is sent. With a key configured, `netintel_wallet_status` also reads that wallet's USDC balance from Base's public node, `https://mainnet.base.org`. Privacy: https://netintel.dev/privacy · Terms: https://netintel.dev/terms
32
+
29
33
  ## Install
30
34
 
31
35
  ```bash
32
36
  # pay from AgentCash, Coinbase Agentic Wallet or Coinbase Wallet MCP
33
37
  claude mcp add netintel -- npx -y netintel-mcp
34
- # or let this server pay from a dedicated wallet
38
+ # or let this server pay from a dedicated wallet (direct install only; the plugin never takes a key)
35
39
  claude mcp add netintel -e EVM_PRIVATE_KEY=0xYOUR_PRIVATE_KEY -- npx -y netintel-mcp
36
40
  ```
37
41
 
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";
@@ -34,7 +35,13 @@ let walletAddress = null;
34
35
  */
35
36
  const SPEND_LIMIT = "SPEND_LIMIT";
36
37
  function limit(envName, fallback) {
37
- const n = Number(process.env[envName]);
38
+ // Empty means unset: Number("") is 0, which would refuse every payment. A
39
+ // config that writes the variable with no value (an unset plugin option with
40
+ // no default resolves to "") must get the default, not a $0 limit.
41
+ const raw = process.env[envName]?.trim();
42
+ if (!raw)
43
+ return fallback;
44
+ const n = Number(raw);
38
45
  return Number.isFinite(n) && n >= 0 ? n : fallback;
39
46
  }
40
47
  export const MAX_PER_CALL_USD = limit("NETINTEL_MAX_PER_CALL_USD", 0.25);
@@ -65,7 +72,9 @@ export function configuredWallet() {
65
72
  */
66
73
  export async function createClient() {
67
74
  const key = process.env.EVM_PRIVATE_KEY?.trim();
68
- const plain = axios.create({ baseURL: BASE_URL });
75
+ // "mcp" = this server paid with its own key (the wallet-less handoff tells the
76
+ // agent's wallet to send "mcp-handoff" instead) — see pay-handoff.ts.
77
+ const plain = axios.create({ baseURL: BASE_URL, headers: { [VIA_HEADER]: "mcp" } });
69
78
  if (!key) {
70
79
  console.error("[netintel-mcp] No EVM_PRIVATE_KEY set — running wallet-less. " +
71
80
  (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.65",
4
4
  "mcpName": "io.github.kjgueye/netintel-mcp",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "test": "tsc && node --test tests/*.test.mjs",
22
22
  "test:live": "tsc && node tests/walletless-live.mjs",
23
23
  "dev": "ts-node src/index.ts",
24
- "prepublishOnly": "npm run build"
24
+ "prepublishOnly": "npm test"
25
25
  },
26
26
  "keywords": [
27
27
  "mcp",