@cloudbase/cloudbase-mcp 2.23.7 → 2.23.9

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/index.cjs CHANGED
@@ -113972,14 +113972,43 @@ const ManageCloudRunInputSchema = {
113972
113972
  })).optional().describe('扩缩容配置数组,用于配置服务的自动扩缩容策略。可配置多个扩缩容策略'),
113973
113973
  CustomLogs: zod_1.z.string().optional().describe('自定义日志配置,用于配置服务的日志收集和存储策略'),
113974
113974
  Port: zod_1.z.number().min(1).max(65535).optional().describe('服务监听端口配置。函数型服务固定为3000,容器型服务可自定义。服务代码必须监听此端口才能正常接收请求'),
113975
- EnvParams: zod_1.z.string().optional().describe('环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如\'{"DATABASE_URL":"mysql://...","NODE_ENV":"production"}\'。敏感信息建议使用环境变量而非硬编码'),
113975
+ EnvParams: zod_1.z.string().optional().describe('环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如\'{"DATABASE_URL":"mysql://...","NODE_ENV":"production"}\'。SDK v5.6.1+ 会自动对传入的环境变量进行 AES-256-CBC 加密传输'),
113976
113976
  Dockerfile: zod_1.z.string().optional().describe('Dockerfile文件名配置,仅容器型服务需要。指定用于构建容器镜像的Dockerfile文件路径,默认为项目根目录下的Dockerfile'),
113977
113977
  BuildDir: zod_1.z.string().optional().describe('构建目录配置,指定代码构建的目录路径。当代码结构与标准不同时使用,默认为项目根目录'),
113978
113978
  InternalAccess: zod_1.z.string().optional().describe('内网访问开关配置,控制是否启用内网访问。true=启用内网访问(可通过云开发SDK直接调用),false=关闭内网访问(仅公网访问)'),
113979
113979
  InternalDomain: zod_1.z.string().optional().describe('内网域名配置,用于配置服务的内网访问域名。仅在启用内网访问时有效'),
113980
113980
  EntryPoint: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile EntryPoint参数配置,仅容器型服务需要。指定容器启动时的入口程序数组,如["node","app.js"]'),
113981
113981
  Cmd: zod_1.z.array(zod_1.z.string()).optional().describe('Dockerfile Cmd参数配置,仅容器型服务需要。指定容器启动时的默认命令数组,如["npm","start"]'),
