@cloudbase/cloudbase-mcp 1.8.16 → 1.8.18

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # 🌟 CloudBase AI ToolKit
8
8
 
9
- **通过AI提示词和MCP协议+云开发,让开发更智能、更高效**
9
+ **🪐 用 AI IDE 一键生成、部署和托管你的全栈 Web 应用与小程序、数据库和后端服务,无需运维,极速上线你的创意 💫**
10
10
 
11
11
  **🌍 Languages:** **中文** | [English](README-EN.md)
12
12
 
@@ -24,7 +24,7 @@
24
24
  [![CNB 镜像](https://img.shields.io/badge/CNB-CloudBase--AI--ToolKit-blue?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjM0I4MkY2Ii8+PHBhdGggZD0iTTUgM0g3VjVINSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiLz48cGF0aCBkPSJNNSA3SDdWOUg1IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjEuNSIvPjwvc3ZnPg==)](https://cnb.cool/tencent/cloud/cloudbase/CloudBase-AI-ToolKit)
25
25
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/TencentCloudBase/CloudBase-AI-ToolKit)
26
26
 
27
- 当你在**Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code**等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。
27
+ 当你在**Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code/OpenAI Codex CLI**等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。
28
28
 
29
29
 
30
30
  **📹 完整视频演示 ⬇️**
@@ -37,12 +37,12 @@
37
37
  |---|---|
38
38
  | 🤖 **AI智能开发**: AI自动生成代码和架构设计<br>☁️ **云开发集成**: 一键接入数据库、云函数、静态托管<br>⚡ **快速部署**: 几分钟内完成全栈应用上线 | **Web应用**: 现代化前端 + 静态托管<br>**微信小程序**: 云开发小程序解决方案<br>**后端服务**: 云数据库 + 无服务器函数+云托管 |
39
39
 
40
- 📚 [快速开始](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/getting-started) | 🛠️ [IDE配置](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/) | 🎨 [项目模板](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/templates) | 📖 [开发指南](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/development) | 🎮 [使用案例](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/examples) | 🎓 [教程](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/tutorials) | 🔧 [MCP工具](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/mcp-tools) | ❓ [常见问题](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/faq)
40
+ 📚 [快速开始](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/getting-started) | 🛠️ [IDE配置](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/) | 🎨 [项目模板](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/templates) | 📖 [开发指南](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/development) | 🎮 [使用案例](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/examples) | 🎓 [教程](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/tutorials) | 🔌 [插件系统](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/plugins) | 🔧 [MCP工具](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/mcp-tools) | ❓ [常见问题](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/faq)
41
41
 
42
42
 
43
43
  </div>
44
44
 
45
- ## 🌟 核心特性
45
+ ## 核心特性
46
46
 
47
47
  - **🤖 AI 原生** - 专为 AI 编程工具设计的规则库,生成代码符合云开发最佳实践
48
48
  - **🚀 一键部署** - MCP 自动化部署到腾讯云开发 CloudBase 平台,Serverless 架构无需购买服务器
@@ -50,21 +50,7 @@
50
50
  - **🔧 智能修复** - AI 自动查看日志并修复问题,降低运维成本
51
51
  - **⚡ 极速体验** - 国内 CDN 加速,比海外平台访问速度更快
52
52
  - **📚 知识检索** - 内置云开发、微信小程序等专业知识库的智能向量检索
53
- - **🔌 插件化架构** - 支持按需启用工具插件,解决 MCP 工具数量限制问题
54
53
 
55
- ## 🔌 插件系统
56
-
57
- CloudBase MCP 采用插件化架构,支持按需启用工具模块。[查看插件详细文档](../doc/plugins.md)
58
-
59
- ### 快速配置
60
-
61
- ```json
62
- {
63
- "env": {
64
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
65
- }
66
- }
67
- ```
68
54
 
69
55
 
70
56
  ## 🚀 快速开始
@@ -87,9 +73,9 @@ CloudBase MCP 采用插件化架构,支持按需启用工具模块。[查看
87
73
  </details>
88
74
 
89
75
  <details>
90
- <summary>安装 Node.js v18及以上版本</summary>
76
+ <summary>安装 Node.js v18.15.0及以上版本</summary>
91
77
 
92
- 确保您的计算机上安装了 Node.js v18 及以上版本。您可以从 [Node.js 官网](https://nodejs.org/) 下载并安装最新版本。
78
+ 确保您的计算机上安装了 Node.js v18.15.0 及以上版本。您可以从 [Node.js 官网](https://nodejs.org/) 下载并安装最新版本。
93
79
 
94
80
  </details>
95
81
 
@@ -111,7 +97,7 @@ npm config set registry https://mirrors.cloud.tencent.com/npm/
111
97
 
112
98
  在**终端命令行**中运行以下命令:
113
99
  ```
114
- npx -y clear-npx-cache
100
+ npx clear-npx-cache
115
101
  ```
116
102
  </details>
117
103
 
@@ -151,20 +137,23 @@ npx -y clear-npx-cache
151
137
 
152
138
  以下工具均支持 CloudBase AI ToolKit,选择合适的工具并按说明配置:
153
139
 
154
- | 工具 | 支持平台 |
155
- |------|----------|
156
- | [Cursor](https://cursor.com/) | 独立 IDE|
157
- | [WindSurf](https://windsurf.com/editor) | 独立 IDE, VSCode、JetBrains 插件 |
158
- | [CodeBuddy](https://copilot.tencent.com/) | VS Code、JetBrains、微信开发者工具插件 |
159
- | [CLINE](https://cline.so/) | VS Code 插件 |
160
- | [GitHub Copilot](https://github.com/features/copilot) | VS Code 插件 |
161
- | [Trae](https://www.trae.ai/) | 独立 IDE |
162
- | [通义灵码](https://tongyi.aliyun.com/lingma) | 独立 IDE,VS Code、 JetBrains插件 |
163
- | [RooCode](https://roocode.com/) | VS Code插件 |
164
- | [文心快码](https://comate.baidu.com/) | VS Code、JetBrains插件|
165
- | [Augment Code](https://www.augmentcode.com/) | VS Code、JetBrains 插件 |
166
- | [Claude Code](https://www.anthropic.com/claude-code) | 命令行工具 |
167
- | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | 命令行工具 |
140
+
141
+ | 工具 | 支持平台 | 查看指引 |
142
+ |------|----------|----------|
143
+ | [Cursor](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/cursor) | 独立 IDE| [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/cursor) |
144
+ | [WindSurf](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/windsurf) | 独立 IDE, VSCode、JetBrains 插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/windsurf) |
145
+ | [CodeBuddy](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/codebuddy) | VS Code、JetBrains、微信开发者工具插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/codebuddy) |
146
+ | [CLINE](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/cline) | VS Code 插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/cline) |
147
+ | [GitHub Copilot](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/github-copilot) | VS Code 插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/github-copilot) |
148
+ | [Trae](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/trae) | 独立 IDE | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/trae) |
149
+ | [通义灵码](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/tongyi-lingma) | 独立 IDE,VS Code、 JetBrains插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/tongyi-lingma) |
150
+ | [RooCode](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/roocode) | VS Code插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/roocode) |
151
+ | [文心快码](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/baidu-comate) | VS Code、JetBrains插件| [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/baidu-comate) |
152
+ | [Augment Code](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/augment-code) | VS Code、JetBrains 插件 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/augment-code) |
153
+ | [Claude Code](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) |
154
+ | [Gemini CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) |
155
+ | [OpenAI Codex CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) |
156
+
168
157
 
169
158
  <details>
170
159
  <summary><strong>🔧 Cursor 配置</strong></summary>
@@ -190,25 +179,7 @@ npx -y clear-npx-cache
190
179
  "mcpServers": {
191
180
  "cloudbase-mcp": {
192
181
  "command": "npx",
193
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
194
- "env": {
195
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
196
- }
197
- }
198
- }
199
- }
200
- ```
201
-
202
- **插件配置示例:**
203
- ```json
204
- {
205
- "mcpServers": {
206
- "cloudbase-mcp": {
207
- "command": "npx",
208
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
209
- "env": {
210
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
211
- }
182
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
212
183
  }
213
184
  }
214
185
  }
@@ -241,25 +212,7 @@ npx -y clear-npx-cache
241
212
  "mcpServers": {
242
213
  "cloudbase-mcp": {
243
214
  "command": "npx",
244
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
245
- "env": {
246
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
247
- }
248
- }
249
- }
250
- }
251
- ```
252
-
253
- **插件配置示例:**
254
- ```json
255
- {
256
- "mcpServers": {
257
- "cloudbase-mcp": {
258
- "command": "npx",
259
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
260
- "env": {
261
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
262
- }
215
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
263
216
  }
264
217
  }
265
218
  }
@@ -295,25 +248,7 @@ npx -y clear-npx-cache
295
248
  "mcpServers": {
296
249
  "cloudbase": {
297
250
  "command": "npx",
298
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
299
- "env": {
300
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
301
- }
302
- }
303
- }
304
- }
305
- ```
306
-
307
- **插件配置示例:**
308
- ```json
309
- {
310
- "mcpServers": {
311
- "cloudbase": {
312
- "command": "npx",
313
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
314
- "env": {
315
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
316
- }
251
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
317
252
  }
318
253
  }
319
254
  }
@@ -354,31 +289,7 @@ npx -y clear-npx-cache
354
289
  "@cloudbase/cloudbase-mcp@latest"
355
290
  ],
356
291
  "transportType": "stdio",
357
- "disabled": false,
358
- "env": {
359
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
360
- }
361
- }
362
- }
363
- }
364
- ```
365
-
366
- **插件配置示例:**
367
- ```json
368
- {
369
- "mcpServers": {
370
- "cloudbase": {
371
- "autoApprove": [],
372
- "timeout": 60,
373
- "command": "npx",
374
- "args": [
375
- "@cloudbase/cloudbase-mcp@latest"
376
- ],
377
- "transportType": "stdio",
378
- "disabled": false,
379
- "env": {
380
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
381
- }
292
+ "disabled": false
382
293
  }
383
294
  }
384
295
  }
