@cloudbase/cloudbase-mcp 2.23.8 → 2.23.10
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 +2 -2
- package/dist/index.cjs +111 -162
- package/dist/index.d.ts +0 -12
- package/dist/index.js +111 -178
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_https__ from "https";
|
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_net__ from "net";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_mcp_js_45c326f0__ from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_path_02319fef__ from "node:path";
|
|
17
16
|
import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
|
|
18
17
|
import * as __WEBPACK_EXTERNAL_MODULE_ws__ from "ws";
|
|
19
18
|
import * as __WEBPACK_EXTERNAL_MODULE__cloudbase_manager_node_6a52ea40__ from "@cloudbase/manager-node";
|
|
@@ -24,7 +23,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
|
|
|
24
23
|
import * as __WEBPACK_EXTERNAL_MODULE_fs_promises_f8dae9d1__ from "fs/promises";
|
|
25
24
|
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
26
25
|
import * as __WEBPACK_EXTERNAL_MODULE_winston__ from "winston";
|
|
27
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_75ed2103__ from "node:fs";
|
|
28
26
|
/******/ var __webpack_modules__ = ({
|
|
29
27
|
|
|
30
28
|
/***/ 622:
|
|
@@ -2202,7 +2200,7 @@ ${envIdSection}
|
|
|
2202
2200
|
## 环境信息
|
|
2203
2201
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
2204
2202
|
- Node.js版本: ${process.version}
|
|
2205
|
-
- MCP 版本:${process.env.npm_package_version || "2.23.
|
|
2203
|
+
- MCP 版本:${process.env.npm_package_version || "2.23.10" || 0}
|
|
2206
2204
|
- 系统架构: ${os_1.default.arch()}
|
|
2207
2205
|
- 时间: ${new Date().toISOString()}
|
|
2208
2206
|
- 请求ID: ${requestId}
|
|
@@ -2283,7 +2281,7 @@ function createWrappedHandler(name, handler, server) {
|
|
|
2283
2281
|
requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
|
|
2284
2282
|
ide: server.ide || process.env.INTEGRATION_IDE || ''
|
|
2285
2283
|
});
|
|
2286
|
-
const mcpVersion = true ? "2.23.
|
|
2284
|
+
const mcpVersion = true ? "2.23.10" : 0;
|
|
2287
2285
|
const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
|
|
2288
2286
|
const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
|
|
2289
2287
|
// 创建新的错误对象,保持原有的错误类型但更新消息
|
|
@@ -6524,6 +6522,12 @@ async function resolveSkillSearchRoots(options = {}) {
|
|
|
6524
6522
|
? path.resolve(path.dirname(cliEntryPath), "..", "..")
|
|
6525
6523
|
: undefined;
|
|
6526
6524
|
return filterExistingDirs([
|
|
6525
|
+
repoRoot
|
|
6526
|
+
? path.join(repoRoot, ".generated", "compat-config", ".agents", "skills")
|
|
6527
|
+
: undefined,
|
|
6528
|
+
repoRoot
|
|
6529
|
+
? path.join(repoRoot, ".generated", "compat-config", ".claude", "skills")
|
|
6530
|
+
: undefined,
|
|
6527
6531
|
repoRoot
|
|
6528
6532
|
? path.join(repoRoot, ".generated", "compat-config", ".codebuddy", "skills")
|
|
6529
6533
|
: undefined,
|
|
@@ -9841,13 +9845,6 @@ function registerAppAuthTools(server) {
|
|
|
9841
9845
|
}
|
|
9842
9846
|
|
|
9843
9847
|
|
|
9844
|
-
/***/ }),
|
|
9845
|
-
|
|
9846
|
-
/***/ 5663:
|
|
9847
|
-
/***/ ((module) => {
|
|
9848
|
-
|
|
9849
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_02319fef__;
|
|
9850
|
-
|
|
9851
9848
|
/***/ }),
|
|
9852
9849
|
|
|
9853
9850
|
/***/ 5814:
|
|
@@ -9917,7 +9914,7 @@ class TelemetryReporter {
|
|
|
9917
9914
|
const nodeVersion = process.version; // Node.js版本
|
|
9918
9915
|
const arch = os_1.default.arch(); // 系统架构
|
|
9919
9916
|
// 从构建时注入的版本号获取MCP版本信息
|
|
9920
|
-
const mcpVersion = process.env.npm_package_version || "2.23.
|
|
9917
|
+
const mcpVersion = process.env.npm_package_version || "2.23.10" || 0;
|
|
9921
9918
|
return {
|
|
9922
9919
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
9923
9920
|
deviceId: this.deviceId,
|
|
@@ -11587,16 +11584,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_ws__;
|
|
|
11587
11584
|
/***/ }),
|
|
11588
11585
|
|
|
11589
11586
|
/***/ 6473:
|
|
11590
|
-
/***/ (
|
|
11587
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11591
11588
|
|
|
11592
11589
|
|
|
11593
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11594
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11595
|
-
};
|
|
11596
11590
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11591
|
+
exports.__resetPgReadyCache = __resetPgReadyCache;
|
|
11597
11592
|
exports.registerPGDatabaseTools = registerPGDatabaseTools;
|
|
11598
|
-
const node_fs_1 = __webpack_require__(9627);
|
|
11599
|
-
const node_path_1 = __importDefault(__webpack_require__(5663));
|
|
11600
11593
|
const zod_1 = __webpack_require__(2971);
|
|
11601
11594
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
11602
11595
|
const tool_result_js_1 = __webpack_require__(9835);
|
|
@@ -11611,7 +11604,6 @@ const QUERY_ACTIONS = [
|
|
|
11611
11604
|
"sql",
|
|
11612
11605
|
];
|
|
11613
11606
|
const MANAGE_ACTIONS = [
|
|
11614
|
-
"init",
|
|
11615
11607
|
"execute",
|
|
11616
11608
|
"dryRun",
|
|
11617
11609
|
"planMigration",
|
|
@@ -11632,63 +11624,19 @@ function buildNextAction(tool, action, reason, suggestedArgs) {
|
|
|
11632
11624
|
reason,
|
|
11633
11625
|
};
|
|
11634
11626
|
}
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
async function
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
try {
|
|
11644
|
-
const raw = await node_fs_1.promises.readFile(getPgContextStorePath(), "utf8");
|
|
11645
|
-
return JSON.parse(raw);
|
|
11646
|
-
}
|
|
11647
|
-
catch {
|
|
11648
|
-
return undefined;
|
|
11649
|
-
}
|
|
11650
|
-
}
|
|
11651
|
-
async function savePgContext(server, context) {
|
|
11652
|
-
server.pgRuntimeContext = context;
|
|
11653
|
-
if (!process.env.CLOUDBASE_PG_CONTEXT_PATH) {
|
|
11654
|
-
return;
|
|
11655
|
-
}
|
|
11656
|
-
const storePath = getPgContextStorePath();
|
|
11657
|
-
await node_fs_1.promises.mkdir(node_path_1.default.dirname(storePath), { recursive: true });
|
|
11658
|
-
await node_fs_1.promises.writeFile(storePath, JSON.stringify(context, null, 2), {
|
|
11659
|
-
encoding: "utf8",
|
|
11660
|
-
mode: 0o600,
|
|
11661
|
-
});
|
|
11662
|
-
await node_fs_1.promises.chmod(storePath, 0o600).catch(() => undefined);
|
|
11663
|
-
}
|
|
11664
|
-
async function getPgContext(server) {
|
|
11665
|
-
if (server.pgRuntimeContext) {
|
|
11666
|
-
return server.pgRuntimeContext;
|
|
11667
|
-
}
|
|
11668
|
-
const stored = await loadStoredPgContext();
|
|
11669
|
-
if (stored) {
|
|
11670
|
-
server.pgRuntimeContext = stored;
|
|
11671
|
-
}
|
|
11672
|
-
return stored;
|
|
11673
|
-
}
|
|
11674
|
-
function buildMissingContextResult() {
|
|
11675
|
-
return buildPgToolResult({
|
|
11676
|
-
success: false,
|
|
11677
|
-
errorCode: "PG_CONTEXT_NOT_INITIALIZED",
|
|
11678
|
-
message: "PostgreSQL context is not initialized yet. Call managePgDatabase(action=init) to bind the current CloudBase environment's built-in PostgreSQL runtime.",
|
|
11679
|
-
nextActions: [
|
|
11680
|
-
buildNextAction(MANAGE_PG_DATABASE, "init", "初始化 CloudBase PG 云端执行上下文,然后再查询 schema 或执行 SQL。", { action: "init" }),
|
|
11681
|
-
],
|
|
11682
|
-
});
|
|
11683
|
-
}
|
|
11684
|
-
function sanitizePgContext(context) {
|
|
11627
|
+
/**
|
|
11628
|
+
* 从 cloudBaseOptions + args 推导 PG 执行上下文(无状态)
|
|
11629
|
+
* 照搬 MySQL 的 resolveSqlDbContext 模式
|
|
11630
|
+
*/
|
|
11631
|
+
async function resolvePgDbContext(cloudBaseOptions, args) {
|
|
11632
|
+
const envId = args?.envId ??
|
|
11633
|
+
cloudBaseOptions?.envId ??
|
|
11634
|
+
(await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions));
|
|
11685
11635
|
return {
|
|
11686
|
-
envId
|
|
11687
|
-
instanceId:
|
|
11688
|
-
defaultSchema:
|
|
11689
|
-
|
|
11690
|
-
bootstrapMode: context.bootstrapMode,
|
|
11691
|
-
role: context.role,
|
|
11636
|
+
envId,
|
|
11637
|
+
instanceId: args?.instanceId ?? "cloudbase-pg",
|
|
11638
|
+
defaultSchema: args?.defaultSchema ?? "public",
|
|
11639
|
+
role: args?.role ?? "cloudbase_admin",
|
|
11692
11640
|
};
|
|
11693
11641
|
}
|
|
11694
11642
|
function normalizeLimit(limit, fallback = 20, max = 200) {
|
|
@@ -12256,89 +12204,65 @@ function createManagerPgClient(context, cloudBaseOptions) {
|
|
|
12256
12204
|
function sleep(ms) {
|
|
12257
12205
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12258
12206
|
}
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12207
|
+
/**
|
|
12208
|
+
* 模块级 Promise 缓存:同一 server 生命周期内只探测一次 PG 就绪状态
|
|
12209
|
+
* 照搬 MySQL lazy 就绪检查模式,避免每次业务调用都 SELECT 1
|
|
12210
|
+
*/
|
|
12211
|
+
let pgReadyPromise = null;
|
|
12212
|
+
/**
|
|
12213
|
+
* @internal 重置就绪探测缓存(仅供测试使用)
|
|
12214
|
+
*/
|
|
12215
|
+
function __resetPgReadyCache() {
|
|
12216
|
+
pgReadyPromise = null;
|
|
12217
|
+
}
|
|
12218
|
+
/**
|
|
12219
|
+
* 首次 SQL 调用时探测 PG 就绪,Promise 缓存避免重复探测
|
|
12220
|
+
* 探测失败抛错,由调用方捕获返回 PG_NOT_READY 错误码
|
|
12221
|
+
*/
|
|
12222
|
+
async function ensurePgReadyOnce(cloudBaseOptions, deps) {
|
|
12223
|
+
if (pgReadyPromise) {
|
|
12224
|
+
return pgReadyPromise;
|
|
12225
|
+
}
|
|
12226
|
+
pgReadyPromise = (async () => {
|
|
12227
|
+
const context = await resolvePgDbContext(cloudBaseOptions);
|
|
12228
|
+
const maxAttempts = deps.readyCheckOptions?.maxAttempts ?? 20;
|
|
12229
|
+
const retryDelayMs = deps.readyCheckOptions?.retryDelayMs ?? 1000;
|
|
12230
|
+
let lastError;
|
|
12231
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
12232
|
+
try {
|
|
12233
|
+
await withPgClient(context, deps, async (client) => {
|
|
12234
|
+
await client.query("SELECT 1");
|
|
12235
|
+
});
|
|
12236
|
+
return;
|
|
12237
|
+
}
|
|
12238
|
+
catch (error) {
|
|
12239
|
+
lastError = error;
|
|
12240
|
+
if (attempt === maxAttempts) {
|
|
12241
|
+
break;
|
|
12242
|
+
}
|
|
12243
|
+
await sleep(retryDelayMs);
|
|
12274
12244
|
}
|
|
12275
|
-
await sleep(retryDelayMs);
|
|
12276
12245
|
}
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
async function handleInit(args, server, deps) {
|
|
12282
|
-
const existing = await getPgContext(server);
|
|
12283
|
-
const resolvedEnvId = args.envId ??
|
|
12284
|
-
server.cloudBaseOptions?.envId ??
|
|
12285
|
-
process.env.CLOUDBASE_ENV_ID ??
|
|
12286
|
-
existing?.envId;
|
|
12287
|
-
if (!resolvedEnvId) {
|
|
12288
|
-
return buildPgToolResult({
|
|
12289
|
-
success: false,
|
|
12290
|
-
errorCode: "ENV_ID_REQUIRED",
|
|
12291
|
-
message: "CloudBase PostgreSQL only supports the built-in cloud runtime. Provide envId or bind a CloudBase environment before calling managePgDatabase(action=init).",
|
|
12292
|
-
});
|
|
12293
|
-
}
|
|
12294
|
-
const bootstrapResult = {
|
|
12295
|
-
instanceId: args.instanceId ?? "cloudbase-pg",
|
|
12296
|
-
defaultSchema: args.defaultSchema ?? "public",
|
|
12297
|
-
status: "ready",
|
|
12298
|
-
runtimeMode: "cloudbase-manager",
|
|
12299
|
-
role: args.role ?? "cloudbase_admin",
|
|
12300
|
-
};
|
|
12301
|
-
const now = new Date().toISOString();
|
|
12302
|
-
const context = {
|
|
12303
|
-
envId: resolvedEnvId,
|
|
12304
|
-
instanceId: bootstrapResult.instanceId,
|
|
12305
|
-
defaultSchema: bootstrapResult.defaultSchema,
|
|
12306
|
-
runtimeMode: "cloudbase-manager",
|
|
12307
|
-
bootstrapMode: "cloud",
|
|
12308
|
-
role: bootstrapResult.role,
|
|
12309
|
-
createdAt: existing?.createdAt ?? now,
|
|
12310
|
-
updatedAt: now,
|
|
12311
|
-
};
|
|
12312
|
-
await ensurePgReady(context, deps, deps.readyCheckOptions);
|
|
12313
|
-
await savePgContext(server, context);
|
|
12314
|
-
return buildPgToolResult({
|
|
12315
|
-
success: true,
|
|
12316
|
-
data: {
|
|
12317
|
-
context: {
|
|
12318
|
-
...sanitizePgContext(context),
|
|
12319
|
-
},
|
|
12320
|
-
status: bootstrapResult.status,
|
|
12321
|
-
},
|
|
12322
|
-
message: "CloudBase PG 云端执行上下文已就绪。先查询对象或 schema,再执行写入 SQL。",
|
|
12323
|
-
nextActions: [
|
|
12324
|
-
buildNextAction(QUERY_PG_DATABASE, "objects", "List schema-qualified database objects before drilling into a specific table.", { action: "objects", limit: 20 }),
|
|
12325
|
-
buildSchemaNextAction("Inspect a concrete schema-qualified table after you know which object matters.", `${context.defaultSchema}.your_table`),
|
|
12326
|
-
],
|
|
12327
|
-
});
|
|
12246
|
+
const reason = lastError instanceof Error ? lastError.message : String(lastError);
|
|
12247
|
+
throw new Error(`PostgreSQL is not ready after ${maxAttempts} attempts. Last error: ${reason}`);
|
|
12248
|
+
})();
|
|
12249
|
+
return pgReadyPromise;
|
|
12328
12250
|
}
|
|
12329
12251
|
async function handleQueryContext(server) {
|
|
12330
|
-
const context = await
|
|
12331
|
-
if (!context) {
|
|
12332
|
-
return buildMissingContextResult();
|
|
12333
|
-
}
|
|
12252
|
+
const context = await resolvePgDbContext(server.cloudBaseOptions);
|
|
12334
12253
|
return buildPgToolResult({
|
|
12335
12254
|
success: true,
|
|
12336
12255
|
data: {
|
|
12337
12256
|
context: {
|
|
12338
|
-
|
|
12257
|
+
envId: context.envId,
|
|
12258
|
+
instanceId: context.instanceId,
|
|
12259
|
+
defaultSchema: context.defaultSchema,
|
|
12260
|
+
runtimeMode: "cloudbase-manager",
|
|
12261
|
+
bootstrapMode: "cloud",
|
|
12262
|
+
role: context.role,
|
|
12339
12263
|
},
|
|
12340
12264
|
},
|
|
12341
|
-
message: "Resolved current CloudBase PostgreSQL context.",
|
|
12265
|
+
message: "Resolved current CloudBase PostgreSQL context (auto-derived).",
|
|
12342
12266
|
nextActions: [
|
|
12343
12267
|
buildNextAction(QUERY_PG_DATABASE, "objects", "List schema-qualified objects before inspecting an individual table.", { action: "objects", limit: 20 }),
|
|
12344
12268
|
],
|
|
@@ -12734,9 +12658,20 @@ function registerPGDatabaseTools(server, providedDeps) {
|
|
|
12734
12658
|
if (args.action === "context") {
|
|
12735
12659
|
return handleQueryContext(server);
|
|
12736
12660
|
}
|
|
12737
|
-
const context = await
|
|
12738
|
-
|
|
12739
|
-
|
|
12661
|
+
const context = await resolvePgDbContext(server.cloudBaseOptions);
|
|
12662
|
+
try {
|
|
12663
|
+
await ensurePgReadyOnce(server.cloudBaseOptions, deps);
|
|
12664
|
+
}
|
|
12665
|
+
catch (error) {
|
|
12666
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
12667
|
+
return buildPgToolResult({
|
|
12668
|
+
success: false,
|
|
12669
|
+
errorCode: "PG_NOT_READY",
|
|
12670
|
+
message: `CloudBase PostgreSQL is not ready. ${reason}`,
|
|
12671
|
+
nextActions: [
|
|
12672
|
+
buildNextAction("queryEnv", "info", "检查当前环境 PostgreSQL 实例状态。", { action: "info", envId: context.envId }),
|
|
12673
|
+
],
|
|
12674
|
+
});
|
|
12740
12675
|
}
|
|
12741
12676
|
switch (args.action) {
|
|
12742
12677
|
case "objects":
|
|
@@ -12757,11 +12692,11 @@ function registerPGDatabaseTools(server, providedDeps) {
|
|
|
12757
12692
|
});
|
|
12758
12693
|
server.registerTool?.(MANAGE_PG_DATABASE, {
|
|
12759
12694
|
title: "管理 PostgreSQL 上下文或执行写入 SQL",
|
|
12760
|
-
description: "管理 CloudBase PostgreSQL MCP
|
|
12695
|
+
description: "管理 CloudBase PostgreSQL:执行已确认的写入 SQL 或 DDL、SQL 风险预检、迁移规划。上下文自动从当前 MCP 环境推导,无需 init。仅支持 CloudBase 内置 PostgreSQL 云端 Manager SDK 执行路径。",
|
|
12761
12696
|
inputSchema: {
|
|
12762
12697
|
action: zod_1.z
|
|
12763
12698
|
.enum(MANAGE_ACTIONS)
|
|
12764
|
-
.describe("操作类型:
|
|
12699
|
+
.describe("操作类型:execute=执行已确认的写入 SQL 或 DDL;dryRun=只分析 SQL 风险不执行;planMigration=通过 PreviewPGUserMigrations 预览迁移计划;applyMigration=通过 PushPGUserMigrations 应用迁移;listMigrations=查询已应用的 Migration 列表;migrationDetail=查看单条 Migration 详情;rollbackMigration=回滚指定 Migration"),
|
|
12765
12700
|
sql: zod_1.z
|
|
12766
12701
|
.string()
|
|
12767
12702
|
.optional()
|
|
@@ -12777,11 +12712,11 @@ function registerPGDatabaseTools(server, providedDeps) {
|
|
|
12777
12712
|
instanceId: zod_1.z
|
|
12778
12713
|
.string()
|
|
12779
12714
|
.optional()
|
|
12780
|
-
.describe("可选的 PostgreSQL
|
|
12715
|
+
.describe("可选的 PostgreSQL 逻辑实例标识,默认 cloudbase-pg。"),
|
|
12781
12716
|
defaultSchema: zod_1.z
|
|
12782
12717
|
.string()
|
|
12783
12718
|
.optional()
|
|
12784
|
-
.describe("
|
|
12719
|
+
.describe("可选的默认 schema,默认 public。"),
|
|
12785
12720
|
role: zod_1.z
|
|
12786
12721
|
.string()
|
|
12787
12722
|
.optional()
|
|
@@ -12799,13 +12734,23 @@ function registerPGDatabaseTools(server, providedDeps) {
|
|
|
12799
12734
|
category: CATEGORY,
|
|
12800
12735
|
},
|
|
12801
12736
|
}, async (args) => {
|
|
12737
|
+
const context = await resolvePgDbContext(server.cloudBaseOptions, args);
|
|
12738
|
+
const cbOpts = server.cloudBaseOptions;
|
|
12802
12739
|
switch (args.action) {
|
|
12803
|
-
case "init":
|
|
12804
|
-
return handleInit(args, server, deps);
|
|
12805
12740
|
case "execute": {
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12741
|
+
try {
|
|
12742
|
+
await ensurePgReadyOnce(cbOpts, deps);
|
|
12743
|
+
}
|
|
12744
|
+
catch (error) {
|
|
12745
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
12746
|
+
return buildPgToolResult({
|
|
12747
|
+
success: false,
|
|
12748
|
+
errorCode: "PG_NOT_READY",
|
|
12749
|
+
message: `CloudBase PostgreSQL is not ready. ${reason}`,
|
|
12750
|
+
nextActions: [
|
|
12751
|
+
buildNextAction("queryEnv", "info", "检查当前环境 PostgreSQL 实例状态。", { action: "info", envId: context.envId }),
|
|
12752
|
+
],
|
|
12753
|
+
});
|
|
12809
12754
|
}
|
|
12810
12755
|
return handleExecuteSql(args, context, deps);
|
|
12811
12756
|
}
|
|
@@ -12816,17 +12761,12 @@ function registerPGDatabaseTools(server, providedDeps) {
|
|
|
12816
12761
|
case "listMigrations":
|
|
12817
12762
|
case "migrationDetail":
|
|
12818
12763
|
case "rollbackMigration": {
|
|
12819
|
-
const migrationCtx = await getPgContext(server);
|
|
12820
|
-
if (!migrationCtx) {
|
|
12821
|
-
return buildMissingContextResult();
|
|
12822
|
-
}
|
|
12823
|
-
const cbOpts = server.cloudBaseOptions;
|
|
12824
12764
|
switch (args.action) {
|
|
12825
|
-
case "planMigration": return handlePlanMigration(args,
|
|
12826
|
-
case "applyMigration": return handleApplyMigration(args,
|
|
12827
|
-
case "listMigrations": return handleListMigrations(args,
|
|
12828
|
-
case "migrationDetail": return handleMigrationDetail(args,
|
|
12829
|
-
case "rollbackMigration": return handleRollbackMigration(args,
|
|
12765
|
+
case "planMigration": return handlePlanMigration(args, context, deps, cbOpts);
|
|
12766
|
+
case "applyMigration": return handleApplyMigration(args, context, deps, cbOpts);
|
|
12767
|
+
case "listMigrations": return handleListMigrations(args, context, deps, cbOpts);
|
|
12768
|
+
case "migrationDetail": return handleMigrationDetail(args, context, deps, cbOpts);
|
|
12769
|
+
case "rollbackMigration": return handleRollbackMigration(args, context, deps, cbOpts);
|
|
12830
12770
|
default: return buildPgToolResult({ success: false, errorCode: "UNSUPPORTED_ACTION", message: `Unsupported action: ${args.action}` });
|
|
12831
12771
|
}
|
|
12832
12772
|
}
|
|
@@ -13928,7 +13868,7 @@ function registerSetupTools(server) {
|
|
|
13928
13868
|
server.registerTool("downloadTemplate", {
|
|
13929
13869
|
title: "下载项目模板",
|
|
13930
13870
|
description: `自动下载并部署CloudBase项目模板。
|
|
13931
|
-
**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.
|
|
13871
|
+
**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.10" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
13932
13872
|
inputSchema: {
|
|
13933
13873
|
template: zod_1.z
|
|
13934
13874
|
.enum(["react", "vue", "miniprogram", "uniapp", "rules"])
|
|
@@ -17312,13 +17252,6 @@ function registerAgentTools(server) {
|
|
|
17312
17252
|
}
|
|
17313
17253
|
|
|
17314
17254
|
|
|
17315
|
-
/***/ }),
|
|
17316
|
-
|
|
17317
|
-
/***/ 9627:
|
|
17318
|
-
/***/ ((module) => {
|
|
17319
|
-
|
|
17320
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_75ed2103__;
|
|
17321
|
-
|
|
17322
17255
|
/***/ }),
|
|
17323
17256
|
|
|
17324
17257
|
/***/ 9684:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cloudbase-mcp",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.10",
|
|
4
4
|
"packageManager": "pnpm@10.8.0",
|
|
5
5
|
"description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
|
|
6
6
|
"main": "./dist/index.cjs",
|