x402-proxy 0.9.0 → 0.9.1
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/CHANGELOG.md +16 -1
- package/README.md +11 -8
- package/dist/bin/cli.js +23 -11
- package/dist/openclaw/plugin.js +1 -1
- package/dist/{setup-BjyoqzT3.js → setup-B7YJa7s6.js} +77 -9
- package/dist/setup-xhtYsp7D.js +4 -0
- package/package.json +1 -1
- package/skills/SKILL.md +17 -7
- package/dist/setup-CJgw4opQ.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.1] - 2026-03-26
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `setup --non-interactive` flag - auto-generates wallet and outputs addresses as JSON to stdout (`{"base":"0x...","tempo":"0x...","solana":"..."}`)
|
|
14
|
+
- `setup --import-mnemonic` flag - import existing BIP-39 mnemonic non-interactively
|
|
15
|
+
- MCP proxy auto-generates wallet on first run when no wallet exists (no more "No wallet configured" error)
|
|
16
|
+
- OpenClaw integration example in README and SKILL.md: `openclaw mcp set surf '{"command":"npx","args":["-y","x402-proxy","mcp","https://surf.cascade.fyi/mcp"]}'`
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- `npx -y` flag added to all generated MCP configs (`mcp add` command and docs) - prevents npx install prompt from corrupting MCP stdio protocol
|
|
20
|
+
- MCP config examples no longer show `X402_PROXY_WALLET_MNEMONIC` env var as default - wallet file is the primary path, env vars are documented as fallback only
|
|
21
|
+
- All example MCP URLs updated to `https://surf.cascade.fyi/mcp`
|
|
22
|
+
- Non-interactive JSON output uses network names (`base`, `tempo`, `solana`) instead of generic `evm`
|
|
23
|
+
|
|
10
24
|
## [0.9.0] - 2026-03-25
|
|
11
25
|
|
|
12
26
|
### Added
|
|
@@ -263,7 +277,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
263
277
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
264
278
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
265
279
|
|
|
266
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.
|
|
280
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.1...HEAD
|
|
281
|
+
[0.9.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.0...v0.9.1
|
|
267
282
|
[0.9.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.6...v0.9.0
|
|
268
283
|
[0.8.6]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.5...v0.8.6
|
|
269
284
|
[0.8.5]: https://github.com/cascade-protocol/x402-proxy/compare/v0.8.4...v0.8.5
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Let your AI agent consume any paid MCP server.
|
|
|
19
19
|
### Quick setup
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npx x402-proxy mcp add
|
|
22
|
+
npx x402-proxy mcp add surf https://surf.cascade.fyi/mcp
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Auto-detects installed AI clients (Claude Code, Cursor, VS Code, and 16+ others), shows a config preview, and writes it for you. Runs wallet setup if needed.
|
|
@@ -31,18 +31,21 @@ Or add to your client config directly:
|
|
|
31
31
|
```json
|
|
32
32
|
{
|
|
33
33
|
"mcpServers": {
|
|
34
|
-
"
|
|
34
|
+
"surf": {
|
|
35
35
|
"command": "npx",
|
|
36
|
-
"args": ["x402-proxy", "mcp", "https://
|
|
37
|
-
"env": {
|
|
38
|
-
"X402_PROXY_WALLET_MNEMONIC": "your 24 words here"
|
|
39
|
-
}
|
|
36
|
+
"args": ["-y", "x402-proxy", "mcp", "https://surf.cascade.fyi/mcp"]
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
```
|
|
44
41
|
|
|
45
|
-
The proxy
|
|
42
|
+
The proxy auto-generates a wallet on first run and uses `~/.config/x402-proxy/wallet.json`. No env vars needed. Your agent never touches crypto.
|
|
43
|
+
|
|
44
|
+
For OpenClaw:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
openclaw mcp set surf '{"command":"npx","args":["-y","x402-proxy","mcp","https://surf.cascade.fyi/mcp"]}'
|
|
48
|
+
```
|
|
46
49
|
|
|
47
50
|
## HTTP Requests
|
|
48
51
|
|
|
@@ -110,7 +113,7 @@ $ MY_MNEMONIC=$(npx x402-proxy wallet export-key mnemonic)
|
|
|
110
113
|
|
|
111
114
|
## Env Vars
|
|
112
115
|
|
|
113
|
-
Override wallet per-instance (
|
|
116
|
+
Override wallet per-instance (fallback for environments where the wallet file isn't accessible):
|
|
114
117
|
|
|
115
118
|
```
|
|
116
119
|
X402_PROXY_WALLET_MNEMONIC # BIP-39 mnemonic (derives both chains)
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as getHistoryPath, c as loadConfig, i as getConfigDirShort, l as loadWalletFile, s as isConfigured, u as saveConfig } from "../derive-CAYmX-Yz.js";
|
|
3
3
|
import { _ as error, b as warn, c as resolveWallet, d as displayNetwork, f as formatAmount, g as dim, h as readHistory, l as appendHistory, m as formatUsdcValue, n as fetchAllBalances, o as walletInfoCommand, p as formatTxLine, s as buildX402Client, u as calcSpend, v as info, y as isTTY } from "../wallet-DZsXptY7.js";
|
|
4
|
-
import { n as setupCommand, t as runSetup } from "../setup-
|
|
4
|
+
import { n as setupCommand, t as runSetup } from "../setup-B7YJa7s6.js";
|
|
5
5
|
import { n as statusCommand } from "../status-D3f5IVf6.js";
|
|
6
6
|
import { dirname, join, normalize, resolve } from "node:path";
|
|
7
7
|
import { buildApplication, buildCommand, buildRouteMap, run } from "@stricli/core";
|
|
@@ -453,7 +453,7 @@ Examples:
|
|
|
453
453
|
process.exit(1);
|
|
454
454
|
}
|
|
455
455
|
dim(" No wallet found. Let's set one up first.\n");
|
|
456
|
-
const { runSetup } = await import("../setup-
|
|
456
|
+
const { runSetup } = await import("../setup-xhtYsp7D.js");
|
|
457
457
|
await runSetup();
|
|
458
458
|
console.log();
|
|
459
459
|
wallet = resolveWallet();
|
|
@@ -764,8 +764,9 @@ const mcpCommand = buildCommand({
|
|
|
764
764
|
|
|
765
765
|
Add to your MCP client config (Claude, Cursor, etc.):
|
|
766
766
|
"command": "npx",
|
|
767
|
-
"args": ["x402-proxy", "mcp", "https://
|
|
768
|
-
|
|
767
|
+
"args": ["-y", "x402-proxy", "mcp", "https://surf.cascade.fyi/mcp"]
|
|
768
|
+
|
|
769
|
+
Wallet is auto-generated on first run. No env vars needed.`
|
|
769
770
|
},
|
|
770
771
|
parameters: {
|
|
771
772
|
flags: {
|
|
@@ -808,8 +809,18 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
808
809
|
solanaKey: flags.solanaKey
|
|
809
810
|
});
|
|
810
811
|
if (wallet.source === "none") {
|
|
811
|
-
|
|
812
|
-
|
|
812
|
+
dim("No wallet found. Auto-generating...");
|
|
813
|
+
const { runSetup } = await import("../setup-xhtYsp7D.js");
|
|
814
|
+
await runSetup({ nonInteractive: true });
|
|
815
|
+
const fresh = resolveWallet({
|
|
816
|
+
evmKey: flags.evmKey,
|
|
817
|
+
solanaKey: flags.solanaKey
|
|
818
|
+
});
|
|
819
|
+
if (fresh.source === "none") {
|
|
820
|
+
error("Wallet auto-setup failed. Run: $ npx x402-proxy setup");
|
|
821
|
+
process.exit(1);
|
|
822
|
+
}
|
|
823
|
+
Object.assign(wallet, fresh);
|
|
813
824
|
}
|
|
814
825
|
dim(`x402-proxy MCP proxy -> ${remoteUrl}`);
|
|
815
826
|
if (wallet.evmAddress) dim(` EVM: ${wallet.evmAddress}`);
|
|
@@ -863,7 +874,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
863
874
|
}
|
|
864
875
|
const remoteClient = new Client({
|
|
865
876
|
name: "x402-proxy",
|
|
866
|
-
version: "0.9.
|
|
877
|
+
version: "0.9.1"
|
|
867
878
|
});
|
|
868
879
|
const x402Mcp = new x402MCPClient(remoteClient, x402PaymentClient, {
|
|
869
880
|
autoPayment: true,
|
|
@@ -901,7 +912,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
901
912
|
}
|
|
902
913
|
const localServer = new Server({
|
|
903
914
|
name: "x402-proxy",
|
|
904
|
-
version: "0.9.
|
|
915
|
+
version: "0.9.1"
|
|
905
916
|
}, { capabilities: {
|
|
906
917
|
tools: tools.length > 0 ? {} : void 0,
|
|
907
918
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -996,7 +1007,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
996
1007
|
}));
|
|
997
1008
|
const remoteClient = new Client({
|
|
998
1009
|
name: "x402-proxy",
|
|
999
|
-
version: "0.9.
|
|
1010
|
+
version: "0.9.1"
|
|
1000
1011
|
});
|
|
1001
1012
|
await connectTransport(remoteClient);
|
|
1002
1013
|
const mppClient = McpClient.wrap(remoteClient, { methods: wrappedMethods });
|
|
@@ -1011,7 +1022,7 @@ Add to your MCP client config (Claude, Cursor, etc.):
|
|
|
1011
1022
|
}
|
|
1012
1023
|
const localServer = new Server({
|
|
1013
1024
|
name: "x402-proxy",
|
|
1014
|
-
version: "0.9.
|
|
1025
|
+
version: "0.9.1"
|
|
1015
1026
|
}, { capabilities: {
|
|
1016
1027
|
tools: tools.length > 0 ? {} : void 0,
|
|
1017
1028
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -1197,6 +1208,7 @@ const mcpAddCommand = buildCommand({
|
|
|
1197
1208
|
const generated = generateConfig(clientId, serverName, {
|
|
1198
1209
|
command: "npx",
|
|
1199
1210
|
args: [
|
|
1211
|
+
"-y",
|
|
1200
1212
|
"x402-proxy",
|
|
1201
1213
|
"mcp",
|
|
1202
1214
|
url
|
|
@@ -1415,7 +1427,7 @@ const routes = buildRouteMap({
|
|
|
1415
1427
|
});
|
|
1416
1428
|
const app = buildApplication(routes, {
|
|
1417
1429
|
name: "x402-proxy",
|
|
1418
|
-
versionInfo: { currentVersion: "0.9.
|
|
1430
|
+
versionInfo: { currentVersion: "0.9.1" },
|
|
1419
1431
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
1420
1432
|
});
|
|
1421
1433
|
|
package/dist/openclaw/plugin.js
CHANGED
|
@@ -726,7 +726,7 @@ function createWalletCommand(ctx) {
|
|
|
726
726
|
try {
|
|
727
727
|
const snap = await getWalletSnapshot(ctx.rpcUrl, walletAddress, ctx.historyPath);
|
|
728
728
|
const solscanUrl = `https://solscan.io/account/${walletAddress}`;
|
|
729
|
-
const lines = [`x402-proxy v0.9.
|
|
729
|
+
const lines = [`x402-proxy v0.9.1`];
|
|
730
730
|
const defaultModel = ctx.allModels[0];
|
|
731
731
|
if (defaultModel) lines.push("", `**Model** - ${defaultModel.name} (${defaultModel.provider})`);
|
|
732
732
|
lines.push("", `**[Wallet](${solscanUrl})**`, `\`${walletAddress}\``);
|
|
@@ -1,15 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { d as saveWalletFile, i as getConfigDirShort, n as deriveSolanaKeypair, o as getWalletPath, r as generateMnemonic, s as isConfigured, t as deriveEvmKeypair, u as saveConfig } from "./derive-CAYmX-Yz.js";
|
|
2
|
+
import { d as saveWalletFile, i as getConfigDirShort, l as loadWalletFile, n as deriveSolanaKeypair, o as getWalletPath, r as generateMnemonic, s as isConfigured, t as deriveEvmKeypair, u as saveConfig } from "./derive-CAYmX-Yz.js";
|
|
3
3
|
import { buildCommand } from "@stricli/core";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import * as prompts from "@clack/prompts";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/setup.ts
|
|
8
8
|
async function runSetup(opts) {
|
|
9
|
+
const nonInteractive = opts?.nonInteractive ?? false;
|
|
10
|
+
if (nonInteractive && isConfigured() && !opts?.force) {
|
|
11
|
+
const walletFile = loadWalletFile();
|
|
12
|
+
if (walletFile) {
|
|
13
|
+
process.stdout.write(`${JSON.stringify({
|
|
14
|
+
base: walletFile.addresses.evm,
|
|
15
|
+
tempo: walletFile.addresses.evm,
|
|
16
|
+
solana: walletFile.addresses.solana
|
|
17
|
+
})}\n`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
9
21
|
if (isConfigured() && !opts?.force) {
|
|
10
22
|
prompts.log.warn(`Already configured. Wallet at ${pc.dim(getWalletPath())}\nTo reconfigure, run:\n ${pc.cyan("$ npx x402-proxy setup --force")}`);
|
|
11
23
|
return;
|
|
12
24
|
}
|
|
25
|
+
let mnemonic;
|
|
26
|
+
if (nonInteractive) {
|
|
27
|
+
if (opts?.importMnemonic) {
|
|
28
|
+
const words = opts.importMnemonic.trim().split(/\s+/);
|
|
29
|
+
if (words.length !== 12 && words.length !== 24) {
|
|
30
|
+
process.stderr.write("Error: mnemonic must be 12 or 24 words\n");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
mnemonic = opts.importMnemonic.trim();
|
|
34
|
+
} else mnemonic = generateMnemonic();
|
|
35
|
+
const evm = deriveEvmKeypair(mnemonic);
|
|
36
|
+
const sol = deriveSolanaKeypair(mnemonic);
|
|
37
|
+
saveWalletFile({
|
|
38
|
+
version: 1,
|
|
39
|
+
mnemonic,
|
|
40
|
+
addresses: {
|
|
41
|
+
evm: evm.address,
|
|
42
|
+
solana: sol.address
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
saveConfig({ preferredProtocol: "x402" });
|
|
46
|
+
process.stdout.write(`${JSON.stringify({
|
|
47
|
+
base: evm.address,
|
|
48
|
+
tempo: evm.address,
|
|
49
|
+
solana: sol.address
|
|
50
|
+
})}\n`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
13
53
|
prompts.intro(pc.cyan("x402-proxy setup"));
|
|
14
54
|
prompts.log.info("This will generate a single BIP-39 mnemonic that derives wallets for both Solana and EVM chains.");
|
|
15
55
|
const action = await prompts.select({
|
|
@@ -26,7 +66,6 @@ async function runSetup(opts) {
|
|
|
26
66
|
prompts.cancel("Setup cancelled.");
|
|
27
67
|
process.exit(0);
|
|
28
68
|
}
|
|
29
|
-
let mnemonic;
|
|
30
69
|
if (action === "generate") {
|
|
31
70
|
mnemonic = generateMnemonic();
|
|
32
71
|
prompts.log.warn("Write down your mnemonic and store it safely. It will NOT be shown again.");
|
|
@@ -109,20 +148,49 @@ async function runSetup(opts) {
|
|
|
109
148
|
prompts.outro(pc.green("Setup complete!"));
|
|
110
149
|
}
|
|
111
150
|
const setupCommand = buildCommand({
|
|
112
|
-
docs: {
|
|
151
|
+
docs: {
|
|
152
|
+
brief: "Set up x402-proxy wallet (generate new or import existing mnemonic)",
|
|
153
|
+
fullDescription: `Set up x402-proxy wallet interactively, or use --non-interactive for automated environments.
|
|
154
|
+
|
|
155
|
+
Non-interactive mode auto-generates a wallet and outputs JSON to stdout:
|
|
156
|
+
$ npx x402-proxy setup --non-interactive
|
|
157
|
+
{"base":"0x...","tempo":"0x...","solana":"..."}
|
|
158
|
+
|
|
159
|
+
Import an existing mnemonic non-interactively:
|
|
160
|
+
$ npx x402-proxy setup --non-interactive --import-mnemonic "word1 word2 ... word24"
|
|
161
|
+
|
|
162
|
+
If a wallet already exists, --non-interactive outputs the existing addresses.`
|
|
163
|
+
},
|
|
113
164
|
parameters: {
|
|
114
|
-
flags: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
165
|
+
flags: {
|
|
166
|
+
force: {
|
|
167
|
+
kind: "boolean",
|
|
168
|
+
brief: "Overwrite existing configuration",
|
|
169
|
+
default: false
|
|
170
|
+
},
|
|
171
|
+
nonInteractive: {
|
|
172
|
+
kind: "boolean",
|
|
173
|
+
brief: "Auto-generate wallet and output addresses as JSON (no prompts)",
|
|
174
|
+
default: false
|
|
175
|
+
},
|
|
176
|
+
importMnemonic: {
|
|
177
|
+
kind: "parsed",
|
|
178
|
+
brief: "Import a BIP-39 mnemonic (use with --non-interactive)",
|
|
179
|
+
parse: String,
|
|
180
|
+
optional: true
|
|
181
|
+
}
|
|
182
|
+
},
|
|
119
183
|
positional: {
|
|
120
184
|
kind: "tuple",
|
|
121
185
|
parameters: []
|
|
122
186
|
}
|
|
123
187
|
},
|
|
124
188
|
async func(flags) {
|
|
125
|
-
await runSetup({
|
|
189
|
+
await runSetup({
|
|
190
|
+
force: flags.force,
|
|
191
|
+
nonInteractive: flags.nonInteractive,
|
|
192
|
+
importMnemonic: flags.importMnemonic
|
|
193
|
+
});
|
|
126
194
|
}
|
|
127
195
|
});
|
|
128
196
|
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -74,7 +74,7 @@ x402-proxy wallet export-key mnemonic # bare mnemonic to stdout
|
|
|
74
74
|
Quick setup (auto-detects installed AI clients):
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
|
-
x402-proxy mcp add
|
|
77
|
+
x402-proxy mcp add surf https://surf.cascade.fyi/mcp
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
Or drop into your client config manually:
|
|
@@ -82,18 +82,28 @@ Or drop into your client config manually:
|
|
|
82
82
|
```json
|
|
83
83
|
{
|
|
84
84
|
"mcpServers": {
|
|
85
|
-
"
|
|
85
|
+
"surf": {
|
|
86
86
|
"command": "npx",
|
|
87
|
-
"args": ["x402-proxy", "mcp", "https://
|
|
88
|
-
"env": {
|
|
89
|
-
"X402_PROXY_WALLET_MNEMONIC": "your 24 words here"
|
|
90
|
-
}
|
|
87
|
+
"args": ["-y", "x402-proxy", "mcp", "https://surf.cascade.fyi/mcp"]
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
91
|
```
|
|
95
92
|
|
|
96
|
-
|
|
93
|
+
For OpenClaw:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
openclaw mcp set surf '{"command":"npx","args":["-y","x402-proxy","mcp","https://surf.cascade.fyi/mcp"]}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The wallet is auto-generated on first run and stored at `~/.config/x402-proxy/wallet.json`. No env vars needed. The proxy intercepts 402 responses, pays automatically, forwards the result. Supports StreamableHTTP and SSE.
|
|
100
|
+
|
|
101
|
+
For non-interactive setup (e.g. automated provisioning):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx x402-proxy setup --non-interactive
|
|
105
|
+
# outputs: {"evm":"0x...","solana":"..."}
|
|
106
|
+
```
|
|
97
107
|
|
|
98
108
|
## Wallet & env vars
|
|
99
109
|
|
package/dist/setup-CJgw4opQ.js
DELETED