@newblock/iautopay-mcp 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NewBlock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,220 @@
1
+ # iautopay-mcp
2
+
3
+ iAutoPay is an MCP service that enables AI agents to automatically pay for purchases. It currently runs on the Base chain (operated by Coinbase) and supports USDC payments. It can be used by intelligent agents to automatically purchase paid AI-related services and data.
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 APIKEY purchase service
13
+
14
+ ## Quick Start with npx (Recommended)
15
+
16
+ No installation required! Just run:
17
+
18
+ ```bash
19
+ npx @newblock/iautopay-mcp
20
+ ```
21
+
22
+ This will automatically download and cache the package.
23
+
24
+ ## Installation
25
+
26
+ ### Option 1: npx (Recommended)
27
+
28
+ ```bash
29
+ npx @newblock/iautopay-mcp
30
+ ```
31
+
32
+ ### Option 2: Global Install
33
+
34
+ ```bash
35
+ npm install -g @newblock/iautopay-mcp
36
+ @newblock/iautopay-mcp
37
+ ```
38
+
39
+ ### Option 3: Project Dependency
40
+
41
+ ```bash
42
+ npm install @newblock/iautopay-mcp
43
+ node node_modules/@newblock/iautopay-mcp/dist/iautopay-mcp.js
44
+ ```
45
+
46
+ ## Configuration
47
+
48
+ ### Environment Variables
49
+
50
+ Set required environment variables:
51
+
52
+ ```bash
53
+ # Required: Your wallet private key for signing payments
54
+ export BUYER_PRIVATE_KEY="0x..."
55
+ ```
56
+
57
+ ### OpenCode Configuration
58
+
59
+ Add to your `opencode.json`:
60
+
61
+ ```json
62
+ {
63
+ "$schema": "https://opencode.ai/config.json",
64
+ "mcp": {
65
+ "iauto-pay": {
66
+ "type": "local",
67
+ "command": ["npx", "-y", "@newblock/iautopay-mcp"],
68
+ "enabled": true,
69
+ "environment": {
70
+ "BUYER_PRIVATE_KEY": "{env:BUYER_PRIVATE_KEY}"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### Claude Code Configuration
78
+
79
+ Add to your `~/.claude/claude_desktop_config.json`:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "iauto-pay": {
85
+ "command": "npx",
86
+ "args": ["@newblock/iautopay-mcp"],
87
+ "env": {
88
+ "BUYER_PRIVATE_KEY": "{env:BUYER_PRIVATE_KEY}"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## MCP Tools
96
+
97
+ ### pay_stablecoin
98
+
99
+ Direct stablecoin payment using EIP-3009 transferWithAuthorization.
100
+
101
+ **Parameters:**
102
+ ```json
103
+ {
104
+ "to": "0x1234567890123456789012345678901234567890",
105
+ "amount": "1000000"
106
+ }
107
+ ```
108
+
109
+ **Usage example:**
110
+ ```
111
+ Use iauto-pay_pay_stablecoin tool to send 1 USDC to 0x123...
112
+ ```
113
+
114
+ **Tip**: You can preset frequently used transfer addresses and amounts to avoid manual input each time, improving convenience.
115
+
116
+ ### buy_glm_apikey
117
+
118
+ **Tip**: You can preset frequently used transfer addresses and amounts to avoid manual input each time, improving convenience.
119
+
120
+ ### buy_glm_apikey
121
+
122
+ Purchase GLM4.7 LLM APIKEY.
123
+
124
+ **Parameters:**
125
+ ```json
126
+ {}
127
+ ```
128
+
129
+ **Returns:**
130
+ ```json
131
+ {
132
+ "apiKey": "sk-ABCD12345678901234567890",
133
+ "txHash": "0x4d757c7e121ad31607ee1e9c5af65bfe13b82c112fcf077638814c031ecc3a6b",
134
+ "payState": "paid"
135
+ }
136
+ **Parameters:**
137
+ ```json
138
+ {}
139
+ ```
140
+
141
+ **Returns:**
142
+ ```json
143
+ {
144
+ "apiKey": "sk-RxmFQ2cLfBaefDFfkYlEGY51E74pl5h06bAHbF41vyCCCC",
145
+ "txHash": "0x4d757c7e121ad31607ee1e9c5af65bfe13b82c112fcf077638814c031ecc3a6b",
146
+ "payState": "paid"
147
+ }
148
+ ```
149
+
150
+ ## Environment Configuration
151
+
152
+ The MCP server supports two environments configured in `src/server.ts`:
153
+
154
+ ### Production (Base Mainnet)
155
+ - Chain ID: 8453
156
+ - RPC URL: https://mainnet.base.org
157
+ - USDC Address: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
158
+ - Token Name: "USD Coin"
159
+
160
+ ### Development (Base Sepolia)
161
+ - Chain ID: 84532
162
+ - RPC URL: https://sepolia.base.org
163
+ - USDC Address: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
164
+ - Token Name: "USDC"
165
+
166
+ To switch environments, modify `CUR_ENV` in `src/server.ts` and rebuild:
167
+
168
+ ```bash
169
+ # Edit src/server.ts: const CUR_ENV: 'dev' | 'prod' = 'prod';
170
+ npm run build
171
+ npm publish
172
+ ```
173
+
174
+ ## Example Workflows
175
+
176
+ ### Example 1: Purchase GLM4.7 API Key
177
+
178
+ ```
179
+ Use iauto-pay_buy_glm_apikey tool to purchase GLM4.7 LLM API Key
180
+ ```
181
+
182
+ ### Example 2: Direct USDC Payment
183
+
184
+ ```
185
+ Use iauto-pay_pay_stablecoin tool to send 0.01 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c
186
+ ```
187
+ Use the iauto-pay_buy_apikey tool to purchase an API key
188
+ ```
189
+
190
+ ### Example 2: Send Payment
191
+
192
+ ```
193
+ Use the iauto-pay_pay_stablecoin tool to send 0.01 USDC to 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c
194
+ ```
195
+
196
+ ## Requirements
197
+
198
+ - Node.js >= 18.0.0
199
+ - npm >= 9.0.0
200
+
201
+ ## Dependencies
202
+
203
+ - @modelcontextprotocol/sdk ^1.0.0
204
+ - @x402/core ^2.3.0
205
+ - @x402/evm ^2.3.0
206
+ - viem ^2.21.35
207
+ - zod ^3.24.1
208
+ - zod-to-json-schema ^3.24.1
209
+
210
+ ## License
211
+
212
+ MIT License - see [LICENSE](LICENSE) file for details.
213
+
214
+ ## Repository
215
+
216
+ [https://github.com/newblock/iautopay](https://github.com/newblock/iautopay)
217
+
218
+ ## Support
219
+
220
+ For issues and questions, please use the [GitHub Issues](https://github.com/newblock/iautopay/issues).
@@ -0,0 +1,173 @@
1
+ # iautopay-mcp
2
+
3
+ iAutoPay 是一个让智能体自动进行支付购买的 MCP 服务,当前使用 Base 链(Coinbase 运营),支持 USDC 进行支付,可用于智能体 Agent 自动购买付费的 AI 相关服务和数据。
4
+
5
+ ## 特性
6
+
7
+ - 🚀 **智能支付**:小额自动支付功能,大额人工审核放行功能
8
+ - 💳 **USDC 支付**:支持基于 Base 链的 USDC 支付购买
9
+ - 🔐 **安全可靠**:基于环境变量的私钥配置
10
+ - 🤖 **AI 原生**:完整的 MCP 集成,专为 AI 智能体设计
11
+ - 💸 **固定转账**:预设固定转账账户命令,命令直接转账
12
+ - 🔑 **API Key 购买**:支持 GLM4.7 LLM 的 APIKEY 购买服务
13
+
14
+ ## 快速开始(推荐)
15
+
16
+ 无需安装!直接运行:
17
+
18
+ ```bash
19
+ npx @newblock/iautopay-mcp
20
+ ```
21
+
22
+ 这将自动下载并缓存该包。
23
+
24
+ ## 安装方式
25
+
26
+ ### 方式 1:npx(推荐)
27
+
28
+ ```bash
29
+ npx @newblock/iautopay-mcp
30
+ ```
31
+
32
+ ### 方式 2:全局安装
33
+
34
+ ```bash
35
+ npm install -g @newblock/iautopay-mcp
36
+ @newblock/iautopay-mcp
37
+ ```
38
+
39
+ ### 方式 3:项目依赖
40
+
41
+ ```bash
42
+ npm install @newblock/iautopay-mcp
43
+ node node_modules/@newblock/iautopay-mcp/dist/iautopay-mcp.js
44
+ ```
45
+
46
+ ## 配置
47
+
48
+ ### 环境变量
49
+
50
+ 设置必需的环境变量:
51
+
52
+ ```bash
53
+ # 必需:用于签名支付的私钥
54
+ export BUYER_PRIVATE_KEY="0x..."
55
+ ```
56
+
57
+ ### OpenCode 配置
58
+
59
+ 在你的 `opencode.json` 中添加:
60
+
61
+ ```json
62
+ {
63
+ "$schema": "https://opencode.ai/config.json",
64
+ "mcp": {
65
+ "iauto-pay": {
66
+ "type": "local",
67
+ "command": ["npx", "-y", "@newblock/iautopay-mcp"],
68
+ "enabled": true,
69
+ "environment": {
70
+ "BUYER_PRIVATE_KEY": "{env:BUYER_PRIVATE_KEY}"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### Claude Code 配置
78
+
79
+ 在你的 `~/.claude/claude_desktop_config.json` 中添加:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "iauto-pay": {
85
+ "command": "npx",
86
+ "args": ["@newblock/iautopay-mcp"],
87
+ "env": {
88
+ "BUYER_PRIVATE_KEY": "{env:BUYER_PRIVATE_KEY}"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## MCP 工具
96
+
97
+ ### pay_stablecoin
98
+
99
+ 使用 EIP-3009 transferWithAuthorization 直接支付稳定币。
100
+
101
+ **参数:**
102
+ ```json
103
+ {
104
+ "to": "0x1234567890123456789012345678901234567890",
105
+ "amount": "1000000"
106
+ }
107
+ ```
108
+
109
+ **使用示例:**
110
+ ```
111
+ 使用 iauto-pay_pay_stablecoin 工具向 0x123... 发送 1 USDC
112
+ ```
113
+
114
+ **提示**:可以预设常用转账地址和金额,避免每次手动输入,提高使用便利性。
115
+
116
+ ### buy_glm_apikey
117
+
118
+ 购买 GLM4.7 LLM 的 APIKEY。
119
+
120
+ **参数:**
121
+ ```json
122
+ {}
123
+ ```
124
+
125
+ **返回值:**
126
+ ```json
127
+ {
128
+ "apiKey": "sk-ABCD12345678901234567890",
129
+ "txHash": "0x4d757c7e121ad31607ee1e9c5af65bfe13b82c112fcf077638814c031ecc3a6b",
130
+ "payState": "paid"
131
+ }
132
+ ```
133
+
134
+
135
+ ## 示例工作流
136
+
137
+ ### 示例 1:购买 GLM4.7 API Key
138
+
139
+ ```
140
+ 使用 iauto-pay_buy_glm_apikey 工具购买 GLM4.7 LLM 的 API Key
141
+ ```
142
+
143
+ ### 示例 2:直接 USDC 支付
144
+
145
+ ```
146
+ 使用 iauto-pay_pay_stablecoin 工具向 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c 发送 0.01 USDC
147
+ ```
148
+
149
+ ## 系统要求
150
+
151
+ - Node.js >= 18.0.0
152
+ - npm >= 9.0.0
153
+
154
+ ## 依赖项
155
+
156
+ - @modelcontextprotocol/sdk ^1.0.0
157
+ - @x402/core ^2.3.0
158
+ - @x402/evm ^2.3.0
159
+ - viem ^2.21.35
160
+ - zod ^3.24.1
161
+ - zod-to-json-schema ^3.24.1
162
+
163
+ ## 许可证
164
+
165
+ MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
166
+
167
+ ## 仓库
168
+
169
+ [https://github.com/newblock/iautopay](https://github.com/newblock/iautopay)
170
+
171
+ ## 支持
172
+
173
+ 如有问题和建议,请使用 [GitHub Issues](https://github.com/newblock/iautopay/issues)。