113982
- }).optional().describe('服务配置项,用于部署时设置服务的运行参数。包括资源规格、访问权限、环境变量等配置。不提供时使用默认配置'),
113982
+ InitialDelaySeconds: zod_1.z.number().min(0).optional().describe('延迟检测时间(秒),用于配置服务启动后的健康检查延迟。在此期间内不会将请求路由到该实例,适用于启动时间较长的服务'),
113983
+ LogType: zod_1.z.string().optional().describe('日志类型配置,指定服务的日志收集类型。影响日志的采集方式和存储格式'),
113984
+ LogSetId: zod_1.z.string().optional().describe('CLS日志集ID配置,指定日志服务(CLS)的日志集ID。需要先开通CLS日志服务'),
113985
+ LogTopicId: zod_1.z.string().optional().describe('CLS日志主题ID配置,指定日志服务(CLS)的日志主题ID。需要先开通CLS日志服务'),
113986
+ LogParseType: zod_1.z.string().optional().describe('日志解析类型配置,指定日志的解析方式。用于将原始日志解析为结构化数据'),
113987
+ Tag: zod_1.z.string().optional().describe('服务标签配置,用于标识服务类型。如设置为"function:"表示函数型服务。SDK会自动根据配置生成'),
113988
+ OperationMode: zod_1.z.string().optional().describe('运行模式配置,指定服务的运行模式。影响服务的调度和资源分配方式'),
113989
+ SessionAffinity: zod_1.z.string().optional().describe('会话保持配置,用于控制是否启用会话保持功能。启用后会将同一客户端的请求路由到同一实例'),
113990
+ TimerScale: zod_1.z.array(zod_1.z.object({
113991
+ CycleType: zod_1.z.enum(['none', 'daily', 'weekly', 'monthly']).describe('循环类型:none=无循环,daily=每日循环,weekly=每周循环,monthly=每月循环'),
113992
+ StartDate: zod_1.z.string().optional().describe('循环起始日期,格式:YYYY-MM-DD'),
113993
+ EndDate: zod_1.z.string().optional().describe('循环结束日期,格式:YYYY-MM-DD'),
113994
+ StartTime: zod_1.z.string().describe('起始时间,格式:HH:mm:ss'),
113995
+ EndTime: zod_1.z.string().describe('结束时间,格式:HH:mm:ss'),
113996
+ ReplicaNum: zod_1.z.number().min(0).describe('定时扩缩容的目标副本数,最小值0(缩容到0)')
113997
+ })).optional().describe('定时扩缩容配置数组,用于配置服务的定时自动扩缩容策略。可配置多个时间段的扩缩容计划,支持每日/每周/每月循环'),
113998
+ VpcConf: zod_1.z.object({
113999
+ VpcId: zod_1.z.string().describe('VPC网络ID,指定服务所在的私有网络'),
114000
+ SubnetId: zod_1.z.string().describe('子网ID,指定服务所在的子网'),
114001
+ }).optional().describe('VPC网络配置,用于将云托管服务部署到指定的私有网络中。需要提前创建好VPC和子网'),
114002
+ VolumesConf: zod_1.z.array(zod_1.z.object({
114003
+ VolumeName: zod_1.z.string().describe('存储卷名称'),
114004
+ VolumeType: zod_1.z.string().describe('存储卷类型,如CFS表示云文件存储'),
114005
+ VolumePath: zod_1.z.string().describe('存储卷挂载路径,服务代码中的目标路径')
114006
+ })).optional().describe('存储卷配置数组,用于挂载云存储(如CFS)到服务实例中。可用于持久化数据或共享文件'),
114007
+ PublicNetConf: zod_1.z.object({
114008
+ PublicAccess: zod_1.z.boolean().optional().describe('是否开启公网访问,true=开启公网访问,false=关闭公网访问'),
114009
+ PublicAccessPath: zod_1.z.string().optional().describe('公网访问路径配置')
114010
+ }).optional().describe('公网访问配置,用于控制服务的公网访问策略。可配置是否开启公网访问及访问路径'),
114011
+ }).optional().describe('服务配置项,用于部署时设置服务的运行参数。包括资源规格、访问权限、环境变量、日志、网络等配置。不提供时使用默认配置'),
113983
114012
  // Init operation parameters
113984
114013
  template: zod_1.z.string().optional().default('helloworld').describe('项目模板标识符,用于指定初始化项目时使用的模板。可通过queryCloudRun的templates操作获取可用模板列表。常用模板:helloworld=Hello World示例,nodejs=Node.js项目模板,python=Python项目模板等'),
113985
114014
  // Run operation parameters (function services only)
@@ -136807,7 +136836,7 @@ class TelemetryReporter {
136807
136836
  const nodeVersion = process.version; // Node.js版本
136808
136837
  const arch = os_1.default.arch(); // 系统架构
136809
136838
  // 从构建时注入的版本号获取MCP版本信息
136810
- const mcpVersion = process.env.npm_package_version || "2.23.7" || 0;
136839
+ const mcpVersion = process.env.npm_package_version || "2.23.9" || 0;
136811
136840
  return {
136812
136841
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
136813
136842
  deviceId: this.deviceId,
@@ -160242,17 +160271,13 @@ exports["default"] = applicator;
160242
160271
  /***/ }),
160243
160272
 
160244
160273
  /***/ 56473:
160245
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
160274
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
160246
160275
 
160247
160276
  "use strict";
160248
160277
 
160249
- var __importDefault = (this && this.__importDefault) || function (mod) {
160250
- return (mod && mod.__esModule) ? mod : { "default": mod };
160251
- };
160252
160278
  Object.defineProperty(exports, "__esModule", ({ value: true }));
160279
+ exports.__resetPgReadyCache = __resetPgReadyCache;
160253
160280
  exports.registerPGDatabaseTools = registerPGDatabaseTools;
