moltspay 1.4.1 → 1.5.0
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 +45 -0
- package/dist/cli/index.js +10 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +10 -8
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/index.js +10 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +10 -8
- package/dist/client/index.mjs.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/index.d.mts +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +1498 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/index.mjs +1492 -0
- package/dist/mcp/index.mjs.map +1 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ MoltsPay enables agent-to-agent commerce using the [x402 protocol](https://www.x
|
|
|
27
27
|
- **Multi-chain** - Base, Polygon, Solana, BNB, Tempo (mainnet & testnet)
|
|
28
28
|
- **Agent-to-Agent** - Complete A2A payment flow support
|
|
29
29
|
- **Multi-VM** - EVM chains + Solana (SVM) with unified API
|
|
30
|
+
- **MCP Server** - Expose wallet + payments to Claude Desktop, Cursor, and other MCP hosts
|
|
30
31
|
|
|
31
32
|
## Installation
|
|
32
33
|
|
|
@@ -133,6 +134,50 @@ npx moltspay pay https://server.com service-id \
|
|
|
133
134
|
--chain tempo_moderato --prompt "test"
|
|
134
135
|
```
|
|
135
136
|
|
|
137
|
+
## MCP Server (For AI Assistants)
|
|
138
|
+
|
|
139
|
+
MoltsPay ships an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) stdio server that lets MCP-compatible hosts (Cursor, Windsurf, Claude Code, Zed, etc.) browse services, check wallet status, and pay for x402 services on your behalf.
|
|
140
|
+
|
|
141
|
+
It is a thin wrapper around `MoltsPayClient` — wallet custody, spending limits, and all payment protocols (x402, MPP, Solana, BNB) are reused from the SDK.
|
|
142
|
+
|
|
143
|
+
### Setup
|
|
144
|
+
|
|
145
|
+
**1. Create a wallet and set spending limits** (the MCP server refuses to start without a wallet):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npx moltspay init
|
|
149
|
+
npx moltspay config --max-per-tx 2 --max-per-day 10
|
|
150
|
+
npx moltspay fund 5 # or: npx moltspay faucet for testnet
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**2. Point your MCP host at the `moltspay-mcp` binary over stdio:**
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npx -y moltspay-mcp # normal mode
|
|
157
|
+
npx -y moltspay-mcp --dry-run # preview payments without signing
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Each host has its own config file for registering stdio MCP servers — check your host's docs for the exact location. For a safer first run, use `--dry-run` so `moltspay_pay` returns a preview instead of spending real funds.
|
|
161
|
+
|
|
162
|
+
### Tools
|
|
163
|
+
|
|
164
|
+
| Tool | What it does | Destructive? |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `moltspay_status` | Wallet address, balances across all supported chains, spending limits | No |
|
|
167
|
+
| `moltspay_services` | Fetch services manifest from a provider URL; optional `query`/`maxPrice` filter | No |
|
|
168
|
+
| `moltspay_pay` | Execute an x402/MPP/SOL/BNB payment and return the service result | **Yes** |
|
|
169
|
+
| `moltspay_config` | Read or update `maxPerTx` / `maxPerDay` limits | Updates config file |
|
|
170
|
+
|
|
171
|
+
### Safety Layers
|
|
172
|
+
|
|
173
|
+
`moltspay_pay` is the only tool that moves money. Three guards stack on top of the MCP host's own tool-approval prompt:
|
|
174
|
+
|
|
175
|
+
1. **SDK spending limits** — `maxPerTx` / `maxPerDay` enforced before signing.
|
|
176
|
+
2. **Dry-run mode** — launch with `--dry-run` and payments return a preview instead of signing.
|
|
177
|
+
3. **Confirmation gate** — set `MOLTSPAY_MCP_REQUIRE_CONFIRM=1` to require a second tool call (`confirmed: true`) for any payment exceeding `maxPerTx / 10`.
|
|
178
|
+
|
|
179
|
+
Private keys and mnemonics are never exposed over MCP — wallet creation stays on the CLI (`npx moltspay init`) by design. See [`docs/MCP-USAGE.md`](docs/MCP-USAGE.md) for full tool arguments and troubleshooting.
|
|
180
|
+
|
|
136
181
|
## Payment Protocols
|
|
137
182
|
|
|
138
183
|
MoltsPay supports multiple payment protocols, each optimized for different chains:
|
package/dist/cli/index.js
CHANGED
|
@@ -1300,15 +1300,17 @@ Run: npx moltspay approve --chain ${chainName} --spender ${spender}`
|
|
|
1300
1300
|
loadWallet() {
|
|
1301
1301
|
const walletPath = (0, import_path2.join)(this.configDir, "wallet.json");
|
|
1302
1302
|
if ((0, import_fs2.existsSync)(walletPath)) {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1303
|
+
if (process.platform !== "win32") {
|
|
1304
|
+
try {
|
|
1305
|
+
const stats = (0, import_fs2.statSync)(walletPath);
|
|
1306
|
+
const mode = stats.mode & 511;
|
|
1307
|
+
if (mode !== 384) {
|
|
1308
|
+
console.warn(`[MoltsPay] WARNING: wallet.json has insecure permissions (${mode.toString(8)})`);
|
|
1309
|
+
console.warn(`[MoltsPay] Fixing permissions to 0600...`);
|
|
1310
|
+
(0, import_fs2.chmodSync)(walletPath, 384);
|
|
1311
|
+
}
|
|
1312
|
+
} catch {
|
|
1310
1313
|
}
|
|
1311
|
-
} catch (err) {
|
|
1312
1314
|
}
|
|
1313
1315
|
const content = (0, import_fs2.readFileSync)(walletPath, "utf-8");
|
|
1314
1316
|
return JSON.parse(content);
|