@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.js
CHANGED
|
@@ -2233,7 +2233,7 @@ ${envIdSection}
|
|
|
2233
2233
|
## 环境信息
|
|
2234
2234
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
2235
2235
|
- Node.js版本: ${process.version}
|
|
2236
|
-
- MCP 版本:${process.env.npm_package_version || "2.25.
|
|
2236
|
+
- MCP 版本:${process.env.npm_package_version || "2.25.1" || 0}
|
|
2237
2237
|
- 系统架构: ${os_1.default.arch()}
|
|
2238
2238
|
- 时间: ${new Date().toISOString()}
|
|
2239
2239
|
- 请求ID: ${requestId}
|
|
@@ -2314,7 +2314,7 @@ function createWrappedHandler(name, handler, server) {
|
|
|
2314
2314
|
requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
|
|
2315
2315
|
ide: server.ide || process.env.INTEGRATION_IDE || ''
|
|
2316
2316
|
});
|
|
2317
|
-
const mcpVersion = true ? "2.25.
|
|
2317
|
+
const mcpVersion = true ? "2.25.1" : 0;
|
|
2318
2318
|
const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
|
|
2319
2319
|
const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
|
|
2320
2320
|
// 创建新的错误对象,保持原有的错误类型但更新消息
|
|
@@ -2483,7 +2483,6 @@ const capi_js_1 = __webpack_require__(738);
|
|
|
2483
2483
|
const cloudrun_js_1 = __webpack_require__(5023);
|
|
2484
2484
|
const dataModel_js_1 = __webpack_require__(4052);
|
|
2485
2485
|
const gateway_js_1 = __webpack_require__(4319);
|
|
2486
|
-
const invite_code_js_1 = __webpack_require__(4760);
|
|
2487
2486
|
const agents_js_1 = __webpack_require__(9527);
|
|
2488
2487
|
const app_auth_js_1 = __webpack_require__(5313);
|
|
2489
2488
|
const apps_js_1 = __webpack_require__(6817);
|
|
@@ -2514,7 +2513,6 @@ const DEFAULT_PLUGINS = [
|
|
|
2514
2513
|
"logs",
|
|
2515
2514
|
"agents",
|
|
2516
2515
|
"download",
|
|
2517
|
-
"invite-code",
|
|
2518
2516
|
"capi",
|
|
2519
2517
|
];
|
|
2520
2518
|
function registerDatabase(server) {
|
|
@@ -2556,7 +2554,6 @@ const AVAILABLE_PLUGINS = {
|
|
|
2556
2554
|
logs: { name: "logs", register: logs_js_1.registerLogTools },
|
|
2557
2555
|
agents: { name: "agents", register: agents_js_1.registerAgentTools },
|
|
2558
2556
|
apps: { name: "apps", register: apps_js_1.registerAppTools },
|
|
2559
|
-
"invite-code": { name: "invite-code", register: invite_code_js_1.registerInviteCodeTools },
|
|
2560
2557
|
cloudrun: { name: "cloudrun", register: cloudrun_js_1.registerCloudRunTools },
|
|
2561
2558
|
capi: { name: "capi", register: capi_js_1.registerCapiTools },
|
|
2562
2559
|
};
|
|
@@ -7247,36 +7244,24 @@ function registerGatewayTools(server) {
|
|
|
7247
7244
|
}
|
|
7248
7245
|
return resolveDefaultHttpDomain();
|
|
7249
7246
|
};
|
|
7250
|
-
const
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
return "SCF";
|
|
7259
|
-
}
|
|
7260
|
-
if (input.requiresFunctionType || input.targetType === "function") {
|
|
7261
|
-
throw new Error("为云函数创建/更新路由时必须显式提供 type(HTTP→WEB_SCF,Event→SCF)或 route.upstreamResourceType。省略会导致 HTTP 与 Event 函数互相误标,访问时可能返回 FUNCTION_PARAM_INVALID 或网关内部错误。");
|
|
7262
|
-
}
|
|
7263
|
-
throw new Error("必须提供 route.upstreamResourceType(SCF / WEB_SCF / CBR / STATIC_STORE / LH),或在函数场景提供 type=\"HTTP\"|\"Event\"。");
|
|
7247
|
+
const resolveUpstreamResourceType = (input) => {
|
|
7248
|
+
const resolved = input.routeUpstreamResourceType ?? input.upstreamResourceType;
|
|
7249
|
+
if (resolved) {
|
|
7250
|
+
return resolved;
|
|
7251
|
+
}
|
|
7252
|
+
throw new Error("必须提供 upstreamResourceType(或 route.upstreamResourceType):" +
|
|
7253
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
7254
|
+
"禁止仅凭 targetName/serviceName 推断上游类型。");
|
|
7264
7255
|
};
|
|
7265
7256
|
const normalizeRoutePayload = async (input) => {
|
|
7266
7257
|
const upstreamResourceName = input.route?.serviceName ?? input.targetName;
|
|
7267
7258
|
if (!upstreamResourceName) {
|
|
7268
|
-
throw new Error("必须提供 targetName 或 route.serviceName
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
input.
|
|
7273
|
-
input.route?.upstreamResourceType
|
|
7274
|
-
(!input.route?.upstreamResourceType && Boolean(input.targetName));
|
|
7275
|
-
const upstreamResourceType = mapUpstreamResourceType({
|
|
7276
|
-
type: input.type,
|
|
7277
|
-
targetType: input.targetType,
|
|
7278
|
-
upstreamResourceType: input.route?.upstreamResourceType,
|
|
7279
|
-
requiresFunctionType: isFunctionRoute,
|
|
7259
|
+
throw new Error("必须提供 targetName 或 route.serviceName 作为上游资源名称:" +
|
|
7260
|
+
"云函数名、云托管服务名,或静态托管实例名(常见为 staticstore)。");
|
|
7261
|
+
}
|
|
7262
|
+
const upstreamResourceType = resolveUpstreamResourceType({
|
|
7263
|
+
upstreamResourceType: input.upstreamResourceType,
|
|
7264
|
+
routeUpstreamResourceType: input.route?.upstreamResourceType,
|
|
7280
7265
|
});
|
|
7281
7266
|
const path = normalizeAccessPath(input.route?.path ?? input.path ?? `/${upstreamResourceName}`);
|
|
7282
7267
|
const domain = await resolveRouteDomain(input.domain);
|
|
@@ -7285,18 +7270,25 @@ function registerGatewayTools(server) {
|
|
|
7285
7270
|
: input.auth !== undefined
|
|
7286
7271
|
? input.auth
|
|
7287
7272
|
: undefined;
|
|
7273
|
+
const enablePathTransmission = input.route?.enablePathTransmission !== undefined
|
|
7274
|
+
? input.route.enablePathTransmission
|
|
7275
|
+
: input.enablePathTransmission !== undefined
|
|
7276
|
+
? input.enablePathTransmission
|
|
7277
|
+
: undefined;
|
|
7278
|
+
const route = {
|
|
7279
|
+
Path: path,
|
|
7280
|
+
UpstreamResourceType: upstreamResourceType,
|
|
7281
|
+
UpstreamResourceName: upstreamResourceName,
|
|
7282
|
+
EnableAuth: enableAuth,
|
|
7283
|
+
};
|
|
7284
|
+
if (enablePathTransmission !== undefined) {
|
|
7285
|
+
route.EnablePathTransmission = enablePathTransmission;
|
|
7286
|
+
}
|
|
7288
7287
|
return {
|
|
7289
7288
|
EnvId: await resolveEnvId(),
|
|
7290
7289
|
Domain: {
|
|
7291
7290
|
Domain: domain,
|
|
7292
|
-
Routes: [
|
|
7293
|
-
{
|
|
7294
|
-
Path: path,
|
|
7295
|
-
UpstreamResourceType: upstreamResourceType,
|
|
7296
|
-
UpstreamResourceName: upstreamResourceName,
|
|
7297
|
-
EnableAuth: enableAuth,
|
|
7298
|
-
},
|
|
7299
|
-
],
|
|
7291
|
+
Routes: [route],
|
|
7300
7292
|
},
|
|
7301
7293
|
resolved: {
|
|
7302
7294
|
domain,
|
|
@@ -7304,6 +7296,7 @@ function registerGatewayTools(server) {
|
|
|
7304
7296
|
upstreamResourceType,
|
|
7305
7297
|
upstreamResourceName,
|
|
7306
7298
|
enableAuth,
|
|
7299
|
+
enablePathTransmission,
|
|
7307
7300
|
},
|
|
7308
7301
|
};
|
|
7309
7302
|
};
|
|
@@ -7417,9 +7410,10 @@ function registerGatewayTools(server) {
|
|
|
7417
7410
|
const message = err instanceof Error ? err.message : String(err);
|
|
7418
7411
|
if (message.includes("An error has occurred")) {
|
|
7419
7412
|
let hint = "为目标资源配置访问路由失败(后端内部错误)。请确保:1) 目标云函数已成功创建并处于 Active 状态;2) 环境默认 HTTP 域名已完成初始化(IsDefault);3) 该访问路径未被占用。";
|
|
7420
|
-
if (
|
|
7413
|
+
if (payload.resolved.upstreamResourceType === "WEB_SCF" ||
|
|
7414
|
+
payload.resolved.upstreamResourceType === "SCF") {
|
|
7421
7415
|
hint +=
|
|
7422
|
-
"
|
|
7416
|
+
"此外注意:HTTP 云函数必须用 upstreamResourceType=WEB_SCF,Event 云函数必须用 SCF;互标会导致此错误。";
|
|
7423
7417
|
}
|
|
7424
7418
|
throw new Error(`${hint} 原始错误:${message}`);
|
|
7425
7419
|
}
|
|
@@ -7429,15 +7423,21 @@ function registerGatewayTools(server) {
|
|
|
7429
7423
|
return buildEnvelope({
|
|
7430
7424
|
action: input.action,
|
|
7431
7425
|
model: "httpServiceRoute",
|
|
7432
|
-
targetType: input.targetType ?? null,
|
|
7433
7426
|
targetName: payload.resolved.upstreamResourceName,
|
|
7434
7427
|
domain: payload.resolved.domain,
|
|
7435
7428
|
path: payload.resolved.path,
|
|
7436
7429
|
upstreamResourceType: payload.resolved.upstreamResourceType,
|
|
7437
7430
|
upstreamResourceName: payload.resolved.upstreamResourceName,
|
|
7438
7431
|
auth: payload.resolved.enableAuth ?? null,
|
|
7432
|
+
enablePathTransmission: payload.resolved.enablePathTransmission ?? null,
|
|
7439
7433
|
raw: result,
|
|
7440
|
-
}, `已为目标 ${payload.resolved.upstreamResourceName} 在域名 ${payload.resolved.domain} 创建路由 ${payload.resolved.path}(${payload.resolved.upstreamResourceType}
|
|
7434
|
+
}, `已为目标 ${payload.resolved.upstreamResourceName} 在域名 ${payload.resolved.domain} 创建路由 ${payload.resolved.path}(${payload.resolved.upstreamResourceType})` +
|
|
7435
|
+
(payload.resolved.enablePathTransmission === true
|
|
7436
|
+
? ";已开启路径透传(后端收到完整请求路径)"
|
|
7437
|
+
: payload.resolved.enablePathTransmission === false
|
|
7438
|
+
? ";路径透传关闭(网关会剥掉触发路径前缀后再转发给后端)"
|
|
7439
|
+
: ";路径透传未显式设置(平台默认 false,会剥掉触发路径前缀)") +
|
|
7440
|
+
`。注意:路由配置传播通常需要等待 30 秒到 3 分钟,请勿立即访问。该操作只创建网关入口,不会自动放开上游权限;若上游是云函数且需要匿名或浏览器直接访问,请继续检查函数资源权限。`, routeMutationNextActions(payload.resolved.upstreamResourceName));
|
|
7441
7441
|
}
|
|
7442
7442
|
case "updateRoute": {
|
|
7443
7443
|
const cloudbase = await getManager();
|
|
@@ -7455,8 +7455,15 @@ function registerGatewayTools(server) {
|
|
|
7455
7455
|
upstreamResourceType: payload.resolved.upstreamResourceType,
|
|
7456
7456
|
upstreamResourceName: payload.resolved.upstreamResourceName,
|
|
7457
7457
|
auth: payload.resolved.enableAuth ?? null,
|
|
7458
|
+
enablePathTransmission: payload.resolved.enablePathTransmission ?? null,
|
|
7458
7459
|
raw: result,
|
|
7459
|
-
}, `HTTP 路由更新成功(${payload.resolved.domain}${payload.resolved.path}
|
|
7460
|
+
}, `HTTP 路由更新成功(${payload.resolved.domain}${payload.resolved.path}` +
|
|
7461
|
+
(payload.resolved.enablePathTransmission === true
|
|
7462
|
+
? ",路径透传=开启"
|
|
7463
|
+
: payload.resolved.enablePathTransmission === false
|
|
7464
|
+
? ",路径透传=关闭"
|
|
7465
|
+
: "") +
|
|
7466
|
+
`)`, routeMutationNextActions(payload.resolved.upstreamResourceName));
|
|
7460
7467
|
}
|
|
7461
7468
|
case "deleteRoute": {
|
|
7462
7469
|
const routePath = input.route?.path ?? input.path;
|
|
@@ -7522,19 +7529,17 @@ function registerGatewayTools(server) {
|
|
|
7522
7529
|
};
|
|
7523
7530
|
server.registerTool?.("queryGateway", {
|
|
7524
7531
|
title: "查询 CloudBase 网关",
|
|
7525
|
-
description: "CloudBase 网关统一只读入口(Domain/Route
|
|
7532
|
+
description: "CloudBase HTTP 网关统一只读入口(Domain/Route)。查询域名下路径路由及其上游:" +
|
|
7533
|
+
"WEB_SCF/SCF=云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
7534
|
+
"主键为 Domain + Path;listRoutes / getRoute / listCustomDomains。",
|
|
7526
7535
|
inputSchema: {
|
|
7527
7536
|
action: zod_1.z
|
|
7528
7537
|
.enum(QUERY_GATEWAY_ACTIONS)
|
|
7529
7538
|
.describe("只读操作类型:listRoutes、getRoute、listCustomDomains"),
|
|
7530
|
-
targetType: zod_1.z
|
|
7531
|
-
.enum(["function"])
|
|
7532
|
-
.optional()
|
|
7533
|
-
.describe("目标资源类型。当前支持 function"),
|
|
7534
7539
|
targetName: zod_1.z
|
|
7535
7540
|
.string()
|
|
7536
7541
|
.optional()
|
|
7537
|
-
.describe("
|
|
7542
|
+
.describe("上游资源名过滤(UpstreamResourceName):云函数名、云托管服务名,或静态托管实例名(常见 staticstore)。"),
|
|
7538
7543
|
routeId: zod_1.z.string().optional().describe("路由 ID。getRoute 时可选"),
|
|
7539
7544
|
path: zod_1.z
|
|
7540
7545
|
.string()
|
|
@@ -7553,40 +7558,68 @@ function registerGatewayTools(server) {
|
|
|
7553
7558
|
}, async (input) => withEnvelope(() => handleQueryGateway(input)));
|
|
7554
7559
|
server.registerTool?.("manageGateway", {
|
|
7555
7560
|
title: "管理 CloudBase 网关",
|
|
7556
|
-
description: "CloudBase 网关统一写入口(Domain/Route
|
|
7561
|
+
description: "CloudBase HTTP 网关统一写入口(Domain/Route)。createRoute/updateRoute/deleteRoute 把域名下的 path 转到上游;未传 domain 时用 IsDefault 默认域名。" +
|
|
7562
|
+
"上游类型只用一个参数 upstreamResourceType(也可写在 route.upstreamResourceType,route 优先):" +
|
|
7563
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器;" +
|
|
7564
|
+
"配合 targetName 或 route.serviceName(云函数名/云托管服务名/静态托管实例名,常见 staticstore)。" +
|
|
7565
|
+
"createRoute 只建网关入口,不改上游权限。" +
|
|
7566
|
+
"enablePathTransmission:默认 false 剥触发路径前缀;true 透传完整路径(CBR 多路由、WEB_SCF 自管子路径常需 true;STATIC_STORE 自定义触发路径映射站点根通常 false)。" +
|
|
7567
|
+
"⚠️ SSL 自定义域名用 bindCustomDomain;CORS/安全域名用 envDomainManagement。",
|
|
7557
7568
|
inputSchema: {
|
|
7558
7569
|
action: zod_1.z
|
|
7559
7570
|
.enum(MANAGE_GATEWAY_ACTIONS)
|
|
7560
|
-
.describe("
|
|
7561
|
-
|
|
7562
|
-
.enum(["function"])
|
|
7563
|
-
.optional()
|
|
7564
|
-
.describe("目标资源类型。当前支持 function"),
|
|
7571
|
+
.describe("写操作:createRoute/updateRoute/deleteRoute 管理路由;bindCustomDomain/deleteCustomDomain 管理自定义域名。" +
|
|
7572
|
+
"createRoute/updateRoute 必须提供 upstreamResourceType。"),
|
|
7565
7573
|
targetName: zod_1.z
|
|
7566
7574
|
.string()
|
|
7567
7575
|
.optional()
|
|
7568
|
-
.describe("
|
|
7576
|
+
.describe("上游资源名称(UpstreamResourceName),与 route.serviceName 二选一(route 优先)。" +
|
|
7577
|
+
"云函数=函数名;云托管=服务名;静态托管=实例名(常见 staticstore)。不会自动推断上游类型。"),
|
|
7569
7578
|
path: zod_1.z
|
|
7570
7579
|
.string()
|
|
7571
7580
|
.optional()
|
|
7572
|
-
.describe("
|
|
7573
|
-
|
|
7574
|
-
|
|
7581
|
+
.describe("触发路径(网关匹配前缀),默认 /{上游名}。例:云函数 /api/hello、云托管 /api、静态托管 / 或 /app。" +
|
|
7582
|
+
"只建网关入口;与 enablePathTransmission 共同决定上游实际收到的路径。"),
|
|
7583
|
+
upstreamResourceType: zod_1.z
|
|
7584
|
+
.enum(UPSTREAM_RESOURCE_TYPES)
|
|
7575
7585
|
.optional()
|
|
7576
|
-
.describe("
|
|
7586
|
+
.describe("上游类型(与 route.upstreamResourceType 二选一,route 优先)。" +
|
|
7587
|
+
"WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。" +
|
|
7588
|
+
"createRoute/updateRoute 必填其一;勿把 manageFunctions 的 type=HTTP|Event 传到本字段。"),
|
|
7577
7589
|
auth: zod_1.z
|
|
7578
7590
|
.boolean()
|
|
7579
7591
|
.optional()
|
|
7580
|
-
.describe("
|
|
7592
|
+
.describe("网关路径鉴权(EnableAuth)。匿名/浏览器公网访问通常 false。" +
|
|
7593
|
+
"只控制网关入口;云函数安全规则、云托管鉴权、静态托管权限需各自工具另行配置。"),
|
|
7594
|
+
enablePathTransmission: zod_1.z
|
|
7595
|
+
.boolean()
|
|
7596
|
+
.optional()
|
|
7597
|
+
.describe("路径透传(EnablePathTransmission),平台默认 false。例 path=/api 且请求 /api/users:" +
|
|
7598
|
+
"false→上游收到 /users;true→上游收到 /api/users。" +
|
|
7599
|
+
"CBR 云托管(Express 等自管子路由)与 WEB_SCF 多路径函数常需 true;" +
|
|
7600
|
+
"STATIC_STORE 把触发路径映射到站点根目录(如 /app → 托管 /)时通常 false;" +
|
|
7601
|
+
"单入口/根路径处理保持 false。也可用 route.enablePathTransmission(route 优先)。"),
|
|
7581
7602
|
route: zod_1.z
|
|
7582
7603
|
.object({
|
|
7583
7604
|
path: zod_1.z.string().optional(),
|
|
7584
|
-
serviceName: zod_1.z
|
|
7585
|
-
|
|
7605
|
+
serviceName: zod_1.z
|
|
7606
|
+
.string()
|
|
7607
|
+
.optional()
|
|
7608
|
+
.describe("上游实例名:云函数名 / 云托管服务名 / 静态托管实例名(常见 staticstore)/ LH 实例。优先于顶层 targetName。"),
|
|
7609
|
+
upstreamResourceType: zod_1.z
|
|
7610
|
+
.enum(UPSTREAM_RESOURCE_TYPES)
|
|
7611
|
+
.optional()
|
|
7612
|
+
.describe("同顶层 upstreamResourceType。route 内设置时优先于顶层。"),
|
|
7586
7613
|
auth: zod_1.z.boolean().optional(),
|
|
7614
|
+
enablePathTransmission: zod_1.z
|
|
7615
|
+
.boolean()
|
|
7616
|
+
.optional()
|
|
7617
|
+
.describe("同顶层 enablePathTransmission。route 内设置时优先于顶层。"),
|
|
7587
7618
|
})
|
|
7588
7619
|
.optional()
|
|
7589
|
-
.describe("
|
|
7620
|
+
.describe("路由对象(可选写法)。例:云函数 {upstreamResourceType:\"WEB_SCF\",serviceName:\"fn\",path:\"/api\"};" +
|
|
7621
|
+
"云托管 {upstreamResourceType:\"CBR\",serviceName:\"svc\",path:\"/api\"};" +
|
|
7622
|
+
"静态托管 {upstreamResourceType:\"STATIC_STORE\",serviceName:\"staticstore\",path:\"/\"}。"),
|
|
7590
7623
|
domain: zod_1.z
|
|
7591
7624
|
.string()
|
|
7592
7625
|
.optional()
|
|
@@ -7648,70 +7681,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
|
7648
7681
|
|
|
7649
7682
|
module.exports = __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_mcp_js_45c326f0__;
|
|
7650
7683
|
|
|
7651
|
-
/***/ }),
|
|
7652
|
-
|
|
7653
|
-
/***/ 4760:
|
|
7654
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7658
|
-
exports.registerInviteCodeTools = registerInviteCodeTools;
|
|
7659
|
-
const zod_1 = __webpack_require__(2971);
|
|
7660
|
-
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
7661
|
-
function registerInviteCodeTools(server) {
|
|
7662
|
-
const cloudBaseOptions = server.cloudBaseOptions;
|
|
7663
|
-
const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
|
|
7664
|
-
server.registerTool?.("activateInviteCode", {
|
|
7665
|
-
title: "激活邀请码",
|
|
7666
|
-
description: "云开发 AI编程激励计划,通过邀请码激活用户激励。",
|
|
7667
|
-
inputSchema: {
|
|
7668
|
-
InviteCode: zod_1.z.string().describe("待激活的邀请码")
|
|
7669
|
-
},
|
|
7670
|
-
annotations: {
|
|
7671
|
-
readOnlyHint: false,
|
|
7672
|
-
destructiveHint: false,
|
|
7673
|
-
idempotentHint: false,
|
|
7674
|
-
openWorldHint: true,
|
|
7675
|
-
category: "invite-code"
|
|
7676
|
-
}
|
|
7677
|
-
}, async ({ InviteCode }) => {
|
|
7678
|
-
if (!InviteCode) {
|
|
7679
|
-
return {
|
|
7680
|
-
content: [
|
|
7681
|
-
{
|
|
7682
|
-
type: "text",
|
|
7683
|
-
text: JSON.stringify({
|
|
7684
|
-
ErrorCode: 'MissingParameter',
|
|
7685
|
-
ErrorMsg: '邀请码为必填项',
|
|
7686
|
-
RequestId: ''
|
|
7687
|
-
}, null, 2)
|
|
7688
|
-
}
|
|
7689
|
-
]
|
|
7690
|
-
};
|
|
7691
|
-
}
|
|
7692
|
-
const manager = await getManager();
|
|
7693
|
-
const EnvId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
|
|
7694
|
-
const result = await manager.commonService().call({
|
|
7695
|
-
Action: 'ActivateInviteCode',
|
|
7696
|
-
Param: { InviteCode, EnvId }
|
|
7697
|
-
});
|
|
7698
|
-
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
|
|
7699
|
-
return {
|
|
7700
|
-
content: [
|
|
7701
|
-
{
|
|
7702
|
-
type: "text",
|
|
7703
|
-
text: JSON.stringify({
|
|
7704
|
-
ErrorCode: result?.ErrorCode || '',
|
|
7705
|
-
ErrorMsg: result?.ErrorMsg || '',
|
|
7706
|
-
RequestId: result?.RequestId || ''
|
|
7707
|
-
}, null, 2)
|
|
7708
|
-
}
|
|
7709
|
-
]
|
|
7710
|
-
};
|
|
7711
|
-
});
|
|
7712
|
-
}
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
7684
|
/***/ }),
|
|
7716
7685
|
|
|
7717
7686
|
/***/ 4848:
|
|
@@ -10015,7 +9984,7 @@ class TelemetryReporter {
|
|
|
10015
9984
|
const nodeVersion = process.version; // Node.js版本
|
|
10016
9985
|
const arch = os_1.default.arch(); // 系统架构
|
|
10017
9986
|
// 从构建时注入的版本号获取MCP版本信息
|
|
10018
|
-
const mcpVersion = process.env.npm_package_version || "2.25.
|
|
9987
|
+
const mcpVersion = process.env.npm_package_version || "2.25.1" || 0;
|
|
10019
9988
|
return {
|
|
10020
9989
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
10021
9990
|
deviceId: this.deviceId,
|
|
@@ -11111,7 +11080,7 @@ function registerFunctionTools(server) {
|
|
|
11111
11080
|
raw: imageResult,
|
|
11112
11081
|
}, `已基于镜像 ${createImageConfig.imageUri} 创建 HTTP 函数 ${functionName}。` +
|
|
11113
11082
|
`请确认 TCR、SCF 与构建管道处于同一地域;如需通过 URL 访问,请显式调用 ` +
|
|
11114
|
-
`manageGateway(action="createRoute",
|
|
11083
|
+
`manageGateway(action="createRoute", upstreamResourceType="WEB_SCF") 并按需调整函数安全规则。` +
|
|
11115
11084
|
`部署后可用 queryFunctions(action="getFunctionDetail") 确认函数已就绪。`, [
|
|
11116
11085
|
{
|
|
11117
11086
|
tool: "queryFunctions",
|
|
@@ -11182,7 +11151,7 @@ function registerFunctionTools(server) {
|
|
|
11182
11151
|
nextActions.push({
|
|
11183
11152
|
tool: "manageGateway",
|
|
11184
11153
|
action: "createRoute",
|
|
11185
|
-
reason: "如果需要通过 URL 访问 HTTP 函数,请调用 manageGateway(action=\"createRoute\") 并显式传
|
|
11154
|
+
reason: "如果需要通过 URL 访问 HTTP 函数,请调用 manageGateway(action=\"createRoute\") 并显式传 upstreamResourceType=\"WEB_SCF\",再按实际路径和鉴权需求创建访问入口,不要默认假设 /函数名 已存在",
|
|
11186
11155
|
});
|
|
11187
11156
|
nextActions.push({
|
|
11188
11157
|
tool: "queryGateway",
|
|
@@ -11201,7 +11170,7 @@ function registerFunctionTools(server) {
|
|
|
11201
11170
|
});
|
|
11202
11171
|
}
|
|
11203
11172
|
const message = func.type === "HTTP"
|
|
11204
|
-
? `已创建 HTTP 函数 ${functionName}。如果后续需要通过 URL 访问,请显式调用 manageGateway(action="createRoute"),并把
|
|
11173
|
+
? `已创建 HTTP 函数 ${functionName}。如果后续需要通过 URL 访问,请显式调用 manageGateway(action="createRoute"),并把 upstreamResourceType="WEB_SCF" 一起传入,再按实际路径和鉴权需求创建访问入口。评测或其他外部调用方可能会以匿名身份访问,而且失败后不一定会把 EXCEED_AUTHORITY 再反馈给 AI;交付前请主动确认访问路径和函数安全规则,若已出现 EXCEED_AUTHORITY,请先调用 queryPermissions(action="getResourcePermission", resourceType="function", resourceId="${functionName}") 查看当前规则,再按需要使用 managePermissions(action="updateResourcePermission") 调整权限。`
|
|
11205
11174
|
: `已创建函数 ${functionName}`;
|
|
11206
11175
|
return buildEnvelope({
|
|
11207
11176
|
action: input.action,
|
|
@@ -14327,7 +14296,7 @@ function registerSetupTools(server) {
|
|
|
14327
14296
|
server.registerTool("downloadTemplate", {
|
|
14328
14297
|
title: "下载项目模板",
|
|
14329
14298
|
description: `自动下载并部署CloudBase项目模板。
|
|
14330
|
-
**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.
|
|
14299
|
+
**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)`,
|
|
14331
14300
|
inputSchema: {
|
|
14332
14301
|
template: zod_1.z
|
|
14333
14302
|
.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.25.
|
|
3
|
+
"version": "2.25.1",
|
|
4
4
|
"packageManager": "pnpm@10.8.0",
|
|
5
5
|
"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.",
|
|
6
6
|
"main": "./dist/index.cjs",
|