verify402-mcp 1.0.2 → 1.0.3
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 +77 -63
- package/index.mjs +17 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ wallet that pays in USDC; the bridge never signs or sends a trade.
|
|
|
14
14
|
|---|---|---|
|
|
15
15
|
| `preflight_gate` | **free** | "Should I sign this payment request or transaction?" — PASS / CAUTION / BLOCK with reasons, `checked` / `notChecked`, and a short-lived receipt |
|
|
16
16
|
| `verify_arbitrage` | $0.05 | "Is this cross-venue arbitrage opportunity real, right now?" |
|
|
17
|
-
| `check_token_safety` | $0.10 | "Is this token
|
|
17
|
+
| `check_token_safety` | $0.10 | "Is this token sellable at a realistic size, and what does the round trip cost?" — TRUST / CAUTION / AVOID with evidence; not a code audit |
|
|
18
18
|
| `get_best_route` | $0.03 | "What would the chain actually pay for this swap?" — best route + every quoted venue |
|
|
19
19
|
| `verify_quote_fairness` | $0.05 | "A broker/bot offered me this number — is it honest?" fair / overpaying / too_good_to_be_true |
|
|
20
20
|
| `get_trade_depth` | $0.05 | "How big can I trade here before the round trip eats me?" — per-size impact, round-trip cost, capacity |
|
|
@@ -31,23 +31,24 @@ belongs in the executor that signs — verify the receipt, then sign. See
|
|
|
31
31
|
for a deny-by-default reference that refuses to call the signer without a
|
|
32
32
|
verified receipt.
|
|
33
33
|
|
|
34
|
-
## Run
|
|
34
|
+
## Distribution & Run
|
|
35
35
|
|
|
36
|
-
The package is
|
|
37
|
-
|
|
36
|
+
The package is officially published on npm as **[`verify402-mcp`](https://www.npmjs.com/package/verify402-mcp)** and indexed on the official [Model Context Protocol Registry](https://registry.modelcontextprotocol.io/).
|
|
37
|
+
|
|
38
|
+
Run directly via `npx` (stdio transport):
|
|
38
39
|
|
|
39
40
|
```bash
|
|
40
|
-
npx -y
|
|
41
|
-
--package=https://github.com/a32116150-ctrl/verify402/releases/download/mcp-v1.0.2/verify402-mcp-1.0.2.tgz \
|
|
42
|
-
verify402-mcp --help
|
|
41
|
+
npx -y verify402-mcp --help
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
You can also install it globally:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g verify402-mcp
|
|
48
|
+
verify402-mcp --help
|
|
49
|
+
```
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
Or run from source:
|
|
51
52
|
|
|
52
53
|
```bash
|
|
53
54
|
git clone https://github.com/a32116150-ctrl/verify402
|
|
@@ -56,47 +57,20 @@ npm ci
|
|
|
56
57
|
node index.mjs --help
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
---
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
`free preflight_gate only`. Nothing can be charged.
|
|
62
|
+
## AI Agent Integration (Step-by-Step)
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Set a wallet with USDC on the payment network. Use a wallet with only the money
|
|
67
|
-
you are willing to spend — never a main wallet. The key stays in your MCP client
|
|
68
|
-
configuration or environment; the package never contains it.
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
EVM_PRIVATE_KEY=0x... # optional; omit for free-only
|
|
72
|
-
VERIFY402_URL=https://verify402.onrender.com
|
|
73
|
-
MAX_PAYMENT_USD=0.25 # hard cap on ONE payment, enforced at signature time
|
|
74
|
-
MAX_DAILY_USD=0.50 # optional cap for the UTC day, persisted
|
|
75
|
-
SPEND_LEDGER_PATH= # optional ledger path (default .spend-ledger.json)
|
|
76
|
-
VERIFY402_NETWORKS=eip155:8453 # paid calls only; comma-separated EVM networks
|
|
77
|
-
VERIFY402_PAY_TO=0xAeEF086DD4e436c69d6d0F684b4c9F43392df9cb
|
|
78
|
-
# VERIFY402_RESOURCE_PREFIX=https://verify402.onrender.com
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
The paid client refuses a 402 that names another network or payee, a resource
|
|
82
|
-
outside the configured server, or a non-paid route. It also refuses redirects.
|
|
83
|
-
The amount cap and the USDC-only default-asset allowlist are enforced inside
|
|
84
|
-
the x402 client, before a signature exists.
|
|
85
|
-
|
|
86
|
-
### Claude Desktop / Cursor
|
|
87
|
-
|
|
88
|
-
`claude_desktop_config.json`, or `.cursor/mcp.json`:
|
|
64
|
+
### Step 1: Free Mode (Zero Config, No Wallet)
|
|
65
|
+
To give your AI agent the free **`preflight_gate`** (checks transaction calldata, payment challenges, payee/amount, approvals, and block freshness before signing), paste this into your client configuration. Honeypot/sellability evidence is the paid `check_token_safety` check, not a free-gate guarantee.
|
|
89
66
|
|
|
67
|
+
**Claude Desktop** (`claude_desktop_config.json`) or **Cursor** (`.cursor/mcp.json`):
|
|
90
68
|
```json
|
|
91
69
|
{
|
|
92
70
|
"mcpServers": {
|
|
93
71
|
"verify402": {
|
|
94
72
|
"command": "npx",
|
|
95
|
-
"args": [
|
|
96
|
-
"-y",
|
|
97
|
-
"--package=https://github.com/a32116150-ctrl/verify402/releases/download/mcp-v1.0.2/verify402-mcp-1.0.2.tgz",
|
|
98
|
-
"verify402-mcp"
|
|
99
|
-
],
|
|
73
|
+
"args": ["-y", "verify402-mcp"],
|
|
100
74
|
"env": {
|
|
101
75
|
"VERIFY402_URL": "https://verify402.onrender.com"
|
|
102
76
|
}
|
|
@@ -105,14 +79,41 @@ the x402 client, before a signature exists.
|
|
|
105
79
|
}
|
|
106
80
|
```
|
|
107
81
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
them.
|
|
82
|
+
### Step 2: Paid Mode (Setting Up the Hot Wallet)
|
|
83
|
+
To enable the 5 deep on-chain truth checks (`verify_arbitrage`, `check_token_safety`, `get_best_route`, `verify_quote_fairness`, `get_trade_depth`), configure a dedicated hot wallet that pays per call in USDC via x402:
|
|
111
84
|
|
|
112
|
-
|
|
85
|
+
1. **Create a Dedicated Hot Wallet**:
|
|
86
|
+
- Create a brand new wallet in MetaMask, Rabby, or via `cast wallet new`.
|
|
87
|
+
- ⚠️ **SECURITY WARNING**: Never use your primary personal wallet, cold storage, or vault.
|
|
88
|
+
2. **Fund the Wallet on Base (EIP-155:8453)**:
|
|
89
|
+
- **USDC**: Transfer $2 to $10 of USDC on Base (the bridge pays per call: $0.03 to $0.10).
|
|
90
|
+
- **Gas (ETH on Base)**: Transfer ~$0.50 worth of ETH on Base for minimal gas allowances if needed.
|
|
91
|
+
3. **Configure Environment Variables in Your MCP Client**:
|
|
92
|
+
- Set `EVM_PRIVATE_KEY` to the 64-character private key of the hot wallet.
|
|
93
|
+
- Set safety caps `MAX_PAYMENT_USD` (e.g., `"0.25"`) and `MAX_DAILY_USD` (e.g., `"1.00"`).
|
|
113
94
|
|
|
114
|
-
|
|
95
|
+
**Paid Configuration Block (Claude Desktop, Cursor, Cline, Windsurf)**:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"verify402": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": ["-y", "verify402-mcp"],
|
|
102
|
+
"env": {
|
|
103
|
+
"VERIFY402_URL": "https://verify402.onrender.com",
|
|
104
|
+
"EVM_PRIVATE_KEY": "0xYOUR_HOT_WALLET_PRIVATE_KEY",
|
|
105
|
+
"MAX_PAYMENT_USD": "0.25",
|
|
106
|
+
"MAX_DAILY_USD": "1.00",
|
|
107
|
+
"VERIFY402_NETWORKS": "eip155:8453",
|
|
108
|
+
"VERIFY402_PAY_TO": "0xAeEF086DD4e436c69d6d0F684b4c9F43392df9cb"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
115
114
|
|
|
115
|
+
### OpenCode V2 Configuration
|
|
116
|
+
In `opencode.jsonc` (or `~/.config/opencode/opencode.jsonc`):
|
|
116
117
|
```jsonc
|
|
117
118
|
{
|
|
118
119
|
"$schema": "https://opencode.ai/config.json",
|
|
@@ -120,14 +121,12 @@ them.
|
|
|
120
121
|
"servers": {
|
|
121
122
|
"verify402": {
|
|
122
123
|
"type": "local",
|
|
123
|
-
"command": [
|
|
124
|
-
"npx",
|
|
125
|
-
"-y",
|
|
126
|
-
"--package=https://github.com/a32116150-ctrl/verify402/releases/download/mcp-v1.0.2/verify402-mcp-1.0.2.tgz",
|
|
127
|
-
"verify402-mcp"
|
|
128
|
-
],
|
|
124
|
+
"command": ["npx", "-y", "verify402-mcp"],
|
|
129
125
|
"environment": {
|
|
130
|
-
"VERIFY402_URL": "https://verify402.onrender.com"
|
|
126
|
+
"VERIFY402_URL": "https://verify402.onrender.com",
|
|
127
|
+
"EVM_PRIVATE_KEY": "{env:EVM_PRIVATE_KEY}",
|
|
128
|
+
"MAX_PAYMENT_USD": "0.25",
|
|
129
|
+
"MAX_DAILY_USD": "1.00"
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
}
|
|
@@ -135,9 +134,22 @@ them.
|
|
|
135
134
|
}
|
|
136
135
|
```
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## How AI Agents Use verify402 (Prompt Examples)
|
|
140
|
+
|
|
141
|
+
Once configured, your agent automatically sees the tools in its context. You can prompt it directly:
|
|
142
|
+
|
|
143
|
+
- **Preflight Gate (Free)**:
|
|
144
|
+
> *"Before signing this transaction, call `preflight_gate` on the payment request / calldata. If it returns BLOCK, abort and explain why."*
|
|
145
|
+
- **Token Safety / Sellability Check ($0.10, not a code audit)**:
|
|
146
|
+
> *"Analyze token `0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE` using `check_token_safety`. Is it sellable at a realistic size, what is the round-trip cost, and is the result TRUST / CAUTION / AVOID?"*
|
|
147
|
+
- **Arbitrage Verification ($0.05)**:
|
|
148
|
+
> *"Use `verify_arbitrage` to verify if there is an arbitrage opportunity between Uniswap V3 and Sushiswap for WETH/USDC on chain 1 at the current block."*
|
|
149
|
+
- **Quote Fairness Audit ($0.05)**:
|
|
150
|
+
> *"I was offered 0.35 WETH for 1,000 USDC. Run `verify_quote_fairness` to see if this is fair or if I'm overpaying."*
|
|
151
|
+
- **Market Depth & Capacity ($0.05)**:
|
|
152
|
+
> *"Check `get_trade_depth` for WETH on Uniswap V3 to see how much slippage and impact a $50,000 swap would suffer."*
|
|
141
153
|
|
|
142
154
|
## Safety
|
|
143
155
|
|
|
@@ -150,11 +162,13 @@ the secret out of the config file.
|
|
|
150
162
|
`VERIFY402_NETWORKS`, `VERIFY402_PAY_TO`, and `VERIFY402_RESOURCE_PREFIX`.
|
|
151
163
|
Defaults are Base mainnet and the public verify402 payee.
|
|
152
164
|
- `MAX_PAYMENT_USD` is enforced inside the x402 client, before a signature
|
|
153
|
-
exists; removing it is a security regression.
|
|
165
|
+
exists; removing it is a security regression. The caps limit what the bridge
|
|
166
|
+
can authorize; they do **not** protect a compromised private key.
|
|
154
167
|
- `preflight_gate` is a check, not a guarantee. Read `notChecked`: it does not
|
|
155
168
|
screen recipient reputation or sanctions, audit contracts, simulate full
|
|
156
|
-
balance deltas,
|
|
157
|
-
|
|
169
|
+
balance deltas, audit the counterparty, scan tool descriptions or responses
|
|
170
|
+
for prompt injection, or protect against MEV. It catches the measurable
|
|
171
|
+
signing mistakes, not every scam.
|
|
158
172
|
- Use the [reference executor](https://github.com/a32116150-ctrl/verify402/blob/master/examples/preflight-guard.mjs)
|
|
159
173
|
when you want enforcement rather than advice.
|
|
160
174
|
|
package/index.mjs
CHANGED
|
@@ -32,12 +32,20 @@ import { z } from "zod";
|
|
|
32
32
|
|
|
33
33
|
config();
|
|
34
34
|
|
|
35
|
+
const VERSION = "1.0.3";
|
|
35
36
|
const EVM_PRIVATE_KEY = process.env.EVM_PRIVATE_KEY;
|
|
36
37
|
const SERVER_URL = process.env.VERIFY402_URL || "https://verify402.onrender.com";
|
|
38
|
+
// Tell the server which client made the call. This is a label, not an identity:
|
|
39
|
+
// it helps separate MCP use from generic HTTP probes without collecting keys or
|
|
40
|
+
// wallet addresses.
|
|
41
|
+
const CLIENT_HEADERS = {
|
|
42
|
+
"User-Agent": `verify402-mcp/${VERSION}`,
|
|
43
|
+
"X-Verify402-Client": `mcp/${VERSION}`,
|
|
44
|
+
};
|
|
37
45
|
// Preflight is free, so it does not go through the paying client. Keeping the
|
|
38
46
|
// two clients separate means a misconfigured 402 on a free route can never
|
|
39
47
|
// turn into a signature.
|
|
40
|
-
const freeApi = axios.create({ baseURL: SERVER_URL, timeout: 30_000, maxRedirects: 0 });
|
|
48
|
+
const freeApi = axios.create({ baseURL: SERVER_URL, timeout: 30_000, maxRedirects: 0, headers: CLIENT_HEADERS });
|
|
41
49
|
// Spend guard: the x402 client refuses to SIGN any payment above this, before
|
|
42
50
|
// a signature exists. Enforced inside x402Client (applySpendControls), not by
|
|
43
51
|
// our own request code - so it cannot be bypassed by a caller.
|
|
@@ -73,7 +81,7 @@ The bridge signs x402 payments only; it never signs or sends a trade.
|
|
|
73
81
|
process.exit(0);
|
|
74
82
|
}
|
|
75
83
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
76
|
-
console.log(
|
|
84
|
+
console.log(VERSION);
|
|
77
85
|
process.exit(0);
|
|
78
86
|
}
|
|
79
87
|
|
|
@@ -103,7 +111,7 @@ async function createPaidClient() {
|
|
|
103
111
|
`payee=${policy.allowedPayTo} resources=${policy.resourcePrefix} ` +
|
|
104
112
|
`{${policy.paidRoutes.join(",")}}`,
|
|
105
113
|
);
|
|
106
|
-
const axiosInstance = axios.create({ baseURL: SERVER_URL, timeout: 120_000, maxRedirects: 0 });
|
|
114
|
+
const axiosInstance = axios.create({ baseURL: SERVER_URL, timeout: 120_000, maxRedirects: 0, headers: CLIENT_HEADERS });
|
|
107
115
|
return wrapAxiosWithPayment(axiosInstance, client);
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -157,7 +165,7 @@ const DESCRIPTIONS = {
|
|
|
157
165
|
async function main() {
|
|
158
166
|
const paidApi = PAID_ENABLED ? await createPaidClient() : null;
|
|
159
167
|
|
|
160
|
-
const server = new McpServer({ name: "verify402", version:
|
|
168
|
+
const server = new McpServer({ name: "verify402", version: VERSION });
|
|
161
169
|
|
|
162
170
|
server.tool(
|
|
163
171
|
"preflight_gate",
|
|
@@ -221,7 +229,11 @@ async function main() {
|
|
|
221
229
|
isError: true,
|
|
222
230
|
content: [{
|
|
223
231
|
type: "text",
|
|
224
|
-
text: `preflight failed${status ? ` (${status})` : ""}: ${JSON.stringify(body ?? e.message)}.
|
|
232
|
+
text: `preflight failed${status ? ` (${status})` : ""}: ${JSON.stringify(body ?? e.message)}. ${
|
|
233
|
+
status === 503
|
|
234
|
+
? "No receipt was issued; stop and retry later."
|
|
235
|
+
: "Do not sign without a verifiable receipt."
|
|
236
|
+
}`,
|
|
225
237
|
}],
|
|
226
238
|
};
|
|
227
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verify402-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"mcpName": "io.github.a32116150-ctrl/verify402-mcp",
|
|
5
5
|
"description": "MCP server for verify402: a free, fail-closed preflight gate before signing, plus five paid on-chain checks paid per call via x402.",
|
|
6
6
|
"type": "module",
|