From 464142cb28e562514fe7dc7e136c237775955b1d Mon Sep 17 00:00:00 2001 From: CodeBuddy Attribution Bot Date: Tue, 28 Apr 2026 23:39:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(attribution):=20MCP=20=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E5=8F=82=E6=95=B0=E9=AA=8C=E8=AF=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=B8=8D=E6=B8=85=E6=99=B0=EF=BC=8C=E7=BC=BA?= =?UTF-8?q?=E4=B9=8F=E5=8F=82=E6=95=B0=E7=A4=BA=E4=BE=8B=20(issue=5Fmo8yzj?= =?UTF-8?q?2s=5Fzu5l9q)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcp/src/tools/functions.ts | 53 ++++++++++++++++++++++++++++++-------- mcp/src/tools/gateway.ts | 28 +++++++++++++++++--- 2 files changed, 66 insertions(+), 15 deletions(-) diff --git a/mcp/src/tools/functions.ts b/mcp/src/tools/functions.ts index 08db62ce..2edad00b 100644 --- a/mcp/src/tools/functions.ts +++ b/mcp/src/tools/functions.ts @@ -1412,23 +1412,38 @@ export function registerFunctionTools(server: ExtendedMcpServer) { { title: "查询云函数域资源", description: - "函数域统一只读入口。通过更自解释的 action 查询函数列表、函数详情、日志、层、触发器和代码下载地址。", + "函数域统一只读入口。通过 action 查询函数列表、函数详情、日志、层、触发器和代码下载地址。" + + "\n\n各 action 所需参数:\n" + + "- listFunctions: 无必填参数(可选 limit, offset)\n" + + "- getFunctionDetail: functionName(必填)\n" + + "- listFunctionLogs: functionName(必填), startTime/endTime(可选)\n" + + "- getFunctionLogDetail: requestId(必填)\n" + + "- listFunctionLayers: functionName(必填)\n" + + "- listLayers: 无必填参数(可选 runtime, searchKey, limit, offset)\n" + + "- listLayerVersions: layerName(必填)\n" + + "- getLayerVersionDetail: layerName + layerVersion(均必填)\n" + + "- listFunctionTriggers: functionName(必填)\n" + + "- getFunctionDownloadUrl: functionName(必填)" + + "\n\n调用示例:\n" + + "- 列出所有函数: { action: \"listFunctions\" }\n" + + "- 查看函数详情: { action: \"getFunctionDetail\", functionName: \"my-function\" }\n" + + "- 查看函数日志: { action: \"listFunctionLogs\", functionName: \"my-function\" }", inputSchema: { action: z .enum(QUERY_FUNCTION_ACTIONS) - .describe("只读操作类型,例如 listFunctions、getFunctionDetail、listFunctionLogs"), - functionName: z.string().optional().describe("函数名称。函数相关 action 必填"), + .describe("只读操作类型。各 action 所需参数详见工具描述。常用: listFunctions, getFunctionDetail, listFunctionLogs"), + functionName: z.string().optional().describe("函数名称。getFunctionDetail/listFunctionLogs/listFunctionLayers/listFunctionTriggers/getFunctionDownloadUrl 时必填"), limit: z.number().optional().describe("分页数量。列表类 action 可选"), offset: z.number().optional().describe("分页偏移。列表类 action 可选"), codeSecret: z.string().optional().describe("代码保护密钥"), startTime: z.string().optional().describe("日志查询开始时间"), endTime: z.string().optional().describe("日志查询结束时间"), - requestId: z.string().optional().describe("日志 requestId。获取日志详情时必填"), + requestId: z.string().optional().describe("日志 requestId。getFunctionLogDetail 时必填"), qualifier: z.string().optional().describe("函数版本,日志查询时可选"), runtime: z.string().optional().describe("层查询的运行时筛选"), searchKey: z.string().optional().describe("层名称搜索关键字"), - layerName: z.string().optional().describe("层名称。层相关 action 必填"), - layerVersion: z.number().optional().describe("层版本号。获取层版本详情时必填"), + layerName: z.string().optional().describe("层名称。listLayerVersions/getLayerVersionDetail 时必填"), + layerVersion: z.number().optional().describe("层版本号。getLayerVersionDetail 时必填"), }, annotations: { readOnlyHint: true, @@ -1444,11 +1459,27 @@ export function registerFunctionTools(server: ExtendedMcpServer) { { title: "管理云函数域资源", description: - "函数域统一写入口。通过 action 管理函数创建、代码更新、配置更新、调用函数、触发器和层绑定。危险操作需要显式 confirm=true。", + "函数域统一写入口。通过 action 管理函数创建、代码更新、配置更新、调用函数、触发器和层绑定。危险操作需要显式 confirm=true。" + + "\n\n各 action 所需参数:\n" + + "- createFunction: func(必填,包含 name),functionRootPath 或 zipFile(HTTP 函数必填其一)\n" + + "- updateFunctionCode: functionName(必填),functionRootPath 或 zipFile\n" + + "- updateFunctionConfig: functionName(必填),timeout/envVariables/vpc(可选)\n" + + "- invokeFunction: functionName(必填),params(可选调用参数)\n" + + "- createFunctionTrigger: functionName + triggers(均必填)\n" + + "- deleteFunctionTrigger: functionName + triggerName(均必填),confirm=true\n" + + "- createLayerVersion: layerName + runtimes(均必填),contentPath 或 base64Content(必填其一)\n" + + "- deleteLayerVersion: layerName + layerVersion(均必填),confirm=true\n" + + "- attachLayer: functionName + layerName + layerVersion(均必填)\n" + + "- detachLayer: functionName + layerName + layerVersion(均必填),confirm=true\n" + + "- updateFunctionLayers: functionName + layers(均必填)" + + "\n\n调用示例:\n" + + "- 创建函数: { action: \"createFunction\", func: { name: \"hello\", type: \"Event\" }, functionRootPath: \"/path/to/cloudfunctions\" }\n" + + "- 更新代码: { action: \"updateFunctionCode\", functionName: \"hello\", functionRootPath: \"/path/to/cloudfunctions\" }\n" + + "- 调用函数: { action: \"invokeFunction\", functionName: \"hello\", params: { key: \"value\" } }", inputSchema: { action: z .enum(MANAGE_FUNCTION_ACTIONS) - .describe("写操作类型,例如 createFunction、invokeFunction、attachLayer"), + .describe("写操作类型。各 action 所需参数详见工具描述。常用: createFunction, updateFunctionCode, invokeFunction"), func: CREATE_FUNCTION_SCHEMA.optional().describe("createFunction 操作的函数配置"), functionRootPath: z.string().optional().describe( "创建或更新函数代码时默认推荐的本地目录方式。" + @@ -1459,7 +1490,7 @@ export function registerFunctionTools(server: ExtendedMcpServer) { "SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。", ), force: z.boolean().optional().describe("createFunction 时是否覆盖"), - functionName: z.string().optional().describe("函数名称。大多数 action 使用该字段作为统一目标"), + functionName: z.string().optional().describe("函数名称。updateFunctionCode/updateFunctionConfig/invokeFunction/createFunctionTrigger/deleteFunctionTrigger/attachLayer/detachLayer/updateFunctionLayers 时必填"), zipFile: z.string().optional().describe( "仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。", ), @@ -1467,8 +1498,8 @@ export function registerFunctionTools(server: ExtendedMcpServer) { timeout: z.number().optional().describe("配置更新时的超时时间"), envVariables: z.record(z.string()).optional().describe("配置更新时要合并的环境变量"), vpc: VPC_SCHEMA.optional().describe("配置更新时的 VPC 信息"), - params: z.record(z.any()).optional().describe("invokeFunction 的调用参数"), - triggers: z.array(TRIGGER_SCHEMA).optional().describe("createFunctionTrigger 的触发器列表"), + params: z.record(z.any()).optional().describe("invokeFunction 的调用参数,例如 { key: \"value\" }"), + triggers: z.array(TRIGGER_SCHEMA).optional().describe("createFunctionTrigger 的触发器列表。例如 [{ name: \"my-timer\", type: \"timer\", config: \"0 */5 * * * * *\" }]"), triggerName: z.string().optional().describe("deleteFunctionTrigger 的目标触发器名称"), layerName: z.string().optional().describe("层名称"), layerVersion: z.number().optional().describe("层版本号"), diff --git a/mcp/src/tools/gateway.ts b/mcp/src/tools/gateway.ts index 6d588d42..98ccee87 100644 --- a/mcp/src/tools/gateway.ts +++ b/mcp/src/tools/gateway.ts @@ -549,11 +549,20 @@ export function registerGatewayTools(server: ExtendedMcpServer) { { title: "查询网关域资源", description: - "网关域统一只读入口。通过 action 查询网关域名、访问入口和目标暴露情况。", + "网关域统一只读入口。通过 action 查询网关域名、访问入口和目标暴露情况。" + + "\n\n各 action 所需参数:\n" + + "- listDomains: 无必填参数\n" + + "- listRoutes: 无必填参数\n" + + "- getAccess: targetName(必填)\n" + + "- getRoute: routeId 或 targetName(可选,用于筛选)\n" + + "- listCustomDomains: 无必填参数" + + "\n\n调用示例:\n" + + "- 列出域名: { action: \"listDomains\" }\n" + + "- 查看访问入口: { action: \"getAccess\", targetName: \"my-function\" }", inputSchema: { action: z .enum(QUERY_GATEWAY_ACTIONS) - .describe("只读操作类型,例如 getAccess、listDomains"), + .describe("只读操作类型。各 action 所需参数详见工具描述。常用: listDomains, getAccess"), targetType: z .enum(["function"]) .optional() @@ -578,11 +587,22 @@ export function registerGatewayTools(server: ExtendedMcpServer) { { title: "管理网关域资源", description: - "网关域统一写入口。通过 action 创建目标访问入口,后续承接更通用的网关配置能力。为已存在的 HTTP 云函数补默认域名访问时,通常使用 createAccess 并提供 targetType=\"function\"、targetName、type=\"HTTP\" 与期望 path。注意 createAccess 只创建网关入口,不会自动修改函数资源权限。", + "网关域统一写入口。通过 action 创建目标访问入口,后续承接更通用的网关配置能力。" + + "\n\n各 action 所需参数:\n" + + "- createAccess: targetType + targetName + type(均必填)。path, auth 可选\n" + + "- createRoute: route(必填,含 path, serviceType, serviceName)\n" + + "- updateRoute: route(必填,含 path, serviceType, serviceName)\n" + + "- deleteRoute: route.path 或 path(必填)\n" + + "- bindCustomDomain: domain + certificateId(均必填)\n" + + "- deleteCustomDomain: domain(必填)\n" + + "- deleteAccess: targetName 或 path(至少一个)\n" + + "- updatePathAuth: targetName 或 path(至少一个)+ auth(必填)" + + "\n\n调用示例:\n" + + "- 为 HTTP 函数创建访问入口: { action: \"createAccess\", targetType: \"function\", targetName: \"my-http-func\", type: \"HTTP\", path: \"/api/hello\", auth: false }", inputSchema: { action: z .enum(MANAGE_GATEWAY_ACTIONS) - .describe('写操作类型,例如 createAccess。为已有函数补默认域名访问入口时使用 createAccess;若 action=createAccess 且 targetType=function,必须显式提供 type。'), + .describe('写操作类型。各 action 所需参数详见工具描述。createAccess 时必须显式提供 type(HTTP 函数传 HTTP,Event 函数传 Event 或省略)。'), targetType: z .enum(["function"]) .optional() From ddc2c6d828bb5d59709f3e6e5daa8231ced1af82 Mon Sep 17 00:00:00 2001 From: bookerzhao Date: Tue, 28 Apr 2026 23:49:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(gateway):=20=F0=9F=94=A7=20add=20missin?= =?UTF-8?q?g=20phrases=20to=20fix=20test=20regressions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcp/src/tools/gateway.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mcp/src/tools/gateway.ts b/mcp/src/tools/gateway.ts index 98ccee87..985ad4df 100644 --- a/mcp/src/tools/gateway.ts +++ b/mcp/src/tools/gateway.ts @@ -588,6 +588,7 @@ export function registerGatewayTools(server: ExtendedMcpServer) { title: "管理网关域资源", description: "网关域统一写入口。通过 action 创建目标访问入口,后续承接更通用的网关配置能力。" + + "常用于为 HTTP 云函数补默认域名访问入口。" + "\n\n各 action 所需参数:\n" + "- createAccess: targetType + targetName + type(均必填)。path, auth 可选\n" + "- createRoute: route(必填,含 path, serviceType, serviceName)\n" + @@ -602,7 +603,7 @@ export function registerGatewayTools(server: ExtendedMcpServer) { inputSchema: { action: z .enum(MANAGE_GATEWAY_ACTIONS) - .describe('写操作类型。各 action 所需参数详见工具描述。createAccess 时必须显式提供 type(HTTP 函数传 HTTP,Event 函数传 Event 或省略)。'), + .describe('写操作类型。各 action 所需参数详见工具描述。createAccess 用于创建默认域名访问入口,必须显式提供 type(HTTP 函数传 HTTP,Event 函数传 Event 或省略)。'), targetType: z .enum(["function"]) .optional() From 884d0c9b8cf05a241b29dd99d2a898a8ccf8dc0d Mon Sep 17 00:00:00 2001 From: CodeBuddy Attribution Bot Date: Tue, 28 Apr 2026 23:49:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(attribution):=20MCP=20=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E5=8F=82=E6=95=B0=E9=AA=8C=E8=AF=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=B8=8D=E6=B8=85=E6=99=B0=EF=BC=8C=E7=BC=BA?= =?UTF-8?q?=E4=B9=8F=E5=8F=82=E6=95=B0=E7=A4=BA=E4=BE=8B=20(issue=5Fmo8yzj?= =?UTF-8?q?2s=5Fzu5l9q)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/prompts/auth-web.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/prompts/auth-web.mdx b/doc/prompts/auth-web.mdx index e2c70abf..edb69a28 100644 --- a/doc/prompts/auth-web.mdx +++ b/doc/prompts/auth-web.mdx @@ -143,10 +143,9 @@ If the current task has not retrieved a real Publishable Key, omit `accessKey` i **1. Phone OTP (Recommended)** - Automatically use `auth-tool-cloudbase` to turn on `SMS Login` through `manageAppAuth` -- Send the phone number to `auth.signInWithOtp({ phone, ... })`, then call the returned `verifyOtp({ token })`. -- `signInWithOtp` can automatically create a new user if the user does not exist; control this via `shouldCreateUser` parameter (default `true`). +- For phone registration, send the phone number to `auth.signUp({ phone, ... })` first, then call the returned `verifyOtp({ token })`. Do not swap the order. ```js -const { data, error } = await auth.signInWithOtp({ phone: '13800138000' }) +const { data, error } = await auth.signUp({ phone: '13800138000' }) const { data: loginData, error: loginError } = await data.verifyOtp({ token:'123456' }) ```