160254
- const node_fs_1 = __webpack_require__(89971);
160255
- const node_path_1 = __importDefault(__webpack_require__(26743));
160256
160281
  const zod_1 = __webpack_require__(21614);
160257
160282
  const cloudbase_manager_js_1 = __webpack_require__(3431);
160258
160283
  const tool_result_js_1 = __webpack_require__(9835);
@@ -160267,7 +160292,6 @@ const QUERY_ACTIONS = [
160267
160292
  "sql",
160268
160293
  ];
160269
160294
  const MANAGE_ACTIONS = [
160270
- "init",
160271
160295
  "execute",
160272
160296
  "dryRun",
160273
160297
  "planMigration",
@@ -160288,63 +160312,19 @@ function buildNextAction(tool, action, reason, suggestedArgs) {
160288
160312
  reason,
160289
160313
  };
160290
160314
  }
160291
- function getPgContextStorePath() {
160292
- return (process.env.CLOUDBASE_PG_CONTEXT_PATH ??
160293
- node_path_1.default.join(process.env.HOME ?? ".", ".cloudbase-mcp", "pg-context.json"));
160294
- }
160295
- async function loadStoredPgContext() {
160296
- if (!process.env.CLOUDBASE_PG_CONTEXT_PATH) {
160297
- return undefined;
160298
- }
160299
- try {
160300
- const raw = await node_fs_1.promises.readFile(getPgContextStorePath(), "utf8");
160301
- return JSON.parse(raw);
160302
- }
160303
- catch {
160304
- return undefined;
160305
- }
160306
- }
160307
- async function savePgContext(server, context) {
160308
- server.pgRuntimeContext = context;
160309
- if (!process.env.CLOUDBASE_PG_CONTEXT_PATH) {
160310
- return;
160311
- }
160312
- const storePath = getPgContextStorePath();
160313
- await node_fs_1.promises.mkdir(node_path_1.default.dirname(storePath), { recursive: true });
160314
- await node_fs_1.promises.writeFile(storePath, JSON.stringify(context, null, 2), {
160315
- encoding: "utf8",
160316
- mode: 0o600,
160317
- });
160318
- await node_fs_1.promises.chmod(storePath, 0o600).catch(() => undefined);
160319
- }
160320
- async function getPgContext(server) {
160321
- if (server.pgRuntimeContext) {
160322
- return server.pgRuntimeContext;
160323
- }
160324
- const stored = await loadStoredPgContext();
160325
- if (stored) {
160326
- server.pgRuntimeContext = stored;
160327
- }
160328
- return stored;
160329
- }
160330
- function buildMissingContextResult() {
160331
- return buildPgToolResult({
160332
- success: false,
160333
- errorCode: "PG_CONTEXT_NOT_INITIALIZED",
160334
- message: "PostgreSQL context is not initialized yet. Call managePgDatabase(action=init) to bind the current CloudBase environment's built-in PostgreSQL runtime.",
160335
- nextActions: [
160336
- buildNextAction(MANAGE_PG_DATABASE, "init", "初始化 CloudBase PG 云端执行上下文,然后再查询 schema 或执行 SQL。", { action: "init" }),
160337
- ],
160338
- });
160339
- }
160340
- function sanitizePgContext(context) {
160315
+ /**
160316
+ * 从 cloudBaseOptions + args 推导 PG 执行上下文(无状态)
160317
+ * 照搬 MySQL 的 resolveSqlDbContext 模式
160318
+ */
160319
+ async function resolvePgDbContext(cloudBaseOptions, args) {
160320
+ const envId = args?.envId ??
160321
+ cloudBaseOptions?.envId ??
160322
+ (await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions));
160341
160323
  return {
160342
- envId: context.envId,
160343
- instanceId: context.instanceId,
160344
- defaultSchema: context.defaultSchema,
160345
- runtimeMode: context.runtimeMode,
160346
- bootstrapMode: context.bootstrapMode,
160347
- role: context.role,
160324
+ envId,
160325
+ instanceId: args?.instanceId ?? "cloudbase-pg",
160326
+ defaultSchema: args?.defaultSchema ?? "public",
160327
+ role: args?.role ?? "cloudbase_admin",
160348
160328
  };
160349
160329
  }
