@cloudbase/cloudbase-mcp 2.28.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +2 -2
- package/dist/index.cjs +286 -29
- package/dist/index.js +285 -29
- package/package.json +1 -1
- package/server.json +5 -3
package/dist/index.js
CHANGED
|
@@ -3360,7 +3360,7 @@ ${envIdSection}
|
|
|
3360
3360
|
## 环境信息
|
|
3361
3361
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
3362
3362
|
- Node.js版本: ${process.version}
|
|
3363
|
-
- MCP 版本:${process.env.npm_package_version || ( true ? "2.
|
|
3363
|
+
- MCP 版本:${process.env.npm_package_version || ( true ? "2.29.0" : 0)}
|
|
3364
3364
|
- 系统架构: ${os_1.default.arch()}
|
|
3365
3365
|
- 时间: ${new Date().toISOString()}
|
|
3366
3366
|
- 请求ID: ${requestId}
|
|
@@ -3441,7 +3441,7 @@ function createWrappedHandler(name, handler, server) {
|
|
|
3441
3441
|
requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
|
|
3442
3442
|
ide: server.ide || process.env.INTEGRATION_IDE || ''
|
|
3443
3443
|
});
|
|
3444
|
-
const mcpVersion = true ? "2.
|
|
3444
|
+
const mcpVersion = true ? "2.29.0" : 0;
|
|
3445
3445
|
const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
|
|
3446
3446
|
const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
|
|
3447
3447
|
// 创建新的错误对象,保持原有的错误类型但更新消息
|
|
@@ -5805,6 +5805,181 @@ function logCloudBaseResult(logger, result) {
|
|
|
5805
5805
|
}
|
|
5806
5806
|
|
|
5807
5807
|
|
|
5808
|
+
/***/ }),
|
|
5809
|
+
|
|
5810
|
+
/***/ 3656:
|
|
5811
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
5812
|
+
|
|
5813
|
+
|
|
5814
|
+
/**
|
|
5815
|
+
* Guidance + bounded wait when a cloud function is not Active.
|
|
5816
|
+
* SCF rejects UpdateFunctionConfiguration / UpdateFunctionCode while Status=Updating.
|
|
5817
|
+
*/
|
|
5818
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5819
|
+
exports.functionUpdatingRuntime = exports.FUNCTION_UPDATING_WAIT = exports.FUNCTION_BUSY_STATUSES = exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS = exports.FUNCTION_UPDATING_ERROR_CODE = void 0;
|
|
5820
|
+
exports.getErrorMessage = getErrorMessage;
|
|
5821
|
+
exports.isFunctionBusyStatus = isFunctionBusyStatus;
|
|
5822
|
+
exports.isFunctionUpdatingError = isFunctionUpdatingError;
|
|
5823
|
+
exports.buildFunctionUpdatingMessage = buildFunctionUpdatingMessage;
|
|
5824
|
+
exports.buildFunctionUpdatingNextActions = buildFunctionUpdatingNextActions;
|
|
5825
|
+
exports.buildFunctionUpdatingPayload = buildFunctionUpdatingPayload;
|
|
5826
|
+
exports.waitUntilFunctionActive = waitUntilFunctionActive;
|
|
5827
|
+
exports.FUNCTION_UPDATING_ERROR_CODE = "FUNCTION_UPDATING";
|
|
5828
|
+
/** Agents must wait at least this long before retrying the same write. */
|
|
5829
|
+
exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS = 10;
|
|
5830
|
+
exports.FUNCTION_BUSY_STATUSES = [
|
|
5831
|
+
"Updating",
|
|
5832
|
+
"Creating",
|
|
5833
|
+
"Publishing",
|
|
5834
|
+
"Deleting",
|
|
5835
|
+
];
|
|
5836
|
+
exports.FUNCTION_UPDATING_WAIT = {
|
|
5837
|
+
intervalMs: 2000,
|
|
5838
|
+
maxAttempts: 5,
|
|
5839
|
+
timeoutMs: 12_000,
|
|
5840
|
+
};
|
|
5841
|
+
/**
|
|
5842
|
+
* Injectable sleep for unit tests. Production uses setTimeout.
|
|
5843
|
+
* Tests must restore the original function in afterEach.
|
|
5844
|
+
*/
|
|
5845
|
+
exports.functionUpdatingRuntime = {
|
|
5846
|
+
sleep: (ms) => new Promise((resolve) => {
|
|
5847
|
+
setTimeout(resolve, ms);
|
|
5848
|
+
}),
|
|
5849
|
+
};
|
|
5850
|
+
function getErrorMessage(error) {
|
|
5851
|
+
if (error instanceof Error) {
|
|
5852
|
+
return error.message;
|
|
5853
|
+
}
|
|
5854
|
+
return String(error);
|
|
5855
|
+
}
|
|
5856
|
+
function isFunctionBusyStatus(status) {
|
|
5857
|
+
if (typeof status !== "string") {
|
|
5858
|
+
return false;
|
|
5859
|
+
}
|
|
5860
|
+
return exports.FUNCTION_BUSY_STATUSES.includes(status);
|
|
5861
|
+
}
|
|
5862
|
+
const UPDATING_ERROR_PATTERNS = [
|
|
5863
|
+
/当前函数处于\s*Updating/i,
|
|
5864
|
+
/函数处于\s*Updating/i,
|
|
5865
|
+
/currently\s+(?:in\s+)?updating/i,
|
|
5866
|
+
/function\s+is\s+(?:currently\s+)?updating/i,
|
|
5867
|
+
/Status\s*(?:is|=|:)?\s*Updating/i,
|
|
5868
|
+
/scf\/UpdateFunction(?:Configuration|Code).{0,80}Updating/i,
|
|
5869
|
+
/函数状态异常,检查超时/,
|
|
5870
|
+
];
|
|
5871
|
+
function isFunctionUpdatingError(error) {
|
|
5872
|
+
const message = getErrorMessage(error);
|
|
5873
|
+
return UPDATING_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
5874
|
+
}
|
|
5875
|
+
function buildFunctionUpdatingMessage(params) {
|
|
5876
|
+
const namePart = params.functionName
|
|
5877
|
+
? `函数 \`${params.functionName}\``
|
|
5878
|
+
: "目标函数";
|
|
5879
|
+
const statusPart = params.status ? `(当前 Status=${params.status})` : "";
|
|
5880
|
+
const lines = [
|
|
5881
|
+
`${namePart} 尚未就绪${statusPart},无法执行 manageFunctions(action="${params.action}")。`,
|
|
5882
|
+
`不要立即重试同一写操作(SCF 会在 Updating 期间连续拒绝 UpdateFunctionConfiguration / UpdateFunctionCode)。`,
|
|
5883
|
+
`请等待 ${exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS} 秒后重试,或先调用 queryFunctions(action="getFunctionDetail") 确认 Status 为 Active。`,
|
|
5884
|
+
];
|
|
5885
|
+
if (params.rawMessage) {
|
|
5886
|
+
lines.push(`原始错误: ${params.rawMessage}`);
|
|
5887
|
+
}
|
|
5888
|
+
return lines.join("\n");
|
|
5889
|
+
}
|
|
5890
|
+
function buildFunctionUpdatingNextActions(params) {
|
|
5891
|
+
const functionName = params.functionName;
|
|
5892
|
+
return [
|
|
5893
|
+
{
|
|
5894
|
+
tool: "queryFunctions",
|
|
5895
|
+
action: "getFunctionDetail",
|
|
5896
|
+
reason: "查看函数 Status,等到 Active 后再写配置/代码",
|
|
5897
|
+
suggested_args: {
|
|
5898
|
+
action: "getFunctionDetail",
|
|
5899
|
+
...(functionName ? { functionName } : {}),
|
|
5900
|
+
},
|
|
5901
|
+
},
|
|
5902
|
+
{
|
|
5903
|
+
tool: "manageFunctions",
|
|
5904
|
+
action: params.action,
|
|
5905
|
+
reason: `等待 ${exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS} 秒且 Status=Active 后,用相同参数重试;禁止立刻连打`,
|
|
5906
|
+
suggested_args: {
|
|
5907
|
+
action: params.action,
|
|
5908
|
+
...(functionName ? { functionName } : {}),
|
|
5909
|
+
},
|
|
5910
|
+
},
|
|
5911
|
+
];
|
|
5912
|
+
}
|
|
5913
|
+
function buildFunctionUpdatingPayload(params) {
|
|
5914
|
+
return {
|
|
5915
|
+
success: false,
|
|
5916
|
+
errorCode: exports.FUNCTION_UPDATING_ERROR_CODE,
|
|
5917
|
+
retryAfterSeconds: exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS,
|
|
5918
|
+
message: buildFunctionUpdatingMessage(params),
|
|
5919
|
+
data: {
|
|
5920
|
+
action: params.action,
|
|
5921
|
+
...(params.functionName ? { functionName: params.functionName } : {}),
|
|
5922
|
+
...(params.status ? { status: params.status } : {}),
|
|
5923
|
+
retryAfterSeconds: exports.FUNCTION_UPDATING_RETRY_AFTER_SECONDS,
|
|
5924
|
+
doNotRetryImmediately: true,
|
|
5925
|
+
...(typeof params.waitedAttempts === "number"
|
|
5926
|
+
? { waitedAttempts: params.waitedAttempts }
|
|
5927
|
+
: {}),
|
|
5928
|
+
...(params.timedOut ? { waitTimedOut: true } : {}),
|
|
5929
|
+
...(params.rawMessage ? { rawError: params.rawMessage.slice(0, 500) } : {}),
|
|
5930
|
+
},
|
|
5931
|
+
nextActions: buildFunctionUpdatingNextActions(params),
|
|
5932
|
+
};
|
|
5933
|
+
}
|
|
5934
|
+
/**
|
|
5935
|
+
* Poll function Status until it leaves a busy state.
|
|
5936
|
+
* Always bounded: maxAttempts AND timeoutMs; never spins without a sleep between polls.
|
|
5937
|
+
*/
|
|
5938
|
+
async function waitUntilFunctionActive(getStatus, options = {}) {
|
|
5939
|
+
const intervalMs = options.intervalMs ?? exports.FUNCTION_UPDATING_WAIT.intervalMs;
|
|
5940
|
+
const maxAttempts = options.maxAttempts ?? exports.FUNCTION_UPDATING_WAIT.maxAttempts;
|
|
5941
|
+
const timeoutMs = options.timeoutMs ?? exports.FUNCTION_UPDATING_WAIT.timeoutMs;
|
|
5942
|
+
const sleep = options.sleep ?? ((ms) => exports.functionUpdatingRuntime.sleep(ms));
|
|
5943
|
+
const now = options.now ?? Date.now;
|
|
5944
|
+
if (maxAttempts < 1) {
|
|
5945
|
+
throw new Error("waitUntilFunctionActive maxAttempts must be >= 1");
|
|
5946
|
+
}
|
|
5947
|
+
if (intervalMs < 0 || timeoutMs < 0) {
|
|
5948
|
+
throw new Error("waitUntilFunctionActive intervalMs/timeoutMs must be >= 0");
|
|
5949
|
+
}
|
|
5950
|
+
if (options.initialStatus !== undefined &&
|
|
5951
|
+
!isFunctionBusyStatus(options.initialStatus)) {
|
|
5952
|
+
return {
|
|
5953
|
+
ready: true,
|
|
5954
|
+
status: options.initialStatus,
|
|
5955
|
+
attempts: 0,
|
|
5956
|
+
timedOut: false,
|
|
5957
|
+
};
|
|
5958
|
+
}
|
|
5959
|
+
const startedAt = now();
|
|
5960
|
+
let attempts = 0;
|
|
5961
|
+
let status = options.initialStatus;
|
|
5962
|
+
while (attempts < maxAttempts) {
|
|
5963
|
+
if (now() - startedAt >= timeoutMs) {
|
|
5964
|
+
return { ready: false, status, attempts, timedOut: true };
|
|
5965
|
+
}
|
|
5966
|
+
attempts += 1;
|
|
5967
|
+
status = await getStatus();
|
|
5968
|
+
if (!isFunctionBusyStatus(status)) {
|
|
5969
|
+
return { ready: true, status, attempts, timedOut: false };
|
|
5970
|
+
}
|
|
5971
|
+
if (attempts >= maxAttempts) {
|
|
5972
|
+
break;
|
|
5973
|
+
}
|
|
5974
|
+
if (now() - startedAt + intervalMs >= timeoutMs) {
|
|
5975
|
+
return { ready: false, status, attempts, timedOut: true };
|
|
5976
|
+
}
|
|
5977
|
+
await sleep(intervalMs);
|
|
5978
|
+
}
|
|
5979
|
+
return { ready: false, status, attempts, timedOut: false };
|
|
5980
|
+
}
|
|
5981
|
+
|
|
5982
|
+
|
|
5808
5983
|
/***/ }),
|
|
5809
5984
|
|
|
5810
5985
|
/***/ 3782:
|
|
@@ -10618,8 +10793,8 @@ async function describeCloudRunEnvStatus(manager, envId) {
|
|
|
10618
10793
|
: "unknown";
|
|
10619
10794
|
return { isExist: true, status, baseInfo };
|
|
10620
10795
|
}
|
|
10621
|
-
/** CloudRun EnvType for CreateCloudRunEnv (
|
|
10622
|
-
exports.CLOUDRUN_ENV_TYPE = "
|
|
10796
|
+
/** CloudRun EnvType for CreateCloudRunEnv (baas DescribeEnvBaseInfo enum). */
|
|
10797
|
+
exports.CLOUDRUN_ENV_TYPE = "baas";
|
|
10623
10798
|
/**
|
|
10624
10799
|
* Extract VPC binding from DescribeEnvBaseInfo.EnvBaseInfo when the env was
|
|
10625
10800
|
* opened with an explicit VPC.
|
|
@@ -10664,7 +10839,7 @@ function resolveCloudRunDeployVpcInfo(options) {
|
|
|
10664
10839
|
};
|
|
10665
10840
|
}
|
|
10666
10841
|
/**
|
|
10667
|
-
* Build CreateCloudRunEnv Param, always including EnvType=
|
|
10842
|
+
* Build CreateCloudRunEnv Param, always including EnvType=baas.
|
|
10668
10843
|
* Optional vpcId/subnetIds are used when the platform requires an explicit VPC.
|
|
10669
10844
|
*/
|
|
10670
10845
|
function buildCreateCloudRunEnvParam(options) {
|
|
@@ -11381,7 +11556,7 @@ function registerCloudRunTools(server) {
|
|
|
11381
11556
|
};
|
|
11382
11557
|
}
|
|
11383
11558
|
// 未开通 → 发起异步开通(CreateCloudRunEnv 异步,不阻塞等待)。
|
|
11384
|
-
// Always pass EnvType=
|
|
11559
|
+
// Always pass EnvType=baas; optional vpcId/subnetIds when an explicit VPC is required.
|
|
11385
11560
|
let createResult;
|
|
11386
11561
|
try {
|
|
11387
11562
|
createResult = await manager
|
|
@@ -13108,7 +13283,7 @@ class TelemetryReporter {
|
|
|
13108
13283
|
const arch = os_1.default.arch(); // 系统架构
|
|
13109
13284
|
// Build-time injected version; guard for vitest / non-webpack runtimes.
|
|
13110
13285
|
const mcpVersion = process.env.npm_package_version ||
|
|
13111
|
-
( true ? "2.
|
|
13286
|
+
( true ? "2.29.0" : 0);
|
|
13112
13287
|
return {
|
|
13113
13288
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
13114
13289
|
deviceId: this.deviceId,
|
|
@@ -13458,6 +13633,8 @@ const cloud_mode_js_1 = __webpack_require__(9684);
|
|
|
13458
13633
|
const gateway_access_urls_js_1 = __webpack_require__(2435);
|
|
13459
13634
|
const json_content_js_1 = __webpack_require__(4365);
|
|
13460
13635
|
const logger_js_1 = __webpack_require__(3039);
|
|
13636
|
+
const tool_result_js_1 = __webpack_require__(9835);
|
|
13637
|
+
const function_updating_js_1 = __webpack_require__(3656);
|
|
13461
13638
|
const fs_1 = __webpack_require__(4421);
|
|
13462
13639
|
const path_1 = __importDefault(__webpack_require__(2521));
|
|
13463
13640
|
exports.SUPPORTED_RUNTIMES = {
|
|
@@ -13778,6 +13955,10 @@ function buildFunctionOperationErrorMessage(operation, functionName, functionRoo
|
|
|
13778
13955
|
suggestions.push("如果 HTTP 函数只使用原生 Node.js API 且没有第三方依赖,可以保留函数目录中的 index.js 和 scf_bootstrap,工具会跳过依赖安装。");
|
|
13779
13956
|
suggestions.push("如果你确实依赖 npm 包,请在函数目录下补充 package.json 后重试。");
|
|
13780
13957
|
}
|
|
13958
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
13959
|
+
suggestions.push(`函数当前处于 Updating/非 Active,不要立即重试 ${operation}。` +
|
|
13960
|
+
`请等待约 10 秒,或先 queryFunctions(action="getFunctionDetail") 确认 Status 为 Active 后再重试。`);
|
|
13961
|
+
}
|
|
13781
13962
|
// Handle invalid parameter value errors from CloudBase API
|
|
13782
13963
|
if (/invalid parameter value/i.test(baseMessage)) {
|
|
13783
13964
|
suggestions.push("检测到参数值格式错误。请重点检查以下配置项:");
|
|
@@ -13805,6 +13986,24 @@ function wrapFunctionOperationError(operation, functionName, functionRootPath, e
|
|
|
13805
13986
|
}
|
|
13806
13987
|
return wrappedError;
|
|
13807
13988
|
}
|
|
13989
|
+
async function waitForManageWriteOrGuide(action, functionName, getFunctionDetail, initialDetail) {
|
|
13990
|
+
const waitResult = await (0, function_updating_js_1.waitUntilFunctionActive)(async () => {
|
|
13991
|
+
const latest = await getFunctionDetail(functionName);
|
|
13992
|
+
return typeof latest?.Status === "string" ? latest.Status : undefined;
|
|
13993
|
+
}, {
|
|
13994
|
+
initialStatus: typeof initialDetail?.Status === "string" ? initialDetail.Status : undefined,
|
|
13995
|
+
});
|
|
13996
|
+
if (waitResult.ready) {
|
|
13997
|
+
return undefined;
|
|
13998
|
+
}
|
|
13999
|
+
return (0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14000
|
+
action,
|
|
14001
|
+
functionName,
|
|
14002
|
+
status: waitResult.status,
|
|
14003
|
+
waitedAttempts: waitResult.attempts,
|
|
14004
|
+
timedOut: waitResult.timedOut,
|
|
14005
|
+
});
|
|
14006
|
+
}
|
|
13808
14007
|
function registerFunctionTools(server) {
|
|
13809
14008
|
const cloudBaseOptions = server.cloudBaseOptions;
|
|
13810
14009
|
const deployOverrides = server.pluginOptions?.functions;
|
|
@@ -13827,6 +14026,15 @@ function registerFunctionTools(server) {
|
|
|
13827
14026
|
return (0, json_content_js_1.jsonContent)(await handler());
|
|
13828
14027
|
}
|
|
13829
14028
|
catch (error) {
|
|
14029
|
+
if ((0, tool_result_js_1.isToolPayloadError)(error)) {
|
|
14030
|
+
return (0, json_content_js_1.jsonContent)(error.payload);
|
|
14031
|
+
}
|
|
14032
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
14033
|
+
return (0, json_content_js_1.jsonContent)((0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14034
|
+
action: "manageFunctions",
|
|
14035
|
+
rawMessage: (0, function_updating_js_1.getErrorMessage)(error),
|
|
14036
|
+
}));
|
|
14037
|
+
}
|
|
13830
14038
|
return (0, json_content_js_1.jsonContent)(buildErrorEnvelope(error));
|
|
13831
14039
|
}
|
|
13832
14040
|
};
|
|
@@ -14381,6 +14589,24 @@ function registerFunctionTools(server) {
|
|
|
14381
14589
|
throw new Error("updateFunctionCode 操作时,functionName 参数是必需的");
|
|
14382
14590
|
}
|
|
14383
14591
|
const cloudbase = await getManager();
|
|
14592
|
+
if (typeof cloudbase.functions.getFunctionDetail === "function") {
|
|
14593
|
+
try {
|
|
14594
|
+
const currentDetail = await cloudbase.functions.getFunctionDetail(input.functionName);
|
|
14595
|
+
const waited = await waitForManageWriteOrGuide("updateFunctionCode", input.functionName, (name) => cloudbase.functions.getFunctionDetail(name), currentDetail);
|
|
14596
|
+
if (waited) {
|
|
14597
|
+
return waited;
|
|
14598
|
+
}
|
|
14599
|
+
}
|
|
14600
|
+
catch (error) {
|
|
14601
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
14602
|
+
return (0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14603
|
+
action: "updateFunctionCode",
|
|
14604
|
+
functionName: input.functionName,
|
|
14605
|
+
rawMessage: (0, function_updating_js_1.getErrorMessage)(error),
|
|
14606
|
+
});
|
|
14607
|
+
}
|
|
14608
|
+
}
|
|
14609
|
+
}
|
|
14384
14610
|
// 镜像更新分支:后续迭代只需用新镜像 tag 更新函数。
|
|
14385
14611
|
const updateImageConfig = input.imageConfig ??
|
|
14386
14612
|
input.func?.imageConfig;
|
|
@@ -14399,6 +14625,13 @@ function registerFunctionTools(server) {
|
|
|
14399
14625
|
});
|
|
14400
14626
|
}
|
|
14401
14627
|
catch (error) {
|
|
14628
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
14629
|
+
return (0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14630
|
+
action: "updateFunctionCode",
|
|
14631
|
+
functionName: input.functionName,
|
|
14632
|
+
rawMessage: (0, function_updating_js_1.getErrorMessage)(error),
|
|
14633
|
+
});
|
|
14634
|
+
}
|
|
14402
14635
|
throw wrapFunctionOperationError("updateFunctionCode", input.functionName, undefined, error);
|
|
14403
14636
|
}
|
|
14404
14637
|
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, imageResult);
|
|
@@ -14456,6 +14689,13 @@ function registerFunctionTools(server) {
|
|
|
14456
14689
|
result = await cloudbase.functions.updateFunctionCode(updateParams);
|
|
14457
14690
|
}
|
|
14458
14691
|
catch (error) {
|
|
14692
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
14693
|
+
return (0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14694
|
+
action: "updateFunctionCode",
|
|
14695
|
+
functionName: input.functionName,
|
|
14696
|
+
rawMessage: (0, function_updating_js_1.getErrorMessage)(error),
|
|
14697
|
+
});
|
|
14698
|
+
}
|
|
14459
14699
|
throw wrapFunctionOperationError("updateFunctionCode", input.functionName, processedRootPath, error);
|
|
14460
14700
|
}
|
|
14461
14701
|
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
|
|
@@ -14500,6 +14740,10 @@ function registerFunctionTools(server) {
|
|
|
14500
14740
|
if (!functionDetail) {
|
|
14501
14741
|
throw new Error(`函数 ${input.functionName} 不存在或无法获取详情`);
|
|
14502
14742
|
}
|
|
14743
|
+
const configBusy = await waitForManageWriteOrGuide("updateFunctionConfig", input.functionName, (name) => cloudbase.functions.getFunctionDetail(name), functionDetail);
|
|
14744
|
+
if (configBusy) {
|
|
14745
|
+
return configBusy;
|
|
14746
|
+
}
|
|
14503
14747
|
const currentVpc = typeof functionDetail.VpcConfig === "object" &&
|
|
14504
14748
|
functionDetail.VpcConfig !== null &&
|
|
14505
14749
|
functionDetail.VpcConfig.SubnetId &&
|
|
@@ -14509,27 +14753,39 @@ function registerFunctionTools(server) {
|
|
|
14509
14753
|
vpcId: functionDetail.VpcConfig.VpcId,
|
|
14510
14754
|
}
|
|
14511
14755
|
: undefined;
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
{
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14756
|
+
try {
|
|
14757
|
+
const result = await cloudbase.functions.updateFunctionConfig({
|
|
14758
|
+
name: input.functionName,
|
|
14759
|
+
envVariables: Object.assign({}, (functionDetail.Environment?.Variables || []).reduce((acc, curr) => {
|
|
14760
|
+
acc[curr.Key] = curr.Value;
|
|
14761
|
+
return acc;
|
|
14762
|
+
}, {}), input.envVariables ?? {}),
|
|
14763
|
+
timeout: input.timeout ?? functionDetail.Timeout,
|
|
14764
|
+
vpc: Object.assign({}, currentVpc, input.vpc ?? {}),
|
|
14765
|
+
});
|
|
14766
|
+
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
|
|
14767
|
+
return buildEnvelope({
|
|
14768
|
+
action: input.action,
|
|
14769
|
+
functionName: input.functionName,
|
|
14770
|
+
raw: result,
|
|
14771
|
+
}, `已更新函数 ${input.functionName} 的配置`, [
|
|
14772
|
+
{
|
|
14773
|
+
tool: "queryFunctions",
|
|
14774
|
+
action: "getFunctionDetail",
|
|
14775
|
+
reason: "确认配置变更结果",
|
|
14776
|
+
},
|
|
14777
|
+
]);
|
|
14778
|
+
}
|
|
14779
|
+
catch (error) {
|
|
14780
|
+
if ((0, function_updating_js_1.isFunctionUpdatingError)(error)) {
|
|
14781
|
+
return (0, function_updating_js_1.buildFunctionUpdatingPayload)({
|
|
14782
|
+
action: "updateFunctionConfig",
|
|
14783
|
+
functionName: input.functionName,
|
|
14784
|
+
rawMessage: (0, function_updating_js_1.getErrorMessage)(error),
|
|
14785
|
+
});
|
|
14786
|
+
}
|
|
14787
|
+
throw error;
|
|
14788
|
+
}
|
|
14533
14789
|
}
|
|
14534
14790
|
case "invokeFunction": {
|
|
14535
14791
|
if (!input.functionName) {
|
|
@@ -18934,7 +19190,7 @@ function registerSetupTools(server) {
|
|
|
18934
19190
|
server.registerTool("downloadTemplate", {
|
|
18935
19191
|
title: "下载项目模板",
|
|
18936
19192
|
description: `自动下载并部署CloudBase项目模板。
|
|
18937
|
-
**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.
|
|
19193
|
+
**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.29.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
18938
19194
|
inputSchema: {
|
|
18939
19195
|
template: zod_1.z
|
|
18940
19196
|
.enum(["react", "vue", "miniprogram", "uniapp", "rules"])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cloudbase-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.0",
|
|
4
4
|
"mcpName": "io.github.TencentCloudBase/cloudbase-mcp",
|
|
5
5
|
"packageManager": "pnpm@10.8.0",
|
|
6
6
|
"description": "CloudBase MCP Server — operate Tencent CloudBase (database, auth, functions, storage, hosting) from AI coding tools via the Model Context Protocol. Part of CloudBase AI Toolkit.",
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.TencentCloudBase/cloudbase-mcp",
|
|
4
4
|
"title": "CloudBase",
|
|
5
5
|
"description": "CloudBase MCP: DB, functions, storage, hosting via @cloudbase/cloudbase-mcp",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.29.0",
|
|
7
7
|
"websiteUrl": "https://github.com/TencentCloudBase/CloudBase-AI-Toolkit",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/TencentCloudBase/CloudBase-AI-Toolkit",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
{
|
|
16
16
|
"src": "https://raw.githubusercontent.com/TencentCloudBase/CloudBase-AI-Toolkit/main/mcp/icon.png",
|
|
17
17
|
"mimeType": "image/png",
|
|
18
|
-
"sizes": [
|
|
18
|
+
"sizes": [
|
|
19
|
+
"96x96"
|
|
20
|
+
]
|
|
19
21
|
}
|
|
20
22
|
],
|
|
21
23
|
"packages": [
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
"registryType": "npm",
|
|
24
26
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
25
27
|
"identifier": "@cloudbase/cloudbase-mcp",
|
|
26
|
-
"version": "2.
|
|
28
|
+
"version": "2.29.0",
|
|
27
29
|
"runtimeHint": "npx",
|
|
28
30
|
"transport": {
|
|
29
31
|
"type": "stdio"
|