@cloudbase/cloudbase-mcp 1.8.42 → 1.8.44
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/dist/cli.cjs +76 -46
- package/dist/index.cjs +76 -46
- package/dist/index.js +76 -46
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1247,9 +1247,6 @@ function registerEnvTools(server) {
|
|
|
1247
1247
|
if (error) {
|
|
1248
1248
|
return { content: [{ type: "text", text: error }] };
|
|
1249
1249
|
}
|
|
1250
|
-
if (noEnvs) {
|
|
1251
|
-
return { content: [{ type: "text", text: "当前账户下暂无可用的云开发环境,请先在腾讯云控制台创建环境 https://tcb.cloud.tencent.com/dev?from=AIToolkit" }] };
|
|
1252
|
-
}
|
|
1253
1250
|
if (cancelled) {
|
|
1254
1251
|
return { content: [{ type: "text", text: "用户取消了登录" }] };
|
|
1255
1252
|
}
|
|
@@ -1327,12 +1324,12 @@ function registerEnvTools(server) {
|
|
|
1327
1324
|
switch (action) {
|
|
1328
1325
|
case "list":
|
|
1329
1326
|
try {
|
|
1330
|
-
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId:
|
|
1327
|
+
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId: true });
|
|
1331
1328
|
result = await cloudbaseList.env.listEnvs();
|
|
1332
1329
|
}
|
|
1333
1330
|
catch (error) {
|
|
1334
1331
|
(0, logger_js_1.debug)('获取环境列表时出错:', error);
|
|
1335
|
-
return { content: [{ type: "text", text: "
|
|
1332
|
+
return { content: [{ type: "text", text: "获取环境列表时出错: " + (error instanceof Error ? error.message : String(error)) }]
|
|
1336
1333
|
};
|
|
1337
1334
|
}
|
|
1338
1335
|
break;
|
|
@@ -22466,11 +22463,11 @@ exports.getEnvId = getEnvId;
|
|
|
22466
22463
|
exports.resetCloudBaseManagerCache = resetCloudBaseManagerCache;
|
|
22467
22464
|
exports.getCloudBaseManager = getCloudBaseManager;
|
|
22468
22465
|
exports.createCloudBaseManagerWithOptions = createCloudBaseManagerWithOptions;
|
|
22466
|
+
const manager_node_1 = __importDefault(__webpack_require__(95492));
|
|
22469
22467
|
const auth_js_1 = __webpack_require__(77291);
|
|
22470
22468
|
const interactive_js_1 = __webpack_require__(3461);
|
|
22471
|
-
const manager_node_1 = __importDefault(__webpack_require__(95492));
|
|
22472
22469
|
const logger_js_1 = __webpack_require__(13039);
|
|
22473
|
-
const ENV_ID_TIMEOUT =
|
|
22470
|
+
const ENV_ID_TIMEOUT = 60000000; // 60000 seconds
|
|
22474
22471
|
// 统一的环境ID管理类
|
|
22475
22472
|
class EnvironmentManager {
|
|
22476
22473
|
cachedEnvId = null;
|
|
@@ -22639,14 +22636,14 @@ exports.saveEnvIdToUserConfig = saveEnvIdToUserConfig;
|
|
|
22639
22636
|
exports.loadEnvIdFromUserConfig = loadEnvIdFromUserConfig;
|
|
22640
22637
|
exports.clearUserEnvId = clearUserEnvId;
|
|
22641
22638
|
exports.autoSetupEnvironmentId = autoSetupEnvironmentId;
|
|
22639
|
+
const promises_1 = __importDefault(__webpack_require__(79748));
|
|
22640
|
+
const os_1 = __importDefault(__webpack_require__(21820));
|
|
22641
|
+
const path_1 = __importDefault(__webpack_require__(39902));
|
|
22642
22642
|
const zod_1 = __webpack_require__(21614);
|
|
22643
|
-
const interactive_server_js_1 = __webpack_require__(92341);
|
|
22644
|
-
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
22645
22643
|
const auth_js_1 = __webpack_require__(77291);
|
|
22644
|
+
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
22645
|
+
const interactive_server_js_1 = __webpack_require__(92341);
|
|
22646
22646
|
const logger_js_1 = __webpack_require__(13039);
|
|
22647
|
-
const promises_1 = __importDefault(__webpack_require__(79748));
|
|
22648
|
-
const path_1 = __importDefault(__webpack_require__(39902));
|
|
22649
|
-
const os_1 = __importDefault(__webpack_require__(21820));
|
|
22650
22647
|
function registerInteractiveTools(server) {
|
|
22651
22648
|
// 统一的交互式对话工具 (cloud-incompatible)
|
|
22652
22649
|
server.registerTool("interactiveDialog", {
|
|
@@ -101565,15 +101562,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
101565
101562
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
101566
101563
|
exports.CLOUDRUN_ACCESS_TYPES = exports.CLOUDRUN_SERVICE_TYPES = void 0;
|
|
101567
101564
|
exports.registerCloudRunTools = registerCloudRunTools;
|
|
101565
|
+
const child_process_1 = __webpack_require__(79646);
|
|
101566
|
+
const fs_1 = __importDefault(__webpack_require__(29021));
|
|
101567
|
+
const path_1 = __importDefault(__webpack_require__(39902));
|
|
101568
101568
|
const zod_1 = __webpack_require__(21614);
|
|
101569
101569
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
101570
|
-
const path_1 = __importDefault(__webpack_require__(39902));
|
|
101571
|
-
const fs_1 = __importDefault(__webpack_require__(29021));
|
|
101572
|
-
const child_process_1 = __webpack_require__(79646);
|
|
101573
101570
|
// CloudRun service types
|
|
101574
101571
|
exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
101575
101572
|
// CloudRun access types
|
|
101576
|
-
exports.CLOUDRUN_ACCESS_TYPES = ['
|
|
101573
|
+
exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
|
|
101577
101574
|
// Input schema for queryCloudRun tool
|
|
101578
101575
|
const queryCloudRunInputSchema = {
|
|
101579
101576
|
action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包括配置、版本、访问地址等),templates=获取可用的项目模板列表(用于初始化新项目)'),
|
|
@@ -101581,7 +101578,7 @@ const queryCloudRunInputSchema = {
|
|
|
101581
101578
|
pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
|
|
101582
101579
|
pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
|
|
101583
101580
|
serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
|
|
101584
|
-
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function
|
|
101581
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
|
|
101585
101582
|
// Detail operation parameters
|
|
101586
101583
|
detailServerName: zod_1.z.string().optional().describe('要查询详细信息的服务名称。当action为detail时必需提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
|
|
101587
101584
|
};
|
|
@@ -101592,18 +101589,24 @@ const ManageCloudRunInputSchema = {
|
|
|
101592
101589
|
// Deploy operation parameters
|
|
101593
101590
|
targetPath: zod_1.z.string().optional().describe('本地代码路径,必须是绝对路径。在deploy操作中指定要部署的代码目录,在download操作中指定下载目标目录,在init操作中指定云托管服务的上级目录(会在该目录下创建以serverName命名的子目录)。建议约定:项目根目录下的cloudrun/目录,例如:/Users/username/projects/my-project/cloudrun'),
|
|
101594
101591
|
serverConfig: zod_1.z.object({
|
|
101595
|
-
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:
|
|
101592
|
+
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:OA=办公网访问,PUBLIC=公网访问(默认,可通过HTTPS域名访问),MINIAPP=小程序访问,VPC=VPC访问(仅同VPC内可访问)。可配置多个类型'),
|
|
101596
101593
|
Cpu: zod_1.z.number().positive().optional().describe('CPU规格配置,单位为核。可选值:0.25、0.5、1、2、4、8等。注意:内存规格必须是CPU规格的2倍(如CPU=0.25时内存=0.5,CPU=1时内存=2)。影响服务性能和计费'),
|
|
101597
101594
|
Mem: zod_1.z.number().positive().optional().describe('内存规格配置,单位为GB。可选值:0.5、1、2、4、8、16等。注意:必须是CPU规格的2倍。影响服务性能和计费'),
|
|
101598
|
-
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0
|
|
101595
|
+
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0时始终保持指定数量的实例运行(确保快速响应但会增加成本)。建议设置为1以降低冷启动延迟,提升用户体验'),
|
|
101599
101596
|
MaxNum: zod_1.z.number().min(1).optional().describe('最大实例数配置,控制服务的最大运行实例数量。当请求量增加时,服务最多可以扩展到指定数量的实例,超过此数量后将拒绝新的请求。建议根据业务峰值设置'),
|
|
101597
|
+
PolicyDetails: zod_1.z.array(zod_1.z.object({
|
|
101598
|
+
PolicyType: zod_1.z.enum(['cpu', 'mem', 'cpu/mem']).describe('扩缩容类型:cpu=基于CPU使用率扩缩容,mem=基于内存使用率扩缩容,cpu/mem=基于CPU和内存使用率扩缩容'),
|
|
101599
|
+
PolicyThreshold: zod_1.z.number().min(1).max(100).describe('扩缩容阈值,单位为百分比。如60表示当资源使用率达到60%时触发扩缩容')
|
|
101600
|
+
})).optional().describe('扩缩容配置数组,用于配置服务的自动扩缩容策略。可配置多个扩缩容策略'),
|
|
101601
|
+
CustomLogs: zod_1.z.string().optional().describe('自定义日志配置,用于配置服务的日志收集和存储策略'),
|
|
101600
101602
|
Port: zod_1.z.number().min(1).max(65535).optional().describe('服务监听端口配置。函数型服务固定为3000,容器型服务可自定义。服务代码必须监听此端口才能正常接收请求'),
|
|
101601
|
-
EnvParams: zod_1.z.
|
|
101603
|
+
EnvParams: zod_1.z.string().optional().describe('环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如\'{"DATABASE_URL":"mysql://...","NODE_ENV":"production"}\'。敏感信息建议使用环境变量而非硬编码'),
|
|
101602
101604
|
Dockerfile: zod_1.z.string().optional().describe('Dockerfile文件名配置,仅容器型服务需要。指定用于构建容器镜像的Dockerfile文件路径,默认为项目根目录下的Dockerfile'),
|
|
101603
101605
|
BuildDir: zod_1.z.string().optional().describe('构建目录配置,指定代码构建的目录路径。当代码结构与标准不同时使用,默认为项目根目录'),
|
|
101604
|
-
InternalAccess: zod_1.z.
|
|
101605
|
-
|
|
101606
|
-
|
|
101606
|
+
InternalAccess: zod_1.z.string().optional().describe('内网访问开关配置,控制是否启用内网访问。true=启用内网访问(可通过云开发SDK直接调用),false=关闭内网访问(仅公网访问)'),
|
|
101607
|
+
InternalDomain: zod_1.z.string().optional().describe('内网域名配置,用于配置服务的内网访问域名。仅在启用内网访问时有效'),
|
|
101608
|
+
EntryPoint: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile EntryPoint参数配置,仅容器型服务需要。指定容器启动时的入口程序数组,如["node","app.js"]'),
|
|
101609
|
+
Cmd: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile Cmd参数配置,仅容器型服务需要。指定容器启动时的默认命令数组,如["npm","start"]'),
|
|
101607
101610
|
}).optional().describe('服务配置项,用于部署时设置服务的运行参数。包括资源规格、访问权限、环境变量等配置。不提供时使用默认配置'),
|
|
101608
101611
|
// Init operation parameters
|
|
101609
101612
|
template: zod_1.z.string().optional().default('helloworld').describe('项目模板标识符,用于指定初始化项目时使用的模板。可通过queryCloudRun的templates操作获取可用模板列表。常用模板:helloworld=Hello World示例,nodejs=Node.js项目模板,python=Python项目模板等'),
|
|
@@ -101623,6 +101626,7 @@ const ManageCloudRunInputSchema = {
|
|
|
101623
101626
|
}).optional().describe('Agent配置项,仅在createAgent操作时使用'),
|
|
101624
101627
|
// Common parameters
|
|
101625
101628
|
force: zod_1.z.boolean().optional().default(false).describe('强制操作开关,用于跳过确认提示。默认false(需要确认),设置为true时跳过所有确认步骤。删除操作时强烈建议设置为true以避免误操作'),
|
|
101629
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型配置:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)。不提供时自动检测:1)现有服务类型 2)有Dockerfile→container 3)有@cloudbase/aiagent-framework依赖→function 4)其他情况→container'),
|
|
101626
101630
|
};
|
|
101627
101631
|
/**
|
|
101628
101632
|
* Check if a project is an Agent project
|
|
@@ -101997,21 +102001,47 @@ for await (let x of res.textStream) {
|
|
|
101997
102001
|
if (!targetPath) {
|
|
101998
102002
|
throw new Error("targetPath is required for deploy operation");
|
|
101999
102003
|
}
|
|
102000
|
-
// Determine service type
|
|
102004
|
+
// Determine service type - use input.serverType if provided, otherwise auto-detect
|
|
102001
102005
|
let serverType;
|
|
102002
|
-
|
|
102003
|
-
|
|
102004
|
-
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
102005
|
-
serverType = details.BaseInfo?.ServerType || 'function';
|
|
102006
|
+
if (input.serverType) {
|
|
102007
|
+
serverType = input.serverType;
|
|
102006
102008
|
}
|
|
102007
|
-
|
|
102008
|
-
|
|
102009
|
-
|
|
102010
|
-
|
|
102011
|
-
serverType = 'container';
|
|
102009
|
+
else {
|
|
102010
|
+
try {
|
|
102011
|
+
// First try to get existing service details
|
|
102012
|
+
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
102013
|
+
serverType = details.BaseInfo?.ServerType || 'container';
|
|
102012
102014
|
}
|
|
102013
|
-
|
|
102014
|
-
|
|
102015
|
+
catch (e) {
|
|
102016
|
+
// If service doesn't exist, determine by project structure
|
|
102017
|
+
const dockerfilePath = path_1.default.join(targetPath, 'Dockerfile');
|
|
102018
|
+
if (fs_1.default.existsSync(dockerfilePath)) {
|
|
102019
|
+
serverType = 'container';
|
|
102020
|
+
}
|
|
102021
|
+
else {
|
|
102022
|
+
// Check if it's a Node.js function project (has package.json with specific structure)
|
|
102023
|
+
const packageJsonPath = path_1.default.join(targetPath, 'package.json');
|
|
102024
|
+
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
102025
|
+
try {
|
|
102026
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
102027
|
+
// If it has function-specific dependencies or scripts, treat as function
|
|
102028
|
+
if (packageJson.dependencies?.['@cloudbase/aiagent-framework'] ||
|
|
102029
|
+
packageJson.scripts?.['dev']?.includes('cloudrun run')) {
|
|
102030
|
+
serverType = 'function';
|
|
102031
|
+
}
|
|
102032
|
+
else {
|
|
102033
|
+
serverType = 'container';
|
|
102034
|
+
}
|
|
102035
|
+
}
|
|
102036
|
+
catch (parseError) {
|
|
102037
|
+
serverType = 'container';
|
|
102038
|
+
}
|
|
102039
|
+
}
|
|
102040
|
+
else {
|
|
102041
|
+
// No package.json, default to container
|
|
102042
|
+
serverType = 'container';
|
|
102043
|
+
}
|
|
102044
|
+
}
|
|
102015
102045
|
}
|
|
102016
102046
|
}
|
|
102017
102047
|
const deployParams = {
|
|
@@ -102022,7 +102052,7 @@ for await (let x of res.textStream) {
|
|
|
102022
102052
|
};
|
|
102023
102053
|
// Add server configuration if provided
|
|
102024
102054
|
if (input.serverConfig) {
|
|
102025
|
-
|
|
102055
|
+
deployParams.serverConfig = input.serverConfig;
|
|
102026
102056
|
}
|
|
102027
102057
|
const result = await cloudrunService.deploy(deployParams);
|
|
102028
102058
|
// Generate cloudbaserc.json configuration file
|
|
@@ -122092,7 +122122,7 @@ class TelemetryReporter {
|
|
|
122092
122122
|
const nodeVersion = process.version; // Node.js版本
|
|
122093
122123
|
const arch = os_1.default.arch(); // 系统架构
|
|
122094
122124
|
// 从构建时注入的版本号获取MCP版本信息
|
|
122095
|
-
const mcpVersion = process.env.npm_package_version || "1.8.
|
|
122125
|
+
const mcpVersion = process.env.npm_package_version || "1.8.44" || 0;
|
|
122096
122126
|
return {
|
|
122097
122127
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
122098
122128
|
deviceId: this.deviceId,
|
|
@@ -179978,7 +180008,7 @@ ${envIdSection}
|
|
|
179978
180008
|
## 环境信息
|
|
179979
180009
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
179980
180010
|
- Node.js版本: ${process.version}
|
|
179981
|
-
- MCP 版本:${process.env.npm_package_version || "1.8.
|
|
180011
|
+
- MCP 版本:${process.env.npm_package_version || "1.8.44" || 0}
|
|
179982
180012
|
- 系统架构: ${os_1.default.arch()}
|
|
179983
180013
|
- 时间: ${new Date().toISOString()}
|
|
179984
180014
|
- 请求ID: ${requestId}
|
|
@@ -195004,7 +195034,7 @@ function registerSetupTools(server) {
|
|
|
195004
195034
|
// downloadTemplate - 下载项目模板 (cloud-incompatible)
|
|
195005
195035
|
server.registerTool("downloadTemplate", {
|
|
195006
195036
|
title: "下载项目模板",
|
|
195007
|
-
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.
|
|
195037
|
+
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.44" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
195008
195038
|
inputSchema: {
|
|
195009
195039
|
template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
|
|
195010
195040
|
ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
|
|
@@ -196213,9 +196243,9 @@ async function getLoginState() {
|
|
|
196213
196243
|
}
|
|
196214
196244
|
const loginState = await auth.getLoginState();
|
|
196215
196245
|
if (!loginState) {
|
|
196216
|
-
(0, logger_js_1.debug)('loginByApiSecret');
|
|
196217
196246
|
await auth.loginByWebAuth({});
|
|
196218
196247
|
const loginState = await auth.getLoginState();
|
|
196248
|
+
(0, logger_js_1.debug)('loginByWebAuth', loginState);
|
|
196219
196249
|
return loginState;
|
|
196220
196250
|
}
|
|
196221
196251
|
else {
|
|
@@ -228516,8 +228546,8 @@ exports.resetInteractiveServer = resetInteractiveServer;
|
|
|
228516
228546
|
exports.getInteractiveServerSafe = getInteractiveServerSafe;
|
|
228517
228547
|
const express_1 = __importDefault(__webpack_require__(26083));
|
|
228518
228548
|
const http_1 = __importDefault(__webpack_require__(81630));
|
|
228519
|
-
const ws_1 = __webpack_require__(17699);
|
|
228520
228549
|
const open_1 = __importDefault(__webpack_require__(45368));
|
|
228550
|
+
const ws_1 = __webpack_require__(17699);
|
|
228521
228551
|
const logger_js_1 = __webpack_require__(13039);
|
|
228522
228552
|
// 动态导入 open 模块,兼容 ESM/CJS 环境
|
|
228523
228553
|
async function openUrl(url, options, server) {
|
|
@@ -229400,8 +229430,8 @@ class InteractiveServer {
|
|
|
229400
229430
|
</div>
|
|
229401
229431
|
|
|
229402
229432
|
<div class="content">
|
|
229403
|
-
<h1 class="content-title"
|
|
229404
|
-
<p class="content-subtitle"
|
|
229433
|
+
<h1 class="content-title">选择 CloudBase 环境</h1>
|
|
229434
|
+
<p class="content-subtitle">请选择您要使用的 CloudBase 环境</p>
|
|
229405
229435
|
|
|
229406
229436
|
<div class="env-list" id="envList">
|
|
229407
229437
|
${(envs || []).length > 0 ?
|
|
@@ -229418,8 +229448,8 @@ class InteractiveServer {
|
|
|
229418
229448
|
`).join('') :
|
|
229419
229449
|
`
|
|
229420
229450
|
<div class="empty-state">
|
|
229421
|
-
<h3 class="empty-title"
|
|
229422
|
-
<p class="empty-message"
|
|
229451
|
+
<h3 class="empty-title">暂无 CloudBase 环境</h3>
|
|
229452
|
+
<p class="empty-message">当前没有可用的 CloudBase 环境,请新建后重新在 AI 对话中重试</p>
|
|
229423
229453
|
<button class="btn btn-primary create-env-btn" onclick="createNewEnv()">
|
|
229424
229454
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
229425
229455
|
<path d="M12 5v14M5 12h14"/>
|
|
@@ -229457,7 +229487,7 @@ class InteractiveServer {
|
|
|
229457
229487
|
</svg>
|
|
229458
229488
|
</div>
|
|
229459
229489
|
<h2 class="success-title">环境配置成功!</h2>
|
|
229460
|
-
<p class="success-message"
|
|
229490
|
+
<p class="success-message">已成功选择 CloudBase 环境</p>
|
|
229461
229491
|
<div class="selected-env-info">
|
|
229462
229492
|
<span class="env-label">环境 ID:</span>
|
|
229463
229493
|
<span class="env-value" id="selectedEnvDisplay"></span>
|
package/dist/index.cjs
CHANGED
|
@@ -1246,9 +1246,6 @@ function registerEnvTools(server) {
|
|
|
1246
1246
|
if (error) {
|
|
1247
1247
|
return { content: [{ type: "text", text: error }] };
|
|
1248
1248
|
}
|
|
1249
|
-
if (noEnvs) {
|
|
1250
|
-
return { content: [{ type: "text", text: "当前账户下暂无可用的云开发环境,请先在腾讯云控制台创建环境 https://tcb.cloud.tencent.com/dev?from=AIToolkit" }] };
|
|
1251
|
-
}
|
|
1252
1249
|
if (cancelled) {
|
|
1253
1250
|
return { content: [{ type: "text", text: "用户取消了登录" }] };
|
|
1254
1251
|
}
|
|
@@ -1326,12 +1323,12 @@ function registerEnvTools(server) {
|
|
|
1326
1323
|
switch (action) {
|
|
1327
1324
|
case "list":
|
|
1328
1325
|
try {
|
|
1329
|
-
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId:
|
|
1326
|
+
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId: true });
|
|
1330
1327
|
result = await cloudbaseList.env.listEnvs();
|
|
1331
1328
|
}
|
|
1332
1329
|
catch (error) {
|
|
1333
1330
|
(0, logger_js_1.debug)('获取环境列表时出错:', error);
|
|
1334
|
-
return { content: [{ type: "text", text: "
|
|
1331
|
+
return { content: [{ type: "text", text: "获取环境列表时出错: " + (error instanceof Error ? error.message : String(error)) }]
|
|
1335
1332
|
};
|
|
1336
1333
|
}
|
|
1337
1334
|
break;
|
|
@@ -22465,11 +22462,11 @@ exports.getEnvId = getEnvId;
|
|
|
22465
22462
|
exports.resetCloudBaseManagerCache = resetCloudBaseManagerCache;
|
|
22466
22463
|
exports.getCloudBaseManager = getCloudBaseManager;
|
|
22467
22464
|
exports.createCloudBaseManagerWithOptions = createCloudBaseManagerWithOptions;
|
|
22465
|
+
const manager_node_1 = __importDefault(__webpack_require__(95492));
|
|
22468
22466
|
const auth_js_1 = __webpack_require__(77291);
|
|
22469
22467
|
const interactive_js_1 = __webpack_require__(3461);
|
|
22470
|
-
const manager_node_1 = __importDefault(__webpack_require__(95492));
|
|
22471
22468
|
const logger_js_1 = __webpack_require__(13039);
|
|
22472
|
-
const ENV_ID_TIMEOUT =
|
|
22469
|
+
const ENV_ID_TIMEOUT = 60000000; // 60000 seconds
|
|
22473
22470
|
// 统一的环境ID管理类
|
|
22474
22471
|
class EnvironmentManager {
|
|
22475
22472
|
cachedEnvId = null;
|
|
@@ -22638,14 +22635,14 @@ exports.saveEnvIdToUserConfig = saveEnvIdToUserConfig;
|
|
|
22638
22635
|
exports.loadEnvIdFromUserConfig = loadEnvIdFromUserConfig;
|
|
22639
22636
|
exports.clearUserEnvId = clearUserEnvId;
|
|
22640
22637
|
exports.autoSetupEnvironmentId = autoSetupEnvironmentId;
|
|
22638
|
+
const promises_1 = __importDefault(__webpack_require__(79748));
|
|
22639
|
+
const os_1 = __importDefault(__webpack_require__(21820));
|
|
22640
|
+
const path_1 = __importDefault(__webpack_require__(39902));
|
|
22641
22641
|
const zod_1 = __webpack_require__(21614);
|
|
22642
|
-
const interactive_server_js_1 = __webpack_require__(92341);
|
|
22643
|
-
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
22644
22642
|
const auth_js_1 = __webpack_require__(77291);
|
|
22643
|
+
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
22644
|
+
const interactive_server_js_1 = __webpack_require__(92341);
|
|
22645
22645
|
const logger_js_1 = __webpack_require__(13039);
|
|
22646
|
-
const promises_1 = __importDefault(__webpack_require__(79748));
|
|
22647
|
-
const path_1 = __importDefault(__webpack_require__(39902));
|
|
22648
|
-
const os_1 = __importDefault(__webpack_require__(21820));
|
|
22649
22646
|
function registerInteractiveTools(server) {
|
|
22650
22647
|
// 统一的交互式对话工具 (cloud-incompatible)
|
|
22651
22648
|
server.registerTool("interactiveDialog", {
|
|
@@ -101416,15 +101413,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
101416
101413
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
101417
101414
|
exports.CLOUDRUN_ACCESS_TYPES = exports.CLOUDRUN_SERVICE_TYPES = void 0;
|
|
101418
101415
|
exports.registerCloudRunTools = registerCloudRunTools;
|
|
101416
|
+
const child_process_1 = __webpack_require__(79646);
|
|
101417
|
+
const fs_1 = __importDefault(__webpack_require__(29021));
|
|
101418
|
+
const path_1 = __importDefault(__webpack_require__(39902));
|
|
101419
101419
|
const zod_1 = __webpack_require__(21614);
|
|
101420
101420
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
101421
|
-
const path_1 = __importDefault(__webpack_require__(39902));
|
|
101422
|
-
const fs_1 = __importDefault(__webpack_require__(29021));
|
|
101423
|
-
const child_process_1 = __webpack_require__(79646);
|
|
101424
101421
|
// CloudRun service types
|
|
101425
101422
|
exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
101426
101423
|
// CloudRun access types
|
|
101427
|
-
exports.CLOUDRUN_ACCESS_TYPES = ['
|
|
101424
|
+
exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
|
|
101428
101425
|
// Input schema for queryCloudRun tool
|
|
101429
101426
|
const queryCloudRunInputSchema = {
|
|
101430
101427
|
action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包括配置、版本、访问地址等),templates=获取可用的项目模板列表(用于初始化新项目)'),
|
|
@@ -101432,7 +101429,7 @@ const queryCloudRunInputSchema = {
|
|
|
101432
101429
|
pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
|
|
101433
101430
|
pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
|
|
101434
101431
|
serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
|
|
101435
|
-
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function
|
|
101432
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
|
|
101436
101433
|
// Detail operation parameters
|
|
101437
101434
|
detailServerName: zod_1.z.string().optional().describe('要查询详细信息的服务名称。当action为detail时必需提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
|
|
101438
101435
|
};
|
|
@@ -101443,18 +101440,24 @@ const ManageCloudRunInputSchema = {
|
|
|
101443
101440
|
// Deploy operation parameters
|
|
101444
101441
|
targetPath: zod_1.z.string().optional().describe('本地代码路径,必须是绝对路径。在deploy操作中指定要部署的代码目录,在download操作中指定下载目标目录,在init操作中指定云托管服务的上级目录(会在该目录下创建以serverName命名的子目录)。建议约定:项目根目录下的cloudrun/目录,例如:/Users/username/projects/my-project/cloudrun'),
|
|
101445
101442
|
serverConfig: zod_1.z.object({
|
|
101446
|
-
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:
|
|
101443
|
+
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:OA=办公网访问,PUBLIC=公网访问(默认,可通过HTTPS域名访问),MINIAPP=小程序访问,VPC=VPC访问(仅同VPC内可访问)。可配置多个类型'),
|
|
101447
101444
|
Cpu: zod_1.z.number().positive().optional().describe('CPU规格配置,单位为核。可选值:0.25、0.5、1、2、4、8等。注意:内存规格必须是CPU规格的2倍(如CPU=0.25时内存=0.5,CPU=1时内存=2)。影响服务性能和计费'),
|
|
101448
101445
|
Mem: zod_1.z.number().positive().optional().describe('内存规格配置,单位为GB。可选值:0.5、1、2、4、8、16等。注意:必须是CPU规格的2倍。影响服务性能和计费'),
|
|
101449
|
-
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0
|
|
101446
|
+
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0时始终保持指定数量的实例运行(确保快速响应但会增加成本)。建议设置为1以降低冷启动延迟,提升用户体验'),
|
|
101450
101447
|
MaxNum: zod_1.z.number().min(1).optional().describe('最大实例数配置,控制服务的最大运行实例数量。当请求量增加时,服务最多可以扩展到指定数量的实例,超过此数量后将拒绝新的请求。建议根据业务峰值设置'),
|
|
101448
|
+
PolicyDetails: zod_1.z.array(zod_1.z.object({
|
|
101449
|
+
PolicyType: zod_1.z.enum(['cpu', 'mem', 'cpu/mem']).describe('扩缩容类型:cpu=基于CPU使用率扩缩容,mem=基于内存使用率扩缩容,cpu/mem=基于CPU和内存使用率扩缩容'),
|
|
101450
|
+
PolicyThreshold: zod_1.z.number().min(1).max(100).describe('扩缩容阈值,单位为百分比。如60表示当资源使用率达到60%时触发扩缩容')
|
|
101451
|
+
})).optional().describe('扩缩容配置数组,用于配置服务的自动扩缩容策略。可配置多个扩缩容策略'),
|
|
101452
|
+
CustomLogs: zod_1.z.string().optional().describe('自定义日志配置,用于配置服务的日志收集和存储策略'),
|
|
101451
101453
|
Port: zod_1.z.number().min(1).max(65535).optional().describe('服务监听端口配置。函数型服务固定为3000,容器型服务可自定义。服务代码必须监听此端口才能正常接收请求'),
|
|
101452
|
-
EnvParams: zod_1.z.
|
|
101454
|
+
EnvParams: zod_1.z.string().optional().describe('环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如\'{"DATABASE_URL":"mysql://...","NODE_ENV":"production"}\'。敏感信息建议使用环境变量而非硬编码'),
|
|
101453
101455
|
Dockerfile: zod_1.z.string().optional().describe('Dockerfile文件名配置,仅容器型服务需要。指定用于构建容器镜像的Dockerfile文件路径,默认为项目根目录下的Dockerfile'),
|
|
101454
101456
|
BuildDir: zod_1.z.string().optional().describe('构建目录配置,指定代码构建的目录路径。当代码结构与标准不同时使用,默认为项目根目录'),
|
|
101455
|
-
InternalAccess: zod_1.z.
|
|
101456
|
-
|
|
101457
|
-
|
|
101457
|
+
InternalAccess: zod_1.z.string().optional().describe('内网访问开关配置,控制是否启用内网访问。true=启用内网访问(可通过云开发SDK直接调用),false=关闭内网访问(仅公网访问)'),
|
|
101458
|
+
InternalDomain: zod_1.z.string().optional().describe('内网域名配置,用于配置服务的内网访问域名。仅在启用内网访问时有效'),
|
|
101459
|
+
EntryPoint: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile EntryPoint参数配置,仅容器型服务需要。指定容器启动时的入口程序数组,如["node","app.js"]'),
|
|
101460
|
+
Cmd: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile Cmd参数配置,仅容器型服务需要。指定容器启动时的默认命令数组,如["npm","start"]'),
|
|
101458
101461
|
}).optional().describe('服务配置项,用于部署时设置服务的运行参数。包括资源规格、访问权限、环境变量等配置。不提供时使用默认配置'),
|
|
101459
101462
|
// Init operation parameters
|
|
101460
101463
|
template: zod_1.z.string().optional().default('helloworld').describe('项目模板标识符,用于指定初始化项目时使用的模板。可通过queryCloudRun的templates操作获取可用模板列表。常用模板:helloworld=Hello World示例,nodejs=Node.js项目模板,python=Python项目模板等'),
|
|
@@ -101474,6 +101477,7 @@ const ManageCloudRunInputSchema = {
|
|
|
101474
101477
|
}).optional().describe('Agent配置项,仅在createAgent操作时使用'),
|
|
101475
101478
|
// Common parameters
|
|
101476
101479
|
force: zod_1.z.boolean().optional().default(false).describe('强制操作开关,用于跳过确认提示。默认false(需要确认),设置为true时跳过所有确认步骤。删除操作时强烈建议设置为true以避免误操作'),
|
|
101480
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型配置:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)。不提供时自动检测:1)现有服务类型 2)有Dockerfile→container 3)有@cloudbase/aiagent-framework依赖→function 4)其他情况→container'),
|
|
101477
101481
|
};
|
|
101478
101482
|
/**
|
|
101479
101483
|
* Check if a project is an Agent project
|
|
@@ -101848,21 +101852,47 @@ for await (let x of res.textStream) {
|
|
|
101848
101852
|
if (!targetPath) {
|
|
101849
101853
|
throw new Error("targetPath is required for deploy operation");
|
|
101850
101854
|
}
|
|
101851
|
-
// Determine service type
|
|
101855
|
+
// Determine service type - use input.serverType if provided, otherwise auto-detect
|
|
101852
101856
|
let serverType;
|
|
101853
|
-
|
|
101854
|
-
|
|
101855
|
-
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
101856
|
-
serverType = details.BaseInfo?.ServerType || 'function';
|
|
101857
|
+
if (input.serverType) {
|
|
101858
|
+
serverType = input.serverType;
|
|
101857
101859
|
}
|
|
101858
|
-
|
|
101859
|
-
|
|
101860
|
-
|
|
101861
|
-
|
|
101862
|
-
serverType = 'container';
|
|
101860
|
+
else {
|
|
101861
|
+
try {
|
|
101862
|
+
// First try to get existing service details
|
|
101863
|
+
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
101864
|
+
serverType = details.BaseInfo?.ServerType || 'container';
|
|
101863
101865
|
}
|
|
101864
|
-
|
|
101865
|
-
|
|
101866
|
+
catch (e) {
|
|
101867
|
+
// If service doesn't exist, determine by project structure
|
|
101868
|
+
const dockerfilePath = path_1.default.join(targetPath, 'Dockerfile');
|
|
101869
|
+
if (fs_1.default.existsSync(dockerfilePath)) {
|
|
101870
|
+
serverType = 'container';
|
|
101871
|
+
}
|
|
101872
|
+
else {
|
|
101873
|
+
// Check if it's a Node.js function project (has package.json with specific structure)
|
|
101874
|
+
const packageJsonPath = path_1.default.join(targetPath, 'package.json');
|
|
101875
|
+
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
101876
|
+
try {
|
|
101877
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
101878
|
+
// If it has function-specific dependencies or scripts, treat as function
|
|
101879
|
+
if (packageJson.dependencies?.['@cloudbase/aiagent-framework'] ||
|
|
101880
|
+
packageJson.scripts?.['dev']?.includes('cloudrun run')) {
|
|
101881
|
+
serverType = 'function';
|
|
101882
|
+
}
|
|
101883
|
+
else {
|
|
101884
|
+
serverType = 'container';
|
|
101885
|
+
}
|
|
101886
|
+
}
|
|
101887
|
+
catch (parseError) {
|
|
101888
|
+
serverType = 'container';
|
|
101889
|
+
}
|
|
101890
|
+
}
|
|
101891
|
+
else {
|
|
101892
|
+
// No package.json, default to container
|
|
101893
|
+
serverType = 'container';
|
|
101894
|
+
}
|
|
101895
|
+
}
|
|
101866
101896
|
}
|
|
101867
101897
|
}
|
|
101868
101898
|
const deployParams = {
|
|
@@ -101873,7 +101903,7 @@ for await (let x of res.textStream) {
|
|
|
101873
101903
|
};
|
|
101874
101904
|
// Add server configuration if provided
|
|
101875
101905
|
if (input.serverConfig) {
|
|
101876
|
-
|
|
101906
|
+
deployParams.serverConfig = input.serverConfig;
|
|
101877
101907
|
}
|
|
101878
101908
|
const result = await cloudrunService.deploy(deployParams);
|
|
101879
101909
|
// Generate cloudbaserc.json configuration file
|
|
@@ -121943,7 +121973,7 @@ class TelemetryReporter {
|
|
|
121943
121973
|
const nodeVersion = process.version; // Node.js版本
|
|
121944
121974
|
const arch = os_1.default.arch(); // 系统架构
|
|
121945
121975
|
// 从构建时注入的版本号获取MCP版本信息
|
|
121946
|
-
const mcpVersion = process.env.npm_package_version || "1.8.
|
|
121976
|
+
const mcpVersion = process.env.npm_package_version || "1.8.44" || 0;
|
|
121947
121977
|
return {
|
|
121948
121978
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
121949
121979
|
deviceId: this.deviceId,
|
|
@@ -179829,7 +179859,7 @@ ${envIdSection}
|
|
|
179829
179859
|
## 环境信息
|
|
179830
179860
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
179831
179861
|
- Node.js版本: ${process.version}
|
|
179832
|
-
- MCP 版本:${process.env.npm_package_version || "1.8.
|
|
179862
|
+
- MCP 版本:${process.env.npm_package_version || "1.8.44" || 0}
|
|
179833
179863
|
- 系统架构: ${os_1.default.arch()}
|
|
179834
179864
|
- 时间: ${new Date().toISOString()}
|
|
179835
179865
|
- 请求ID: ${requestId}
|
|
@@ -194855,7 +194885,7 @@ function registerSetupTools(server) {
|
|
|
194855
194885
|
// downloadTemplate - 下载项目模板 (cloud-incompatible)
|
|
194856
194886
|
server.registerTool("downloadTemplate", {
|
|
194857
194887
|
title: "下载项目模板",
|
|
194858
|
-
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.
|
|
194888
|
+
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.44" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
194859
194889
|
inputSchema: {
|
|
194860
194890
|
template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
|
|
194861
194891
|
ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
|
|
@@ -196064,9 +196094,9 @@ async function getLoginState() {
|
|
|
196064
196094
|
}
|
|
196065
196095
|
const loginState = await auth.getLoginState();
|
|
196066
196096
|
if (!loginState) {
|
|
196067
|
-
(0, logger_js_1.debug)('loginByApiSecret');
|
|
196068
196097
|
await auth.loginByWebAuth({});
|
|
196069
196098
|
const loginState = await auth.getLoginState();
|
|
196099
|
+
(0, logger_js_1.debug)('loginByWebAuth', loginState);
|
|
196070
196100
|
return loginState;
|
|
196071
196101
|
}
|
|
196072
196102
|
else {
|
|
@@ -228412,8 +228442,8 @@ exports.resetInteractiveServer = resetInteractiveServer;
|
|
|
228412
228442
|
exports.getInteractiveServerSafe = getInteractiveServerSafe;
|
|
228413
228443
|
const express_1 = __importDefault(__webpack_require__(26083));
|
|
228414
228444
|
const http_1 = __importDefault(__webpack_require__(81630));
|
|
228415
|
-
const ws_1 = __webpack_require__(17699);
|
|
228416
228445
|
const open_1 = __importDefault(__webpack_require__(45368));
|
|
228446
|
+
const ws_1 = __webpack_require__(17699);
|
|
228417
228447
|
const logger_js_1 = __webpack_require__(13039);
|
|
228418
228448
|
// 动态导入 open 模块,兼容 ESM/CJS 环境
|
|
228419
228449
|
async function openUrl(url, options, server) {
|
|
@@ -229296,8 +229326,8 @@ class InteractiveServer {
|
|
|
229296
229326
|
</div>
|
|
229297
229327
|
|
|
229298
229328
|
<div class="content">
|
|
229299
|
-
<h1 class="content-title"
|
|
229300
|
-
<p class="content-subtitle"
|
|
229329
|
+
<h1 class="content-title">选择 CloudBase 环境</h1>
|
|
229330
|
+
<p class="content-subtitle">请选择您要使用的 CloudBase 环境</p>
|
|
229301
229331
|
|
|
229302
229332
|
<div class="env-list" id="envList">
|
|
229303
229333
|
${(envs || []).length > 0 ?
|
|
@@ -229314,8 +229344,8 @@ class InteractiveServer {
|
|
|
229314
229344
|
`).join('') :
|
|
229315
229345
|
`
|
|
229316
229346
|
<div class="empty-state">
|
|
229317
|
-
<h3 class="empty-title"
|
|
229318
|
-
<p class="empty-message"
|
|
229347
|
+
<h3 class="empty-title">暂无 CloudBase 环境</h3>
|
|
229348
|
+
<p class="empty-message">当前没有可用的 CloudBase 环境,请新建后重新在 AI 对话中重试</p>
|
|
229319
229349
|
<button class="btn btn-primary create-env-btn" onclick="createNewEnv()">
|
|
229320
229350
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
229321
229351
|
<path d="M12 5v14M5 12h14"/>
|
|
@@ -229353,7 +229383,7 @@ class InteractiveServer {
|
|
|
229353
229383
|
</svg>
|
|
229354
229384
|
</div>
|
|
229355
229385
|
<h2 class="success-title">环境配置成功!</h2>
|
|
229356
|
-
<p class="success-message"
|
|
229386
|
+
<p class="success-message">已成功选择 CloudBase 环境</p>
|
|
229357
229387
|
<div class="selected-env-info">
|
|
229358
229388
|
<span class="env-label">环境 ID:</span>
|
|
229359
229389
|
<span class="env-value" id="selectedEnvDisplay"></span>
|
package/dist/index.js
CHANGED
|
@@ -31,15 +31,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32
32
|
exports.CLOUDRUN_ACCESS_TYPES = exports.CLOUDRUN_SERVICE_TYPES = void 0;
|
|
33
33
|
exports.registerCloudRunTools = registerCloudRunTools;
|
|
34
|
+
const child_process_1 = __webpack_require__(814);
|
|
35
|
+
const fs_1 = __importDefault(__webpack_require__(421));
|
|
36
|
+
const path_1 = __importDefault(__webpack_require__(521));
|
|
34
37
|
const zod_1 = __webpack_require__(971);
|
|
35
38
|
const cloudbase_manager_js_1 = __webpack_require__(431);
|
|
36
|
-
const path_1 = __importDefault(__webpack_require__(521));
|
|
37
|
-
const fs_1 = __importDefault(__webpack_require__(421));
|
|
38
|
-
const child_process_1 = __webpack_require__(814);
|
|
39
39
|
// CloudRun service types
|
|
40
40
|
exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
41
41
|
// CloudRun access types
|
|
42
|
-
exports.CLOUDRUN_ACCESS_TYPES = ['
|
|
42
|
+
exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
|
|
43
43
|
// Input schema for queryCloudRun tool
|
|
44
44
|
const queryCloudRunInputSchema = {
|
|
45
45
|
action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包括配置、版本、访问地址等),templates=获取可用的项目模板列表(用于初始化新项目)'),
|
|
@@ -47,7 +47,7 @@ const queryCloudRunInputSchema = {
|
|
|
47
47
|
pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
|
|
48
48
|
pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
|
|
49
49
|
serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
|
|
50
|
-
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function
|
|
50
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
|
|
51
51
|
// Detail operation parameters
|
|
52
52
|
detailServerName: zod_1.z.string().optional().describe('要查询详细信息的服务名称。当action为detail时必需提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
|
|
53
53
|
};
|
|
@@ -58,18 +58,24 @@ const ManageCloudRunInputSchema = {
|
|
|
58
58
|
// Deploy operation parameters
|
|
59
59
|
targetPath: zod_1.z.string().optional().describe('本地代码路径,必须是绝对路径。在deploy操作中指定要部署的代码目录,在download操作中指定下载目标目录,在init操作中指定云托管服务的上级目录(会在该目录下创建以serverName命名的子目录)。建议约定:项目根目录下的cloudrun/目录,例如:/Users/username/projects/my-project/cloudrun'),
|
|
60
60
|
serverConfig: zod_1.z.object({
|
|
61
|
-
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:
|
|
61
|
+
OpenAccessTypes: zod_1.z.array(zod_1.z.enum(exports.CLOUDRUN_ACCESS_TYPES)).optional().describe('公网访问类型配置,控制服务的访问权限:OA=办公网访问,PUBLIC=公网访问(默认,可通过HTTPS域名访问),MINIAPP=小程序访问,VPC=VPC访问(仅同VPC内可访问)。可配置多个类型'),
|
|
62
62
|
Cpu: zod_1.z.number().positive().optional().describe('CPU规格配置,单位为核。可选值:0.25、0.5、1、2、4、8等。注意:内存规格必须是CPU规格的2倍(如CPU=0.25时内存=0.5,CPU=1时内存=2)。影响服务性能和计费'),
|
|
63
63
|
Mem: zod_1.z.number().positive().optional().describe('内存规格配置,单位为GB。可选值:0.5、1、2、4、8、16等。注意:必须是CPU规格的2倍。影响服务性能和计费'),
|
|
64
|
-
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0
|
|
64
|
+
MinNum: zod_1.z.number().min(0).optional().describe('最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0时始终保持指定数量的实例运行(确保快速响应但会增加成本)。建议设置为1以降低冷启动延迟,提升用户体验'),
|
|
65
65
|
MaxNum: zod_1.z.number().min(1).optional().describe('最大实例数配置,控制服务的最大运行实例数量。当请求量增加时,服务最多可以扩展到指定数量的实例,超过此数量后将拒绝新的请求。建议根据业务峰值设置'),
|
|
66
|
+
PolicyDetails: zod_1.z.array(zod_1.z.object({
|
|
67
|
+
PolicyType: zod_1.z.enum(['cpu', 'mem', 'cpu/mem']).describe('扩缩容类型:cpu=基于CPU使用率扩缩容,mem=基于内存使用率扩缩容,cpu/mem=基于CPU和内存使用率扩缩容'),
|
|
68
|
+
PolicyThreshold: zod_1.z.number().min(1).max(100).describe('扩缩容阈值,单位为百分比。如60表示当资源使用率达到60%时触发扩缩容')
|
|
69
|
+
})).optional().describe('扩缩容配置数组,用于配置服务的自动扩缩容策略。可配置多个扩缩容策略'),
|
|
70
|
+
CustomLogs: zod_1.z.string().optional().describe('自定义日志配置,用于配置服务的日志收集和存储策略'),
|
|
66
71
|
Port: zod_1.z.number().min(1).max(65535).optional().describe('服务监听端口配置。函数型服务固定为3000,容器型服务可自定义。服务代码必须监听此端口才能正常接收请求'),
|
|
67
|
-
EnvParams: zod_1.z.
|
|
72
|
+
EnvParams: zod_1.z.string().optional().describe('环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如\'{"DATABASE_URL":"mysql://...","NODE_ENV":"production"}\'。敏感信息建议使用环境变量而非硬编码'),
|
|
68
73
|
Dockerfile: zod_1.z.string().optional().describe('Dockerfile文件名配置,仅容器型服务需要。指定用于构建容器镜像的Dockerfile文件路径,默认为项目根目录下的Dockerfile'),
|
|
69
74
|
BuildDir: zod_1.z.string().optional().describe('构建目录配置,指定代码构建的目录路径。当代码结构与标准不同时使用,默认为项目根目录'),
|
|
70
|
-
InternalAccess: zod_1.z.
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
InternalAccess: zod_1.z.string().optional().describe('内网访问开关配置,控制是否启用内网访问。true=启用内网访问(可通过云开发SDK直接调用),false=关闭内网访问(仅公网访问)'),
|
|
76
|
+
InternalDomain: zod_1.z.string().optional().describe('内网域名配置,用于配置服务的内网访问域名。仅在启用内网访问时有效'),
|
|
77
|
+
EntryPoint: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile EntryPoint参数配置,仅容器型服务需要。指定容器启动时的入口程序数组,如["node","app.js"]'),
|
|
78
|
+
Cmd: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile Cmd参数配置,仅容器型服务需要。指定容器启动时的默认命令数组,如["npm","start"]'),
|
|
73
79
|
}).optional().describe('服务配置项,用于部署时设置服务的运行参数。包括资源规格、访问权限、环境变量等配置。不提供时使用默认配置'),
|
|
74
80
|
// Init operation parameters
|
|
75
81
|
template: zod_1.z.string().optional().default('helloworld').describe('项目模板标识符,用于指定初始化项目时使用的模板。可通过queryCloudRun的templates操作获取可用模板列表。常用模板:helloworld=Hello World示例,nodejs=Node.js项目模板,python=Python项目模板等'),
|
|
@@ -89,6 +95,7 @@ const ManageCloudRunInputSchema = {
|
|
|
89
95
|
}).optional().describe('Agent配置项,仅在createAgent操作时使用'),
|
|
90
96
|
// Common parameters
|
|
91
97
|
force: zod_1.z.boolean().optional().default(false).describe('强制操作开关,用于跳过确认提示。默认false(需要确认),设置为true时跳过所有确认步骤。删除操作时强烈建议设置为true以避免误操作'),
|
|
98
|
+
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型配置:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)。不提供时自动检测:1)现有服务类型 2)有Dockerfile→container 3)有@cloudbase/aiagent-framework依赖→function 4)其他情况→container'),
|
|
92
99
|
};
|
|
93
100
|
/**
|
|
94
101
|
* Check if a project is an Agent project
|
|
@@ -463,21 +470,47 @@ for await (let x of res.textStream) {
|
|
|
463
470
|
if (!targetPath) {
|
|
464
471
|
throw new Error("targetPath is required for deploy operation");
|
|
465
472
|
}
|
|
466
|
-
// Determine service type
|
|
473
|
+
// Determine service type - use input.serverType if provided, otherwise auto-detect
|
|
467
474
|
let serverType;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
471
|
-
serverType = details.BaseInfo?.ServerType || 'function';
|
|
475
|
+
if (input.serverType) {
|
|
476
|
+
serverType = input.serverType;
|
|
472
477
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
serverType = 'container';
|
|
478
|
+
else {
|
|
479
|
+
try {
|
|
480
|
+
// First try to get existing service details
|
|
481
|
+
const details = await cloudrunService.detail({ serverName: input.serverName });
|
|
482
|
+
serverType = details.BaseInfo?.ServerType || 'container';
|
|
478
483
|
}
|
|
479
|
-
|
|
480
|
-
|
|
484
|
+
catch (e) {
|
|
485
|
+
// If service doesn't exist, determine by project structure
|
|
486
|
+
const dockerfilePath = path_1.default.join(targetPath, 'Dockerfile');
|
|
487
|
+
if (fs_1.default.existsSync(dockerfilePath)) {
|
|
488
|
+
serverType = 'container';
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
// Check if it's a Node.js function project (has package.json with specific structure)
|
|
492
|
+
const packageJsonPath = path_1.default.join(targetPath, 'package.json');
|
|
493
|
+
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
494
|
+
try {
|
|
495
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
496
|
+
// If it has function-specific dependencies or scripts, treat as function
|
|
497
|
+
if (packageJson.dependencies?.['@cloudbase/aiagent-framework'] ||
|
|
498
|
+
packageJson.scripts?.['dev']?.includes('cloudrun run')) {
|
|
499
|
+
serverType = 'function';
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
serverType = 'container';
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
catch (parseError) {
|
|
506
|
+
serverType = 'container';
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
// No package.json, default to container
|
|
511
|
+
serverType = 'container';
|
|
512
|
+
}
|
|
513
|
+
}
|
|
481
514
|
}
|
|
482
515
|
}
|
|
483
516
|
const deployParams = {
|
|
@@ -488,7 +521,7 @@ for await (let x of res.textStream) {
|
|
|
488
521
|
};
|
|
489
522
|
// Add server configuration if provided
|
|
490
523
|
if (input.serverConfig) {
|
|
491
|
-
|
|
524
|
+
deployParams.serverConfig = input.serverConfig;
|
|
492
525
|
}
|
|
493
526
|
const result = await cloudrunService.deploy(deployParams);
|
|
494
527
|
// Generate cloudbaserc.json configuration file
|
|
@@ -2056,9 +2089,9 @@ async function getLoginState() {
|
|
|
2056
2089
|
}
|
|
2057
2090
|
const loginState = await auth.getLoginState();
|
|
2058
2091
|
if (!loginState) {
|
|
2059
|
-
(0, logger_js_1.debug)('loginByApiSecret');
|
|
2060
2092
|
await auth.loginByWebAuth({});
|
|
2061
2093
|
const loginState = await auth.getLoginState();
|
|
2094
|
+
(0, logger_js_1.debug)('loginByWebAuth', loginState);
|
|
2062
2095
|
return loginState;
|
|
2063
2096
|
}
|
|
2064
2097
|
else {
|
|
@@ -2135,8 +2168,8 @@ exports.resetInteractiveServer = resetInteractiveServer;
|
|
|
2135
2168
|
exports.getInteractiveServerSafe = getInteractiveServerSafe;
|
|
2136
2169
|
const express_1 = __importDefault(__webpack_require__(674));
|
|
2137
2170
|
const http_1 = __importDefault(__webpack_require__(782));
|
|
2138
|
-
const ws_1 = __webpack_require__(220);
|
|
2139
2171
|
const open_1 = __importDefault(__webpack_require__(241));
|
|
2172
|
+
const ws_1 = __webpack_require__(220);
|
|
2140
2173
|
const logger_js_1 = __webpack_require__(39);
|
|
2141
2174
|
// 动态导入 open 模块,兼容 ESM/CJS 环境
|
|
2142
2175
|
async function openUrl(url, options, server) {
|
|
@@ -3019,8 +3052,8 @@ class InteractiveServer {
|
|
|
3019
3052
|
</div>
|
|
3020
3053
|
|
|
3021
3054
|
<div class="content">
|
|
3022
|
-
<h1 class="content-title"
|
|
3023
|
-
<p class="content-subtitle"
|
|
3055
|
+
<h1 class="content-title">选择 CloudBase 环境</h1>
|
|
3056
|
+
<p class="content-subtitle">请选择您要使用的 CloudBase 环境</p>
|
|
3024
3057
|
|
|
3025
3058
|
<div class="env-list" id="envList">
|
|
3026
3059
|
${(envs || []).length > 0 ?
|
|
@@ -3037,8 +3070,8 @@ class InteractiveServer {
|
|
|
3037
3070
|
`).join('') :
|
|
3038
3071
|
`
|
|
3039
3072
|
<div class="empty-state">
|
|
3040
|
-
<h3 class="empty-title"
|
|
3041
|
-
<p class="empty-message"
|
|
3073
|
+
<h3 class="empty-title">暂无 CloudBase 环境</h3>
|
|
3074
|
+
<p class="empty-message">当前没有可用的 CloudBase 环境,请新建后重新在 AI 对话中重试</p>
|
|
3042
3075
|
<button class="btn btn-primary create-env-btn" onclick="createNewEnv()">
|
|
3043
3076
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3044
3077
|
<path d="M12 5v14M5 12h14"/>
|
|
@@ -3076,7 +3109,7 @@ class InteractiveServer {
|
|
|
3076
3109
|
</svg>
|
|
3077
3110
|
</div>
|
|
3078
3111
|
<h2 class="success-title">环境配置成功!</h2>
|
|
3079
|
-
<p class="success-message"
|
|
3112
|
+
<p class="success-message">已成功选择 CloudBase 环境</p>
|
|
3080
3113
|
<div class="selected-env-info">
|
|
3081
3114
|
<span class="env-label">环境 ID:</span>
|
|
3082
3115
|
<span class="env-value" id="selectedEnvDisplay"></span>
|
|
@@ -5008,7 +5041,7 @@ ${envIdSection}
|
|
|
5008
5041
|
## 环境信息
|
|
5009
5042
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
5010
5043
|
- Node.js版本: ${process.version}
|
|
5011
|
-
- MCP 版本:${process.env.npm_package_version || "1.8.
|
|
5044
|
+
- MCP 版本:${process.env.npm_package_version || "1.8.44" || 0}
|
|
5012
5045
|
- 系统架构: ${os_1.default.arch()}
|
|
5013
5046
|
- 时间: ${new Date().toISOString()}
|
|
5014
5047
|
- 请求ID: ${requestId}
|
|
@@ -5321,11 +5354,11 @@ exports.getEnvId = getEnvId;
|
|
|
5321
5354
|
exports.resetCloudBaseManagerCache = resetCloudBaseManagerCache;
|
|
5322
5355
|
exports.getCloudBaseManager = getCloudBaseManager;
|
|
5323
5356
|
exports.createCloudBaseManagerWithOptions = createCloudBaseManagerWithOptions;
|
|
5357
|
+
const manager_node_1 = __importDefault(__webpack_require__(665));
|
|
5324
5358
|
const auth_js_1 = __webpack_require__(291);
|
|
5325
5359
|
const interactive_js_1 = __webpack_require__(461);
|
|
5326
|
-
const manager_node_1 = __importDefault(__webpack_require__(665));
|
|
5327
5360
|
const logger_js_1 = __webpack_require__(39);
|
|
5328
|
-
const ENV_ID_TIMEOUT =
|
|
5361
|
+
const ENV_ID_TIMEOUT = 60000000; // 60000 seconds
|
|
5329
5362
|
// 统一的环境ID管理类
|
|
5330
5363
|
class EnvironmentManager {
|
|
5331
5364
|
cachedEnvId = null;
|
|
@@ -5500,14 +5533,14 @@ exports.saveEnvIdToUserConfig = saveEnvIdToUserConfig;
|
|
|
5500
5533
|
exports.loadEnvIdFromUserConfig = loadEnvIdFromUserConfig;
|
|
5501
5534
|
exports.clearUserEnvId = clearUserEnvId;
|
|
5502
5535
|
exports.autoSetupEnvironmentId = autoSetupEnvironmentId;
|
|
5536
|
+
const promises_1 = __importDefault(__webpack_require__(932));
|
|
5537
|
+
const os_1 = __importDefault(__webpack_require__(116));
|
|
5538
|
+
const path_1 = __importDefault(__webpack_require__(521));
|
|
5503
5539
|
const zod_1 = __webpack_require__(971);
|
|
5504
|
-
const interactive_server_js_1 = __webpack_require__(341);
|
|
5505
|
-
const cloudbase_manager_js_1 = __webpack_require__(431);
|
|
5506
5540
|
const auth_js_1 = __webpack_require__(291);
|
|
5541
|
+
const cloudbase_manager_js_1 = __webpack_require__(431);
|
|
5542
|
+
const interactive_server_js_1 = __webpack_require__(341);
|
|
5507
5543
|
const logger_js_1 = __webpack_require__(39);
|
|
5508
|
-
const promises_1 = __importDefault(__webpack_require__(932));
|
|
5509
|
-
const path_1 = __importDefault(__webpack_require__(521));
|
|
5510
|
-
const os_1 = __importDefault(__webpack_require__(116));
|
|
5511
5544
|
function registerInteractiveTools(server) {
|
|
5512
5545
|
// 统一的交互式对话工具 (cloud-incompatible)
|
|
5513
5546
|
server.registerTool("interactiveDialog", {
|
|
@@ -6051,7 +6084,7 @@ function registerSetupTools(server) {
|
|
|
6051
6084
|
// downloadTemplate - 下载项目模板 (cloud-incompatible)
|
|
6052
6085
|
server.registerTool("downloadTemplate", {
|
|
6053
6086
|
title: "下载项目模板",
|
|
6054
|
-
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.
|
|
6087
|
+
description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "1.8.44" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
6055
6088
|
inputSchema: {
|
|
6056
6089
|
template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
|
|
6057
6090
|
ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
|
|
@@ -6243,9 +6276,6 @@ function registerEnvTools(server) {
|
|
|
6243
6276
|
if (error) {
|
|
6244
6277
|
return { content: [{ type: "text", text: error }] };
|
|
6245
6278
|
}
|
|
6246
|
-
if (noEnvs) {
|
|
6247
|
-
return { content: [{ type: "text", text: "当前账户下暂无可用的云开发环境,请先在腾讯云控制台创建环境 https://tcb.cloud.tencent.com/dev?from=AIToolkit" }] };
|
|
6248
|
-
}
|
|
6249
6279
|
if (cancelled) {
|
|
6250
6280
|
return { content: [{ type: "text", text: "用户取消了登录" }] };
|
|
6251
6281
|
}
|
|
@@ -6323,12 +6353,12 @@ function registerEnvTools(server) {
|
|
|
6323
6353
|
switch (action) {
|
|
6324
6354
|
case "list":
|
|
6325
6355
|
try {
|
|
6326
|
-
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId:
|
|
6356
|
+
const cloudbaseList = await (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions, requireEnvId: true });
|
|
6327
6357
|
result = await cloudbaseList.env.listEnvs();
|
|
6328
6358
|
}
|
|
6329
6359
|
catch (error) {
|
|
6330
6360
|
(0, logger_js_1.debug)('获取环境列表时出错:', error);
|
|
6331
|
-
return { content: [{ type: "text", text: "
|
|
6361
|
+
return { content: [{ type: "text", text: "获取环境列表时出错: " + (error instanceof Error ? error.message : String(error)) }]
|
|
6332
6362
|
};
|
|
6333
6363
|
}
|
|
6334
6364
|
break;
|
|
@@ -8907,7 +8937,7 @@ class TelemetryReporter {
|
|
|
8907
8937
|
const nodeVersion = process.version; // Node.js版本
|
|
8908
8938
|
const arch = os_1.default.arch(); // 系统架构
|
|
8909
8939
|
// 从构建时注入的版本号获取MCP版本信息
|
|
8910
|
-
const mcpVersion = process.env.npm_package_version || "1.8.
|
|
8940
|
+
const mcpVersion = process.env.npm_package_version || "1.8.44" || 0;
|
|
8911
8941
|
return {
|
|
8912
8942
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
8913
8943
|
deviceId: this.deviceId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cloudbase-mcp",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.44",
|
|
4
4
|
"description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|