160350
160330
  function normalizeLimit(limit, fallback = 20, max = 200) {
@@ -160912,89 +160892,65 @@ function createManagerPgClient(context, cloudBaseOptions) {
160912
160892
  function sleep(ms) {
160913
160893
  return new Promise((resolve) => setTimeout(resolve, ms));
160914
160894
  }
160915
- async function ensurePgReady(context, deps, options) {
160916
- const maxAttempts = options?.maxAttempts ?? 20;
160917
- const retryDelayMs = options?.retryDelayMs ?? 1000;
160918
- let lastError;
160919
- for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
160920
- try {
160921
- await withPgClient(context, deps, async (client) => {
160922
- await client.query("SELECT 1");
160923
- });
160924
- return;
160925
- }
160926
- catch (error) {
160927
- lastError = error;
160928
- if (attempt === maxAttempts) {
160929
- break;
160930
- }
160931
- await sleep(retryDelayMs);
160932
- }
160933
- }
160934
- const reason = lastError instanceof Error ? lastError.message : String(lastError);
160935
- throw new Error(`PostgreSQL is not ready after ${maxAttempts} attempts. Last error: ${reason}`);
160895
+ /**
160896
+ * 模块级 Promise 缓存:同一 server 生命周期内只探测一次 PG 就绪状态
160897
+ * 照搬 MySQL lazy 就绪检查模式,避免每次业务调用都 SELECT 1
160898
+ */
160899
+ let pgReadyPromise = null;
160900
+ /**
160901
+ * @internal 重置就绪探测缓存(仅供测试使用)
160902
+ */
160903
+ function __resetPgReadyCache() {
160904
+ pgReadyPromise = null;
160936
160905
  }
160937
- async function handleInit(args, server, deps) {
160938
- const existing = await getPgContext(server);
160939
- const resolvedEnvId = args.envId ??
160940
- server.cloudBaseOptions?.envId ??
160941
- process.env.CLOUDBASE_ENV_ID ??
160942
- existing?.envId;
160943
- if (!resolvedEnvId) {
160944
- return buildPgToolResult({
160945
- success: false,
160946
- errorCode: "ENV_ID_REQUIRED",
160947
- message: "CloudBase PostgreSQL only supports the built-in cloud runtime. Provide envId or bind a CloudBase environment before calling managePgDatabase(action=init).",
160948
- });
160906
+ /**
160907
+ * 首次 SQL 调用时探测 PG 就绪,Promise 缓存避免重复探测
160908
+ * 探测失败抛错,由调用方捕获返回 PG_NOT_READY 错误码
160909
+ */
160910
+ async function ensurePgReadyOnce(cloudBaseOptions, deps) {
160911
+ if (pgReadyPromise) {
160912
+ return pgReadyPromise;
160949
160913
  }
160950
- const bootstrapResult = {
160951
- instanceId: args.instanceId ?? "cloudbase-pg",
160952
- defaultSchema: args.defaultSchema ?? "public",
160953
- status: "ready",
160954
- runtimeMode: "cloudbase-manager",
160955
- role: args.role ?? "cloudbase_admin",
160956
- };
160957
- const now = new Date().toISOString();
160958
- const context = {
160959
- envId: resolvedEnvId,
160960
- instanceId: bootstrapResult.instanceId,
160961
- defaultSchema: bootstrapResult.defaultSchema,
160962
- runtimeMode: "cloudbase-manager",
160963
- bootstrapMode: "cloud",
160964
- role: bootstrapResult.role,
160965
- createdAt: existing?.createdAt ?? now,
160966
- updatedAt: now,
160967
- };
160968
- await ensurePgReady(context, deps, deps.readyCheckOptions);
160969
- await savePgContext(server, context);
160970
- return buildPgToolResult({
160971
- success: true,
160972
- data: {
160973
- context: {
160974
- ...sanitizePgContext(context),
160975
- },
160976
- status: bootstrapResult.status,
160977
- },
160978
- message: "CloudBase PG 云端执行上下文已就绪。先查询对象或 schema,再执行写入 SQL。",
160979
- nextActions: [
160980
- buildNextAction(QUERY_PG_DATABASE, "objects", "List schema-qualified database objects before drilling into a specific table.", { action: "objects", limit: 20 }),
160981
- buildSchemaNextAction("Inspect a concrete schema-qualified table after you know which object matters.", `${context.defaultSchema}.your_table`),
160982
- ],
160983
- });
160914
+ pgReadyPromise = (async () => {
160915
+ const context = await resolvePgDbContext(cloudBaseOptions);
160916
+ const maxAttempts = deps.readyCheckOptions?.maxAttempts ?? 20;
160917
+ const retryDelayMs = deps.readyCheckOptions?.retryDelayMs ?? 1000;
160918
+ let lastError;
160919
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
160920
+ try {
160921
+ await withPgClient(context, deps, async (client) => {
160922
+ await client.query("SELECT 1");
160923
+ });
160924
+ return;
160925
+ }
160926
+ catch (error) {
160927
+ lastError = error;
160928
+ if (attempt === maxAttempts) {
160929
+ break;
160930
+ }
160931
+ await sleep(retryDelayMs);
160932
+ }
160933
+ }
160934
+ const reason = lastError instanceof Error ? lastError.message : String(lastError);
160935
+ throw new Error(`PostgreSQL is not ready after ${maxAttempts} attempts. Last error: ${reason}`);
160936
+ })();
160937
+ return pgReadyPromise;
160984
160938
  }
160985
160939
  async function handleQueryContext(server) {
160986
- const context = await getPgContext(server);
160987
- if (!context) {
160988
- return buildMissingContextResult();
160989
- }
160940
+ const context = await resolvePgDbContext(server.cloudBaseOptions);
160990
160941
  return buildPgToolResult({
160991
160942
  success: true,
160992
160943
  data: {
160993
160944
  context: {
160994
- ...sanitizePgContext(context),
160945
+ envId: context.envId,
160946
+ instanceId: context.instanceId,
160947
+ defaultSchema: context.defaultSchema,
160948
+ runtimeMode: "cloudbase-manager",
160949
+ bootstrapMode: "cloud",
160950
+ role: context.role,
160995
160951
  },
160996
160952
  },
160997
- message: "Resolved current CloudBase PostgreSQL context.",
160953
+ message: "Resolved current CloudBase PostgreSQL context (auto-derived).",
160998
160954
  nextActions: [
160999
160955
  buildNextAction(QUERY_PG_DATABASE, "objects", "List schema-qualified objects before inspecting an individual table.", { action: "objects", limit: 20 }),
161000
160956
  ],
@@ -161390,9 +161346,20 @@ function registerPGDatabaseTools(server, providedDeps) {
161390
161346
  if (args.action === "context") {
161391
161347
  return handleQueryContext(server);
161392
161348
  }
161393
- const context = await getPgContext(server);
161394
- if (!context) {
161395
- return buildMissingContextResult();
161349
+ const context = await resolvePgDbContext(server.cloudBaseOptions);
161350
+ try {
161351
+ await ensurePgReadyOnce(server.cloudBaseOptions, deps);
161352
+ }
161353
+ catch (error) {
161354
+ const reason = error instanceof Error ? error.message : String(error);
161355
+ return buildPgToolResult({
161356
+ success: false,
161357
+ errorCode: "PG_NOT_READY",
161358
+ message: `CloudBase PostgreSQL is not ready. ${reason}`,
161359
+ nextActions: [
161360
+ buildNextAction("queryEnv", "info", "检查当前环境 PostgreSQL 实例状态。", { action: "info", envId: context.envId }),
161361
+ ],
161362
+ });
161396
161363
  }
161397
161364
  switch (args.action) {
161398
161365
  case "objects":
@@ -161413,11 +161380,11 @@ function registerPGDatabaseTools(server, providedDeps) {
161413
161380
  });
161414
161381
  server.registerTool?.(MANAGE_PG_DATABASE, {
161415
161382
  title: "管理 PostgreSQL 上下文或执行写入 SQL",
161416
- description: "管理 CloudBase PostgreSQL MCP 上下文。仅支持 CloudBase 内置 PostgreSQL 云端 Manager SDK 执行路径、SQL 风险预检、迁移规划,以及在显式确认后执行写入 SQL。",
161383
+ description: "管理 CloudBase PostgreSQL:执行已确认的写入 SQL 或 DDL、SQL 风险预检、迁移规划。上下文自动从当前 MCP 环境推导,无需 init。仅支持 CloudBase 内置 PostgreSQL 云端 Manager SDK 执行路径。",
161417
161384
  inputSchema: {
161418
161385
  action: zod_1.z
161419
161386
  .enum(MANAGE_ACTIONS)
161420
- .describe("操作类型:init=初始化或绑定 PostgreSQL 上下文;execute=执行已确认的写入 SQL 或 DDL;dryRun=只分析 SQL 风险不执行;planMigration=通过 PreviewPGUserMigrations 预览迁移计划;applyMigration=通过 PushPGUserMigrations 应用迁移;listMigrations=查询已应用的 Migration 列表;migrationDetail=查看单条 Migration 详情;rollbackMigration=回滚指定 Migration"),
161387
+ .describe("操作类型:execute=执行已确认的写入 SQL 或 DDL;dryRun=只分析 SQL 风险不执行;planMigration=通过 PreviewPGUserMigrations 预览迁移计划;applyMigration=通过 PushPGUserMigrations 应用迁移;listMigrations=查询已应用的 Migration 列表;migrationDetail=查看单条 Migration 详情;rollbackMigration=回滚指定 Migration"),
161421
161388
  sql: zod_1.z
161422
161389
  .string()
161423
161390
  .optional()
@@ -161433,11 +161400,11 @@ function registerPGDatabaseTools(server, providedDeps) {
161433
161400
  instanceId: zod_1.z
161434
161401
  .string()
161435
161402
  .optional()
161436
- .describe("可选的 PostgreSQL 逻辑实例标识。"),
161403
+ .describe("可选的 PostgreSQL 逻辑实例标识,默认 cloudbase-pg。"),
161437
161404
  defaultSchema: zod_1.z
161438
161405
  .string()
161439
161406
  .optional()
161440
- .describe("默认 schema,会保存到 PG 上下文中,默认 public。"),
161407
+ .describe("可选的默认 schema,默认 public。"),
161441
161408
  role: zod_1.z
161442
161409
  .string()
161443
161410
  .optional()
@@ -161455,13 +161422,23 @@ function registerPGDatabaseTools(server, providedDeps) {
161455
161422
  category: CATEGORY,
161456
161423
  },
161457
161424
  }, async (args) => {
161425
+ const context = await resolvePgDbContext(server.cloudBaseOptions, args);
161426
+ const cbOpts = server.cloudBaseOptions;
161458
161427
  switch (args.action) {
161459
- case "init":
161460
- return handleInit(args, server, deps);
161461
161428
  case "execute": {
161462
- const context = await getPgContext(server);
161463
- if (!context) {
161464
- return buildMissingContextResult();
161429
+ try {
161430
+ await ensurePgReadyOnce(cbOpts, deps);
161431
+ }
161432
+ catch (error) {
161433
+ const reason = error instanceof Error ? error.message : String(error);
161434
+ return buildPgToolResult({
161435
+ success: false,
161436
+ errorCode: "PG_NOT_READY",
161437
+ message: `CloudBase PostgreSQL is not ready. ${reason}`,
161438
+ nextActions: [
161439
+ buildNextAction("queryEnv", "info", "检查当前环境 PostgreSQL 实例状态。", { action: "info", envId: context.envId }),
161440
+ ],
161441
+ });
161465
161442
  }
161466
161443
  return handleExecuteSql(args, context, deps);
161467
161444
  }
@@ -161472,17 +161449,12 @@ function registerPGDatabaseTools(server, providedDeps) {
161472
161449
  case "listMigrations":
161473
161450
  case "migrationDetail":
161474
161451
  case "rollbackMigration": {
161475
- const migrationCtx = await getPgContext(server);
161476
- if (!migrationCtx) {
161477
- return buildMissingContextResult();
161478
- }
161479
- const cbOpts = server.cloudBaseOptions;
161480
161452
  switch (args.action) {
161481
- case "planMigration": return handlePlanMigration(args, migrationCtx, deps, cbOpts);
161482
- case "applyMigration": return handleApplyMigration(args, migrationCtx, deps, cbOpts);
161483
- case "listMigrations": return handleListMigrations(args, migrationCtx, deps, cbOpts);
161484
- case "migrationDetail": return handleMigrationDetail(args, migrationCtx, deps, cbOpts);
161485
- case "rollbackMigration": return handleRollbackMigration(args, migrationCtx, deps, cbOpts);
161453
+ case "planMigration": return handlePlanMigration(args, context, deps, cbOpts);
161454
+ case "applyMigration": return handleApplyMigration(args, context, deps, cbOpts);
161455
+ case "listMigrations": return handleListMigrations(args, context, deps, cbOpts);
161456
+ case "migrationDetail": return handleMigrationDetail(args, context, deps, cbOpts);
161457
+ case "rollbackMigration": return handleRollbackMigration(args, context, deps, cbOpts);
161486
161458
  default: return buildPgToolResult({ success: false, errorCode: "UNSUPPORTED_ACTION", message: `Unsupported action: ${args.action}` });
161487
161459
  }
161488
161460
  }
@@ -196592,7 +196564,7 @@ ${envIdSection}
196592
196564
  ## 环境信息
196593
196565
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
196594
196566
  - Node.js版本: ${process.version}
196595
- - MCP 版本:${process.env.npm_package_version || "2.23.7" || 0}
196567
+ - MCP 版本:${process.env.npm_package_version || "2.23.9" || 0}
196596
196568
  - 系统架构: ${os_1.default.arch()}
196597
196569
  - 时间: ${new Date().toISOString()}
196598
196570
  - 请求ID: ${requestId}
@@ -196673,7 +196645,7 @@ function createWrappedHandler(name, handler, server) {
196673
196645
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
196674
196646
  ide: server.ide || process.env.INTEGRATION_IDE || ''
196675
196647
  });
196676
- const mcpVersion = true ? "2.23.7" : 0;
196648
+ const mcpVersion = true ? "2.23.9" : 0;
196677
196649
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
196678
196650
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
196679
196651
  // 创建新的错误对象,保持原有的错误类型但更新消息
@@ -212687,7 +212659,7 @@ function registerSetupTools(server) {
212687
212659
  server.registerTool("downloadTemplate", {
212688
212660
  title: "下载项目模板",
212689
212661
  description: `自动下载并部署CloudBase项目模板。
212690
- **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.7" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
212662
+ **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.9" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
212691
212663
  inputSchema: {
212692
212664
  template: zod_1.z
212693
212665
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
package/dist/index.d.ts CHANGED
@@ -159,7 +159,6 @@ export declare interface ExtendedMcpServer extends McpServer {
159
159
  authOptions?: AuthOptions;
160
160
  ide?: string;
161
161
  logger?: Logger;
162
- pgRuntimeContext?: PgRuntimeContext;
163
162
  enabledPlugins?: string[];
164
163
  pluginOptions?: PluginOptions;
165
164
  /** 已注册工具的列表,供外部(如微信 IDE)提取并注册到自己的 MCP server */
@@ -333,17 +332,6 @@ export declare function logout(): Promise<void>;
333
332
 
334
333
  export { McpServer }
335
334
 
336
- declare interface PgRuntimeContext {
337
- envId: string;
338
- instanceId: string;
339
- defaultSchema: string;
340
- runtimeMode: "cloudbase-manager";
341
- bootstrapMode: "cloud";
342
- role?: string;
343
- createdAt: string;
344
- updatedAt: string;
345
- }
346
-
347
335
  /** 各插件的可选配置 */
348
336
  export declare interface PluginOptions {
349
337
  functions?: FunctionDeployOverrides;