agent402-mcp 0.13.19 → 0.13.21
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 +30 -40
- package/index.js +42 -30
- package/output-schemas.js +28 -16
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -1,59 +1,39 @@
|
|
|
1
1
|
# agent402-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for [Agent402](https://agent402.tools), the applied layer of
|
|
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 a licensed feed, 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 **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.
|
|
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).
|
|
6
4
|
|
|
7
5
|
## Quick start
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
MCP server - e.g. claude.ai → Settings → Connectors → Add custom connector. The
|
|
11
|
-
pure-CPU tools run free there (rate-limited), and the paid tools are payable
|
|
12
|
-
right on the connector over [MPP](https://agent402.tools/what-is-mpp): a paid
|
|
13
|
-
call answers JSON-RPC error `-32042` carrying the challenges (`-32043` if a presented credential was refused), and an MCP client
|
|
14
|
-
wrapped with `mppx`'s `McpClient.wrap()` (USDC on Base/Celo, or native Tempo)
|
|
15
|
-
pays and retries on its own, receipt in `_meta`. For no rate limit, or to pay
|
|
16
|
-
over x402 or with a credits key already issued, run this package locally:
|
|
7
|
+
Pick one setup. Both run locally through `npx`.
|
|
17
8
|
|
|
18
|
-
|
|
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.
|
|
19
10
|
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
"mcpServers": {
|
|
23
|
-
"agent402": {
|
|
24
|
-
"command": "npx",
|
|
25
|
-
"args": ["-y", "agent402-mcp"],
|
|
26
|
-
"env": { "AGENT_KEY": "0xYOUR_PRIVATE_KEY" }
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
11
|
+
```
|
|
12
|
+
claude mcp add agent402 -s user -- npx -y agent402-mcp@0.13.21
|
|
30
13
|
```
|
|
31
14
|
|
|
32
|
-
|
|
15
|
+
**2. Paid, with a wallet.** Paid tools are settled in USDC on each call.
|
|
33
16
|
|
|
34
17
|
```json
|
|
35
18
|
{
|
|
36
19
|
"mcpServers": {
|
|
37
20
|
"agent402": {
|
|
38
21
|
"command": "npx",
|
|
39
|
-
"args": ["-y", "agent402-mcp"],
|
|
40
|
-
"env": { "
|
|
22
|
+
"args": ["-y", "agent402-mcp@0.13.21"],
|
|
23
|
+
"env": { "AGENT_KEY": "0xYOUR_PRIVATE_KEY" }
|
|
41
24
|
}
|
|
42
25
|
}
|
|
43
26
|
}
|
|
44
27
|
```
|
|
45
28
|
|
|
46
|
-
|
|
29
|
+
> Use a new wallet holding only a few dollars of USDC. Never use your main wallet.
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
"mcpServers": {
|
|
51
|
-
"agent402": { "command": "npx", "args": ["-y", "agent402-mcp"] }
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
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`.
|
|
55
32
|
|
|
56
|
-
Claude Code: `claude mcp add agent402 -- npx -y agent402-mcp`
|
|
33
|
+
Claude Code with a wallet: `claude mcp add agent402 -s user -e AGENT_KEY=0xYOUR_PRIVATE_KEY -- npx -y agent402-mcp@0.13.21`
|
|
34
|
+
(use a new wallet holding only a few dollars of USDC; never your main wallet).
|
|
35
|
+
|
|
36
|
+
Advanced setup (chains, MPP, error codes, the hosted connector) is in [Advanced](#advanced).
|
|
57
37
|
|
|
58
38
|
## Configuration
|
|
59
39
|
|
|
@@ -63,26 +43,26 @@ Every variable the server reads (all optional):
|
|
|
63
43
|
| --- | --- | --- |
|
|
64
44
|
| `AGENT_KEY` | _(unset)_ | Hex private key of an EVM wallet funded with USDC on Base (or another EVM chain the server offers), or USDG on Robinhood Chain. |
|
|
65
45
|
| `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 credits key (`a402_
|
|
46
|
+
| `AGENT402_CREDITS_KEY` | _(unset)_ | A prepaid credits key (`a402_...`; [agent402.tools/credits](https://agent402.tools/credits) says whether packs are 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. Credits pay Agent402's own services only: `router.execute`, `seller-payability`, `decide.execute` and the flight tools buy from outside sellers and need a wallet key, and memory and usage need a wallet identity. |
|
|
67
47
|
| `AGENT402_URL` | `https://agent402.tools` | Target service (point at your own deployment). Paid calls never follow redirects, so use the address that serves the routes directly; a redirect is refused with the origin to use. |
|
|
68
48
|
| `AGENT402_TOOLS` | curated set | Comma-separated slugs to expose as first-class tools. |
|
|
69
49
|
| `AGENT402_MAX_PER_CALL` | `4` | Refuse any single call priced above this many USD (e.g. `0.05`); `off` disables it. Applies to the wallet and the credits path. |
|
|
70
|
-
| `AGENT402_BUDGET` | no
|
|
50
|
+
| `AGENT402_BUDGET` | _(unset, no cap)_ | Optional hard cap on total USD spent per session (e.g. `1.00`); unset or `off` means no session cap. Applies to the wallet and the credits path. |
|
|
51
|
+
| `AGENT402_SHOW_ROUTER` | _(unset)_ | `1` lists `router.execute` and `sellers.list` even without a wallet. Both are listed automatically when a wallet key is set; a credits key does not pay `router.execute`, which buys from outside sellers and takes a wallet payment. |
|
|
71
52
|
| `AGENT402_NETWORKS` | _(unset)_ | Restrict + order the chains to pay on - e.g. `robinhood` (USDG on Robinhood Chain), `base,solana`, or a raw CAIP-2 like `eip155:4663`. Unset = the client picks (effectively Base on multi-chain sellers). |
|
|
72
53
|
| `AGENT402_ASYNC` | `auto` | Slow routes (reports, video, the premium image; `async.recommended` on their `/api/pricing` row) are paid with `Prefer: respond-async` and collected from their job link, so a long run never outlives the connection. `off` waits on the connection instead (since 0.13.18 sending `Prefer: wait=<maxSeconds>` where the row gives `async.preferWait`); `always` uses a job on every route that runs as one. |
|
|
73
54
|
| `AGENT402_ASYNC_TIMEOUT_MS` | `900000` | How long to poll a job before answering with its link (`structuredContent.jobUrl`) to collect later. |
|
|
74
55
|
|
|
75
56
|
The per-call cap is on by default and the session budget is opt-in; both are
|
|
76
57
|
enforced on the payment that is signed (or before a credits call is sent) - a
|
|
77
|
-
|
|
58
|
+
call over the cap is refused before anything is signed. The
|
|
78
59
|
wallet's x402 client carries a policy that drops every payment option over the
|
|
79
60
|
per-call cap or what is left of the budget, so the 402 the wallet signs is held
|
|
80
61
|
to the caps, and a wallet call sends no unpaid preflight first. Each option is priced from the
|
|
81
62
|
known decimals of its asset (USDC on each rail, USDG on Robinhood Chain), never
|
|
82
63
|
from a decimals value in the challenge, and an option in any other asset is not
|
|
83
64
|
signed. A value that is not a USD amount or `off` reads as the default (the
|
|
84
|
-
$4 per-call cap
|
|
85
|
-
session may spend in total.
|
|
65
|
+
$4 per-call cap and no session budget). Set `AGENT402_BUDGET` to cap the session total.
|
|
86
66
|
`payment.info` reports the caps, what's been spent, and what remains. With no wallet key and no credits key,
|
|
87
67
|
the server runs in proof-of-work mode (pure-CPU tools stay free). Use dedicated
|
|
88
68
|
low-value wallets for `AGENT_KEY` / `SOLANA_AGENT_KEY`, funded only with what
|
|
@@ -92,13 +72,23 @@ report products run $0.60 to $2.00 per report (domain-audit $0.60 up to the tick
|
|
|
92
72
|
so the default per-call cap of $4 covers every tool; set `AGENT402_MAX_PER_CALL` lower for a
|
|
93
73
|
tighter ceiling.
|
|
94
74
|
|
|
75
|
+
## Advanced
|
|
76
|
+
|
|
77
|
+
**Hosted connector (no install).** Add `https://agent402.tools/mcp` as a remote MCP server (for example claude.ai → Settings → Connectors → Add custom connector). Pure-CPU tools run free there, rate-limited. Paid tools are payable on the connector over [MPP](https://agent402.tools/what-is-mpp): a paid call answers JSON-RPC error `-32042` with the payment challenges, and `-32043` if a credential you presented was refused. An MCP client wrapped with `mppx`'s `McpClient.wrap()` pays and retries on its own, with the receipt in `_meta`. This package runs locally for no rate limit, or to pay over x402.
|
|
78
|
+
|
|
79
|
+
**Chains.** With a funded wallet, `AGENT_KEY` pays USDC on any EVM chain the server offers (Base, Polygon, Arbitrum, Monad, Celo, Avalanche, Sei, Optimism, Arc) or USDG on Robinhood Chain. `SOLANA_AGENT_KEY` pays USDC on Solana. The service also settles on Stellar and Algorand, which this package does not sign. Restrict or order chains with `AGENT402_NETWORKS`.
|
|
80
|
+
|
|
81
|
+
**Credits key.** A prepaid credits key (`AGENT402_CREDITS_KEY`) pays per successful call on Agent402's own services; the routes that buy from outside sellers (`router.execute`, `seller-payability`, `decide.execute`, the flight tools) need a wallet key. [agent402.tools/credits](https://agent402.tools/credits) says whether packs are on sale.
|
|
82
|
+
|
|
83
|
+
**Error codes.** `-32042` payment required (the challenges are in the error data). `-32043` a presented credential was refused.
|
|
84
|
+
|
|
95
85
|
## How it works
|
|
96
86
|
|
|
97
87
|
- On startup the server reads the live catalog from `https://agent402.tools/api/pricing` + `/openapi.json`.
|
|
98
88
|
- **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).
|
|
99
89
|
- **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.
|
|
100
90
|
- The rest of the 500+ tool 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.
|
|
101
|
-
- When a call hits HTTP 402: with a wallet key set (`AGENT_KEY` for the EVM chains, Robinhood Chain included; `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, Arc, Stellar and Algorand, plus USDG on Robinhood Chain - 13 chains total - for callers using a raw x402 client rather than this package.)
|
|
91
|
+
- When a call hits HTTP 402: with a wallet key set (`AGENT_KEY` for the EVM chains, Robinhood Chain included; `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, Arc, Stellar and Algorand, plus USDG on Robinhood Chain - 13 chains total - for callers using a raw x402 client rather than this package. Where the server also offers a Circle Gateway batched accept on Arc or Base, this package pays the plain accept beside it.)
|
|
102
92
|
- Since 0.13.15 the server's requests to the catalog and to sellers (catalog reads, the 402 and the paid retry) refuse a TLS chain through one of the intermediate CAs listed in `networks.js` (keys reported recoverable in Mozilla bug 2083449), keyed on each certificate's SubjectPublicKeyInfo hash, on a dedicated dispatcher. With a proxy or custom dispatcher installed, requests go out through it unchanged.
|
|
103
93
|
- **Slow routes run as jobs** (since 0.13.17): a paid call to a route the catalog marks slow carries `Prefer: respond-async`, answers `202` with a job link, and the server polls `GET /api/jobs/{id}` (free), waiting `Retry-After` seconds between polls, until the answer is ready, reading the job's `state` and falling back to its `status`. Payment settles only on the delivered answer. A caller that sends a `progressToken` gets `notifications/progress` from the job's stage, steps and ETA. A job still running when `AGENT402_ASYNC_TIMEOUT_MS` ends comes back with its `jobUrl` instead.
|
|
104
94
|
- `payment.info` tells the model which mode it's in and what a wallet or a credits key would unlock.
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Agent402 MCP server, exposes the agent402.tools catalog (
|
|
2
|
+
// Agent402 MCP server, exposes the agent402.tools catalog (500+ pay-per-call
|
|
3
3
|
// web tools) to any MCP client (Claude, ChatGPT, custom agents) and settles
|
|
4
4
|
// payment underneath, so the model never sees the 402 dance:
|
|
5
5
|
//
|
|
@@ -17,9 +17,11 @@
|
|
|
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 (default 4; off disables)
|
|
20
|
-
// AGENT402_CREDITS_KEY a prepaid credits key (a402_...)
|
|
21
|
-
//
|
|
22
|
-
// AGENT402_BUDGET hard cap on total USD spent this session (
|
|
20
|
+
// AGENT402_CREDITS_KEY a prepaid credits key (a402_...); pays per successful call with no wallet,
|
|
21
|
+
// on Agent402's own services only (outside-seller routes need a wallet)
|
|
22
|
+
// AGENT402_BUDGET optional hard cap on total USD spent this session (no cap by default)
|
|
23
|
+
// AGENT402_SHOW_ROUTER "1" lists router.execute and sellers.list without a wallet (both are listed
|
|
24
|
+
// when a wallet or credits key is set)
|
|
23
25
|
// AGENT402_NETWORKS restrict + order the chains to pay on (e.g. "robinhood" for USDG on
|
|
24
26
|
// Robinhood Chain, "base,solana", or a raw CAIP-2 like eip155:4663), optional
|
|
25
27
|
import { createHash } from "node:crypto";
|
|
@@ -51,6 +53,8 @@ import {
|
|
|
51
53
|
outputSchemaFromExample,
|
|
52
54
|
mcpInitializeInstructions,
|
|
53
55
|
toolInputBoundRefusal,
|
|
56
|
+
AGENT402_MCP_VERSION,
|
|
57
|
+
clipToolDescription,
|
|
54
58
|
} from "./output-schemas.js";
|
|
55
59
|
|
|
56
60
|
const BASE = (process.env.AGENT402_URL || "https://agent402.tools").replace(/\/$/, "");
|
|
@@ -68,6 +72,10 @@ const HAS_WALLET = Boolean(AGENT_KEY || SOLANA_AGENT_KEY);
|
|
|
68
72
|
// Sent as Authorization: Bearer on every catalog call; the server debits the
|
|
69
73
|
// list price only on a successful (200) call and returns X-Credits-Balance.
|
|
70
74
|
const CREDITS_KEY = (process.env.AGENT402_CREDITS_KEY || "").trim();
|
|
75
|
+
// Listed with a wallet: a credits key does not pay routes that buy from an
|
|
76
|
+
// outside seller (prepaid credits are spent only on Agent402's own services).
|
|
77
|
+
const SHOW_ROUTER = HAS_WALLET || process.env.AGENT402_SHOW_ROUTER === "1";
|
|
78
|
+
const HIDDEN_WITHOUT_WALLET = new Set(["router.execute", META_MCP_NAMES.list_top_sellers]);
|
|
71
79
|
const HAS_CREDITS = /^a402_[A-Za-z0-9_-]{32,64}$/.test(CREDITS_KEY);
|
|
72
80
|
// Slow paid routes (async.recommended on their /api/pricing row) are sent with
|
|
73
81
|
// Prefer: respond-async and collected from their job link (./async-job.js).
|
|
@@ -85,8 +93,8 @@ const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.meta.ur
|
|
|
85
93
|
// by default, at the dearest list price in the Agent402 catalog rounded up to
|
|
86
94
|
// a whole dollar (mcp/test.js checks it still covers the catalog), and `off`
|
|
87
95
|
// disables it; a malformed value reads as that default, never as off. The
|
|
88
|
-
// session budget is opt-in: unset (or `off`) is no session cap, so a
|
|
89
|
-
//
|
|
96
|
+
// session budget is opt-in: unset (or `off`) is no session cap, so a heavy user
|
|
97
|
+
// is never stopped by a default. The per-call cap above still applies.
|
|
90
98
|
const DEFAULT_MAX_PER_CALL_USD = 4;
|
|
91
99
|
const DEFAULT_BUDGET_USD = Infinity;
|
|
92
100
|
const capFromEnv = (name, def) => {
|
|
@@ -256,7 +264,7 @@ function walletRequiredText(tool) {
|
|
|
256
264
|
`To enable it: set AGENT_KEY on this MCP server to the hex private key of an EVM wallet funded with USDC`,
|
|
257
265
|
`on Base (or Polygon/Arbitrum), and/or SOLANA_AGENT_KEY to the base58 secret key of a Solana wallet funded`,
|
|
258
266
|
`with USDC on Solana. Payment is per call via the x402 protocol: no signup or API key.`,
|
|
259
|
-
`
|
|
267
|
+
`Hold a prepaid credits key? Set AGENT402_CREDITS_KEY to the a402_ key and it pays per successful call on Agent402's own services (${BASE}/credits says whether packs are on sale).`,
|
|
260
268
|
`Pricing and details: ${BASE}/tools/${tool.slug}`,
|
|
261
269
|
].join(" ");
|
|
262
270
|
}
|
|
@@ -674,20 +682,20 @@ async function ensureCatalog() {
|
|
|
674
682
|
const withCatalog = (handler) => async (req, extra) => { await ensureCatalog(); return handler(req, extra); };
|
|
675
683
|
|
|
676
684
|
server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
685
|
+
// Read-only only for lookups that stay on this machine (describe, payment
|
|
686
|
+
// info). Anything that reaches the network or can spend is NET: not read-only,
|
|
687
|
+
// open-world. A host reads readOnlyHint to decide whether to ask first.
|
|
677
688
|
const SAFE = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
678
|
-
const
|
|
679
|
-
const WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
689
|
+
const NET = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
680
690
|
const tools = curated.map((t) => {
|
|
681
691
|
// verb_noun exposed names (match hosted /mcp). CallTool accepts kebab + plain snake too.
|
|
682
692
|
const name = FLAGSHIP_MCP_NAMES[t.slug] || t.slug.replace(/-/g, "_");
|
|
683
|
-
const ann =
|
|
684
|
-
: ["search", "answer", "search-news", "render", "stock-quote", "transcribe"].includes(t.slug) ? OPEN
|
|
685
|
-
: SAFE;
|
|
693
|
+
const ann = NET;
|
|
686
694
|
return {
|
|
687
695
|
name,
|
|
688
696
|
title: t.slug,
|
|
689
697
|
annotations: { title: t.slug, ...ann },
|
|
690
|
-
description: `
|
|
698
|
+
description: clipToolDescription(`${t.computePayable ? `Paid (${t.price}/call), or free via proof-of-work:` : `Paid (${t.price}/call):`} ${t.description}`),
|
|
691
699
|
inputSchema: t.inputSchema,
|
|
692
700
|
outputSchema: FLAGSHIP_OUTPUT_SCHEMAS[t.slug] || outputSchemaFromExample(null),
|
|
693
701
|
};
|
|
@@ -696,9 +704,9 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
696
704
|
{
|
|
697
705
|
name: META_MCP_NAMES.search_tools,
|
|
698
706
|
title: "Search the Agent402 tool catalog",
|
|
699
|
-
annotations: { title: "Search the Agent402 tool catalog", ...
|
|
707
|
+
annotations: { title: "Search the Agent402 tool catalog", ...NET },
|
|
700
708
|
description:
|
|
701
|
-
`
|
|
709
|
+
`Keyword search over the Agent402 catalog of 500+ tools (${catalog.size} loaded by this server). Returns matching tools and workflow templates; run one with catalog.call. Pure-CPU tools are free through proof-of-work; the others are paid per call in USDC when a wallet key is set.`,
|
|
702
710
|
inputSchema: {
|
|
703
711
|
type: "object",
|
|
704
712
|
properties: {
|
|
@@ -712,9 +720,9 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
712
720
|
{
|
|
713
721
|
name: META_MCP_NAMES.find_tool,
|
|
714
722
|
title: "Resolve a task to the one best Agent402 tool",
|
|
715
|
-
annotations: { title: "Resolve a task to the one best Agent402 tool", ...
|
|
723
|
+
annotations: { title: "Resolve a task to the one best Agent402 tool", ...NET },
|
|
716
724
|
description:
|
|
717
|
-
"
|
|
725
|
+
"Resolve a plain-language task to the single best-matching Agent402 tool through the hosted /api/find resolver. Returns { task, matches } with the top pick first. Run the pick with catalog.call and the slug and params it lists. Use catalog.search to compare several candidates.",
|
|
718
726
|
inputSchema: {
|
|
719
727
|
type: "object",
|
|
720
728
|
properties: {
|
|
@@ -728,7 +736,7 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
728
736
|
{
|
|
729
737
|
name: META_MCP_NAMES.call_tool,
|
|
730
738
|
title: "Run an Agent402 tool",
|
|
731
|
-
annotations: { title: "Run an Agent402 tool", ...
|
|
739
|
+
annotations: { title: "Run an Agent402 tool", ...NET },
|
|
732
740
|
description:
|
|
733
741
|
"Call any Agent402 tool by slug (find slugs with catalog.find or catalog.search). Payment is handled automatically: USDC via x402 if this server has a wallet key, otherwise free proof-of-work on eligible pure-CPU tools (no wallet needed). Wallet-keyed highlights: live search/answer, stock-quote, render, transcribe, memory, and the /v1 LLM gateway tiers.",
|
|
734
742
|
inputSchema: {
|
|
@@ -755,7 +763,7 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
755
763
|
name: META_MCP_NAMES.describe_server,
|
|
756
764
|
title: "About this Agent402 connector",
|
|
757
765
|
annotations: { title: "About this Agent402 connector", ...SAFE },
|
|
758
|
-
description: "Describe this stdio MCP server:
|
|
766
|
+
description: "Describe this stdio MCP server: the tools it lists, install commands, free vs paid, and discovery URLs.",
|
|
759
767
|
inputSchema: { type: "object", properties: {} },
|
|
760
768
|
outputSchema: META_OUTPUT_SCHEMAS["server.describe"],
|
|
761
769
|
},
|
|
@@ -766,9 +774,9 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
766
774
|
// Pure verb_noun (Smithery Naming). list_x402_sellers / top_x402_sellers stay aliases.
|
|
767
775
|
name: META_MCP_NAMES.list_top_sellers,
|
|
768
776
|
title: "List top x402 sellers",
|
|
769
|
-
annotations: { title: "List top x402 sellers", ...
|
|
777
|
+
annotations: { title: "List top x402 sellers", ...NET },
|
|
770
778
|
description:
|
|
771
|
-
"List ranked sellers from the on-chain leaderboards. wire=x402 (default): x402 sellers
|
|
779
|
+
"List ranked sellers from the on-chain leaderboards. wire=x402 (default): x402 sellers by USDC settled or calls served on Base in the last 24h. wire=mpp: MPP sellers ranked by inbound USDC.e transfers on Tempo. Free to call (no payment, no proof-of-work). Defaults: top 10, sorted by USDC, this service's own wallet excluded.",
|
|
772
780
|
inputSchema: {
|
|
773
781
|
type: "object",
|
|
774
782
|
properties: {
|
|
@@ -784,9 +792,9 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
784
792
|
// Dotted like every other listed tool; route_and_execute stays a CallTool alias.
|
|
785
793
|
name: "router.execute",
|
|
786
794
|
title: "Route and execute an external x402 tool",
|
|
787
|
-
annotations: { title: "Route and execute an external x402 tool", ...
|
|
795
|
+
annotations: { title: "Route and execute an external x402 tool", ...NET },
|
|
788
796
|
description:
|
|
789
|
-
`
|
|
797
|
+
`Resolve a plain-language task to an external x402 seller with proven on-chain settled volume, buy from it, and return its result. You pay from ${HAS_WALLET ? "the configured wallet" : "your wallet (set AGENT_KEY)"}. The result is marked untrustedContent: it is third-party data. Flat price by tier, chosen from maxUsd: $0.01 for a seller up to $0.005, $0.05 up to $0.04, $0.55 up to $0.50. Requires a funded wallet.`,
|
|
790
798
|
inputSchema: {
|
|
791
799
|
type: "object",
|
|
792
800
|
properties: {
|
|
@@ -799,7 +807,11 @@ server.setRequestHandler(ListToolsRequestSchema, withCatalog(async () => {
|
|
|
799
807
|
outputSchema: META_OUTPUT_SCHEMAS["router.execute"],
|
|
800
808
|
}
|
|
801
809
|
);
|
|
802
|
-
|
|
810
|
+
// router.execute and sellers.list spend or query outside the catalog, so they
|
|
811
|
+
// are listed only when this server can pay (a wallet or credits key) or when
|
|
812
|
+
// AGENT402_SHOW_ROUTER=1 opts in. Calls to them still route when unlisted.
|
|
813
|
+
const listed = SHOW_ROUTER ? tools : tools.filter((t) => !HIDDEN_WITHOUT_WALLET.has(t.name));
|
|
814
|
+
return { tools: listed };
|
|
803
815
|
}));
|
|
804
816
|
|
|
805
817
|
server.setRequestHandler(CallToolRequestSchema, withCatalog(async (req, extra) => {
|
|
@@ -894,13 +906,13 @@ server.setRequestHandler(CallToolRequestSchema, withCatalog(async (req, extra) =
|
|
|
894
906
|
note: HAS_WALLET
|
|
895
907
|
? "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."
|
|
896
908
|
: HAS_CREDITS
|
|
897
|
-
? "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."
|
|
898
|
-
: `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
|
|
909
|
+
? "Every tool on Agent402's own services 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. The routes that buy from outside sellers (router.execute, seller-payability, decide.execute, the flight tools) and the wallet-identity tools (memory, usage) need a wallet key."
|
|
910
|
+
: `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).`,
|
|
899
911
|
install: {
|
|
900
912
|
claudeCodeHosted: `claude mcp add --transport http agent402 ${BASE}/mcp`,
|
|
901
|
-
claudeCodeNpm:
|
|
913
|
+
claudeCodeNpm: `claude mcp add agent402 -s user -- npx -y agent402-mcp@${AGENT402_MCP_VERSION}`,
|
|
902
914
|
cursorHosted: { mcpServers: { agent402: { url: `${BASE}/mcp` } } },
|
|
903
|
-
npm: "npx -y agent402-mcp",
|
|
915
|
+
npm: "npx -y agent402-mcp@0.13.21",
|
|
904
916
|
maintainer: "Havok Holdings LLC",
|
|
905
917
|
},
|
|
906
918
|
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.`,
|
|
@@ -919,8 +931,8 @@ server.setRequestHandler(CallToolRequestSchema, withCatalog(async (req, extra) =
|
|
|
919
931
|
},
|
|
920
932
|
install: {
|
|
921
933
|
claudeCodeHosted: `claude mcp add --transport http agent402 ${BASE}/mcp`,
|
|
922
|
-
claudeCodeNpm:
|
|
923
|
-
npm: "npx -y agent402-mcp",
|
|
934
|
+
claudeCodeNpm: `claude mcp add agent402 -s user -- npx -y agent402-mcp@${AGENT402_MCP_VERSION}`,
|
|
935
|
+
npm: "npx -y agent402-mcp@0.13.21",
|
|
924
936
|
maintainer: "Havok Holdings LLC",
|
|
925
937
|
},
|
|
926
938
|
tools: catalog.size,
|
package/output-schemas.js
CHANGED
|
@@ -492,12 +492,29 @@ export function mcpJsonResult(obj) {
|
|
|
492
492
|
* Hosted URL is parameterized; npm / Claude Code / Cursor / Smithery notes
|
|
493
493
|
* match docs/ecosystem-listings.md + wiki/MCP-Connector.md.
|
|
494
494
|
*/
|
|
495
|
+
export const AGENT402_MCP_VERSION = "0.13.21";
|
|
496
|
+
|
|
497
|
+
/** A listed MCP tool description, at most `max` characters. Hosts truncate or
|
|
498
|
+
* skip long descriptions, so the listing keeps the first whole sentences; the
|
|
499
|
+
* full catalog text stays on catalog.find and the tool's page. */
|
|
500
|
+
export const TOOL_DESCRIPTION_MAX = 400;
|
|
501
|
+
export function clipToolDescription(text, max = TOOL_DESCRIPTION_MAX) {
|
|
502
|
+
const s = String(text ?? "").replace(/\s+/g, " ").trim();
|
|
503
|
+
if (s.length <= max) return s;
|
|
504
|
+
const head = s.slice(0, max);
|
|
505
|
+
const cut = head.lastIndexOf(". ");
|
|
506
|
+
if (cut > max * 0.5) return head.slice(0, cut + 1);
|
|
507
|
+
const sp = head.lastIndexOf(" ", max - 1);
|
|
508
|
+
return head.slice(0, sp > 0 ? sp : max - 1).replace(/[,;:\-\s]+$/, "") + ".";
|
|
509
|
+
}
|
|
510
|
+
|
|
495
511
|
export function mcpInstallHints(baseUrl) {
|
|
496
512
|
const hosted = `${baseUrl}/mcp`;
|
|
497
513
|
return {
|
|
498
514
|
hostedUrl: hosted,
|
|
499
515
|
claudeCodeHosted: `claude mcp add --transport http agent402 ${hosted}`,
|
|
500
|
-
|
|
516
|
+
walletWarning: "Use a new wallet holding only a few dollars of USDC. Never your main wallet.",
|
|
517
|
+
claudeCodeNpm: `claude mcp add agent402 -s user -- npx -y agent402-mcp@${AGENT402_MCP_VERSION}`,
|
|
501
518
|
cursorMcpJson: {
|
|
502
519
|
mcpServers: {
|
|
503
520
|
agent402: { url: hosted },
|
|
@@ -507,12 +524,12 @@ export function mcpInstallHints(baseUrl) {
|
|
|
507
524
|
mcpServers: {
|
|
508
525
|
agent402: {
|
|
509
526
|
command: "npx",
|
|
510
|
-
args: ["-y", "agent402-mcp"],
|
|
527
|
+
args: ["-y", "agent402-mcp@0.13.21"],
|
|
511
528
|
env: { AGENT_KEY: "0xYOUR_PRIVATE_KEY" },
|
|
512
529
|
},
|
|
513
530
|
},
|
|
514
531
|
},
|
|
515
|
-
npm: "npx -y agent402-mcp",
|
|
532
|
+
npm: "npx -y agent402-mcp@0.13.21",
|
|
516
533
|
smithery: `Paste ${hosted} into the add-server form at https://smithery.ai/new. Submission is external; Agent402 does not auto-publish.`,
|
|
517
534
|
maintainer: "Havok Holdings LLC",
|
|
518
535
|
};
|
|
@@ -527,22 +544,17 @@ export function mcpInitializeInstructions(baseUrl, { decide = false, mpp = false
|
|
|
527
544
|
const install = mcpInstallHints(baseUrl);
|
|
528
545
|
const hosted = install.hostedUrl;
|
|
529
546
|
return [
|
|
530
|
-
"Agent402 is
|
|
531
|
-
"
|
|
532
|
-
"
|
|
533
|
-
"Long catalog (500+ tools): call catalog.find with your task, or catalog.search then catalog.call.",
|
|
547
|
+
"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
|
+
"Flagship tools: web.search (live web search), web.answer (answers with citations), web.news, browser.render, market.quote, audio.transcribe, memory.read, memory.write.",
|
|
549
|
+
"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.",
|
|
534
550
|
// Only where the decide tools are listed: an instruction must never name a
|
|
535
551
|
// tool the connector does not advertise.
|
|
536
|
-
...(decide ? ["
|
|
537
|
-
"
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
// The hosted line says what that connector takes: with MPP on it, a wallet
|
|
541
|
-
// can pay the other tools there too.
|
|
542
|
-
`${mpp ? "Hosted (proof-of-work tools free; the rest payable there over MPP from a wallet)" : "No wallet yet (hosted, proof-of-work tools only)"}: ${install.claudeCodeHosted}`,
|
|
552
|
+
...(decide ? ["Multi-step jobs: decide.plan returns a call-ready plan (tools, order, fallbacks, inputs); decide.execute runs it. The plan fee is credited toward the run."] : []),
|
|
553
|
+
"Also: server.describe (connector details), payment.info (wallet and payment setup), demand.request (report a missing tool).",
|
|
554
|
+
`Install (npm package, pinned): ${install.claudeCodeNpm}`,
|
|
555
|
+
`${mpp ? "Hosted connector (proof-of-work tools free; other tools payable over MPP from a wallet)" : "Hosted connector (proof-of-work tools free; others need a wallet on the npm package)"}: ${install.claudeCodeHosted}`,
|
|
543
556
|
`Cursor mcp.json: { "mcpServers": { "agent402": { "url": "${hosted}" } } }`,
|
|
544
|
-
`
|
|
545
|
-
`Docs: ${baseUrl}/llms.txt · ${baseUrl}/api/find?q=… · status ${baseUrl}/status`,
|
|
557
|
+
`Docs: ${baseUrl}/llms.txt · status ${baseUrl}/status`,
|
|
546
558
|
].join("\n");
|
|
547
559
|
}
|
|
548
560
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent402-mcp",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.21",
|
|
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",
|
|
@@ -82,16 +82,19 @@
|
|
|
82
82
|
"viem": "^2.21.0"
|
|
83
83
|
},
|
|
84
84
|
"overrides": {
|
|
85
|
-
"qs": "6.16.
|
|
85
|
+
"qs": "6.16.1",
|
|
86
86
|
"ws": "^8.21.0",
|
|
87
87
|
"hono": "4.13.13",
|
|
88
|
-
"fast-uri": "3.1.
|
|
89
|
-
"body-parser": "2.
|
|
88
|
+
"fast-uri": "3.1.9",
|
|
89
|
+
"body-parser": "2.4.0",
|
|
90
90
|
"@hono/node-server": "2.0.12",
|
|
91
91
|
"ip-address": "10.7.4",
|
|
92
92
|
"@solana-program/token": "0.17.0",
|
|
93
93
|
"@solana-program/compute-budget": "0.19.0",
|
|
94
94
|
"@solana-program/token-2022": "0.19.0",
|
|
95
|
-
"@solana/program-client-core": "8.4.0"
|
|
95
|
+
"@solana/program-client-core": "8.4.0",
|
|
96
|
+
"@modelcontextprotocol/sdk": {
|
|
97
|
+
"zod": "4.6.7"
|
|
98
|
+
}
|
|
96
99
|
}
|
|
97
100
|
}
|