@@ -412,27 +323,7 @@ npx -y clear-npx-cache
412
323
  "command": "npx",
413
324
  "args": [
414
325
  "@cloudbase/cloudbase-mcp@latest"
415
- ],
416
- "env": {
417
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
418
- }
419
- }
420
- }
421
- }
422
- ```
423
-
424
- **插件配置示例:**
425
- ```json
426
- {
427
- "servers": {
428
- "cloudbase": {
429
- "command": "npx",
430
- "args": [
431
- "@cloudbase/cloudbase-mcp@latest"
432
- ],
433
- "env": {
434
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
435
- }
326
+ ]
436
327
  }
437
328
  }
438
329
  }
@@ -466,25 +357,7 @@ npx -y clear-npx-cache
466
357
  "mcpServers": {
467
358
  "cloudbase-mcp": {
468
359
  "command": "npx",
469
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
470
- "env": {
471
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
472
- }
473
- }
474
- }
475
- }
476
- ```
477
-
478
- **插件配置示例:**
479
- ```json
480
- {
481
- "mcpServers": {
482
- "cloudbase-mcp": {
483
- "command": "npx",
484
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
485
- "env": {
486
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
487
- }
360
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
488
361
  }
489
362
  }
490
363
  }
@@ -516,25 +389,7 @@ npx -y clear-npx-cache
516
389
  "mcpServers": {
517
390
  "cloudbase-mcp": {
518
391
  "command": "npx",
519
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
520
- "env": {
521
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
522
- }
523
- }
524
- }
525
- }
526
- ```
527
-
528
- **插件配置示例:**
529
- ```json
530
- {
531
- "mcpServers": {
532
- "cloudbase-mcp": {
533
- "command": "npx",
534
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
535
- "env": {
536
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
537
- }
392
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
538
393
  }
539
394
  }
540
395
  }
