agent402-mcp 0.13.31 → 0.13.32

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
@@ -1,6 +1,6 @@
1
1
  # agent402-mcp
2
2
 
3
- MCP server for [Agent402](https://agent402.tools), the applied layer of Agentic Finance: a catalog of **500+ web tools** that AI agents call one request at a time, paid per call in USDC over x402 or MPP (Machine Payments Protocol). Pure-CPU tools are free: each call solves a small proof-of-work puzzle on your own machine. Other tools are paid per call in USDC over the [x402 protocol](https://www.x402.org) from a wallet you control. Built by [Havok Holdings LLC](https://github.com/MikeyPetrillo/Agent402).
3
+ MCP server for [Agent402](https://agent402.tools), the applied layer of Agentic Finance. Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. Paid calls settle in USDC over x402 or MPP (Machine Payments Protocol). Pure-CPU tools are free: each call solves a small proof-of-work puzzle on your own machine. Other tools are paid per call in USDC over the [x402 protocol](https://www.x402.org) from a wallet you control. Built by [Havok Holdings LLC](https://github.com/MikeyPetrillo/Agent402).
4
4
 
5
5
  ## Quick start
6
6
 
@@ -9,7 +9,7 @@ Pick one setup. Both run locally through `npx`.
9
9
  **1. Free, no wallet.** Pure-CPU tools (no outbound calls, keys or models) run free. Each call solves a proof-of-work puzzle with your CPU, typically well under a second on a laptop. Tools that reach the network or a model ask for a wallet.
10
10
 
11
11
  ```
12
- claude mcp add agent402 -s user -- npx -y agent402-mcp@0.13.31
12
+ claude mcp add agent402 -s user -- npx -y agent402-mcp@0.13.32
13
13
  ```
14
14
 
15
15
  **2. Paid, with a wallet.** Paid tools are settled in USDC on each call.
@@ -19,7 +19,7 @@ claude mcp add agent402 -s user -- npx -y agent402-mcp@0.13.31
19
19
  "mcpServers": {
20
20
  "agent402": {
21
21
  "command": "npx",
22
- "args": ["-y", "agent402-mcp@0.13.31"],
22
+ "args": ["-y", "agent402-mcp@0.13.32"],
23
23
  "env": { "AGENT_KEY": "0xYOUR_PRIVATE_KEY" }
24
24
  }
25
25
  }
@@ -30,7 +30,7 @@ claude mcp add agent402 -s user -- npx -y agent402-mcp@0.13.31
30
30
 
31
31
  Use `SOLANA_AGENT_KEY` instead for USDC on Solana. Each call is capped at $4 by default; there is no session budget unless you set `AGENT402_BUDGET`.
32
32
 
33
- Claude Code with a wallet: `claude mcp add agent402 -s user -e AGENT_KEY=0xYOUR_PRIVATE_KEY -- npx -y agent402-mcp@0.13.31`
33
+ Claude Code with a wallet: `claude mcp add agent402 -s user -e AGENT_KEY=0xYOUR_PRIVATE_KEY -- npx -y agent402-mcp@0.13.32`
34
34
  (use a new wallet holding only a few dollars of USDC; never your main wallet).
35
35
 
36
36
  Advanced setup (chains, MPP, error codes, the hosted connector) is in [Advanced](#advanced).
package/async-job.js CHANGED
@@ -12,7 +12,9 @@
12
12
  // on a delivered result, which may still happen).
13
13
  //
14
14
  // The job link must be on the same origin as the server: a Location naming
15
- // another host is refused rather than fetched.
15
+ // another host is refused rather than fetched, and so is a redirect on a poll
16
+ // that points off the origin (each hop is read with redirect: "manual" and its
17
+ // target checked before it is fetched).
16
18
  //
17
19
  // Kept in lockstep with client/async-job.js (agent402-client).
18
20
 
@@ -53,6 +55,36 @@ function sameOrigin(url, baseUrl) {
53
55
  try { return new URL(url).origin === new URL(baseUrl).origin; } catch { return false; }
54
56
  }
55
57
 
58
+ const MAX_POLL_REDIRECTS = 5;
59
+ // One poll of the job link. Redirects are followed by hand, each hop's target
60
+ // checked against the server's origin first; a hop off the origin, an opaque
61
+ // redirect (a browser's "manual" answer, which hides its target) or too many
62
+ // hops throws instead of fetching. A fetch that followed a redirect anyway is
63
+ // refused when it landed off the origin.
64
+ async function pollJobLink(fetchImpl, jobUrl, baseUrl, slug, doc) {
65
+ let url = jobUrl;
66
+ for (let hop = 0; ; hop++) {
67
+ const g = await fetchImpl(url, { headers: { Accept: "application/json" }, redirect: "manual" });
68
+ if (!g) return g;
69
+ if (g.redirected && g.url && !sameOrigin(g.url, baseUrl)) {
70
+ throw new AsyncJobPendingError(`the job link for "${slug}" redirected to another origin; it was not followed`, { jobUrl, slug, job: doc });
71
+ }
72
+ const redirect = g.type === "opaqueredirect" || (g.status >= 300 && g.status < 400 && g.status !== 304);
73
+ if (!redirect) return g;
74
+ const loc = g.headers && typeof g.headers.get === "function" ? g.headers.get("location") : null;
75
+ let next = null;
76
+ try { next = loc ? new URL(loc, url).href : null; } catch { next = null; }
77
+ if (!next || !sameOrigin(next, baseUrl) || hop >= MAX_POLL_REDIRECTS) {
78
+ // A browser's opaque redirect hides its target: where it pointed is unknown.
79
+ const msg = !next && g.type === "opaqueredirect"
80
+ ? `the job link for "${slug}" answered with a redirect this client could not follow (its target is hidden here)`
81
+ : `the job link for "${slug}" redirected ${!next ? "with no readable target" : sameOrigin(next, baseUrl) ? "too many times" : "to another origin"}; it was not followed`;
82
+ throw new AsyncJobPendingError(msg, { jobUrl, slug, job: doc });
83
+ }
84
+ url = next;
85
+ }
86
+ }
87
+
56
88
  // The job's lifecycle: `state` (queued | running | succeeded | failed) when
57
89
  // the server sends it, else the original `status` (working | completed | failed).
58
90
  const STATUS_TO_STATE = { working: "running", completed: "succeeded", failed: "failed", cancelled: "failed" };
@@ -105,8 +137,8 @@ export async function awaitJob(res, { baseUrl, fetchImpl, timeoutMs = DEFAULT_AS
105
137
  }
106
138
  await sleep(wait);
107
139
  let g;
108
- try { g = await fetchImpl(jobUrl, { headers: { Accept: "application/json" } }); }
109
- catch { g = null; }
140
+ try { g = await pollJobLink(fetchImpl, jobUrl, baseUrl, slug, doc); }
141
+ catch (e) { if (e instanceof AsyncJobPendingError) throw e; g = null; }
110
142
  if (!g || g.status >= 500 || g.status === 429) {
111
143
  if (++failures >= MAX_POLL_FAILURES) throw new AsyncJobPendingError(`the job link for "${slug}" could not be read (${g ? `HTTP ${g.status}` : "network error"}); collect it from ${jobUrl}`, { jobUrl, slug, job: doc });
112
144
  wait = retryAfterMs(g?.headers, doc);
package/index.js CHANGED
@@ -1051,10 +1051,10 @@ server.setRequestHandler(CallToolRequestSchema, redacted(withCatalog(async (req,
1051
1051
  claudeCodeHosted: `claude mcp add --transport http agent402 ${BASE}/mcp`,
1052
1052
  claudeCodeNpm: `claude mcp add agent402 -s user -- npx -y agent402-mcp@${AGENT402_MCP_VERSION}`,
1053
1053
  cursorHosted: { mcpServers: { agent402: { url: `${BASE}/mcp` } } },
1054
- npm: "npx -y agent402-mcp@0.13.31",
1054
+ npm: "npx -y agent402-mcp@0.13.32",
1055
1055
  maintainer: "Havok Holdings LLC",
1056
1056
  },
1057
- positioning: `Flagship search/answer first, 500+ long-tail tools via catalog.find / catalog.search / catalog.call. Agent402 is the applied layer of Agentic Finance: agents that pay and get paid per request over x402 or MPP (Machine Payments Protocol), both on the same 402 - ${BASE}/agentic-finance, ${BASE}/glossary.`,
1057
+ positioning: `Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. Flagship search/answer first, 500+ long-tail tools via catalog.find / catalog.search / catalog.call. Agent402 is the applied layer of Agentic Finance: agents that pay and get paid per request over x402 or MPP (Machine Payments Protocol), both on the same 402 - ${BASE}/agentic-finance, ${BASE}/glossary.`,
1058
1058
  ecosystem: "Call sellers.list to see which x402 sellers (any wallet, not just this host) are settling the most USDC (primarily on Base) in the last 24h, or sellers.list with wire=mpp for MPP sellers ranked by on-chain USDC.e transfers on Tempo - discovers the live economy beyond this catalog.",
1059
1059
  });
1060
1060
  }
@@ -1063,7 +1063,7 @@ server.setRequestHandler(CallToolRequestSchema, redacted(withCatalog(async (req,
1063
1063
  service: BASE,
1064
1064
  connector: "stdio npm package (agent402-mcp)",
1065
1065
  maintainer: "Havok Holdings LLC",
1066
- positioning: `Agent402 is the applied layer of Agentic Finance: software agents that pay and get paid on their own, per request, over x402 or MPP (Machine Payments Protocol) - both answered on the same 402. ${BASE}/agentic-finance, ${BASE}/glossary.`,
1066
+ positioning: `Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. It is the applied layer of Agentic Finance: software agents that pay and get paid on their own, per request, over x402 or MPP (Machine Payments Protocol) - both answered on the same 402. ${BASE}/agentic-finance, ${BASE}/glossary.`,
1067
1067
  startHere: {
1068
1068
  firstJob: "Search the web and answer questions. Call web.search or web.answer directly, or catalog.find with your task.",
1069
1069
  mode: HAS_WALLET ? "usdc" : HAS_CREDITS ? "credits" : "proof-of-work",
@@ -1071,7 +1071,7 @@ server.setRequestHandler(CallToolRequestSchema, redacted(withCatalog(async (req,
1071
1071
  install: {
1072
1072
  claudeCodeHosted: `claude mcp add --transport http agent402 ${BASE}/mcp`,
1073
1073
  claudeCodeNpm: `claude mcp add agent402 -s user -- npx -y agent402-mcp@${AGENT402_MCP_VERSION}`,
1074
- npm: "npx -y agent402-mcp@0.13.31",
1074
+ npm: "npx -y agent402-mcp@0.13.32",
1075
1075
  maintainer: "Havok Holdings LLC",
1076
1076
  },
1077
1077
  tools: catalog.size,
package/output-schemas.js CHANGED
@@ -119,7 +119,7 @@ export const FLAGSHIP_WRITERS = new Set(["memory-write", "decide-execute"]);
119
119
 
120
120
  /** initialize.serverInfo description (MCP Implementation.description). */
121
121
  export const MCP_SERVER_DESCRIPTION =
122
- "Agent402 - pay-per-call tools and models for AI agents: live web search and cited answers, news, browser render, market data, speech-to-text, wallet-keyed memory, plus 500+ long-tail tools via catalog.find. Settle in USDC via x402 or MPP (Machine Payments Protocol) on the same 402, or free via proof-of-work. The applied layer of Agentic Finance. Maintained by Havok Holdings LLC.";
122
+ "Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. Flagships: live web search and cited answers, news, browser render, market data, speech-to-text and wallet-keyed memory; the rest via catalog.find. Settle in USDC via x402 or MPP (Machine Payments Protocol) on the same 402, or free via proof-of-work. The applied layer of Agentic Finance. Maintained by Havok Holdings LLC.";
123
123
 
124
124
  /** initialize.serverInfo.websiteUrl */
125
125
  export const MCP_SERVER_WEBSITE = "https://agent402.tools";
@@ -421,6 +421,8 @@ export const FLAGSHIP_OUTPUT_SCHEMAS = {
421
421
  text: { type: "string" },
422
422
  language: { type: "string" },
423
423
  duration: { type: "number" },
424
+ trimmedToCapSeconds: { type: "number", description: "Present only when the file's length could not be confirmed: the audio was transcribed up to this many seconds (the tier's cap)" },
425
+ durationUnconfirmed: { type: "boolean", description: "Present (true) only with trimmedToCapSeconds: the file's full length was not confirmed" },
424
426
  },
425
427
  required: ["text"],
426
428
  },
@@ -492,7 +494,7 @@ export function mcpJsonResult(obj) {
492
494
  * Hosted URL is parameterized; npm / Claude Code / Cursor notes
493
495
  * match docs/ecosystem-listings.md + wiki/MCP-Connector.md.
494
496
  */
495
- export const AGENT402_MCP_VERSION = "0.13.31";
497
+ export const AGENT402_MCP_VERSION = "0.13.32";
496
498
 
497
499
  /** A listed MCP tool description, at most `max` characters. Hosts truncate or
498
500
  * skip long descriptions, so the listing keeps the first whole sentences; the
@@ -524,12 +526,12 @@ export function mcpInstallHints(baseUrl) {
524
526
  mcpServers: {
525
527
  agent402: {
526
528
  command: "npx",
527
- args: ["-y", "agent402-mcp@0.13.31"],
529
+ args: ["-y", "agent402-mcp@0.13.32"],
528
530
  env: { AGENT_KEY: "0xYOUR_PRIVATE_KEY" },
529
531
  },
530
532
  },
531
533
  },
532
- npm: "npx -y agent402-mcp@0.13.31",
534
+ npm: "npx -y agent402-mcp@0.13.32",
533
535
  maintainer: "Havok Holdings LLC",
534
536
  };
535
537
  }
@@ -543,7 +545,7 @@ export function mcpInitializeInstructions(baseUrl, { decide = false, mpp = false
543
545
  const install = mcpInstallHints(baseUrl);
544
546
  const hosted = install.hostedUrl;
545
547
  return [
546
- "Agent402 is the applied layer of Agentic Finance: a catalog of 500+ tools for AI agents: per-call tools and metered models, paid in USDC over x402 or MPP, or free through proof-of-work for the pure-CPU tools.",
548
+ "Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. Per-call tools and metered models, paid in USDC, or free through proof-of-work for the pure-CPU tools; the applied layer of Agentic Finance.",
547
549
  "Flagship tools: web.search (live web search), web.answer (answers with citations), web.news, browser.render, market.quote, audio.transcribe, memory.read, memory.write.",
548
550
  "Long tail: catalog.search lists tools by keyword, catalog.find returns the best match with its input schema and price, catalog.call runs a tool by slug.",
549
551
  // Only where the decide tools are listed: an instruction must never name a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent402-mcp",
3
- "version": "0.13.31",
3
+ "version": "0.13.32",
4
4
  "mcpName": "io.github.MikeyPetrillo/agent402",
5
5
  "author": "Havok Holdings LLC <mike@agent402.tools> (https://agent402.tools)",
6
6
  "homepage": "https://agent402.tools",
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/MikeyPetrillo/Agent402.git",
10
10
  "directory": "mcp"
11
11
  },
12
- "description": "Agent402 MCP server: 500+ pay-per-call tools + skill packs for AI agents over x402 (USDC or USDG on 14 chains) or MPP on the same 402, or free via proof-of-work - the applied layer of Agentic Finance. Catalog: browser, web search + cited answers, PDFs, OCR, images, LLM inference, image generation, code execution, STT, embeddings, live financial/crypto/macro data, SEC EDGAR filings, deterministic stats & forecasting, compression, payments. Open source, self-hostable.",
12
+ "description": "Agent402 MCP server. Agent402 is a catalog of 500+ tools that AI agents find, pay for per request over x402 or MPP, and call with no account or API key. The applied layer of Agentic Finance: skill packs too, USDC or USDG on 14 chains, or free via proof-of-work. Catalog: browser, web search + cited answers, PDFs, OCR, images, LLM inference, image generation, code execution, STT, embeddings, live financial/crypto/macro data, SEC EDGAR filings, deterministic stats & forecasting, compression, payments. Open source, self-hostable.",
13
13
  "type": "module",
14
14
  "bin": {
15
15
  "agent402-mcp": "index.js"
@@ -84,10 +84,10 @@
84
84
  "overrides": {
85
85
  "qs": "6.16.1",
86
86
  "ws": "^8.21.0",
87
- "hono": "4.13.13",
87
+ "hono": "4.13.16",
88
88
  "fast-uri": "3.1.9",
89
89
  "body-parser": "2.4.0",
90
- "@hono/node-server": "2.1.3",
90
+ "@hono/node-server": "2.1.6",
91
91
  "ip-address": "10.7.4",
92
92
  "@solana-program/token": "0.17.0",
93
93
  "@solana-program/compute-budget": "0.19.0",