agent402-mcp 0.13.4 → 0.13.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # agent402-mcp
2
2
 
3
- MCP server for [Agent402](https://agent402.tools), the applied layer of [Agentic Finance](https://agent402.tools/agentic-finance) - a catalog of **500+: 400+ pay-per-call web tools + 80+ curated multi-tool skill packs** for AI agents (every one tested, priced, and settled on-chain; every one earns its place), paid per call in USDC via the [x402 protocol](https://www.x402.org), **with compute (proof-of-work)** when no wallet is configured, or **by card** through a prepaid credits key. (The hosted API is dual-stack: it also accepts [MPP](https://agent402.tools/what-is-mpp) clients on the same 402, settling on Base/Celo or natively on Tempo; this package pays via x402 or credits.) Built by [Havok Holdings LLC](https://github.com/MikeyPetrillo/Agent402).
3
+ MCP server for [Agent402](https://agent402.tools), the applied layer of [Agentic Finance](https://agent402.tools/agentic-finance) - a catalog of **500+: 400+ pay-per-call web tools + 80+ curated multi-tool skill packs** for AI agents (every one priced per call and settled on-chain), paid per call in USDC via the [x402 protocol](https://www.x402.org), **with compute (proof-of-work)** when no wallet is configured, or through a prepaid credits key already issued. (The hosted API is dual-stack: it also accepts [MPP](https://agent402.tools/what-is-mpp) clients on the same 402, settling on Base/Celo or natively on Tempo; this package pays via x402 or credits.) Built by [Havok Holdings LLC](https://github.com/MikeyPetrillo/Agent402).
4
4
 
5
- Your agent gets browser rendering, screenshots, PDF text extraction, URL→markdown, live web search **+ web answers with citations**, live **financial/crypto/macro data** (US equity quotes and daily bars from Databento, CoinGecko, FRED, ECB FX, World Bank, yield curve), **SEC EDGAR filings** (10-K/10-Q text, XBRL, insider, 13F, IPO calendar), **deterministic stats & forecasting** (Pearson correlation, OLS, Holt-Winters), **compression** (gzip/brotli), DNS/TLS/WHOIS + email-deliverability checks, wallet-keyed shared memory, and 200+ deterministic pure-CPU utilities - plus 100+ **skill packs** like `security-audit`, `trend-analysis`, `structured-scrape`, `decode-blob`, and `forecasting-bake-off` callable as MCP prompts, and the **report products** (deep research, company dossier, 13F fund report, domain audit, token risk, FDA recall, insider flow, market brief) as ordinary catalog slugs. Payment handled invisibly underneath the MCP calls. No signup, no API key.
5
+ Your agent gets browser rendering, screenshots, PDF text extraction, URL→markdown, live web search **+ web answers with citations**, live **financial/crypto/macro data** (US equity quotes and daily bars from Databento, CoinGecko, FRED, ECB FX, World Bank, yield curve), **SEC EDGAR filings** (10-K/10-Q text, XBRL, insider, 13F, IPO calendar), **deterministic stats & forecasting** (Pearson correlation, OLS, Holt-Winters), **compression** (gzip/brotli), DNS/TLS/WHOIS + email-deliverability checks, wallet-keyed shared memory, and the pure-CPU utilities - plus 80+ **skill packs** like `security-audit`, `trend-analysis`, `structured-scrape`, `decode-blob`, and `forecasting-bake-off` callable as MCP prompts, and the **report products** (deep research, company dossier, 13F fund report, domain audit, token risk, FDA recall, insider flow, market brief) as ordinary catalog slugs. Payment handled invisibly underneath the MCP calls. No signup, no API key.
6
6
 
7
7
  ## Quick start
8
8
 
@@ -10,7 +10,7 @@ Your agent gets browser rendering, screenshots, PDF text extraction, URL→markd
10
10
  MCP server - e.g. claude.ai → Settings → Connectors → Add custom connector. The
11
11
  pure-CPU tools run free there (rate-limited), and the paid tools are payable
12
12
  right on the connector over [MPP](https://agent402.tools/what-is-mpp): a paid
13
- call answers JSON-RPC error `-32042` with the challenges (`-32043` if a presented credential was refused), and an MCP client
13
+ call answers with a tool result carrying the challenges in `_meta["org.paymentauth/payment-required"]` (`-32043` if a presented credential was refused), and an MCP client
14
14
  wrapped with `mppx`'s `McpClient.wrap()` (USDC on Base/Celo, or native Tempo)
15
15
  pays and retries on its own, receipt in `_meta`. For no rate limit, or to pay
16
16
  over x402 or by card instead, run this package locally:
@@ -29,7 +29,7 @@ With a funded wallet (USDC on any EVM rail the server offers - Base, Polygon, Ar
29
29
  }
30
30
  ```
31
31
 
32
- With prepaid card credits (no wallet) - buy a pack at https://agent402.tools/credits, claim the `a402_...` key once, and every tool is available:
32
+ With a prepaid credits key already issued (new credits are not on sale) - every tool except the wallet-scoped ones (memory, usage) is available:
33
33
 
34
34
  ```json
35
35
  {
@@ -43,7 +43,7 @@ With prepaid card credits (no wallet) - buy a pack at https://agent402.tools/cre
43
43
  }
44
44
  ```
45
45
 
46
- Without a wallet or credits key - the 200+ pure-CPU tools work free via proof-of-work (the network/browser/memory tools will ask for a wallet or a credits key):
46
+ Without a wallet or credits key - the pure-CPU tools work free via proof-of-work (the network/browser/memory tools will ask for a wallet or a credits key):
47
47
 
48
48
  ```json
49
49
  {
@@ -63,7 +63,7 @@ Every variable the server reads (all optional):
63
63
  | --- | --- | --- |
64
64
  | `AGENT_KEY` | _(unset)_ | Hex private key of an EVM wallet funded with USDC on Base (or Polygon/Arbitrum/Monad), or USDG on Robinhood Chain. |
65
65
  | `SOLANA_AGENT_KEY` | _(unset)_ | Base58 secret key (or JSON byte array) of a Solana wallet funded with USDC on Solana. |
66
- | `AGENT402_CREDITS_KEY` | _(unset)_ | A prepaid card-credits key (`a402_...`) from https://agent402.tools/credits. Sent as `Authorization: Bearer` on every catalog call; the server debits the list price only on a successful (200) call and answers `X-Credits-Balance`. Used only when no wallet key is set (a wallet key wins); in credits mode every call - pure-CPU tools included - is debited from the key. |
66
+ | `AGENT402_CREDITS_KEY` | _(unset)_ | A prepaid credits key (`a402_...`) already issued (new credits are not on sale). Sent as `Authorization: Bearer` on every catalog call; the server debits the list price only on a successful (200) call and answers `X-Credits-Balance`. Used only when no wallet key is set (a wallet key wins); in credits mode every call - pure-CPU tools included - is debited from the key. |
67
67
  | `AGENT402_URL` | `https://agent402.tools` | Target service (point at your own deployment). |
68
68
  | `AGENT402_TOOLS` | curated set | Comma-separated slugs to expose as first-class tools. |
69
69
  | `AGENT402_MAX_PER_CALL` | unlimited | Refuse any single call priced above this many USD (e.g. `0.01`). Applies to the wallet and the credits path. |
@@ -76,7 +76,7 @@ caps, what's been spent, and what remains. With no wallet key and no credits key
76
76
  the server runs in proof-of-work mode (pure-CPU tools stay free). Use dedicated
77
77
  low-value wallets for `AGENT_KEY` / `SOLANA_AGENT_KEY`, funded only with what
78
78
  you intend to spend. Most tools cost $0.001–$0.02. The routing tiers top out
79
- at $3.30 (`route-execute-pro`); multi-tool skill packs run $0.003 to $0.119; and the
79
+ at $3.30 (`route-execute-pro`); multi-tool skill packs run $0.003 to $0.101; and the
80
80
  report products run $0.60 to $2.00 per report (domain-audit $0.60 up to the ticker pack at $2.00),
81
81
  so set `AGENT402_MAX_PER_CALL` if you want a hard per-call ceiling.
82
82
 
@@ -84,6 +84,7 @@ so set `AGENT402_MAX_PER_CALL` if you want a hard per-call ceiling.
84
84
 
85
85
  - On startup the server reads the live catalog from `https://agent402.tools/api/pricing` + `/openapi.json`.
86
86
  - **Flagship tools** are exposed as first-class MCP tools under dotted names - `web.search`, `web.answer`, `web.news`, `browser.render`, `market.quote`, `audio.transcribe`, `memory.read`, `memory.write` - search/answer is the front door. Override the set with `AGENT402_TOOLS` (slugs; a non-flagship slug is listed as its snake_case name).
87
+ - **Decide** (`decide.plan`, `decide.execute`, `decide.feedback`): describe a job and get a call-ready plan over the catalog and outside x402 sellers (tools in order, fallbacks, validated params, chained steps), then run it yourself or through Agent402. Listed when the server offers Decide; see https://agent402.tools/decide.
87
88
  - The rest of the 500+ endpoint catalog is reachable via the meta tools `catalog.search` / `catalog.find` + `catalog.call` - keeping your context window small. The same dotted names are listed on the hosted connector; the older snake names (`search_tools`, `find_tool`, `call_tool`, `get_payment_info`, `describe_server`, `list_top_sellers`, and the flagship `search_web` …) remain accepted as CallTool aliases, so existing configs keep working.
88
89
  - When a call hits HTTP 402: with a wallet key set (`AGENT_KEY` for the EVM chains - Base/Polygon/Arbitrum/Monad plus Robinhood Chain, `SOLANA_AGENT_KEY` for Solana), the server signs an x402 payment on a chain the seller accepts and retries; with only a credits key it sends `Authorization: Bearer a402_…` and the server debits the balance on success; with neither it solves the tool's proof-of-work challenge (~0.2 s of CPU) on the eligible tools. (The service settles USDC on Base, Solana, Polygon, Arbitrum, Monad, Celo, Avalanche, Sei, Optimism, Stellar and Algorand, plus USDG on Robinhood Chain - 12 chains total - for callers using a raw x402 client rather than this package.)
89
90
  - `payment.info` tells the model which mode it's in and what a wallet or a credits key would unlock.
package/index.js CHANGED
@@ -17,8 +17,8 @@
17
17
  // SOLANA_AGENT_KEY base58 (or JSON byte-array) secret key of a funded Solana wallet (USDC on Solana) — optional
18
18
  // AGENT402_TOOLS comma-separated slugs to expose first-class (overrides default)
19
19
  // AGENT402_MAX_PER_CALL refuse any single call priced above this many USD (e.g. 0.01)
20
- // AGENT402_CREDITS_KEY a prepaid card-credits key (a402_...) from https://agent402.tools/credits -
21
- // pays every tool by card with no wallet; debited per successful call
20
+ // AGENT402_CREDITS_KEY a prepaid credits key (a402_...) already issued (new credits are not on
21
+ // sale); pays per successful call with no wallet
22
22
  // AGENT402_BUDGET hard cap on total USDC spent this session (e.g. 1.00)
23
23
  // AGENT402_NETWORKS restrict + order the chains to pay on (e.g. "robinhood" for USDG on
24
24
  // Robinhood Chain, "base,solana", or a raw CAIP-2 like eip155:4663) — optional
@@ -75,6 +75,8 @@ const DEFAULT_CURATED = [
75
75
  // Search/answer is the front door; long tail stays behind catalog.search/catalog.call.
76
76
  "search", "answer", "search-news", "render",
77
77
  "stock-quote", "transcribe", "memory-read", "memory-write",
78
+ // Present only on hosts running the decide service; skipped elsewhere.
79
+ "decide", "decide-execute",
78
80
  ];
79
81
 
80
82
  // stdout is the MCP protocol channel — all logging goes to stderr.
@@ -196,7 +198,7 @@ function walletRequiredText(tool) {
196
198
  `To enable it: set AGENT_KEY on this MCP server to the hex private key of an EVM wallet funded with USDC`,
197
199
  `on Base (or Polygon/Arbitrum), and/or SOLANA_AGENT_KEY to the base58 secret key of a Solana wallet funded`,
198
200
  `with USDC on Solana. Payment is per call via the x402 protocol — no signup or API key.`,
199
- `No wallet? Buy prepaid card credits at ${BASE}/credits and set AGENT402_CREDITS_KEY to the a402_ key - every tool then pays by card, debited per successful call.`,
201
+ `Already hold a prepaid credits key? Set AGENT402_CREDITS_KEY to the a402_ key and it pays per successful call (new credits are not on sale).`,
200
202
  `Pricing and details: ${BASE}/tools/${tool.slug}`,
201
203
  ].join(" ");
202
204
  }
@@ -271,6 +273,20 @@ async function quotedUsd(url, init, listUsd) {
271
273
  } catch { return listUsd; /* fail-open to the advertised price */ }
272
274
  }
273
275
 
276
+ // A refused call's tool text. A 402 body from an x402 v2 seller may also carry
277
+ // the whole PaymentRequired offer (this server copies its PAYMENT-REQUIRED
278
+ // header into the body), which is kilobytes of accepts and extension schemas
279
+ // an agent cannot act on in text. Keep the refusal's own fields (error,
280
+ // reason, hint, retry) and say where the offer is; any other body is returned
281
+ // as it came.
282
+ function failureText(status, text) {
283
+ let doc;
284
+ try { doc = JSON.parse(text); } catch { return text; }
285
+ if (!doc || typeof doc !== "object" || Array.isArray(doc) || typeof doc.x402Version !== "number") return text;
286
+ const { x402Version: _v, resource: _r, accepts, extensions: _e, ...rest } = doc;
287
+ return JSON.stringify({ ...rest, status, paymentOptions: Array.isArray(accepts) ? accepts.length : 0, note: "The full offer is in the PAYMENT-REQUIRED header of this 402." });
288
+ }
289
+
274
290
  async function callEndpoint(tool, args = {}) {
275
291
  const url = new URL(`${BASE}${tool.path}`);
276
292
  const init = { method: tool.method, headers: { Accept: "application/json" } };
@@ -349,7 +365,7 @@ async function callEndpoint(tool, args = {}) {
349
365
  }
350
366
  const text = await res.text();
351
367
  if (res.status >= 400) {
352
- return { content: [{ type: "text", text }], isError: true };
368
+ return { content: [{ type: "text", text: failureText(res.status, text) }], isError: true };
353
369
  }
354
370
  let parsed;
355
371
  try { parsed = JSON.parse(text); } catch { parsed = { raw: text }; }
@@ -713,7 +729,7 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
713
729
  ? "Every tool is available; each call is paid in USDC via x402 from the configured wallet(s) - EVM chains via AGENT_KEY, Solana via SOLANA_AGENT_KEY - within the spend controls above."
714
730
  : HAS_CREDITS
715
731
  ? "Every tool is available; each call is paid from the prepaid card credits key (AGENT402_CREDITS_KEY), debited only on a successful call, within the spend controls above."
716
- : `No wallet or credits key configured: ${computePayable} pure-CPU tools are free via proof-of-work; the ${catalog.size - computePayable} network/browser/memory tools need a funded wallet (AGENT_KEY / SOLANA_AGENT_KEY) or a prepaid credits key (AGENT402_CREDITS_KEY, buy at ${BASE}/credits).`,
732
+ : `No wallet or credits key configured: ${computePayable} pure-CPU tools are free via proof-of-work; the ${catalog.size - computePayable} network/browser/memory tools need a funded wallet (AGENT_KEY / SOLANA_AGENT_KEY) or a prepaid credits key already issued (AGENT402_CREDITS_KEY).`,
717
733
  install: {
718
734
  claudeCodeHosted: `claude mcp add --transport http agent402 ${BASE}/mcp`,
719
735
  claudeCodeNpm: "claude mcp add agent402 -s user -- npx -y agent402-mcp@latest",
package/output-schemas.js CHANGED
@@ -39,6 +39,8 @@ export const FLAGSHIP_MCP_NAMES = {
39
39
  transcribe: "audio.transcribe",
40
40
  "memory-read": "memory.read",
41
41
  "memory-write": "memory.write",
42
+ decide: "decide.plan",
43
+ "decide-execute": "decide.execute",
42
44
  };
43
45
 
44
46
  /** Meta tools listed alongside flagships — dotted canonical names. */
@@ -91,11 +93,11 @@ export function resolveListedName(name) {
91
93
 
92
94
  /** Open-world / egress tools — honest annotations for directory clients. */
93
95
  export const FLAGSHIP_OPEN_WORLD = new Set([
94
- "search", "answer", "search-news", "render", "stock-quote", "transcribe",
96
+ "search", "answer", "search-news", "render", "stock-quote", "transcribe", "decide",
95
97
  ]);
96
98
 
97
99
  /** Tools that mutate durable state (not read-only). */
98
- export const FLAGSHIP_WRITERS = new Set(["memory-write"]);
100
+ export const FLAGSHIP_WRITERS = new Set(["memory-write", "decide-execute"]);
99
101
 
100
102
  /** initialize.serverInfo description (MCP Implementation.description). */
101
103
  export const MCP_SERVER_DESCRIPTION =
@@ -503,7 +505,7 @@ export function mcpInstallHints(baseUrl) {
503
505
  * server.describe. Keep tool names listed-only (dotted Smithery form) (self-consistency) and lead
504
506
  * with search/answer as the front door.
505
507
  */
506
- export function mcpInitializeInstructions(baseUrl) {
508
+ export function mcpInitializeInstructions(baseUrl, { decide = false } = {}) {
507
509
  const install = mcpInstallHints(baseUrl);
508
510
  const hosted = install.hostedUrl;
509
511
  return [
@@ -511,12 +513,15 @@ export function mcpInitializeInstructions(baseUrl) {
511
513
  "Front door: call web.search or web.answer for live web search and cited answers.",
512
514
  "Also listed: web.news, browser.render, market.quote, audio.transcribe, memory.read, memory.write.",
513
515
  "Long catalog (500+ tools): call catalog.find with your task, or catalog.search then catalog.call.",
516
+ // Only where the decide tools are listed: an instruction must never name a
517
+ // tool the connector does not advertise.
518
+ ...(decide ? ["A job that needs several tools: call decide.plan with the task for a call-ready plan (tools, order, fallbacks, inputs), then decide.execute to run it; the plan fee comes back as credit toward the run."] : []),
514
519
  "Orientation: call server.describe. Payment rails / wallet setup: call payment.info.",
515
520
  "Missing a tool: call demand.request. Ecosystem sellers: call sellers.list.",
516
521
  `Install (hosted, zero wallet): ${install.claudeCodeHosted}`,
517
- `Install (npm + wallet or prepaid card credits for paid flagships): ${install.claudeCodeNpm}`,
522
+ `Install (npm + wallet for paid flagships): ${install.claudeCodeNpm}`,
518
523
  `Cursor mcp.json: { "mcpServers": { "agent402": { "url": "${hosted}" } } }`,
519
- `Why pay here (usage priced under a quoted ceiling, a failed call is not charged and the receipt proves it, keyed retries never pay twice, one key for tools + models + reports, card credits with no wallet, proof at /status and /revenue): ${baseUrl}/why`,
524
+ `Why pay here (usage priced under a quoted ceiling, a failed call is not charged and the receipt proves it, keyed retries never pay twice, one key for tools + models + reports, no wallet needed for the proof-of-work tools or a report by card, proof at /status and /revenue): ${baseUrl}/why`,
520
525
  `Docs: ${baseUrl}/llms.txt · ${baseUrl}/api/find?q=… · status ${baseUrl}/status`,
521
526
  ].join("\n");
522
527
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent402-mcp",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
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",
@@ -69,21 +69,21 @@
69
69
  ],
70
70
  "license": "MIT",
71
71
  "dependencies": {
72
- "@modelcontextprotocol/sdk": "^1.30.0",
72
+ "@modelcontextprotocol/sdk": "^1.31.0",
73
73
  "@solana/kit": "^5.1.0",
74
- "@x402/core": "2.26.0",
75
- "@x402/evm": "2.26.0",
76
- "@x402/fetch": "2.26.0",
77
- "@x402/svm": "2.26.0",
74
+ "@x402/core": "2.27.0",
75
+ "@x402/evm": "2.27.0",
76
+ "@x402/fetch": "2.27.0",
77
+ "@x402/svm": "2.27.0",
78
78
  "viem": "^2.21.0"
79
79
  },
80
80
  "overrides": {
81
81
  "qs": "6.16.0",
82
82
  "ws": "^8.21.0",
83
83
  "hono": "4.13.7",
84
- "fast-uri": "3.1.7",
84
+ "fast-uri": "3.1.8",
85
85
  "body-parser": "2.3.0",
86
86
  "@hono/node-server": "2.0.12",
87
- "ip-address": "10.4.0"
87
+ "ip-address": "10.7.1"
88
88
  }
89
89
  }