@@ -569,28 +424,7 @@ npx -y clear-npx-cache
569
424
  "args": [
570
425
  "@cloudbase/cloudbase-mcp@latest"
571
426
  ],
572
- "disabled": false,
573
- "env": {
574
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
575
- }
576
- }
577
- }
578
- }
579
- ```
580
-
581
- **插件配置示例:**
582
- ```json
583
- {
584
- "mcpServers": {
585
- "cloudbase": {
586
- "command": "npx",
587
- "args": [
588
- "@cloudbase/cloudbase-mcp@latest"
589
- ],
590
- "disabled": false,
591
- "env": {
592
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
593
- }
427
+ "disabled": false
594
428
  }
595
429
  }
596
430
  }
@@ -625,28 +459,7 @@ npx -y clear-npx-cache
625
459
  "args": [
626
460
  "@cloudbase/cloudbase-mcp@latest"
627
461
  ],
628
- "disabled": false,
629
- "env": {
630
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
631
- }
632
- }
633
- }
634
- }
635
- ```
636
-
637
- **插件配置示例:**
638
- ```json
639
- {
640
- "mcpServers": {
641
- "cloudbase": {
642
- "command": "npx",
643
- "args": [
644
- "@cloudbase/cloudbase-mcp@latest"
645
- ],
646
- "disabled": false,
647
- "env": {
648
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
649
- }
462
+ "disabled": false
650
463
  }
651
464
  }
652
465
  }
