run402-mcp 0.1.1 → 1.2.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 +42 -5
- package/README.zh-CN.md +170 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +73 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/archive-project.d.ts +14 -0
- package/dist/tools/archive-project.d.ts.map +1 -0
- package/dist/tools/archive-project.js +47 -0
- package/dist/tools/archive-project.js.map +1 -0
- package/dist/tools/browse-apps.d.ts +14 -0
- package/dist/tools/browse-apps.d.ts.map +1 -0
- package/dist/tools/browse-apps.js +45 -0
- package/dist/tools/browse-apps.js.map +1 -0
- package/dist/tools/bundle-deploy.d.ts +120 -0
- package/dist/tools/bundle-deploy.d.ts.map +1 -0
- package/dist/tools/bundle-deploy.js +136 -0
- package/dist/tools/bundle-deploy.js.map +1 -0
- package/dist/tools/check-balance.d.ts +14 -0
- package/dist/tools/check-balance.d.ts.map +1 -0
- package/dist/tools/check-balance.js +45 -0
- package/dist/tools/check-balance.js.map +1 -0
- package/dist/tools/delete-file.d.ts +18 -0
- package/dist/tools/delete-file.d.ts.map +1 -0
- package/dist/tools/delete-file.js +47 -0
- package/dist/tools/delete-file.js.map +1 -0
- package/dist/tools/delete-function.d.ts +16 -0
- package/dist/tools/delete-function.d.ts.map +1 -0
- package/dist/tools/delete-function.js +44 -0
- package/dist/tools/delete-function.js.map +1 -0
- package/dist/tools/delete-secret.d.ts +16 -0
- package/dist/tools/delete-secret.d.ts.map +1 -0
- package/dist/tools/delete-secret.js +44 -0
- package/dist/tools/delete-secret.js.map +1 -0
- package/dist/tools/download-file.d.ts +18 -0
- package/dist/tools/download-file.d.ts.map +1 -0
- package/dist/tools/download-file.js +48 -0
- package/dist/tools/download-file.js.map +1 -0
- package/dist/tools/fork-app.d.ts +20 -0
- package/dist/tools/fork-app.d.ts.map +1 -0
- package/dist/tools/fork-app.js +87 -0
- package/dist/tools/fork-app.js.map +1 -0
- package/dist/tools/generate-image.d.ts +20 -0
- package/dist/tools/generate-image.d.ts.map +1 -0
- package/dist/tools/generate-image.js +66 -0
- package/dist/tools/generate-image.js.map +1 -0
- package/dist/tools/get-quote.d.ts +9 -0
- package/dist/tools/get-quote.d.ts.map +1 -0
- package/dist/tools/get-quote.js +27 -0
- package/dist/tools/get-quote.js.map +1 -0
- package/dist/tools/get-schema.d.ts +14 -0
- package/dist/tools/get-schema.d.ts.map +1 -0
- package/dist/tools/get-schema.js +69 -0
- package/dist/tools/get-schema.js.map +1 -0
- package/dist/tools/get-usage.d.ts +14 -0
- package/dist/tools/get-usage.d.ts.map +1 -0
- package/dist/tools/get-usage.js +55 -0
- package/dist/tools/get-usage.js.map +1 -0
- package/dist/tools/list-files.d.ts +16 -0
- package/dist/tools/list-files.d.ts.map +1 -0
- package/dist/tools/list-files.js +61 -0
- package/dist/tools/list-files.js.map +1 -0
- package/dist/tools/list-functions.d.ts +14 -0
- package/dist/tools/list-functions.d.ts.map +1 -0
- package/dist/tools/list-functions.js +56 -0
- package/dist/tools/list-functions.js.map +1 -0
- package/dist/tools/list-projects.d.ts +14 -0
- package/dist/tools/list-projects.d.ts.map +1 -0
- package/dist/tools/list-projects.js +43 -0
- package/dist/tools/list-projects.js.map +1 -0
- package/dist/tools/list-secrets.d.ts +14 -0
- package/dist/tools/list-secrets.d.ts.map +1 -0
- package/dist/tools/list-secrets.js +54 -0
- package/dist/tools/list-secrets.js.map +1 -0
- package/dist/tools/list-subdomains.d.ts +14 -0
- package/dist/tools/list-subdomains.d.ts.map +1 -0
- package/dist/tools/list-subdomains.js +56 -0
- package/dist/tools/list-subdomains.js.map +1 -0
- package/dist/tools/list-versions.d.ts +14 -0
- package/dist/tools/list-versions.d.ts.map +1 -0
- package/dist/tools/list-versions.js +57 -0
- package/dist/tools/list-versions.js.map +1 -0
- package/dist/tools/publish-app.d.ts +22 -0
- package/dist/tools/publish-app.d.ts.map +1 -0
- package/dist/tools/publish-app.js +69 -0
- package/dist/tools/publish-app.js.map +1 -0
- package/dist/tools/request-faucet.d.ts +14 -0
- package/dist/tools/request-faucet.d.ts.map +1 -0
- package/dist/tools/request-faucet.js +73 -0
- package/dist/tools/request-faucet.js.map +1 -0
- package/dist/tools/setup-rls.d.ts +30 -0
- package/dist/tools/setup-rls.d.ts.map +1 -0
- package/dist/tools/setup-rls.js +62 -0
- package/dist/tools/setup-rls.js.map +1 -0
- package/dist/tools/wallet-create.d.ts +9 -0
- package/dist/tools/wallet-create.d.ts.map +1 -0
- package/dist/tools/wallet-create.js +64 -0
- package/dist/tools/wallet-create.js.map +1 -0
- package/dist/tools/wallet-export.d.ts +9 -0
- package/dist/tools/wallet-export.d.ts.map +1 -0
- package/dist/tools/wallet-export.js +35 -0
- package/dist/tools/wallet-export.js.map +1 -0
- package/dist/tools/wallet-status.d.ts +9 -0
- package/dist/tools/wallet-status.d.ts.map +1 -0
- package/dist/tools/wallet-status.js +42 -0
- package/dist/tools/wallet-status.js.map +1 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# run402-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Developer tools for [Run402](https://run402.com) — provision Postgres databases, deploy static sites, generate images, and manage x402 wallets. Available as an MCP server, an OpenClaw skill, and a CLI.
|
|
4
|
+
|
|
5
|
+
English | [简体中文](./README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
## Integrations
|
|
8
|
+
|
|
9
|
+
| Interface | Use when... |
|
|
10
|
+
|-----------|-------------|
|
|
11
|
+
| [`cli/`](./cli/) | Terminal, scripts, CI/CD |
|
|
12
|
+
| [`openclaw/`](./openclaw/) | OpenClaw agent (no MCP required) |
|
|
13
|
+
| MCP server (this package) | Claude Desktop, Cursor, Cline, Claude Code |
|
|
4
14
|
|
|
5
15
|
## Quick Start
|
|
6
16
|
|
|
@@ -20,7 +30,34 @@ npx run402-mcp
|
|
|
20
30
|
|
|
21
31
|
## Client Configuration
|
|
22
32
|
|
|
23
|
-
###
|
|
33
|
+
### CLI
|
|
34
|
+
|
|
35
|
+
A standalone CLI is available in the [`cli/`](./cli/) directory.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g run402-cli
|
|
39
|
+
|
|
40
|
+
run402 wallet create
|
|
41
|
+
run402 wallet fund
|
|
42
|
+
run402 deploy --tier prototype --manifest app.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
See [`cli/README.md`](./cli/README.md) for full usage.
|
|
46
|
+
|
|
47
|
+
### OpenClaw
|
|
48
|
+
|
|
49
|
+
A standalone skill is available in the [`openclaw/`](./openclaw/) directory — no MCP server required. It calls the Run402 API directly via Node.js scripts.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cp -r openclaw ~/.openclaw/skills/run402
|
|
53
|
+
cd ~/.openclaw/skills/run402/scripts && npm install
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See [`openclaw/README.md`](./openclaw/README.md) for details.
|
|
57
|
+
|
|
58
|
+
### MCP Clients
|
|
59
|
+
|
|
60
|
+
#### Claude Desktop
|
|
24
61
|
|
|
25
62
|
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
26
63
|
|
|
@@ -35,7 +72,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
35
72
|
}
|
|
36
73
|
```
|
|
37
74
|
|
|
38
|
-
|
|
75
|
+
#### Cursor
|
|
39
76
|
|
|
40
77
|
Add to `.cursor/mcp.json` in your project:
|
|
41
78
|
|
|
@@ -50,7 +87,7 @@ Add to `.cursor/mcp.json` in your project:
|
|
|
50
87
|
}
|
|
51
88
|
```
|
|
52
89
|
|
|
53
|
-
|
|
90
|
+
#### Cline
|
|
54
91
|
|
|
55
92
|
Add to Cline MCP settings:
|
|
56
93
|
|
|
@@ -65,7 +102,7 @@ Add to Cline MCP settings:
|
|
|
65
102
|
}
|
|
66
103
|
```
|
|
67
104
|
|
|
68
|
-
|
|
105
|
+
#### Claude Code
|
|
69
106
|
|
|
70
107
|
```bash
|
|
71
108
|
claude mcp add run402 -- npx -y run402-mcp
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# run402-mcp
|
|
2
|
+
|
|
3
|
+
[Run402](https://run402.com) 的 MCP 服务器 — 从任何 MCP 兼容客户端创建和管理 AI 原生 Postgres 数据库。
|
|
4
|
+
|
|
5
|
+
> **不到 ¥1,让 OpenClaw 上线完整后端 7 天。**
|
|
6
|
+
> 数据库 + REST API + 鉴权 + 存储 + 静态站点 + 函数。无需云账号。
|
|
7
|
+
|
|
8
|
+
[English](./README.md) | 简体中文
|
|
9
|
+
|
|
10
|
+
## 快速开始
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx run402-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 工具列表
|
|
17
|
+
|
|
18
|
+
| 工具 | 说明 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| `provision_postgres_project` | 创建新的 Postgres 数据库(prototype/hobby/team 等级) |
|
|
21
|
+
| `run_sql` | 对项目执行 SQL(DDL 或查询) |
|
|
22
|
+
| `rest_query` | 通过 PostgREST 查询/修改数据 |
|
|
23
|
+
| `upload_file` | 上传文件到项目存储 |
|
|
24
|
+
| `renew_project` | 续期数据库租约 |
|
|
25
|
+
| `deploy_site` | 部署静态 HTML/CSS/JS 站点 |
|
|
26
|
+
| `deploy_function` | 部署 Node 22 Serverless 函数 |
|
|
27
|
+
| `invoke_function` | 调用已部署的函数 |
|
|
28
|
+
| `get_function_logs` | 获取函数日志 |
|
|
29
|
+
| `set_secret` | 设置函数环境变量 |
|
|
30
|
+
|
|
31
|
+
## 定价
|
|
32
|
+
|
|
33
|
+
| 等级 | 价格 | 租期 | 存储 | API 调用 |
|
|
34
|
+
|------|------|------|------|----------|
|
|
35
|
+
| Prototype 原型 | $0.10 / ¥0.7 | 7 天 | 250 MB | 50 万次 |
|
|
36
|
+
| Hobby 进阶 | $5 / ¥36 | 30 天 | 1 GB | 500 万次 |
|
|
37
|
+
| Team 团队 | $20 / ¥145 | 30 天 | 10 GB | 5000 万次 |
|
|
38
|
+
|
|
39
|
+
仅创建和续期需要付款。后续 REST/鉴权/存储请求使用返回的密钥,无需额外付费。
|
|
40
|
+
|
|
41
|
+
## 客户端配置
|
|
42
|
+
|
|
43
|
+
### Claude Desktop
|
|
44
|
+
|
|
45
|
+
添加到 `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"run402": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "run402-mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Cursor
|
|
59
|
+
|
|
60
|
+
添加到项目中的 `.cursor/mcp.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"run402": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "run402-mcp"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Cline
|
|
74
|
+
|
|
75
|
+
在 Cline MCP 设置中添加:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"run402": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "run402-mcp"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Claude Code
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
claude mcp add run402 -- npx -y run402-mcp
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### OpenClaw
|
|
95
|
+
|
|
96
|
+
Run402 已发布为 OpenClaw Skill。支持所有 OpenClaw 兼容的模型和平台,包括:
|
|
97
|
+
|
|
98
|
+
- **豆包 Doubao**(字节跳动 ArkClaw)
|
|
99
|
+
- **Kimi**(月之暗面)
|
|
100
|
+
- **GLM**(智谱)
|
|
101
|
+
- **MiniMax**
|
|
102
|
+
|
|
103
|
+
## 工作流程
|
|
104
|
+
|
|
105
|
+
1. **创建项目** — 调用 `provision_postgres_project` 创建数据库。服务器自动处理 x402 支付协商,并在本地保存凭证。
|
|
106
|
+
2. **构建应用** — 用 `run_sql` 创建表结构,`rest_query` 插入/查询数据,`upload_file` 管理文件存储。
|
|
107
|
+
3. **部署上线** — 用 `deploy_site` 部署前端,`deploy_function` 部署后端函数。
|
|
108
|
+
4. **续期维护** — 在租约到期前调用 `renew_project`。
|
|
109
|
+
|
|
110
|
+
### 支付流程
|
|
111
|
+
|
|
112
|
+
创建和续期需要 x402 微支付。当需要付款时,工具会返回支付详情(而不是错误),以便 LLM 可以分析并引导用户完成支付。
|
|
113
|
+
|
|
114
|
+
### 密钥存储
|
|
115
|
+
|
|
116
|
+
项目凭证保存在 `~/.config/run402/projects.json`(权限 `0600`)。每个项目存储:
|
|
117
|
+
- `anon_key` — 公开查询用(遵循行级安全策略)
|
|
118
|
+
- `service_key` — 管理操作用(绕过行级安全策略)
|
|
119
|
+
- `tier` — prototype、hobby 或 team
|
|
120
|
+
- `expires_at` — 租约到期时间
|
|
121
|
+
|
|
122
|
+
## 智能体额度(Agent Allowance)
|
|
123
|
+
|
|
124
|
+
> 给智能体一个额度,不是钱包。
|
|
125
|
+
|
|
126
|
+
Run402 支持预付费、硬限额的智能体额度模式:
|
|
127
|
+
- **预付制** — 像充值卡一样预存额度
|
|
128
|
+
- **硬限额** — 智能体不会超支
|
|
129
|
+
- **可撤销** — 随时暂停或取消
|
|
130
|
+
- **可追溯** — 每笔交易都有记录
|
|
131
|
+
|
|
132
|
+
了解更多:[run402.com/agent-allowance](https://run402.com/agent-allowance)
|
|
133
|
+
|
|
134
|
+
## 应用模板(一键复制)
|
|
135
|
+
|
|
136
|
+
Run402 上的公开应用可以一键复制(Fork),每个副本拥有独立的数据库、鉴权、存储和 URL。
|
|
137
|
+
|
|
138
|
+
- 浏览可用应用:[run402.com/apps](https://run402.com/apps)
|
|
139
|
+
- API:`GET https://api.run402.com/v1/apps`
|
|
140
|
+
- 复制应用:`POST /v1/fork/:tier` + `{ "version_id": "...", "name": "my-copy" }`
|
|
141
|
+
|
|
142
|
+
模板发布者可获得下游实例续费的 **20% 持续分成**。
|
|
143
|
+
|
|
144
|
+
## 环境变量
|
|
145
|
+
|
|
146
|
+
| 变量 | 默认值 | 说明 |
|
|
147
|
+
|------|--------|------|
|
|
148
|
+
| `RUN402_API_BASE` | `https://api.run402.com` | API 基础 URL |
|
|
149
|
+
| `RUN402_CONFIG_DIR` | `~/.config/run402` | 密钥存储目录 |
|
|
150
|
+
|
|
151
|
+
## 相关链接
|
|
152
|
+
|
|
153
|
+
- **中文落地页**:[run402.com/zh-cn](https://run402.com/zh-cn)
|
|
154
|
+
- **完整 API 文档**:[run402.com/llms.txt](https://run402.com/llms.txt)
|
|
155
|
+
- **OpenAPI 规范**:[run402.com/openapi.json](https://run402.com/openapi.json)
|
|
156
|
+
- **应用市场**:[run402.com/apps](https://run402.com/apps)
|
|
157
|
+
- **API 状态**:[api.run402.com/health](https://api.run402.com/health)
|
|
158
|
+
- **npm**:[npmjs.com/package/run402-mcp](https://www.npmjs.com/package/run402-mcp)
|
|
159
|
+
- **GitHub**:[github.com/kychee-com/run402-mcp](https://github.com/kychee-com/run402-mcp)
|
|
160
|
+
|
|
161
|
+
## 开发
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm run build
|
|
165
|
+
npm run test:skill
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## 许可证
|
|
169
|
+
|
|
170
|
+
MIT
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAMD,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/config.js
CHANGED
|
@@ -3,8 +3,13 @@ import { join } from "node:path";
|
|
|
3
3
|
export function getApiBase() {
|
|
4
4
|
return process.env.RUN402_API_BASE || "https://api.run402.com";
|
|
5
5
|
}
|
|
6
|
+
function getConfigDir() {
|
|
7
|
+
return process.env.RUN402_CONFIG_DIR || join(homedir(), ".config", "run402");
|
|
8
|
+
}
|
|
6
9
|
export function getKeystorePath() {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
return join(getConfigDir(), "projects.json");
|
|
11
|
+
}
|
|
12
|
+
export function getWalletPath() {
|
|
13
|
+
return join(getConfigDir(), "wallet.json");
|
|
9
14
|
}
|
|
10
15
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,wBAAwB,CAAC;AACjE,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,wBAAwB,CAAC;AACjE,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,eAAe,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,aAAa,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
// Existing tools
|
|
4
5
|
import { provisionSchema, handleProvision } from "./tools/provision.js";
|
|
5
6
|
import { runSqlSchema, handleRunSql } from "./tools/run-sql.js";
|
|
6
7
|
import { restQuerySchema, handleRestQuery } from "./tools/rest-query.js";
|
|
@@ -13,22 +14,89 @@ import { deployFunctionSchema, handleDeployFunction } from "./tools/deploy-funct
|
|
|
13
14
|
import { invokeFunctionSchema, handleInvokeFunction } from "./tools/invoke-function.js";
|
|
14
15
|
import { getFunctionLogsSchema, handleGetFunctionLogs } from "./tools/get-function-logs.js";
|
|
15
16
|
import { setSecretSchema, handleSetSecret } from "./tools/set-secret.js";
|
|
17
|
+
// New tools — database
|
|
18
|
+
import { setupRlsSchema, handleSetupRls } from "./tools/setup-rls.js";
|
|
19
|
+
import { getSchemaSchema, handleGetSchema } from "./tools/get-schema.js";
|
|
20
|
+
import { getUsageSchema, handleGetUsage } from "./tools/get-usage.js";
|
|
21
|
+
// New tools — bundle & marketplace
|
|
22
|
+
import { bundleDeploySchema, handleBundleDeploy } from "./tools/bundle-deploy.js";
|
|
23
|
+
import { browseAppsSchema, handleBrowseApps } from "./tools/browse-apps.js";
|
|
24
|
+
import { forkAppSchema, handleForkApp } from "./tools/fork-app.js";
|
|
25
|
+
import { getQuoteSchema, handleGetQuote } from "./tools/get-quote.js";
|
|
26
|
+
import { publishAppSchema, handlePublishApp } from "./tools/publish-app.js";
|
|
27
|
+
import { listVersionsSchema, handleListVersions } from "./tools/list-versions.js";
|
|
28
|
+
// New tools — storage CRUD
|
|
29
|
+
import { downloadFileSchema, handleDownloadFile } from "./tools/download-file.js";
|
|
30
|
+
import { deleteFileSchema, handleDeleteFile } from "./tools/delete-file.js";
|
|
31
|
+
import { listFilesSchema, handleListFiles } from "./tools/list-files.js";
|
|
32
|
+
// New tools — functions & secrets CRUD
|
|
33
|
+
import { listFunctionsSchema, handleListFunctions } from "./tools/list-functions.js";
|
|
34
|
+
import { deleteFunctionSchema, handleDeleteFunction } from "./tools/delete-function.js";
|
|
35
|
+
import { listSecretsSchema, handleListSecrets } from "./tools/list-secrets.js";
|
|
36
|
+
import { deleteSecretSchema, handleDeleteSecret } from "./tools/delete-secret.js";
|
|
37
|
+
// New tools — subdomains & projects
|
|
38
|
+
import { listSubdomainsSchema, handleListSubdomains } from "./tools/list-subdomains.js";
|
|
39
|
+
import { archiveProjectSchema, handleArchiveProject } from "./tools/archive-project.js";
|
|
40
|
+
// New tools — billing
|
|
41
|
+
import { checkBalanceSchema, handleCheckBalance } from "./tools/check-balance.js";
|
|
42
|
+
import { listProjectsSchema, handleListProjects } from "./tools/list-projects.js";
|
|
43
|
+
// New tools — wallet, faucet, image
|
|
44
|
+
import { walletStatusSchema, handleWalletStatus } from "./tools/wallet-status.js";
|
|
45
|
+
import { walletCreateSchema, handleWalletCreate } from "./tools/wallet-create.js";
|
|
46
|
+
import { walletExportSchema, handleWalletExport } from "./tools/wallet-export.js";
|
|
47
|
+
import { requestFaucetSchema, handleRequestFaucet } from "./tools/request-faucet.js";
|
|
48
|
+
import { generateImageSchema, handleGenerateImage } from "./tools/generate-image.js";
|
|
16
49
|
const server = new McpServer({
|
|
17
50
|
name: "run402",
|
|
18
|
-
version: "
|
|
51
|
+
version: "1.2.0",
|
|
19
52
|
});
|
|
53
|
+
// ─── Core database tools ────────────────────────────────────────────────────
|
|
20
54
|
server.tool("provision_postgres_project", "Provision a new Postgres database. Returns project credentials on success, or payment details if x402 payment is needed.", provisionSchema, async (args) => handleProvision(args));
|
|
21
55
|
server.tool("run_sql", "Execute SQL (DDL or queries) against a provisioned project. Returns results as a markdown table.", runSqlSchema, async (args) => handleRunSql(args));
|
|
22
56
|
server.tool("rest_query", "Query or mutate data via the PostgREST REST API. Supports GET/POST/PATCH/DELETE with query params.", restQuerySchema, async (args) => handleRestQuery(args));
|
|
57
|
+
server.tool("setup_rls", "Apply row-level security to tables. Templates: user_owns_rows (users access own rows only), public_read (anyone reads, authenticated writes), public_read_write (open access).", setupRlsSchema, async (args) => handleSetupRls(args));
|
|
58
|
+
server.tool("get_schema", "Introspect the database schema — tables, columns, types, constraints, and RLS policies. Useful for understanding the database structure before writing queries.", getSchemaSchema, async (args) => handleGetSchema(args));
|
|
59
|
+
server.tool("get_usage", "Get project usage report — API calls, storage usage, limits, and lease expiry.", getUsageSchema, async (args) => handleGetUsage(args));
|
|
60
|
+
// ─── Storage tools ──────────────────────────────────────────────────────────
|
|
23
61
|
server.tool("upload_file", "Upload text content to project storage. Returns the storage key and size.", uploadFileSchema, async (args) => handleUploadFile(args));
|
|
24
|
-
server.tool("
|
|
25
|
-
server.tool("
|
|
26
|
-
server.tool("
|
|
27
|
-
|
|
62
|
+
server.tool("download_file", "Download a file from project storage. Returns the file content.", downloadFileSchema, async (args) => handleDownloadFile(args));
|
|
63
|
+
server.tool("delete_file", "Delete a file from project storage.", deleteFileSchema, async (args) => handleDeleteFile(args));
|
|
64
|
+
server.tool("list_files", "List files in a storage bucket. Shows file names, sizes, and last modified dates.", listFilesSchema, async (args) => handleListFiles(args));
|
|
65
|
+
// ─── Functions tools ────────────────────────────────────────────────────────
|
|
28
66
|
server.tool("deploy_function", "Deploy a serverless function (Node 22) to a project. Handler signature: export default async (req: Request) => Response. Pre-bundled packages: stripe, openai, @anthropic-ai/sdk, resend, zod, uuid, jsonwebtoken, bcryptjs, cheerio, csv-parse.", deployFunctionSchema, async (args) => handleDeployFunction(args));
|
|
29
67
|
server.tool("invoke_function", "Invoke a deployed function via HTTP. Returns the function's response body and status code. Useful for testing functions without building a frontend.", invokeFunctionSchema, async (args) => handleInvokeFunction(args));
|
|
30
68
|
server.tool("get_function_logs", "Get recent logs from a deployed function. Shows console.log/error output and error stack traces from CloudWatch.", getFunctionLogsSchema, async (args) => handleGetFunctionLogs(args));
|
|
69
|
+
server.tool("list_functions", "List all deployed functions for a project. Shows names, URLs, runtime, timeout, and memory.", listFunctionsSchema, async (args) => handleListFunctions(args));
|
|
70
|
+
server.tool("delete_function", "Delete a deployed function from a project.", deleteFunctionSchema, async (args) => handleDeleteFunction(args));
|
|
71
|
+
// ─── Secrets tools ──────────────────────────────────────────────────────────
|
|
31
72
|
server.tool("set_secret", "Set a project secret (e.g. STRIPE_SECRET_KEY). Secrets are injected as process.env variables in functions. Setting an existing key overwrites it.", setSecretSchema, async (args) => handleSetSecret(args));
|
|
73
|
+
server.tool("list_secrets", "List secret keys for a project (values are not shown). Useful for checking which secrets are configured.", listSecretsSchema, async (args) => handleListSecrets(args));
|
|
74
|
+
server.tool("delete_secret", "Delete a secret from a project.", deleteSecretSchema, async (args) => handleDeleteSecret(args));
|
|
75
|
+
// ─── Deployment & subdomain tools ───────────────────────────────────────────
|
|
76
|
+
server.tool("deploy_site", "Deploy a static site (HTML/CSS/JS). Files are uploaded to S3 and served via CloudFront at a unique URL. Costs $0.05 USDC via x402.", deploySiteSchema, async (args) => handleDeploySite(args));
|
|
77
|
+
server.tool("claim_subdomain", "Claim a custom subdomain (e.g. myapp.run402.com) and point it at an existing deployment. Free, requires service_key auth.", claimSubdomainSchema, async (args) => handleClaimSubdomain(args));
|
|
78
|
+
server.tool("delete_subdomain", "Release a custom subdomain. The URL will stop serving content.", deleteSubdomainSchema, async (args) => handleDeleteSubdomain(args));
|
|
79
|
+
server.tool("list_subdomains", "List all subdomains claimed by a project.", listSubdomainsSchema, async (args) => handleListSubdomains(args));
|
|
80
|
+
// ─── Bundle deploy & marketplace tools ──────────────────────────────────────
|
|
81
|
+
server.tool("bundle_deploy", "One-call full-stack app deployment. Provisions a database and optionally runs migrations, applies RLS, sets secrets, deploys functions, deploys a static site, and claims a subdomain — all in a single x402 payment.", bundleDeploySchema, async (args) => handleBundleDeploy(args));
|
|
82
|
+
server.tool("browse_apps", "Browse public apps available for forking. Optionally filter by tags.", browseAppsSchema, async (args) => handleBrowseApps(args));
|
|
83
|
+
server.tool("fork_app", "Fork a published app into a new project. Creates a full copy including database, functions, site, and optionally claims a subdomain.", forkAppSchema, async (args) => handleForkApp(args));
|
|
84
|
+
server.tool("publish_app", "Publish a project as a forkable app. Set visibility and tags for discoverability.", publishAppSchema, async (args) => handlePublishApp(args));
|
|
85
|
+
server.tool("list_versions", "List published versions of a project.", listVersionsSchema, async (args) => handleListVersions(args));
|
|
86
|
+
// ─── Project lifecycle tools ────────────────────────────────────────────────
|
|
87
|
+
server.tool("get_quote", "Get tier pricing for Run402 projects. Free, no auth required. Shows prices, lease durations, storage limits, and API call limits.", getQuoteSchema, async (args) => handleGetQuote(args));
|
|
88
|
+
server.tool("renew_project", "Renew a project's lease. Returns success or payment details if x402 payment is needed.", renewSchema, async (args) => handleRenew(args));
|
|
89
|
+
server.tool("archive_project", "Archive a project and remove it from the local key store. This action cannot be undone.", archiveProjectSchema, async (args) => handleArchiveProject(args));
|
|
90
|
+
// ─── Billing & wallet tools ─────────────────────────────────────────────────
|
|
91
|
+
server.tool("check_balance", "Check billing account balance for a wallet address. Shows available and held funds.", checkBalanceSchema, async (args) => handleCheckBalance(args));
|
|
92
|
+
server.tool("list_projects", "List all active projects for a wallet address.", listProjectsSchema, async (args) => handleListProjects(args));
|
|
93
|
+
// ─── Wallet & faucet tools ────────────────────────────────────────────────
|
|
94
|
+
server.tool("wallet_status", "Check local wallet status — address, network, and funding status.", walletStatusSchema, async (args) => handleWalletStatus(args));
|
|
95
|
+
server.tool("wallet_create", "Create a new local wallet (Base Sepolia testnet). Generates a private key and derives the Ethereum address. Saved to ~/.config/run402/wallet.json.", walletCreateSchema, async (args) => handleWalletCreate(args));
|
|
96
|
+
server.tool("wallet_export", "Export the local wallet address. Safe to share publicly.", walletExportSchema, async (args) => handleWalletExport(args));
|
|
97
|
+
server.tool("request_faucet", "Request free testnet USDC from the Run402 faucet (Base Sepolia). Rate limit: 1 per IP per 24h. Returns 0.25 USDC — enough for 2 prototype databases.", requestFaucetSchema, async (args) => handleRequestFaucet(args));
|
|
98
|
+
// ─── Image generation tools ──────────────────────────────────────────────
|
|
99
|
+
server.tool("generate_image", "Generate a PNG image from a text prompt. Costs $0.03 USDC via x402. Aspect ratios: square (1:1), landscape (16:9), portrait (9:16).", generateImageSchema, async (args) => handleGenerateImage(args));
|
|
32
100
|
const transport = new StdioServerTransport();
|
|
33
101
|
await server.connect(transport);
|
|
34
102
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAA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z.ZodString;
|
|
4
|
+
};
|
|
5
|
+
export declare function handleArchiveProject(args: {
|
|
6
|
+
project_id: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
content: Array<{
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}>;
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=archive-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-project.d.ts","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA2CjF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
import { getProject, loadKeyStore, saveKeyStore } from "../keystore.js";
|
|
4
|
+
export const archiveProjectSchema = {
|
|
5
|
+
project_id: z.string().describe("The project ID to archive"),
|
|
6
|
+
};
|
|
7
|
+
export async function handleArchiveProject(args) {
|
|
8
|
+
const project = getProject(args.project_id);
|
|
9
|
+
if (!project) {
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: "text",
|
|
14
|
+
text: `Error: Project \`${args.project_id}\` not found in key store. Provision a project first.`,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
isError: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const res = await apiRequest(`/v1/projects/${args.project_id}`, {
|
|
21
|
+
method: "DELETE",
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${project.service_key}`,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
if (!res.ok) {
|
|
27
|
+
const body = res.body;
|
|
28
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
31
|
+
isError: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Remove from local key store
|
|
35
|
+
const store = loadKeyStore();
|
|
36
|
+
delete store.projects[args.project_id];
|
|
37
|
+
saveKeyStore(store);
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `Project \`${args.project_id}\` archived and removed from local key store.`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=archive-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-project.js","sourceRoot":"","sources":["../../src/tools/archive-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;CAC7D,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAE1C;IACC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB,IAAI,CAAC,UAAU,uDAAuD;iBACjG;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,gBAAgB,IAAI,CAAC,UAAU,EAAE,EAAE;QAC9D,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,EAAE;SAC/C;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,GAAG,CAAC,IAA+B,CAAC;QACjD,MAAM,GAAG,GAAI,IAAI,CAAC,KAAgB,IAAI,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,8BAA8B;IAC9B,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,YAAY,CAAC,KAAK,CAAC,CAAC;IAEpB,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,IAAI,CAAC,UAAU,+CAA+C;aAClF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const browseAppsSchema: {
|
|
3
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4
|
+
};
|
|
5
|
+
export declare function handleBrowseApps(args: {
|
|
6
|
+
tags?: string[];
|
|
7
|
+
}): Promise<{
|
|
8
|
+
content: Array<{
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}>;
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=browse-apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse-apps.d.ts","sourceRoot":"","sources":["../../src/tools/browse-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;CAK5B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAsDjF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { apiRequest } from "../client.js";
|
|
3
|
+
export const browseAppsSchema = {
|
|
4
|
+
tags: z
|
|
5
|
+
.array(z.string())
|
|
6
|
+
.optional()
|
|
7
|
+
.describe("Optional tags to filter by (e.g. ['auth', 'rls'])"),
|
|
8
|
+
};
|
|
9
|
+
export async function handleBrowseApps(args) {
|
|
10
|
+
let path = "/v1/apps";
|
|
11
|
+
if (args.tags && args.tags.length > 0) {
|
|
12
|
+
const params = args.tags.map((t) => `tag=${encodeURIComponent(t)}`).join("&");
|
|
13
|
+
path = `/v1/apps?${params}`;
|
|
14
|
+
}
|
|
15
|
+
const res = await apiRequest(path, { method: "GET" });
|
|
16
|
+
if (!res.ok) {
|
|
17
|
+
const body = res.body;
|
|
18
|
+
const msg = body.error || `HTTP ${res.status}`;
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
21
|
+
isError: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const body = res.body;
|
|
25
|
+
if (body.apps.length === 0) {
|
|
26
|
+
return {
|
|
27
|
+
content: [{ type: "text", text: `## Public Apps\n\n_No public apps found._` }],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const lines = [
|
|
31
|
+
`## Public Apps (${body.total})`,
|
|
32
|
+
``,
|
|
33
|
+
`| Name | Description | Tags | Forkable |`,
|
|
34
|
+
`|------|-------------|------|----------|`,
|
|
35
|
+
];
|
|
36
|
+
for (const app of body.apps) {
|
|
37
|
+
const tags = app.tags.length > 0 ? app.tags.join(", ") : "-";
|
|
38
|
+
const desc = app.description || "-";
|
|
39
|
+
lines.push(`| ${app.project_name} | ${desc} | ${tags} | ${app.fork_allowed ? "Yes" : "No"} |`);
|
|
40
|
+
}
|
|
41
|
+
lines.push(``);
|
|
42
|
+
lines.push(`Use \`fork_app\` to fork any forkable app into your own project.`);
|
|
43
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=browse-apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse-apps.js","sourceRoot":"","sources":["../../src/tools/browse-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,mDAAmD,CAAC;CACjE,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAEtC;IACC,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,M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