@cloudbase/cloudbase-mcp 2.25.0 → 2.25.1
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 +103 -135
- package/dist/index.js +103 -134
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -90811,7 +90811,7 @@ function registerFunctionTools(server) {
|
|
|
90811
90811
|
raw: imageResult,
|
|
90812
90812
|
}, `已基于镜像 ${createImageConfig.imageUri} 创建 HTTP 函数 ${functionName}。` +
|
|
90813
90813
|
`请确认 TCR、SCF 与构建管道处于同一地域;如需通过 URL 访问,请显式调用 ` +
|
|
90814
|
-
`manageGateway(action="createRoute",
|
|
90814
|
+
`manageGateway(action="createRoute", upstreamResourceType="WEB_SCF") 并按需调整函数安全规则。` +
|
|
90815
90815
|
`部署后可用 queryFunctions(action="getFunctionDetail") 确认函数已就绪。`, [
|
|
90816
90816
|
{
|
|
90817
90817
|
tool: "queryFunctions",
|
|
@@ -90882,7 +90882,7 @@ function registerFunctionTools(server) {
|
|
|
90882
90882
|
nextActions.push({
|
|
90883
90883
|
tool: "manageGateway",
|
|
90884
90884
|
action: "createRoute",
|
|
90885
|
-
reason: "如果需要通过 URL 访问 HTTP 函数,请调用 manageGateway(action=\"createRoute\") 并显式传
|
|
90885
|
+
reason: "如果需要通过 URL 访问 HTTP 函数,请调用 manageGateway(action=\"createRoute\") 并显式传 upstreamResourceType=\"WEB_SCF\",再按实际路径和鉴权需求创建访问入口,不要默认假设 /函数名 已存在",
|
|
90886
90886
|
});
|
|
90887
90887
|
nextActions.push({
|
|
90888
90888
|
tool: "queryGateway",
|
|
@@ -90901,7 +90901,7 @@ function registerFunctionTools(server) {
|
|
|
90901
90901
|
});
|
|
90902
90902
|
}
|
|
90903
90903
|
const message = func.type === "HTTP"
|
|
90904
|
-
? `已创建 HTTP 函数 ${functionName}。如果后续需要通过 URL 访问,请显式调用 manageGateway(action="createRoute"),并把
|
|
90904
|
+
? `已创建 HTTP 函数 ${functionName}。如果后续需要通过 URL 访问,请显式调用 manageGateway(action="createRoute"),并把 upstreamResourceType="WEB_SCF" 一起传入,再按实际路径和鉴权需求创建访问入口。评测或其他外部调用方可能会以匿名身份访问,而且失败后不一定会把 EXCEED_AUTHORITY 再反馈给 AI;交付前请主动确认访问路径和函数安全规则,若已出现 EXCEED_AUTHORITY,请先调用 queryPermissions(action="getResourcePermission", resourceType="function", resourceId="${functionName}") 查看当前规则,再按需要使用 managePermissions(action="updateResourcePermission") 调整权限。`
|
|
90905
90905
|
: `已创建函数 ${functionName}`;
|
|
90906
90906
|
return buildEnvelope({
|
|
90907
90907
|
action: input.action,
|
|
@@ -103680,7 +103680,6 @@ const capi_js_1 = __webpack_require__(40738);
|
|
|
103680
103680
|
const cloudrun_js_1 = __webpack_require__(35023);
|
|
103681
103681
|
const dataModel_js_1 = __webpack_require__(34052);
|
|
103682
103682
|
const gateway_js_1 = __webpack_require__(84319);
|
|
103683
|
-
const invite_code_js_1 = __webpack_require__(44760);
|
|
103684
103683
|
const agents_js_1 = __webpack_require__(9527);
|
|
103685
103684
|
const app_auth_js_1 = __webpack_require__(5313);
|
|
103686
103685
|
const apps_js_1 = __webpack_require__(36817);
|
|
@@ -103711,7 +103710,6 @@ const DEFAULT_PLUGINS = [
|
|
|
103711
103710
|
"logs",
|
|
103712
103711
|
"agents",
|
|
103713
103712
|
"download",
|
|
103714
|
-
"invite-code",
|
|
103715
103713
|
"capi",
|
|
103716
103714
|
];
|
|
103717
103715
|
function registerDatabase(server) {
|
|
@@ -103753,7 +103751,6 @@ const AVAILABLE_PLUGINS = {
|
|
|
103753
103751
|
logs: { name: "logs", register: logs_js_1.registerLogTools },
|
|
103754
103752
|
agents: { name: "agents", register: agents_js_1.registerAgentTools },
|
|
103755
103753
|
apps: { name: "apps", register: apps_js_1.registerAppTools },
|
|
103756
|
-
"invite-code": { name: "invite-code", register: invite_code_js_1.registerInviteCodeTools },
|
|
103757
103754
|
cloudrun: { name: "cloudrun", register: cloudrun_js_1.registerCloudRunTools },
|
|
103758
103755
|
capi: { name: "capi", register: capi_js_1.registerCapiTools },
|
|
103759
103756
|
};
|
|
@@ -133297,71 +133294,6 @@ util.inherits(ArchiverError, Error);
|
|
|
133297
133294
|
|
|
133298
133295
|
exports = module.exports = ArchiverError;
|
|
133299
133296
|
|
|
133300
|
-
/***/ }),
|
|
133301
|
-
|
|
133302
|
-
/***/ 44760:
|
|
133303
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
133304
|
-
|
|
133305
|
-
"use strict";
|
|
133306
|
-
|
|
133307
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
133308
|
-
exports.registerInviteCodeTools = registerInviteCodeTools;
|
|
133309
|
-
const zod_1 = __webpack_require__(21614);
|
|
133310
|
-
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
133311
|
-
function registerInviteCodeTools(server) {
|
|
133312
|
-
const cloudBaseOptions = server.cloudBaseOptions;
|
|
133313
|
-
const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
|
|
133314
|
-
server.registerTool?.("activateInviteCode", {
|
|
133315
|
-
title: "激活邀请码",
|
|
133316
|
-
description: "云开发 AI编程激励计划,通过邀请码激活用户激励。",
|
|
133317
|
-
inputSchema: {
|
|
133318
|
-
InviteCode: zod_1.z.string().describe("待激活的邀请码")
|
|
133319
|
-
},
|
|
133320
|
-
annotations: {
|
|
133321
|
-
readOnlyHint: false,
|
|
133322
|
-
destructiveHint: false,
|
|
133323
|
-
idempotentHint: false,
|
|
133324
|
-
openWorldHint: true,
|
|
133325
|
-
category: "invite-code"
|
|
133326
|
-
}
|
|
133327
|
-
}, async ({ InviteCode }) => {
|
|
133328
|
-
if (!InviteCode) {
|
|
133329
|
-
return {
|
|
133330
|
-
content: [
|
|
133331
|
-
{
|
|
133332
|
-
type: "text",
|
|
133333
|
-
text: JSON.stringify({
|
|
133334
|
-
ErrorCode: 'MissingParameter',
|
|
133335
|
-
ErrorMsg: '邀请码为必填项',
|
|
133336
|
-
RequestId: ''
|
|
133337
|
-
}, null, 2)
|
|
133338
|
-
}
|
|
133339
|
-
]
|
|
133340
|
-
};
|
|
133341
|
-
}
|
|
133342
|
-
const manager = await getManager();
|
|
133343
|
-
const EnvId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
|
|
133344
|
-
const result = await manager.commonService().call({
|
|
133345
|
-
Action: 'ActivateInviteCode',
|
|
133346
|
-
Param: { InviteCode, EnvId }
|
|
133347
|
-
});
|
|
133348
|
-
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
|
|
133349
|
-
return {
|
|
133350
|
-
content: [
|
|
133351
|
-
{
|
|
133352
|
-
type: "text",
|
|
133353
|
-
text: JSON.stringify({
|
|
133354
|
-
ErrorCode: result?.ErrorCode || '',
|
|
133355
|
-
ErrorMsg: result?.ErrorMsg || '',
|
|
133356
|
-
RequestId: result?.RequestId || ''
|
|
133357
|
-
}, null, 2)
|
|
133358
|
-
}
|
|
133359
|
-
]
|
|
133360
|
-
};
|
|
133361
|
-
});
|
|
133362
|
-
}
|
|
133363
|
-
|
|
133364
|
-
|
|
133365
133297
|
/***/ }),
|
|
133366
133298
|
|
|
133367
133299
|
/***/ 44763:
|
|
@@ -137273,7 +137205,7 @@ class TelemetryReporter {
|
|
|
137273
137205
|
const nodeVersion = process.version; // Node.js版本
|
|
137274
137206
|
const arch = os_1.default.arch(); // 系统架构
|
|
137275
137207
|
// 从构建时注入的版本号获取MCP版本信息
|
|
137276
|
-
const mcpVersion = process.env.npm_package_version || "2.25.
|
|
137208
|
+
const mcpVersion = process.env.npm_package_version || "2.25.1" || 0;
|
|
137277
137209
|
return {
|
|
137278
137210
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
137279
137211
|
deviceId: this.deviceId,
|
|
@@ -197369,7 +197301,7 @@ ${envIdSection}
|
|
|
197369
197301
|
## 环境信息
|
|
197370
197302
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
197371
197303
|
- Node.js版本: ${process.version}
|
|
197372
|
-
- MCP 版本:${process.env.npm_package_version || "2.25.
|
|
197304
|
+
- MCP 版本:${process.env.npm_package_version || "2.25.1" || 0}
|
|
197373
197305
|
- 系统架构: ${os_1.default.arch()}
|
|
197374
197306
|
- 时间: ${new Date().toISOString()}
|
|
197375
197307
|
- 请求ID: ${requestId}
|
|
@@ -197450,7 +197382,7 @@ function createWrappedHandler(name, handler, server) {
|
|
|
197450
197382
|
requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
|
|
197451
197383
|
ide: server.ide || process.env.INTEGRATION_IDE || ''
|
|
197452
197384
|
});
|
|
197453
|
-
const mcpVersion = true ? "2.25.
|
|
197385
|
+
const mcpVersion = true ? "2.25.1" : 0;
|
|
197454
197386
|
const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
|
|
197455
197387
|
const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
|
|
197456
197388
|
// 创建新的错误对象,保持原有的错误类型但更新消息
|
|
@@ -214038,7 +213970,7 @@ function registerSetupTools(server) {
|
|
|
214038
213970
|
server.registerTool("downloadTemplate", {
|
|
214039
213971
|
title: "下载项目模板",
|
|
214040
213972
|
description: `自动下载并部署CloudBase项目模板。
|
|
214041
|
-
**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.25.
|
|
213973
|
+
**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.25.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
214042
213974
|
inputSchema: {
|
|
214043
213975
|
template: zod_1.z
|
|
214044
213976
|
.enum(["react", "vue", "miniprogram", "uniapp", "rules"])
|
|
@@ -231232,36 +231164,24 @@ function registerGatewayTools(server) {
|
|
|
231232
231164
|
}
|
|
231233
231165
|
return resolveDefaultHttpDomain();
|
|
231234
231166
|
};
|
|
231235
|
-
const
|
|
231236
|
-
|
|
231237
|
-
|
|
231238
|
-
|
|
231239
|
-
|
|
231240
|
-
|
|
231241
|
-
|
|
231242
|
-
|
|
231243
|
-
return "SCF";
|
|
231244
|
-
}
|
|
231245
|
-
if (input.requiresFunctionType || input.targetType === "function") {
|
|
231246
|
-
throw new Error("为云函数创建/更新路由时必须显式提供 type(HTTP→WEB_SCF,Event→SCF)或 route.upstreamResourceType。省略会导致 HTTP 与 Event 函数互相误标,访问时可能返回 FUNCTION_PARAM_INVALID 或网关内部错误。");
|
|
231247
|
-
}
|
|
231248
|
-
throw new Error("必须提供 route.upstreamResourceType(SCF / WEB_SCF / CBR / STATIC_STORE / LH),或在函数场景提供 type=\"HTTP\"|\"Event\"。");
|
|
231167
|
+
const resolveUpstreamResourceType = (input) => {
|
|
231168
|
+
const resolved = input.routeUpstreamResourceType ?? input.upstreamResourceType;
|
|
231169
|
+
if (resolved) {
|
|
231170
|
+
return resolved;
|
|
231171
|
+
}
|
|
231172
|
+
throw new Error("必须提供 upstreamResourceType(或 route.upstreamResourceType):" +
|
|
231173
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
231174
|
+
"禁止仅凭 targetName/serviceName 推断上游类型。");
|
|
231249
231175
|
};
|
|
231250
231176
|
const normalizeRoutePayload = async (input) => {
|
|
231251
231177
|
const upstreamResourceName = input.route?.serviceName ?? input.targetName;
|
|
231252
231178
|
if (!upstreamResourceName) {
|
|
231253
|
-
throw new Error("必须提供 targetName 或 route.serviceName
|
|
231254
|
-
|
|
231255
|
-
|
|
231256
|
-
|
|
231257
|
-
input.
|
|
231258
|
-
input.route?.upstreamResourceType
|
|
231259
|
-
(!input.route?.upstreamResourceType && Boolean(input.targetName));
|
|
231260
|
-
const upstreamResourceType = mapUpstreamResourceType({
|
|
231261
|
-
type: input.type,
|
|
231262
|
-
targetType: input.targetType,
|
|
231263
|
-
upstreamResourceType: input.route?.upstreamResourceType,
|
|
231264
|
-
requiresFunctionType: isFunctionRoute,
|
|
231179
|
+
throw new Error("必须提供 targetName 或 route.serviceName 作为上游资源名称:" +
|
|
231180
|
+
"云函数名、云托管服务名,或静态托管实例名(常见为 staticstore)。");
|
|
231181
|
+
}
|
|
231182
|
+
const upstreamResourceType = resolveUpstreamResourceType({
|
|
231183
|
+
upstreamResourceType: input.upstreamResourceType,
|
|
231184
|
+
routeUpstreamResourceType: input.route?.upstreamResourceType,
|
|
231265
231185
|
});
|
|
231266
231186
|
const path = normalizeAccessPath(input.route?.path ?? input.path ?? `/${upstreamResourceName}`);
|
|
231267
231187
|
const domain = await resolveRouteDomain(input.domain);
|
|
@@ -231270,18 +231190,25 @@ function registerGatewayTools(server) {
|
|
|
231270
231190
|
: input.auth !== undefined
|
|
231271
231191
|
? input.auth
|
|
231272
231192
|
: undefined;
|
|
231193
|
+
const enablePathTransmission = input.route?.enablePathTransmission !== undefined
|
|
231194
|
+
? input.route.enablePathTransmission
|
|
231195
|
+
: input.enablePathTransmission !== undefined
|
|
231196
|
+
? input.enablePathTransmission
|
|
231197
|
+
: undefined;
|
|
231198
|
+
const route = {
|
|
231199
|
+
Path: path,
|
|
231200
|
+
UpstreamResourceType: upstreamResourceType,
|
|
231201
|
+
UpstreamResourceName: upstreamResourceName,
|
|
231202
|
+
EnableAuth: enableAuth,
|
|
231203
|
+
};
|
|
231204
|
+
if (enablePathTransmission !== undefined) {
|
|
231205
|
+
route.EnablePathTransmission = enablePathTransmission;
|
|
231206
|
+
}
|
|
231273
231207
|
return {
|
|
231274
231208
|
EnvId: await resolveEnvId(),
|
|
231275
231209
|
Domain: {
|
|
231276
231210
|
Domain: domain,
|
|
231277
|
-
Routes: [
|
|
231278
|
-
{
|
|
231279
|
-
Path: path,
|
|
231280
|
-
UpstreamResourceType: upstreamResourceType,
|
|
231281
|
-
UpstreamResourceName: upstreamResourceName,
|
|
231282
|
-
EnableAuth: enableAuth,
|
|
231283
|
-
},
|
|
231284
|
-
],
|
|
231211
|
+
Routes: [route],
|
|
231285
231212
|
},
|
|
231286
231213
|
resolved: {
|
|
231287
231214
|
domain,
|
|
@@ -231289,6 +231216,7 @@ function registerGatewayTools(server) {
|
|
|
231289
231216
|
upstreamResourceType,
|
|
231290
231217
|
upstreamResourceName,
|
|
231291
231218
|
enableAuth,
|
|
231219
|
+
enablePathTransmission,
|
|
231292
231220
|
},
|
|
231293
231221
|
};
|
|
231294
231222
|
};
|
|
@@ -231402,9 +231330,10 @@ function registerGatewayTools(server) {
|
|
|
231402
231330
|
const message = err instanceof Error ? err.message : String(err);
|
|
231403
231331
|
if (message.includes("An error has occurred")) {
|
|
231404
231332
|
let hint = "为目标资源配置访问路由失败(后端内部错误)。请确保:1) 目标云函数已成功创建并处于 Active 状态;2) 环境默认 HTTP 域名已完成初始化(IsDefault);3) 该访问路径未被占用。";
|
|
231405
|
-
if (
|
|
231333
|
+
if (payload.resolved.upstreamResourceType === "WEB_SCF" ||
|
|
231334
|
+
payload.resolved.upstreamResourceType === "SCF") {
|
|
231406
231335
|
hint +=
|
|
231407
|
-
"
|
|
231336
|
+
"此外注意:HTTP 云函数必须用 upstreamResourceType=WEB_SCF,Event 云函数必须用 SCF;互标会导致此错误。";
|
|
231408
231337
|
}
|
|
231409
231338
|
throw new Error(`${hint} 原始错误:${message}`);
|
|
231410
231339
|
}
|
|
@@ -231414,15 +231343,21 @@ function registerGatewayTools(server) {
|
|
|
231414
231343
|
return buildEnvelope({
|
|
231415
231344
|
action: input.action,
|
|
231416
231345
|
model: "httpServiceRoute",
|
|
231417
|
-
targetType: input.targetType ?? null,
|
|
231418
231346
|
targetName: payload.resolved.upstreamResourceName,
|
|
231419
231347
|
domain: payload.resolved.domain,
|
|
231420
231348
|
path: payload.resolved.path,
|
|
231421
231349
|
upstreamResourceType: payload.resolved.upstreamResourceType,
|
|
231422
231350
|
upstreamResourceName: payload.resolved.upstreamResourceName,
|
|
231423
231351
|
auth: payload.resolved.enableAuth ?? null,
|
|
231352
|
+
enablePathTransmission: payload.resolved.enablePathTransmission ?? null,
|
|
231424
231353
|
raw: result,
|
|
231425
|
-
}, `已为目标 ${payload.resolved.upstreamResourceName} 在域名 ${payload.resolved.domain} 创建路由 ${payload.resolved.path}(${payload.resolved.upstreamResourceType}
|
|
231354
|
+
}, `已为目标 ${payload.resolved.upstreamResourceName} 在域名 ${payload.resolved.domain} 创建路由 ${payload.resolved.path}(${payload.resolved.upstreamResourceType})` +
|
|
231355
|
+
(payload.resolved.enablePathTransmission === true
|
|
231356
|
+
? ";已开启路径透传(后端收到完整请求路径)"
|
|
231357
|
+
: payload.resolved.enablePathTransmission === false
|
|
231358
|
+
? ";路径透传关闭(网关会剥掉触发路径前缀后再转发给后端)"
|
|
231359
|
+
: ";路径透传未显式设置(平台默认 false,会剥掉触发路径前缀)") +
|
|
231360
|
+
`。注意:路由配置传播通常需要等待 30 秒到 3 分钟,请勿立即访问。该操作只创建网关入口,不会自动放开上游权限;若上游是云函数且需要匿名或浏览器直接访问,请继续检查函数资源权限。`, routeMutationNextActions(payload.resolved.upstreamResourceName));
|
|
231426
231361
|
}
|
|
231427
231362
|
case "updateRoute": {
|
|
231428
231363
|
const cloudbase = await getManager();
|
|
@@ -231440,8 +231375,15 @@ function registerGatewayTools(server) {
|
|
|
231440
231375
|
upstreamResourceType: payload.resolved.upstreamResourceType,
|
|
231441
231376
|
upstreamResourceName: payload.resolved.upstreamResourceName,
|
|
231442
231377
|
auth: payload.resolved.enableAuth ?? null,
|
|
231378
|
+
enablePathTransmission: payload.resolved.enablePathTransmission ?? null,
|
|
231443
231379
|
raw: result,
|
|
231444
|
-
}, `HTTP 路由更新成功(${payload.resolved.domain}${payload.resolved.path}
|
|
231380
|
+
}, `HTTP 路由更新成功(${payload.resolved.domain}${payload.resolved.path}` +
|
|
231381
|
+
(payload.resolved.enablePathTransmission === true
|
|
231382
|
+
? ",路径透传=开启"
|
|
231383
|
+
: payload.resolved.enablePathTransmission === false
|
|
231384
|
+
? ",路径透传=关闭"
|
|
231385
|
+
: "") +
|
|
231386
|
+
`)`, routeMutationNextActions(payload.resolved.upstreamResourceName));
|
|
231445
231387
|
}
|
|
231446
231388
|
case "deleteRoute": {
|
|
231447
231389
|
const routePath = input.route?.path ?? input.path;
|
|
@@ -231507,19 +231449,17 @@ function registerGatewayTools(server) {
|
|
|
231507
231449
|
};
|
|
231508
231450
|
server.registerTool?.("queryGateway", {
|
|
231509
231451
|
title: "查询 CloudBase 网关",
|
|
231510
|
-
description: "CloudBase 网关统一只读入口(Domain/Route
|
|
231452
|
+
description: "CloudBase HTTP 网关统一只读入口(Domain/Route)。查询域名下路径路由及其上游:" +
|
|
231453
|
+
"WEB_SCF/SCF=云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
231454
|
+
"主键为 Domain + Path;listRoutes / getRoute / listCustomDomains。",
|
|
231511
231455
|
inputSchema: {
|
|
231512
231456
|
action: zod_1.z
|
|
231513
231457
|
.enum(QUERY_GATEWAY_ACTIONS)
|
|
231514
231458
|
.describe("只读操作类型:listRoutes、getRoute、listCustomDomains"),
|
|
231515
|
-
targetType: zod_1.z
|
|
231516
|
-
.enum(["function"])
|
|
231517
|
-
.optional()
|
|
231518
|
-
.describe("目标资源类型。当前支持 function"),
|
|
231519
231459
|
targetName: zod_1.z
|
|
231520
231460
|
.string()
|
|
231521
231461
|
.optional()
|
|
231522
|
-
.describe("
|
|
231462
|
+
.describe("上游资源名过滤(UpstreamResourceName):云函数名、云托管服务名,或静态托管实例名(常见 staticstore)。"),
|
|
231523
231463
|
routeId: zod_1.z.string().optional().describe("路由 ID。getRoute 时可选"),
|
|
231524
231464
|
path: zod_1.z
|
|
231525
231465
|
.string()
|
|
@@ -231538,40 +231478,68 @@ function registerGatewayTools(server) {
|
|
|
231538
231478
|
}, async (input) => withEnvelope(() => handleQueryGateway(input)));
|
|
231539
231479
|
server.registerTool?.("manageGateway", {
|
|
231540
231480
|
title: "管理 CloudBase 网关",
|
|
231541
|
-
description: "CloudBase 网关统一写入口(Domain/Route
|
|
231481
|
+
description: "CloudBase HTTP 网关统一写入口(Domain/Route)。createRoute/updateRoute/deleteRoute 把域名下的 path 转到上游;未传 domain 时用 IsDefault 默认域名。" +
|
|
231482
|
+
"上游类型只用一个参数 upstreamResourceType(也可写在 route.upstreamResourceType,route 优先):" +
|
|
231483
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器;" +
|
|
231484
|
+
"配合 targetName 或 route.serviceName(云函数名/云托管服务名/静态托管实例名,常见 staticstore)。" +
|
|
231485
|
+
"createRoute 只建网关入口,不改上游权限。" +
|
|
231486
|
+
"enablePathTransmission:默认 false 剥触发路径前缀;true 透传完整路径(CBR 多路由、WEB_SCF 自管子路径常需 true;STATIC_STORE 自定义触发路径映射站点根通常 false)。" +
|
|
231487
|
+
"⚠️ SSL 自定义域名用 bindCustomDomain;CORS/安全域名用 envDomainManagement。",
|
|
231542
231488
|
inputSchema: {
|
|
231543
231489
|
action: zod_1.z
|
|
231544
231490
|
.enum(MANAGE_GATEWAY_ACTIONS)
|
|
231545
|
-
.describe("
|
|
231546
|
-
|
|
231547
|
-
.enum(["function"])
|
|
231548
|
-
.optional()
|
|
231549
|
-
.describe("目标资源类型。当前支持 function"),
|
|
231491
|
+
.describe("写操作:createRoute/updateRoute/deleteRoute 管理路由;bindCustomDomain/deleteCustomDomain 管理自定义域名。" +
|
|
231492
|
+
"createRoute/updateRoute 必须提供 upstreamResourceType。"),
|
|
231550
231493
|
targetName: zod_1.z
|
|
231551
231494
|
.string()
|
|
231552
231495
|
.optional()
|
|
231553
|
-
.describe("
|
|
231496
|
+
.describe("上游资源名称(UpstreamResourceName),与 route.serviceName 二选一(route 优先)。" +
|
|
231497
|
+
"云函数=函数名;云托管=服务名;静态托管=实例名(常见 staticstore)。不会自动推断上游类型。"),
|
|
231554
231498
|
path: zod_1.z
|
|
231555
231499
|
.string()
|
|
231556
231500
|
.optional()
|
|
231557
|
-
.describe("
|
|
231558
|
-
|
|
231559
|
-
|
|
231501
|
+
.describe("触发路径(网关匹配前缀),默认 /{上游名}。例:云函数 /api/hello、云托管 /api、静态托管 / 或 /app。" +
|
|
231502
|
+
"只建网关入口;与 enablePathTransmission 共同决定上游实际收到的路径。"),
|
|
231503
|
+
upstreamResourceType: zod_1.z
|
|
231504
|
+
.enum(UPSTREAM_RESOURCE_TYPES)
|
|
231560
231505
|
.optional()
|
|
231561
|
-
.describe("
|
|
231506
|
+
.describe("上游类型(与 route.upstreamResourceType 二选一,route 优先)。" +
|
|
231507
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
231508
|
+
"createRoute/updateRoute 必填其一;勿把 manageFunctions 的 type=HTTP|Event 传到本字段。"),
|
|
231562
231509
|
auth: zod_1.z
|
|
231563
231510
|
.boolean()
|
|
231564
231511
|
.optional()
|
|
231565
|
-
.describe("
|
|
231512
|
+
.describe("网关路径鉴权(EnableAuth)。匿名/浏览器公网访问通常 false。" +
|
|
231513
|
+
"只控制网关入口;云函数安全规则、云托管鉴权、静态托管权限需各自工具另行配置。"),
|
|
231514
|
+
enablePathTransmission: zod_1.z
|
|
231515
|
+
.boolean()
|
|
231516
|
+
.optional()
|
|
231517
|
+
.describe("路径透传(EnablePathTransmission),平台默认 false。例 path=/api 且请求 /api/users:" +
|
|
231518
|
+
"false→上游收到 /users;true→上游收到 /api/users。" +
|
|
231519
|
+
"CBR 云托管(Express 等自管子路由)与 WEB_SCF 多路径函数常需 true;" +
|
|
231520
|
+
"STATIC_STORE 把触发路径映射到站点根目录(如 /app → 托管 /)时通常 false;" +
|
|
231521
|
+
"单入口/根路径处理保持 false。也可用 route.enablePathTransmission(route 优先)。"),
|
|
231566
231522
|
route: zod_1.z
|
|
231567
231523
|
.object({
|
|
231568
231524
|
path: zod_1.z.string().optional(),
|
|
231569
|
-
serviceName: zod_1.z
|
|
231570
|
-
|
|
231525
|
+
serviceName: zod_1.z
|
|
231526
|
+
.string()
|
|
231527
|
+
.optional()
|
|
231528
|
+
.describe("上游实例名:云函数名 / 云托管服务名 / 静态托管实例名(常见 staticstore)/ LH 实例。优先于顶层 targetName。"),
|
|
231529
|
+
upstreamResourceType: zod_1.z
|
|
231530
|
+
.enum(UPSTREAM_RESOURCE_TYPES)
|
|
231531
|
+
.optional()
|
|
231532
|
+
.describe("同顶层 upstreamResourceType。route 内设置时优先于顶层。"),
|
|
231571
231533
|
auth: zod_1.z.boolean().optional(),
|
|
231534
|
+
enablePathTransmission: zod_1.z
|
|
231535
|
+
.boolean()
|
|
231536
|
+
.optional()
|
|
231537
|
+
.describe("同顶层 enablePathTransmission。route 内设置时优先于顶层。"),
|
|
231572
231538
|
})
|
|
231573
231539
|
.optional()
|
|
231574
|
-
.describe("
|
|
231540
|
+
.describe("路由对象(可选写法)。例:云函数 {upstreamResourceType:\"WEB_SCF\",serviceName:\"fn\",path:\"/api\"};" +
|
|
231541
|
+
"云托管 {upstreamResourceType:\"CBR\",serviceName:\"svc\",path:\"/api\"};" +
|
|
231542
|
+
"静态托管 {upstreamResourceType:\"STATIC_STORE\",serviceName:\"staticstore\",path:\"/\"}。"),
|
|
231575
231543
|
domain: zod_1.z
|
|
231576
231544
|
.string()
|
|
231577
231545
|
.optional()
|