@@ -685,29 +498,7 @@ npx -y clear-npx-cache
685
498
  "command": "npx",
686
499
  "args": [
687
500
  "@cloudbase/cloudbase-mcp@latest"
688
- ],
689
- "env": {
690
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
691
- }
692
- }
693
- }
694
- }
695
- }
696
- ```
697
-
698
- **插件配置示例:**
699
- ```json
700
- {
701
- "augment.advanced": {
702
- "mcpServers": {
703
- "cloudbase": {
704
- "command": "npx",
705
- "args": [
706
- "@cloudbase/cloudbase-mcp@latest"
707
- ],
708
- "env": {
709
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
710
- }
501
+ ]
711
502
  }
712
503
  }
713
504
  }
@@ -743,28 +534,7 @@ npx -y clear-npx-cache
743
534
  "args": [
744
535
  "-y",
745
536
  "@cloudbase/cloudbase-mcp@latest"
746
- ],
747
- "env": {
748
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
749
- }
750
- }
751
- }
752
- }
753
- ```
754
-
755
- **插件配置示例:**
756
- ```json
757
- {
758
- "mcpServers": {
759
- "cloudbase": {
760
- "command": "npx",
761
- "args": [
762
- "-y",
763
- "@cloudbase/cloudbase-mcp@latest"
764
- ],
765
- "env": {
766
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
767
- }
537
+ ]
768
538
  }
769
539
  }
770
540
  }
@@ -810,25 +580,7 @@ npx @google/gemini-cli
810
580
  "mcpServers": {
811
581
  "cloudbase-mcp": {
812
582
  "command": "npx",
813
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
814
- "env": {
815
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting,storage,setup,interactive"
816
- }
817
- }
818
- }
819
- }
820
- ```
821
-
822
- **插件配置示例:**
823
- ```json
824
- {
825
- "mcpServers": {
826
- "cloudbase-mcp": {
827
- "command": "npx",
828
- "args": ["-y", "@cloudbase/cloudbase-mcp@latest"],
829
- "env": {
830
- "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
831
- }
583
+ "args": ["@cloudbase/cloudbase-mcp@latest"]
832
584
  }
833
585
  }
834
586
  }
@@ -867,6 +619,87 @@ gemini
867
619
 
868
620
  </details>
869
621
 
