Skip to content

Commit 99ee04f

Browse files
authored
Merge pull request #660 from TencentCloudBase/automation/attribution-issue-mo8xfv8b-20m1lv-mcp
fix: MCP 域名管理工具参数约定不清晰,且缺乏文件写入类任务的处理指引
2 parents c3ac07c + 3accec2 commit 99ee04f

3 files changed

Lines changed: 48 additions & 6 deletions

File tree

config/source/skills/cloudbase-platform/SKILL.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Keep local `references/...` paths for files that ship with the current skill dir
4848
- Staying here after the correct implementation skill is already clear.
4949
- Mixing platform overview with platform-specific API shapes or SDK details.
5050
- Using this overview skill as a detour in an existing application where the active auth, storage, and data files are already obvious.
51+
- **Confusing security domains with custom domains**: These are two completely different tools for different purposes:
52+
- `envDomainManagement` (action: create/delete) = Security domains (安全域名) for CORS/request source validation - used for browser upload whitelisting. Does NOT accept certificateId.
53+
- `manageGateway(action="bindCustomDomain")` = Custom domains (自定义域名) for public HTTPS access with SSL certificates - requires domain and certificateId parameters.
5154

5255
## When to use this skill
5356

@@ -93,6 +96,45 @@ Use this skill for **CloudBase platform knowledge** when you need to:
9396

9497
# CloudBase Platform Knowledge
9598

99+
### Domain Management Tools: Clear Distinction
100+
101+
When working with domain-related tasks, use the correct tool based on the requirement:
102+
103+
| Requirement | Tool | Parameters | Purpose |
104+
|-------------|------|------------|---------|
105+
| **Security Domain (安全域名)** | `envDomainManagement` | `action`, `domains` (array of host:port strings) | CORS/request source validation for browser uploads. No certificate involved. |
106+
| **Custom Domain (自定义域名)** | `manageGateway(action="bindCustomDomain")` | `domain` (string), `certificateId` (string) | Public HTTPS access with SSL certificate. Requires certId from SSL console. |
107+
| **Delete Custom Domain** | `manageGateway(action="deleteCustomDomain")` | `domain` (string) | Remove custom domain binding. |
108+
109+
**Key indicators for choosing the right tool:**
110+
- Task mentions "certificate ID" or "SSL" → Use `manageGateway(action="bindCustomDomain")`
111+
- Task mentions "浏览器上传" or "CORS" or "安全域名" → Use `envDomainManagement`
112+
- Task mentions "public access" or "HTTPS" with domain → Use `manageGateway`
113+
114+
### Recording Operation Results
115+
116+
When a task explicitly requires recording operation steps or results to a file (e.g., `RESULT.json`):
117+
118+
1. Perform the tool calls first to get actual results
119+
2. Collect all operation steps with their success/failure status
120+
3. Write the complete record to the specified file in the required format
121+
4. Include both successful operations and failed attempts with error messages
122+
123+
Example structure for operation recording:
124+
```json
125+
{
126+
"steps": [
127+
{"action": "listDomains", "success": true, "message": "Found 3 domains"},
128+
{"action": "bindDomain", "success": false, "message": "Certificate not found"}
129+
],
130+
"summary": {
131+
"totalAttempted": 2,
132+
"succeeded": 1,
133+
"failed": 1
134+
}
135+
}
136+
```
137+
96138
## Storage and Hosting
97139

98140
1. **Static Hosting vs Cloud Storage**:

mcp/src/tools/env.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,14 +1483,14 @@ export function registerEnvTools(server: ExtendedMcpServer) {
14831483
server.registerTool?.(
14841484
"envDomainManagement",
14851485
{
1486-
title: "环境域名管理",
1486+
title: "环境域名管理(安全域名 / CORS 白名单)",
14871487
description:
1488-
"管理云开发环境的安全域名,支持添加和删除操作。(原工具名:createEnvDomain/deleteEnvDomain,为兼容旧AI规则可继续使用这些名称)当浏览器 Web 应用需要从本地 Vite / dev server 或自定义域名直接访问 CloudBase 资源时,应先用 envQuery(action=domains) 检查当前实际浏览器 origin 对应的 host:port 是否已在白名单中,再按该实际值添加。新增或删除后通常需要继续轮询 envQuery(action=domains) 确认状态收敛;安全域名一般约 10 分钟生效。",
1488+
"管理云开发环境的安全域名(安全域名 / CORS 白名单),支持添加和删除操作。(原工具名:createEnvDomain/deleteEnvDomain,为兼容旧AI规则可继续使用这些名称)当浏览器 Web 应用需要从本地 Vite / dev server 直接访问 CloudBase 资源时,应先用 envQuery(action=domains) 检查当前实际浏览器 origin 对应的 host:port 是否已在白名单中,再按该实际值添加。新增或删除后通常需要继续轮询 envQuery(action=domains) 确认状态收敛;安全域名一般约 10 分钟生效。⚠️ 重要:此工具仅用于 CORS/请求来源验证,不涉及 SSL 证书。如需绑定自定义域名供公网 HTTPS 访问,请使用 manageGateway(action=\"bindCustomDomain\")。",
14891489
inputSchema: {
14901490
action: z
14911491
.enum(["create", "delete"])
1492-
.describe("操作类型:create=添加域名,delete=删除域名"),
1493-
domains: z.array(z.string()).describe("安全域名数组"),
1492+
.describe("操作类型:create=添加安全域名,delete=删除安全域名"),
1493+
domains: z.array(z.string()).describe("安全域名数组(格式:host:port,例如 localhost:5173 或 127.0.0.1:4173)。注意:不是自定义域名,不需要证书。"),
14941494
},
14951495
annotations: {
14961496
readOnlyHint: false,

mcp/src/tools/gateway.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ export function registerGatewayTools(server: ExtendedMcpServer) {
572572
server.registerTool?.(
573573
"manageGateway",
574574
{
575-
title: "管理网关域资源",
575+
title: "管理网关域资源(含自定义域名绑定)",
576576
description:
577-
"网关域统一写入口。通过 action 创建目标访问入口,后续承接更通用的网关配置能力。为已存在的 HTTP 云函数补默认域名访问时,通常使用 createAccess 并提供 targetType=\"function\"、targetName、type=\"HTTP\" 与期望 path。注意 createAccess 只创建网关入口,不会自动修改函数资源权限。",
577+
"网关域统一写入口。通过 action 创建目标访问入口,后续承接更通用的网关配置能力。为已存在的 HTTP 云函数补默认域名访问时,通常使用 createAccess 并提供 targetType=\"function\"、targetName、type=\"HTTP\" 与期望 path。注意 createAccess 只创建网关入口,不会自动修改函数资源权限。⚠️ 如需绑定带 SSL 证书的自定义域名供公网 HTTPS 访问,使用 action=\"bindCustomDomain\"(需要 domain 和 certificateId 参数);如需配置 CORS/安全域名(无证书),请使用 envDomainManagement 工具。",
578578
inputSchema: {
579579
action: z
580580
.enum(MANAGE_GATEWAY_ACTIONS)

0 commit comments

Comments
 (0)