@newblock/iautopay-mcp 0.0.5 → 0.0.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/CLAUDE_CLI_MCP_SETUP.md +16 -13
- package/README.md +120 -171
- package/dist/iautopay-mcp.js +101 -104
- package/mcp-config.json.example +2 -2
- package/package.json +1 -1
package/CLAUDE_CLI_MCP_SETUP.md
CHANGED
|
@@ -7,11 +7,12 @@ This project supports both OpenCode and Claude CLI MCP servers.
|
|
|
7
7
|
Configuration is automatically generated at installation via `opencode.json`.
|
|
8
8
|
|
|
9
9
|
Available commands:
|
|
10
|
+
- `/autopay_guide` - Show iAutoPay usage guide
|
|
10
11
|
- `/autopay_toA` - Quick payment of 0.01 USDC
|
|
11
12
|
- `/autopay_toB` - Quick payment of 0.05 USDC (with confirmation)
|
|
12
|
-
- `/
|
|
13
|
-
- `/
|
|
14
|
-
- `/
|
|
13
|
+
- `/autopay_buy_apikey_1day` - Buy 1-day API Key (0.09 USDC)
|
|
14
|
+
- `/autopay_buy_apikey_7days` - Buy 7-day API Key (0.49 USDC)
|
|
15
|
+
- `/autopay_get_info` - Get iAutoPay server information
|
|
15
16
|
|
|
16
17
|
## Claude CLI
|
|
17
18
|
|
|
@@ -28,7 +29,7 @@ This method uses the configuration file generated at `mcp-config.json` during in
|
|
|
28
29
|
|
|
29
30
|
```bash
|
|
30
31
|
# Add MCP server to Claude CLI
|
|
31
|
-
BUYER_PRIVATE_KEY="your_private_key" claude mcp add
|
|
32
|
+
BUYER_PRIVATE_KEY="your_private_key" claude mcp add autopay \
|
|
32
33
|
-e BUYER_PRIVATE_KEY="your_private_key" \
|
|
33
34
|
-- npx -y @newblock/iautopay-mcp
|
|
34
35
|
|
|
@@ -36,7 +37,7 @@ BUYER_PRIVATE_KEY="your_private_key" claude mcp add iauto-pay \
|
|
|
36
37
|
claude mcp list
|
|
37
38
|
|
|
38
39
|
# Should show:
|
|
39
|
-
#
|
|
40
|
+
# autopay: npx -y @newblock/iautopay-mcp - ✓ Connected
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
After adding, you can simply run `claude` without any additional flags.
|
|
@@ -47,7 +48,7 @@ After adding, you can simply run `claude` without any additional flags.
|
|
|
47
48
|
# Create mcp-config.json manually:
|
|
48
49
|
{
|
|
49
50
|
"mcpServers": {
|
|
50
|
-
"
|
|
51
|
+
"autopay": {
|
|
51
52
|
"command": "npx",
|
|
52
53
|
"args": ["-y", "@newblock/iautopay-mcp"],
|
|
53
54
|
"env": {
|
|
@@ -65,10 +66,12 @@ claude --mcp-config mcp-config.json
|
|
|
65
66
|
|
|
66
67
|
When using Claude CLI with MCP enabled, the following tools are available:
|
|
67
68
|
|
|
68
|
-
- `
|
|
69
|
-
- `
|
|
70
|
-
- `
|
|
71
|
-
- `
|
|
69
|
+
- `guide` - Display complete iAutoPay usage guide
|
|
70
|
+
- `info` - Get server information (stock, prices, network config)
|
|
71
|
+
- `buy_apikey` - Buy API key (supports 1/7 day durations)
|
|
72
|
+
- `pay_stablecoin` - Pay stablecoin to specified address
|
|
73
|
+
- `sync_opencode_config` - Auto-configure opencode.json shortcuts
|
|
74
|
+
- `refresh_pricing` - Refresh prices from server
|
|
72
75
|
|
|
73
76
|
## Usage Examples
|
|
74
77
|
|
|
@@ -91,14 +94,14 @@ claude
|
|
|
91
94
|
claude mcp list
|
|
92
95
|
|
|
93
96
|
# Get details of specific server
|
|
94
|
-
claude mcp get
|
|
97
|
+
claude mcp get autopay
|
|
95
98
|
```
|
|
96
99
|
|
|
97
100
|
## Removing MCP Server
|
|
98
101
|
|
|
99
102
|
If you added to local config:
|
|
100
103
|
```bash
|
|
101
|
-
claude mcp remove
|
|
104
|
+
claude mcp remove autopay -s local
|
|
102
105
|
```
|
|
103
106
|
|
|
104
107
|
If using config file, simply remove the `--mcp-config mcp-config.json` flag when running `claude`.
|
|
@@ -112,7 +115,7 @@ If using config file, simply remove the `--mcp-config mcp-config.json` flag when
|
|
|
112
115
|
|
|
113
116
|
**Tools not showing up:**
|
|
114
117
|
1. Verify MCP connection: `claude mcp list`
|
|
115
|
-
2. Check server health: `claude mcp get
|
|
118
|
+
2. Check server health: `claude mcp get autopay`
|
|
116
119
|
3. Restart Claude CLI
|
|
117
120
|
|
|
118
121
|
**Wrong environment (dev vs prod):**
|
package/README.md
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
# iAutoPay MCP Service
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🚀 **Smart Payment**: Small automatic payments, large amount manual approval
|
|
8
|
-
- 💳 **USDC Payments**: Support USDC-based payments on Base chain
|
|
9
|
-
- 🔐 **Secure**: Environment variable based configuration for private keys
|
|
10
|
-
- 🤖 **AI-Native**: Full MCP integration designed for AI agents
|
|
11
|
-
- 💸 **Fixed Transfer**: Preset fixed transfer account command, direct transfer by command
|
|
12
|
-
- 🔑 **API Key Purchase**: Support GLM4.7 LLM API Key purchase service with dynamic pricing
|
|
13
|
-
|
|
14
|
-
## Supported Models
|
|
15
|
-
|
|
16
|
-
API keys purchased through this service provide access to:
|
|
17
|
-
- `z-ai/glm4.7` (GLM4.7 with thinking chain support)
|
|
18
|
-
- `minimaxai/minimax-m2.1` (MiniMax general LLM)
|
|
19
|
-
- `deepseek-ai/deepseek-v3.2` (DeepSeek with thinking chain)
|
|
3
|
+
iAutoPay is an MCP (Model Context Protocol) service that enables AI agents to automatically pay for purchases. It supports all EVM-compatible public chains and USDC payments. Agents can use it to automatically purchase paid AI-related services and data.
|
|
20
4
|
|
|
21
5
|
## Installation
|
|
22
6
|
|
|
@@ -34,27 +18,10 @@ This will automatically download and cache the package.
|
|
|
34
18
|
|
|
35
19
|
```bash
|
|
36
20
|
npm install -g @newblock/iautopay-mcp
|
|
37
|
-
@newblock/iautopay-mcp
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Option 3: Project Dependency
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm install @newblock/iautopay-mcp
|
|
44
|
-
node node_modules/@newblock/iautopay-mcp/dist/iautopay-mcp.js
|
|
45
21
|
```
|
|
46
22
|
|
|
47
23
|
## Configuration
|
|
48
24
|
|
|
49
|
-
### Environment Variables
|
|
50
|
-
|
|
51
|
-
Set required environment variables:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
# Required: Your wallet private key for signing payments
|
|
55
|
-
export BUYER_PRIVATE_KEY="0x..."
|
|
56
|
-
```
|
|
57
|
-
|
|
58
25
|
### OpenCode Configuration
|
|
59
26
|
|
|
60
27
|
Add to your `opencode.json`:
|
|
@@ -63,12 +30,12 @@ Add to your `opencode.json`:
|
|
|
63
30
|
{
|
|
64
31
|
"$schema": "https://opencode.ai/config.json",
|
|
65
32
|
"mcp": {
|
|
66
|
-
"
|
|
33
|
+
"autopay": {
|
|
67
34
|
"type": "local",
|
|
68
35
|
"command": ["npx", "-y", "@newblock/iautopay-mcp"],
|
|
69
36
|
"enabled": true,
|
|
70
37
|
"environment": {
|
|
71
|
-
"BUYER_PRIVATE_KEY": "
|
|
38
|
+
"BUYER_PRIVATE_KEY": "0xEVM_wallet_private_key"
|
|
72
39
|
}
|
|
73
40
|
}
|
|
74
41
|
}
|
|
@@ -83,7 +50,7 @@ For detailed instructions on using Claude CLI with MCP, see [CLAUDE_CLI_MCP_SETU
|
|
|
83
50
|
|
|
84
51
|
```bash
|
|
85
52
|
# Install and add to Claude CLI
|
|
86
|
-
BUYER_PRIVATE_KEY="your_private_key" claude mcp add
|
|
53
|
+
BUYER_PRIVATE_KEY="your_private_key" claude mcp add autopay \
|
|
87
54
|
-e BUYER_PRIVATE_KEY="your_private_key" \
|
|
88
55
|
-- npx -y @newblock/iautopay-mcp
|
|
89
56
|
|
|
@@ -98,179 +65,160 @@ Add to your `~/.claude/claude_desktop_config.json`:
|
|
|
98
65
|
```json
|
|
99
66
|
{
|
|
100
67
|
"mcpServers": {
|
|
101
|
-
"
|
|
68
|
+
"autopay": {
|
|
102
69
|
"command": "npx",
|
|
103
|
-
"args": ["@newblock/iautopay-mcp"],
|
|
70
|
+
"args": ["-y", "@newblock/iautopay-mcp"],
|
|
104
71
|
"env": {
|
|
105
|
-
"BUYER_PRIVATE_KEY": "
|
|
72
|
+
"BUYER_PRIVATE_KEY": "0xEVM_wallet_private_key"
|
|
106
73
|
}
|
|
107
74
|
}
|
|
108
75
|
}
|
|
109
76
|
}
|
|
110
77
|
```
|
|
111
78
|
|
|
112
|
-
|
|
79
|
+
> **Basic Knowledge About Cryptocurrency and Wallets**
|
|
80
|
+
>
|
|
81
|
+
> Before using iAutoPay, you need to understand some basic cryptocurrency concepts:
|
|
82
|
+
>
|
|
83
|
+
> - **Wallet Private Key**: A key similar to a password, used to sign transactions. **Keep it safe and never share it with anyone!**
|
|
84
|
+
> - **Testnet**: A network for testing where test coins can be obtained for free from faucets
|
|
85
|
+
> - **Mainnet**: The official network that requires real funds
|
|
86
|
+
> - **USDC**: A stablecoin pegged to US dollar (1 USDC ≈ 1 USD)
|
|
87
|
+
>
|
|
88
|
+
> How to get test coins:
|
|
89
|
+
> 1. Visit the Base Sepolia faucet: https://sepoliafaucet.com/
|
|
90
|
+
> 2. Enter your wallet address
|
|
91
|
+
> 3. Get free test USDC
|
|
92
|
+
>
|
|
93
|
+
> Security tips:
|
|
94
|
+
> - Never share your private key
|
|
95
|
+
> - Test thoroughly on testnet before using mainnet
|
|
96
|
+
> - Use a dedicated wallet, don't store large amounts of funds
|
|
97
|
+
>
|
|
98
|
+
> For more blockchain basics, refer to: https://www.wtf.academy/zh/course/ethers101/HelloVitalik
|
|
113
99
|
|
|
114
|
-
###
|
|
115
|
-
|
|
116
|
-
⭐ **FIRST TIME?** Run this guide to learn how to use iAutoPay tools and commands.
|
|
117
|
-
|
|
118
|
-
**Parameters:**
|
|
119
|
-
```json
|
|
120
|
-
{}
|
|
121
|
-
```
|
|
100
|
+
### opencode autopay command loading success
|
|
122
101
|
|
|
123
|
-
|
|
124
|
-
- Complete guide with all tools and commands
|
|
125
|
-
- Pricing information
|
|
126
|
-
- Network configuration
|
|
102
|
+

|
|
127
103
|
|
|
128
|
-
|
|
104
|
+
## MCP Tools Usage
|
|
129
105
|
|
|
130
|
-
|
|
106
|
+
### Quick Commands Configuration
|
|
131
107
|
|
|
132
|
-
|
|
133
|
-
```json
|
|
134
|
-
{}
|
|
135
|
-
```
|
|
108
|
+
Add these shortcuts to your `opencode.json` for faster access:
|
|
136
109
|
|
|
137
|
-
**Returns:**
|
|
138
110
|
```json
|
|
139
111
|
{
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
112
|
+
"$schema": "https://opencode.ai/config.json",
|
|
113
|
+
"mcp": {
|
|
114
|
+
"autopay": {
|
|
115
|
+
"type": "local",
|
|
116
|
+
"command": ["npx", "-y", "@newblock/iautopay-mcp"],
|
|
117
|
+
"enabled": true,
|
|
118
|
+
"environment": {
|
|
119
|
+
"BUYER_PRIVATE_KEY": "0xEVM_wallet_private_key"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
145
122
|
},
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
|
|
123
|
+
"command": {
|
|
124
|
+
"autopay_toA": {
|
|
125
|
+
"template": "Use pay_stablecoin tool to pay 0.01 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c, params: to=\"0x1a85156c2943b63febeee7883bd84a7d1cf0da0c\", amount=\"10000\"",
|
|
126
|
+
"description": "Pay 0.01 USDC to account A"
|
|
127
|
+
},
|
|
128
|
+
"autopay_toB": {
|
|
129
|
+
"template": "First use question tool to ask user confirmation with options: 1) Confirm (continue payment), 2) Cancel (do not pay). Show payment details: Pay 0.05 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c, params: to=\"0x1a85156c2943b63febeee7883bd84a7d1cf0da0c\", amount=\"50000\". Only proceed if user confirms.",
|
|
130
|
+
"description": "Pay 0.05 USDC to account A (requires confirmation)"
|
|
131
|
+
},
|
|
132
|
+
"autopay_buy_apikey_1day": {
|
|
133
|
+
"template": "Use buy_apikey tool to buy 1-day API Key, params: {\"duration\": 1}",
|
|
134
|
+
"description": "Buy 1-day API Key (0.09 USDC)"
|
|
135
|
+
},
|
|
136
|
+
"autopay_buy_apikey_7days": {
|
|
137
|
+
"template": "Use buy_apikey tool to buy 7-day API Key, params: {\"duration\": 7}",
|
|
138
|
+
"description": "Buy 7-day API Key (0.49 USDC)"
|
|
139
|
+
},
|
|
140
|
+
"autopay_get_info": {
|
|
141
|
+
"template": "Use info tool to get server information (API Key stock, prices, network config)",
|
|
142
|
+
"description": "Get iAutoPay server information"
|
|
143
|
+
},
|
|
144
|
+
"autopay_guide": {
|
|
145
|
+
"template": "Use guide tool to show iAutoPay usage guide",
|
|
146
|
+
"description": "Show iAutoPay usage guide"
|
|
147
|
+
}
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
```
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Purchase an API key with optional duration (1/7/30 days).
|
|
156
|
-
|
|
157
|
-
**Parameters:**
|
|
158
|
-
```json
|
|
159
|
-
{
|
|
160
|
-
"duration": 1
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Duration Options:**
|
|
165
|
-
- `1`: 1 day validity
|
|
166
|
-
- `7`: 7 days validity
|
|
167
|
-
- `30`: 30 days validity
|
|
152
|
+
Run `sync_opencode_config` tool to auto-add these commands to your config.
|
|
168
153
|
|
|
169
|
-
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"apiKey": "sk-ABCD12345678901234567890",
|
|
173
|
-
"txHash": "0x4d757c7e121ad31607ee1e9c5af65bfe13b82c112fcf077638814c031ecc3a6b",
|
|
174
|
-
"payState": "paid",
|
|
175
|
-
"price": "0.09 USDC",
|
|
176
|
-
"deductedAmount": "0.09 USDC",
|
|
177
|
-
"currentBalance": "9.91 USDC"
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### pay_stablecoin
|
|
182
|
-
|
|
183
|
-
Pay stablecoin to any address using EIP-3009.
|
|
184
|
-
|
|
185
|
-
**Parameters:**
|
|
186
|
-
```json
|
|
187
|
-
{
|
|
188
|
-
"to": "0x1234567890123456789012345678901234567890",
|
|
189
|
-
"amount": "100000"
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**Amount is in smallest units** (e.g., 100000 = 0.1 USDC, 1000000 = 1 USDC)
|
|
194
|
-
|
|
195
|
-
**Returns:**
|
|
196
|
-
```json
|
|
197
|
-
{
|
|
198
|
-
"from": "0x...",
|
|
199
|
-
"to": "0x...",
|
|
200
|
-
"amount": "0.1 USDC",
|
|
201
|
-
"txHash": "0x...",
|
|
202
|
-
"deductedAmount": "0.1 USDC",
|
|
203
|
-
"currentBalance": "9.9 USDC"
|
|
204
|
-
}
|
|
205
|
-
```
|
|
154
|
+
### Opencode Quick Commands Usage Examples
|
|
206
155
|
|
|
207
|
-
###
|
|
156
|
+
### 1: /autopay_guide
|
|
208
157
|
|
|
209
|
-
|
|
158
|
+
Output:
|
|
210
159
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
160
|
+
iAutoPay Usage Guide
|
|
161
|
+
Available Tools
|
|
162
|
+
- guide - Display complete usage guide
|
|
163
|
+
- info - Get server information (stock, prices, network config)
|
|
164
|
+
- buy_apikey - Buy API key (supports 1/7 day durations)
|
|
165
|
+
- pay_stablecoin - Pay stablecoin to specified address
|
|
166
|
+
- sync_opencode_config - Auto-configure opencode.json shortcuts
|
|
167
|
+
- refresh_pricing - Refresh prices from server
|
|
168
|
+
Quick Commands
|
|
169
|
+
- autopay_toA - Quick pay 0.01 USDC
|
|
170
|
+
- autopay_toB - Pay 0.1 USDC (requires confirmation)
|
|
171
|
+
- autopay_buy_apikey_1day - Buy 1-day API Key (0.1 USDC)
|
|
172
|
+
- autopay_buy_apikey_7days - Buy 7-day API Key (0.9 USDC)
|
|
173
|
+
- autopay_get_info - Quick get server information
|
|
174
|
+
Network Information
|
|
175
|
+
- Testnet: Base Sepolia (84532)
|
|
176
|
+
- Mainnet: Base Mainnet (8453)
|
|
177
|
+
- Current Network: Base Sepolia (84532)
|
|
178
|
+
Pricing
|
|
179
|
+
- 1 day: 0.1 USDC
|
|
180
|
+
- 7 days: 0.9 USDC
|
|
181
|
+
Environment: dev
|
|
215
182
|
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"message": "✅ 已添加 7 个命令到 opencode.json"
|
|
220
|
-
}
|
|
221
|
-
```
|
|
183
|
+
### 2: /autopay_toA
|
|
222
184
|
|
|
223
|
-
|
|
185
|
+
Output:
|
|
224
186
|
|
|
225
|
-
|
|
187
|
+
Paying 0.01 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c...
|
|
188
|
+
Transaction hash: 0xabc123...
|
|
189
|
+
Payment successful!
|
|
226
190
|
|
|
227
|
-
|
|
228
|
-
```json
|
|
229
|
-
{}
|
|
230
|
-
```
|
|
191
|
+
### 3: /autopay_toB
|
|
231
192
|
|
|
232
|
-
|
|
233
|
-
```json
|
|
234
|
-
{
|
|
235
|
-
"1day": "0.09 USDC",
|
|
236
|
-
"7days": "0.49 USDC",
|
|
237
|
-
"30days": "0.99 USDC"
|
|
238
|
-
}
|
|
239
|
-
```
|
|
193
|
+
Output:
|
|
240
194
|
|
|
241
|
-
|
|
195
|
+
Please confirm payment:
|
|
196
|
+
- Amount: 0.05 USDC
|
|
197
|
+
- Recipient: 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c
|
|
198
|
+
- Network: Base Sepolia (84532)
|
|
242
199
|
|
|
243
|
-
|
|
200
|
+
Select: 1) Confirm 2) Cancel
|
|
201
|
+
[User selects confirm]
|
|
244
202
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
- USDC Address: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
|
|
249
|
-
- Token Name: "USDC"
|
|
203
|
+
Paying 0.05 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c...
|
|
204
|
+
Transaction hash: 0xdef456...
|
|
205
|
+
Payment successful!
|
|
250
206
|
|
|
251
|
-
###
|
|
252
|
-
- Chain ID: 8453
|
|
253
|
-
- RPC URL: https://mainnet.base.org
|
|
254
|
-
- USDC Address: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
|
|
255
|
-
- Token Name: "USD Coin"
|
|
207
|
+
### 4: /autopay_buy_apikey_1day
|
|
256
208
|
|
|
257
|
-
|
|
209
|
+
Output:
|
|
258
210
|
|
|
259
|
-
|
|
211
|
+
Purchasing 1-day API Key...
|
|
212
|
+
Price: 0.09 USDC
|
|
213
|
+
Processing payment...
|
|
214
|
+
Transaction hash: 0xghi789...
|
|
215
|
+
Purchase successful!
|
|
260
216
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
Use buy_apikey tool with duration: 1
|
|
264
|
-
Receive API key in response
|
|
265
|
-
```
|
|
217
|
+
Your API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
218
|
+
Valid for: 1 day
|
|
266
219
|
|
|
267
|
-
|
|
220
|
+
👉 Check [LLM Services Guide](doc/LLM_SERVICES_GUIDE.md) to learn how to use the API Key to access supported models
|
|
268
221
|
|
|
269
|
-
```
|
|
270
|
-
Use pay_stablecoin tool with to: "0x1a85156c2943b63febeee7883bd84a7d1cf0da0c" and amount: "10000"
|
|
271
|
-
Transaction executes automatically
|
|
272
|
-
Receive transaction hash
|
|
273
|
-
```
|
|
274
222
|
|
|
275
223
|
## License
|
|
276
224
|
|
|
@@ -286,5 +234,6 @@ For issues and questions, please use the [GitHub Issues](https://github.com/newb
|
|
|
286
234
|
|
|
287
235
|
## Documentation
|
|
288
236
|
|
|
237
|
+
- [LLM Services Guide](doc/LLM_SERVICES_GUIDE.md) - Supported models and API Key purchase guide
|
|
289
238
|
- [CLAUDE_CLI_MCP_SETUP.md](CLAUDE_CLI_MCP_SETUP.md) - Claude CLI integration guide
|
|
290
239
|
- [mcp-config.json.example](mcp-config.json.example) - MCP configuration template
|
package/dist/iautopay-mcp.js
CHANGED
|
@@ -53,10 +53,10 @@ const paymentRequirementsSchema = z.object({
|
|
|
53
53
|
price: z.string().min(1),
|
|
54
54
|
payee: z.string().optional(),
|
|
55
55
|
});
|
|
56
|
-
const payStablecoinInput = z.object({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
56
|
+
// const payStablecoinInput = z.object({
|
|
57
|
+
// to: z.string().min(1),
|
|
58
|
+
// amount: z.string().min(1),
|
|
59
|
+
// });
|
|
60
60
|
const buyApikeyInput = z.object({
|
|
61
61
|
duration: z.number().optional().refine(val => !val || [1, 7, 30].includes(val), {
|
|
62
62
|
message: "Duration must be 1, 7, or 30 days"
|
|
@@ -64,7 +64,7 @@ const buyApikeyInput = z.object({
|
|
|
64
64
|
});
|
|
65
65
|
const getInfoInput = z.object({});
|
|
66
66
|
const guideInput = z.object({});
|
|
67
|
-
const syncOpencodeConfigInput = z.object({});
|
|
67
|
+
// const syncOpencodeConfigInput = z.object({});
|
|
68
68
|
const refreshPricingInput = z.object({});
|
|
69
69
|
// ============================================================================
|
|
70
70
|
// Dynamic Pricing from Fact API
|
|
@@ -326,16 +326,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
326
326
|
description: "Purchase an API key with optional duration (1/7/30 days). Prices: 1 day=0.9 USDC, 7 days=4.9 USDC, 30 days=9.9 USDC. Run 'info' first to confirm stock.",
|
|
327
327
|
inputSchema: zodToJsonSchema(buyApikeyInput),
|
|
328
328
|
},
|
|
329
|
-
{
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
},
|
|
329
|
+
// {
|
|
330
|
+
// name: "pay_stablecoin",
|
|
331
|
+
// description: "Pay stablecoin to any address using EIP-3009. Amount is in smallest unit (e.g., 100000 = 0.1 USDC).",
|
|
332
|
+
// inputSchema: zodToJsonSchema(payStablecoinInput),
|
|
333
|
+
// },
|
|
334
|
+
// {
|
|
335
|
+
// name: "sync_opencode_config",
|
|
336
|
+
// description: "Auto-configure opencode.json with quick commands (autopay_toA, autopay_toB, etc.)",
|
|
337
|
+
// inputSchema: zodToJsonSchema(syncOpencodeConfigInput),
|
|
338
|
+
// },
|
|
339
339
|
{
|
|
340
340
|
name: "refresh_pricing",
|
|
341
341
|
description: "Refresh pricing from API. Use this if prices are changed on the server.",
|
|
@@ -346,21 +346,20 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
346
346
|
});
|
|
347
347
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
348
348
|
const { name, arguments: args } = request.params;
|
|
349
|
-
if (name === "pay_stablecoin") {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
349
|
+
// if (name === "pay_stablecoin") {
|
|
350
|
+
// const parsed = payStablecoinInput.parse(args);
|
|
351
|
+
// try {
|
|
352
|
+
// const result = await payStablecoin({
|
|
353
|
+
// to: parsed.to,
|
|
354
|
+
// amount: parsed.amount,
|
|
355
|
+
// asset: CURRENT_USDC,
|
|
356
|
+
// isTestnet: (CUR_ENV as string) === 'dev',
|
|
357
|
+
// });
|
|
358
|
+
// return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
359
|
+
// } catch (error) {
|
|
360
|
+
// throw error;
|
|
361
|
+
// }
|
|
362
|
+
// }
|
|
364
363
|
if (name === "buy_apikey") {
|
|
365
364
|
const parsed = buyApikeyInput.parse(args);
|
|
366
365
|
const duration = parsed.duration || 1;
|
|
@@ -474,80 +473,78 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
474
473
|
};
|
|
475
474
|
return { content: [{ type: "text", text: JSON.stringify(toolsData, null, 2) }] };
|
|
476
475
|
}
|
|
477
|
-
if (name === "sync_opencode_config") {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
}
|
|
476
|
+
// if (name === "sync_opencode_config") {
|
|
477
|
+
// const parsed = syncOpencodeConfigInput.parse(args);
|
|
478
|
+
// try {
|
|
479
|
+
// const fs = await import('fs/promises');
|
|
480
|
+
// const opencodePath = '/Users/michael/opc/proj/iautopay/opencode.json';
|
|
481
|
+
// const opencodeData = JSON.parse(await fs.readFile(opencodePath, 'utf-8'));
|
|
482
|
+
// const pricing = CACHED_PRICING || {
|
|
483
|
+
// "1day": "0.09 USDC",
|
|
484
|
+
// "7days": "0.49 USDC",
|
|
485
|
+
// "30days": "0.99 USDC"
|
|
486
|
+
// };
|
|
487
|
+
// const requiredCommands = {
|
|
488
|
+
// "autopay_toA": {
|
|
489
|
+
// "template": "使用 pay_stablecoin 工具向 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c 支付 0.01 USDC,参数为:to=\"0x1a85156c2943b63febeee7883bd84a7d1cf0da0c\", amount=\"10000\"",
|
|
490
|
+
// "description": "支付0.01 USDC给A账户"
|
|
491
|
+
// },
|
|
492
|
+
// "autopay_toB": {
|
|
493
|
+
// "template": "首先使用 question 工具询问用户确认,选项包括:1) 确认(继续支付),2) 取消(不进行支付)。显示支付详情:向 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c 支付 0.05 USDC,参数为:to=\"0x1a85156c2943b63febeee7883bd84a7d1cf0da0c\", amount=\"50000\"。只有用户选择确认时才继续支付。",
|
|
494
|
+
// "description": "支付0.05 USDC给A账户(需要确认)"
|
|
495
|
+
// },
|
|
496
|
+
// "autopay_buy_apikey_1day": {
|
|
497
|
+
// "template": "使用 buy_apikey 工具购买1天API Key,参数为:{\"duration\": 1}",
|
|
498
|
+
// "description": `购买1天API Key(${pricing["1day"]})`
|
|
499
|
+
// },
|
|
500
|
+
// "autopay_buy_apikey_7days": {
|
|
501
|
+
// "template": "使用 buy_apikey 工具购买7天API Key,参数为:{\"duration\": 7}",
|
|
502
|
+
// "description": `购买7天API Key(${pricing["7days"]})`
|
|
503
|
+
// },
|
|
504
|
+
// "autopay_buy_apikey_30days": {
|
|
505
|
+
// "template": "使用 buy_apikey 工具购买30天API Key,参数为:{\"duration\": 30}",
|
|
506
|
+
// "description": `购买30天API Key(${pricing["30days"]})`
|
|
507
|
+
// },
|
|
508
|
+
// "autopay_get_info": {
|
|
509
|
+
// "template": "使用 info 工具获取服务器信息(API Key 库存、价格、网络配置)",
|
|
510
|
+
// "description": "获取iAutoPay服务器信息"
|
|
511
|
+
// },
|
|
512
|
+
// "autopay_guide": {
|
|
513
|
+
// "template": "使用 guide 工具显示 iAutoPay 使用指南",
|
|
514
|
+
// "description": "显示iAutoPay使用指南"
|
|
515
|
+
// }
|
|
516
|
+
// };
|
|
517
|
+
// let addedCommands: string[] = [];
|
|
518
|
+
// let updatedCommands: string[] = [];
|
|
519
|
+
// if (!opencodeData.command) {
|
|
520
|
+
// opencodeData.command = {};
|
|
521
|
+
// }
|
|
522
|
+
// for (const [key, value] of Object.entries(requiredCommands)) {
|
|
523
|
+
// if (!opencodeData.command[key]) {
|
|
524
|
+
// opencodeData.command[key] = value;
|
|
525
|
+
// addedCommands.push(key);
|
|
526
|
+
// }
|
|
527
|
+
// }
|
|
528
|
+
// if (addedCommands.length > 0) {
|
|
529
|
+
// await fs.writeFile(opencodePath, JSON.stringify(opencodeData, null, 2), 'utf-8');
|
|
530
|
+
// return {
|
|
531
|
+
// content: [{
|
|
532
|
+
// type: "text",
|
|
533
|
+
// text: `✅ 已添加 ${addedCommands.length} 个命令到 opencode.json:\n${addedCommands.map(c => ` - ${c}`).join('\n')}`
|
|
534
|
+
// }]
|
|
535
|
+
// };
|
|
536
|
+
// } else {
|
|
537
|
+
// return {
|
|
538
|
+
// content: [{
|
|
539
|
+
// type: "text",
|
|
540
|
+
// text: "✅ 所有 autopay_ 命令已存在,无需更新"
|
|
541
|
+
// }]
|
|
542
|
+
// };
|
|
543
|
+
// }
|
|
544
|
+
// } catch (error) {
|
|
545
|
+
// throw new Error(`同步配置失败: ${error}`);
|
|
546
|
+
// }
|
|
547
|
+
// }
|
|
551
548
|
if (name === "refresh_pricing") {
|
|
552
549
|
const parsed = refreshPricingInput.parse(args);
|
|
553
550
|
try {
|
package/mcp-config.json.example
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newblock/iautopay-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "iAutoPay is an MCP service that enables AI agents to automatically pay for purchases. It currently runs on Base chain (operated by Coinbase) and supports USDC payments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/iautopay-mcp.js",
|