622
+ <details>
623
+ <summary><strong>🤖 OpenAI Codex CLI 配置</strong></summary>
624
+
625
+ #### 步骤1:安装 OpenAI Codex CLI
626
+
627
+ 确保安装 Node.js 18+,然后全局安装 OpenAI Codex CLI:
628
+
629
+ ```bash
630
+ npm install -g @openai/codex
631
+ ```
632
+
633
+ 或直接运行:
634
+
635
+ ```bash
636
+ npx @openai/codex
637
+ ```
638
+
639
+ #### 步骤2:配置 MCP
640
+
641
+ > [!TIP]
642
+ > 如果安装以后工具数量一直为 0,请参考[常见问题](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/faq#mcp-%E6%98%BE%E7%A4%BA%E5%B7%A5%E5%85%B7%E6%95%B0%E9%87%8F%E4%B8%BA-0-%E6%80%8E%E4%B9%88%E5%8A%9E)
643
+
644
+ 如果使用模板项目,MCP 配置已经预置完成。如果不是从模板开始,有两种配置方式:
645
+
646
+ **方式一:使用项目配置文件(推荐)**
647
+
648
+ 在项目根目录创建 `.codex/config.toml` 文件:
649
+
650
+ ```toml
651
+ [mcp_servers.cloudbase]
652
+ command = "npx"
653
+ args = ["-y", "@cloudbase/cloudbase-mcp@latest"]
654
+ ```
655
+
656
+ 然后启动时指定配置文件:
657
+
658
+ ```bash
659
+ codex --config .codex/config.toml
660
+ ```
661
+
662
+ **方式二:全局配置**
663
+
664
+ 在用户主目录创建 `~/.codex/config.toml` 文件:
665
+
666
+ ```toml
667
+ [mcp_servers.cloudbase]
668
+ command = "npx"
669
+ args = ["-y", "@cloudbase/cloudbase-mcp@latest"]
670
+ ```
671
+
672
+ #### 步骤3:启用 AI 规则
673
+
674
+ 模板中已包含 `AGENTS.md` 文件,OpenAI Codex CLI 会自动识别云开发最佳实践。如果不是从模板开始,可以让 AI 帮你下载云开发规则:
675
+
676
+ ```
677
+ 在当前项目中下载云开发 AI 规则
678
+ ```
679
+
680
+ #### 步骤4:开始开发
681
+
682
+ 启动 OpenAI Codex CLI:
683
+
684
+ ```bash
685
+ codex
686
+ ```
687
+
688
+ 如果使用项目配置文件:
689
+
690
+ ```bash
691
+ codex --config .codex/config.toml
692
+ ```
693
+
694
+ 在 Codex CLI 中与 AI 对话:
695
+
696
+ ```
697
+ 登录云开发
698
+ ```
699
+ 然后就可以进行需求的开发了
700
+
701
+ </details>
702
+
870
703
  <details>
871
704
  <summary><strong>🔄 更新 CloudBase AI ToolKit</strong></summary>
872
705
 
@@ -941,6 +774,19 @@ AI 会自动:
941
774
  云函数代码运行不符合需求,需求是 xxx,请查看日志和数据进行调试,并进行修复
942
775
  ```
943
776
 
777
+ ## 🔌 插件系统
778
+
779
+ CloudBase MCP 采用插件化架构,支持按需启用工具模块。[查看详细文档](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/plugins)
780
+
781
+ ### 快速配置
782
+
783
+ ```json
784
+ {
785
+ "env": {
786
+ "CLOUDBASE_MCP_PLUGINS_ENABLED": "env,database,functions,hosting"
787
+ }
788
+ }
789
+ ```
944
790
 
945
791
 
946
792
  ## 📚 教程
@@ -948,12 +794,22 @@ AI 会自动:
948
794
  ### 📄 文章
949
795
  - [1小时开发微信小游戏《我的早餐店》——基于CloudBase AI Toolkit](https://cloud.tencent.com/developer/article/2532595)
950
796
  - [AI Coding宝藏组合:Cursor + Cloudbase-AI-Toolkit 开发游戏实战](https://juejin.cn/post/7518783423277695028#comment)
797
+ - [我用「CloudBase AI ToolKit」一天做出"网络热词"小程序](https://cloud.tencent.com/developer/article/2537907)
798
+ - [我用AI开发并上线了一款小程序:解忧百宝盒](https://mp.weixin.qq.com/s/DYekRheNQ2u8LAl_F830fA)
799
+ - [2天上线一款可联机的分手厨房小游戏](https://mp.weixin.qq.com/s/nKfhHUf8w-EVKvA0u1rdeg)
800
+ - [AI时代,从零基础到全栈开发者之路:Figma + Cursor + Cloudbase快速搭建微信小程序](https://mp.weixin.qq.com/s/nT2JsKnwBiup1imniCr2jA)
951
801
 
952
802
  ### 📱 应用项目
953
803
  - [简历助手小程序](https://gitcode.com/qq_33681891/resume_template)
804
+ - [五子棋联机游戏](https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/web/gomoku-game)
805
+ - [分手厨房联机游戏](https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/web/overcooked-game)
806
+ - [电商管理后台](https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/web/ecommerce-management-backend)
807
+ - [短视频小程序](https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/miniprogram/cloudbase-ai-video)
808
+ - [约会小程序](https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/miniprogram/dating)
954
809
 
955
810
  ### 🎥 视频教程
956
811
  - [云开发CloudBase:用AI开发一款分手厨房小游戏](https://www.bilibili.com/video/BV1v5KAzwEf9/)
812
+ - [软件3.0:AI 编程新时代的最佳拍档 CloudBase AI ToolKit,以开发微信小程序为例](https://www.bilibili.com/video/BV15gKdz1E5N/)
957
813
 
958
814
  ---
959
815
 
@@ -1076,7 +932,7 @@ AI 会自动:
1076
932
 
1077
933
  ## 🛠️ 云开发 MCP 工具一览
1078
934
 
1079
- 目前共有 **35 个工具**,涵盖环境管理、数据库操作、云函数管理、静态托管等核心功能。
935
+ 目前共有 **39 个工具**,涵盖环境管理、数据库操作、云函数管理、静态托管、小程序发布等核心功能。
1080
936
 
1081
937
  📋 **完整工具文档**: [查看 MCP 工具详细说明](doc/mcp-tools.md) | [查看工具规格 JSON](scripts/tools.json)
1082
938
 
@@ -1089,7 +945,8 @@ AI 会自动:
1089
945
  | ⚡ **云函数管理** | 9 个 | 函数创建、更新、调用、日志、触发器 |
1090
946
  | 🌐 **静态托管** | 5 个 | 文件上传管理、域名配置、网站部署 |
1091
947
  | 📁 **文件操作** | 2 个 | 远程文件下载、云存储上传 |
1092
- | 🛠️ **工具支持** | 3 个 | 项目模板、知识库搜索、交互对话 |
948
+ | 📱 **小程序发布** | 7 个 | 小程序上传、预览、构建、配置、调试、质量检查 |
949
+ | 🛠️ **工具支持** | 4 个 | 项目模板、知识库搜索、联网搜索、交互对话 |
1093
950
  | 🔌 **HTTP访问** | 1 个 | HTTP 函数访问配置 |
1094
951
 
1095
952
  ### 🌟 核心工具亮点
@@ -1105,7 +962,7 @@ AI 会自动:
1105
962
 
1106
963
  ### 💡 工具优化说明
1107
964
 
1108
- 我们将原来 40 个工具优化为 35 个,通过合并相关功能提供更好的使用体验
965
+ 我们将原来 40 个工具优化为 36 个,并新增了 3 个小程序调试工具,现在共有 39 个工具,通过合并相关功能和新增小程序完整工具链提供更好的使用体验
1109
966
 
1110
967
  🔗 **想了解每个工具的详细功能?** 请查看 [MCP 工具完整文档](doc/mcp-tools.md)
1111
968
 
@@ -0,0 +1 @@
1
+ "use strict";exports.id=440,exports.ids=[440],exports.modules={83440:(e,r,o)=>{o.r(r),o.d(r,{apps:()=>k,default:()=>O,openApp:()=>$});var t=o(81329),n=o(6258),i=o(26743),a=o(42413),s=o(3776),c=o(60636),l=o(94658),m=o(81258),p=o(89971);let d,f;function u(){return void 0===f&&(f=(()=>{try{return p.statSync("/run/.containerenv"),!0}catch{return!1}})()||(void 0===d&&(d=function(){try{return p.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return p.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),d)),f}const w=()=>{if("linux"!==t.platform)return!1;if(m.release().toLowerCase().includes("microsoft"))return!u();try{return!!p.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")&&!u()}catch{return!1}},g=t.env.__IS_WSL_TEST__?w:w(),h=(()=>{const e="/mnt/";let r;return async function(){if(r)return r;const o="/etc/wsl.conf";let t=!1;try{await l.access(o,l.constants.F_OK),t=!0}catch{}if(!t)return e;const n=await l.readFile(o,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),x=async()=>g?(async()=>`${await h()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`)():`${t.env.SYSTEMROOT||t.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function y(e,r,o){const t=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){const e=o();return t(e),e},set(e){t(e)}}),e}const v=(0,s.promisify)(c.execFile),b=(0,s.promisify)(c.execFile);async function S(e){return async function(e,{humanReadableOutput:r=!0}={}){if("darwin"!==t.platform)throw new Error("macOS only");const o=r?[]:["-ss"],{stdout:n}=await b("osascript",["-e",e,o]);return n.trim()}(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const E=(0,s.promisify)(c.execFile),P={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}};class A extends Error{}const B=(0,s.promisify)(c.execFile);const F=(0,s.promisify)(c.execFile),C=i.dirname((0,a.fileURLToPath)("file:///Users/bookerzhao/Projects/cloudbase-turbo-delploy/mcp/node_modules/open/index.js")),L=i.join(C,"xdg-open"),{platform:T,arch:M}=t,H=async(e,r)=>{let o;for(const t of e)try{return await r(t)}catch(e){o=e}throw o},U=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return H(e.app,r=>U({...e,app:r}));let r,{name:o,arguments:i=[]}=e.app??{};if(i=[...i],Array.isArray(o))return H(o,r=>U({...e,app:{name:r,arguments:i}}));if("browser"===o||"browserPrivate"===o){const r={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},a={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=g?await async function(){const e=await x(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,o=n.Buffer.from(r,"utf16le").toString("base64"),{stdout:t}=await F(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",o],{encoding:"utf8"}),i=t.trim(),a={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return a[i]?{id:a[i]}:{}}():await async function(){if("darwin"===t.platform){const e=await async function(){if("darwin"!==t.platform)throw new Error("macOS only");const{stdout:e}=await v("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e);return r?.groups.id??"com.apple.Safari"}();return{name:await S(e),id:e}}if("linux"===t.platform){const{stdout:e}=await B("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:r.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:r}}if("win32"===t.platform)return async function(e=E){const{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),o=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!o)throw new A(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);const{id:t}=o.groups,n=P[t];if(!n)throw new A(`Unknown browser ID: ${t}`);return n}();throw new Error("Only macOS, Linux, and Windows are supported")}();if(s.id in r){const t=r[s.id];return"browserPrivate"===o&&i.push(a[t]),U({...e,app:{name:k[t],arguments:i}})}throw new Error(`${s.name} is not supported as a default browser`)}const a=[],s={};if("darwin"===T)r="open",e.wait&&a.push("--wait-apps"),e.background&&a.push("--background"),e.newInstance&&a.push("--new"),o&&a.push("-a",o);else if("win32"===T||g&&!u()&&!o){r=await x(),a.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),g||(s.windowsVerbatimArguments=!0);const t=["Start"];e.wait&&t.push("-Wait"),o?(t.push(`"\`"${o}\`""`),e.target&&i.push(e.target)):e.target&&t.push(`"${e.target}"`),i.length>0&&(i=i.map(e=>`"\`"${e}\`""`),t.push("-ArgumentList",i.join(","))),e.target=n.Buffer.from(t.join(" "),"utf16le").toString("base64")}else{if(o)r=o;else{const e=!C||"/"===C;let o=!1;try{await l.access(L,l.constants.X_OK),o=!0}catch{}r=t.versions.electron??("android"===T||e||!o)?"xdg-open":L}i.length>0&&a.push(...i),e.wait||(s.stdio="ignore",s.detached=!0)}"darwin"===T&&i.length>0&&a.push("--args",...i),e.target&&a.push(e.target);const m=c.spawn(r,a,s);return e.wait?new Promise((r,o)=>{m.once("error",o),m.once("close",t=>{!e.allowNonzeroExitCode&&t>0?o(new Error(`Exited with code ${t}`)):r(m)})}):(m.unref(),m)},$=(e,r)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected a valid `name`");const{arguments:o=[]}=r??{};if(null!=o&&!Array.isArray(o))throw new TypeError("Expected `appArguments` as Array type");return U({...r,app:{name:e,arguments:o}})};function _(e){if("string"==typeof e||Array.isArray(e))return e;const{[M]:r}=e;if(!r)throw new Error(`${M} is not supported`);return r}function I({[T]:e},{wsl:r}){if(r&&g)return _(r);if(!e)throw new Error(`${T} is not supported`);return _(e)}const k={};y(k,"chrome",()=>I({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),y(k,"brave",()=>I({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),y(k,"firefox",()=>I({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),y(k,"edge",()=>I({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),y(k,"browser",()=>"browser"),y(k,"browserPrivate",()=>"browserPrivate");const O=(e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");return U({...r,target:e})}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=440,exports.ids=[440],exports.modules={83440:(e,r,o)=>{o.r(r),o.d(r,{apps:()=>k,default:()=>O,openApp:()=>$});var t=o(81329),n=o(6258),i=o(26743),a=o(42413),s=o(3776),c=o(60636),l=o(94658),m=o(81258),p=o(89971);let d,f;function u(){return void 0===f&&(f=(()=>{try{return p.statSync("/run/.containerenv"),!0}catch{return!1}})()||(void 0===d&&(d=function(){try{return p.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return p.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),d)),f}const w=()=>{if("linux"!==t.platform)return!1;if(m.release().toLowerCase().includes("microsoft"))return!u();try{return!!p.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")&&!u()}catch{return!1}},g=t.env.__IS_WSL_TEST__?w:w(),h=(()=>{const e="/mnt/";let r;return async function(){if(r)return r;const o="/etc/wsl.conf";let t=!1;try{await l.access(o,l.constants.F_OK),t=!0}catch{}if(!t)return e;const n=await l.readFile(o,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),x=async()=>g?(async()=>`${await h()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`)():`${t.env.SYSTEMROOT||t.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function y(e,r,o){const t=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){const e=o();return t(e),e},set(e){t(e)}}),e}const v=(0,s.promisify)(c.execFile),b=(0,s.promisify)(c.execFile);async function S(e){return async function(e,{humanReadableOutput:r=!0}={}){if("darwin"!==t.platform)throw new Error("macOS only");const o=r?[]:["-ss"],{stdout:n}=await b("osascript",["-e",e,o]);return n.trim()}(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const E=(0,s.promisify)(c.execFile),P={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}};class A extends Error{}const B=(0,s.promisify)(c.execFile);const F=(0,s.promisify)(c.execFile),C=i.dirname((0,a.fileURLToPath)("file:///Users/bookerzhao/Projects/cloudbase-turbo-delploy/mcp/node_modules/open/index.js")),L=i.join(C,"xdg-open"),{platform:T,arch:M}=t,H=async(e,r)=>{let o;for(const t of e)try{return await r(t)}catch(e){o=e}throw o},U=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return H(e.app,r=>U({...e,app:r}));let r,{name:o,arguments:i=[]}=e.app??{};if(i=[...i],Array.isArray(o))return H(o,r=>U({...e,app:{name:r,arguments:i}}));if("browser"===o||"browserPrivate"===o){const r={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},a={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=g?await async function(){const e=await x(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,o=n.Buffer.from(r,"utf16le").toString("base64"),{stdout:t}=await F(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",o],{encoding:"utf8"}),i=t.trim(),a={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return a[i]?{id:a[i]}:{}}():await async function(){if("darwin"===t.platform){const e=await async function(){if("darwin"!==t.platform)throw new Error("macOS only");const{stdout:e}=await v("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e);return r?.groups.id??"com.apple.Safari"}();return{name:await S(e),id:e}}if("linux"===t.platform){const{stdout:e}=await B("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:r.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:r}}if("win32"===t.platform)return async function(e=E){const{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),o=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!o)throw new A(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);const{id:t}=o.groups,n=P[t];if(!n)throw new A(`Unknown browser ID: ${t}`);return n}();throw new Error("Only macOS, Linux, and Windows are supported")}();if(s.id in r){const t=r[s.id];return"browserPrivate"===o&&i.push(a[t]),U({...e,app:{name:k[t],arguments:i}})}throw new Error(`${s.name} is not supported as a default browser`)}const a=[],s={};if("darwin"===T)r="open",e.wait&&a.push("--wait-apps"),e.background&&a.push("--background"),e.newInstance&&a.push("--new"),o&&a.push("-a",o);else if("win32"===T||g&&!u()&&!o){r=await x(),a.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),g||(s.windowsVerbatimArguments=!0);const t=["Start"];e.wait&&t.push("-Wait"),o?(t.push(`"\`"${o}\`""`),e.target&&i.push(e.target)):e.target&&t.push(`"${e.target}"`),i.length>0&&(i=i.map(e=>`"\`"${e}\`""`),t.push("-ArgumentList",i.join(","))),e.target=n.Buffer.from(t.join(" "),"utf16le").toString("base64")}else{if(o)r=o;else{const e=!C||"/"===C;let o=!1;try{await l.access(L,l.constants.X_OK),o=!0}catch{}r=t.versions.electron??("android"===T||e||!o)?"xdg-open":L}i.length>0&&a.push(...i),e.wait||(s.stdio="ignore",s.detached=!0)}"darwin"===T&&i.length>0&&a.push("--args",...i),e.target&&a.push(e.target);const m=c.spawn(r,a,s);return e.wait?new Promise((r,o)=>{m.once("error",o),m.once("close",t=>{!e.allowNonzeroExitCode&&t>0?o(new Error(`Exited with code ${t}`)):r(m)})}):(m.unref(),m)},$=(e,r)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected a valid `name`");const{arguments:o=[]}=r??{};if(null!=o&&!Array.isArray(o))throw new TypeError("Expected `appArguments` as Array type");return U({...r,app:{name:e,arguments:o}})};function _(e){if("string"==typeof e||Array.isArray(e))return e;const{[M]:r}=e;if(!r)throw new Error(`${M} is not supported`);return r}function I({[T]:e},{wsl:r}){if(r&&g)return _(r);if(!e)throw new Error(`${T} is not supported`);return _(e)}const k={};y(k,"chrome",()=>I({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),y(k,"brave",()=>I({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),y(k,"firefox",()=>I({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),y(k,"edge",()=>I({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),y(k,"browser",()=>"browser"),y(k,"browserPrivate",()=>"browserPrivate");const O=(e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");return U({...r,target:e})}}};