alibabacloud-devops
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIntelligent DevOps Execution via Yunxiao Tools
基于Yunxiao工具的智能DevOps执行
This skill translates natural-language DevOps requests into Alibaba Cloud Yunxiao API calls. It supports three invocation channels: Alibaba Cloud CLI (), MCP Server, and mcporter CLI. It covers 8 Yunxiao products (~388 CLI commands, ~165 MCP tools).
aliyun devops本技能将自然语言描述的DevOps请求转换为阿里云Yunxiao API调用。它支持三种调用渠道:Alibaba Cloud CLI()、MCP Server和mcporter CLI。覆盖8款Yunxiao产品(约388条CLI命令、约165个MCP工具)。
aliyun devops1. Overview
1. 概述
- Core flow: Intent classification → Ambiguity resolution → Product mapping → Reference reading → Tool execution → Result verification
- Scope: CI/CD, code management, project collaboration, sprints/work items, artifacts, testing, application delivery
For the full product and tool catalog (MCP tools and CLI commands by product), see references/tool-catalog.md.
- 核心流程:意图分类 → 歧义消除 → 产品映射 → 参考文档查阅 → 工具执行 → 结果验证
- 覆盖范围:CI/CD、代码管理、项目协作、迭代/工作项、制品、测试、应用交付
完整的产品与工具目录(按产品划分的MCP工具和CLI命令)请查看 references/tool-catalog.md。
2. Prerequisites
2. 前置条件
[MUST] Execution order is mandatory. Steps in this section form a sequential decision tree. You MUST execute them in the numbered order below. Do NOT check Node.js, MCP, or mcporter availability until the CLI path (Steps 1–4) has been fully attempted and failed. Do NOT run any checks in parallel across subsections 2.1 and 2.2.
Token Security Rules (applies to ALL channels):
- NEVER ask users to paste plaintext tokens in conversation or command line
- NEVER read/print token values using
or similar commandsecho- ONLY verify token existence via check (see steps below for channel-specific env var names)
- If token is not configured, STOP and guide user to Yunxiao Personal Access Token. Required scopes: Organization Management (R/W), Project Collaboration (R/W), Code Management (R/W), Pipeline (R/W), Packages (R/W), Application Delivery (R/W), Test Management (R/W).
[必须] 执行顺序强制要求。本节步骤构成一个顺序决策树。您必须按照以下编号顺序执行。在CLI路径(步骤1-4)完全尝试失败前,请勿检查Node.js、MCP或mcporter的可用性。请勿并行检查2.1和2.2小节的内容。
Token安全规则(适用于所有渠道):
- 绝对不要要求用户在对话或命令行中粘贴明文Token
- 绝对不要使用
或类似命令读取/打印Token值echo- 仅可通过检查验证Token是否存在(以下为各渠道特定的环境变量名称)
- 如果未配置Token,请停止操作,并引导用户前往 Yunxiao个人访问Token 获取。所需权限范围:组织管理(读/写)、项目协作(读/写)、代码管理(读/写)、Pipeline(读/写)、Packages(读/写)、应用交付(读/写)、测试管理(读/写)。
2.1 CLI Channel Setup (Primary — MUST complete first)
2.1 CLI渠道配置(主渠道——必须优先完成)
The Alibaba Cloud CLI () is the primary invocation channel. MCP Server and mcporter are fallbacks only. Full configuration guide: references/aliyun-cli-setup.md.aliyun devops
Step 1: CLI availability check
bash
aliyun devops --help >/dev/null 2>&1 && echo "cli ready" || echo "cli not available"- Available → Go to Step 3
- Not available → Go to Step 2 (attempt installation)
Step 2: [MUST] Attempt CLI installation
[MUST] If CLI is not found in Step 1, you MUST attempt installation before considering any fallback channel. Skipping this step is prohibited. Full installation guide: references/aliyun-cli-install.md.
-
Detect OS and install:
- macOS (Homebrew available):
bash
brew install aliyun-cli - macOS / Linux (no Homebrew):
bash
/bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" - Windows (PowerShell): Guide user to download and run the PowerShell install script. See references/aliyun-cli-install.md.
- macOS (Homebrew available):
-
Verify installation and re-check:bash
aliyun version aliyun devops --help >/dev/null 2>&1 && echo "cli ready" || echo "cli not available"- Available → Go to Step 3
- Still not available → Go to Section 2.2 Fallback
Step 3: Authentication and site type detection
Cloud DevOps (Yunxiao) uses Personal Access Token for authentication, not AK/SK profiles.
3a. Check token:
bash
[ -n "$ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN" ] && echo "token configured" || echo "token missing"If token is missing, guide user to configure based on their site type:
Central site (default) — token + organization ID:
bash
export ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN=<your-personal-access-token>
export ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID=<your-organization-id>Region site — token + region API base URL:
bash
export ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN=<your-personal-access-token>
export ALIBABA_CLOUD_YUNXIAO_API_BASE_URL=<your-region-api-base-url>[MUST] Never ask the user for an API base URL on the central site — it defaults to(for both the CLI and the MCP Server). The base URL is a region-site-only setting.openapi-rdc.aliyuncs.com
Recommend adding these to the user's shell profile (, , etc.) for persistence.
~/.bashrc~/.zshrc3b. Detect site type:
After token is confirmed, detect the site type:
bash
[ -n "$ALIBABA_CLOUD_YUNXIAO_API_BASE_URL" ] && echo "region site" || echo "central site (default)"
[ -n "$ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID" ] && echo "org id configured" || echo "org id missing"- set → Region site: subsequent CLI calls do NOT use
ALIBABA_CLOUD_YUNXIAO_API_BASE_URL; the API base URL is read from the environment variable automatically--organization-id - Not set → Central site (default): subsequent CLI calls use ; if the org id is missing, guide user to set
--organization-id(it can be looked up viaALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID)aliyun devops base-get-user-by-token
[MUST] Remember the detected site type. All subsequent CLI calls in this session must use the corresponding parameter pattern. CLI parameters use kebab-case (e.g.,), not camelCase (--organization-id).--organizationId
Step 4: [MUST] Disable the interactive plugin-install prompt
The commands live in the plugin, which is not bundled with a fresh CLI install. The first therefore prompts and blocks until the command times out. Run this once per session, before any business command:
devopsaliyun-cli-devopsaliyun devops <business-command>Do you want to install it? [Y/n]:bash
aliyun configure set --auto-plugin-install trueSkipping this step wastes the whole timeout budget of your first business call.
CLI ready — If Steps 1–4 all pass, CLI channel is ready. Skip Section 2.2 entirely and proceed to Section 3.
Alibaba Cloud CLI()是主调用渠道。MCP Server和mcporter仅作为备选方案。完整配置指南:references/aliyun-cli-setup.md。aliyun devops
步骤1:检查CLI可用性
bash
aliyun devops --help >/dev/null 2>&1 && echo "cli ready" || echo "cli not available"- 可用 → 前往步骤3
- 不可用 → 前往步骤2(尝试安装)
步骤2:[必须] 尝试安装CLI
[必须] 如果步骤1中未找到CLI,您必须先尝试安装,再考虑任何备选渠道。禁止跳过此步骤。完整安装指南:references/aliyun-cli-install.md。
-
检测操作系统并安装:
- macOS(已安装Homebrew):
bash
brew install aliyun-cli - macOS / Linux(未安装Homebrew):
bash
/bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" - Windows(PowerShell):引导用户下载并运行PowerShell安装脚本。详情请查看 references/aliyun-cli-install.md。
- macOS(已安装Homebrew):
-
验证安装并重新检查:bash
aliyun version aliyun devops --help >/dev/null 2>&1 && echo "cli ready" || echo "cli not available"- 可用 → 前往步骤3
- 仍不可用 → 前往2.2 备选渠道
步骤3:身份验证与站点类型检测
云效DevOps使用个人访问Token进行身份验证,而非AK/SK配置文件。
3a. 检查Token:
bash
[ -n "$ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN" ] && echo "token configured" || echo "token missing"如果Token缺失,根据用户的站点类型引导其配置:
中心站点(默认)——Token + 组织ID:
bash
export ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN=<your-personal-access-token>
export ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID=<your-organization-id>区域站点——Token + 区域API基础URL:
bash
export ALIBABA_CLOUD_YUNXIAO_ACCESS_TOKEN=<your-personal-access-token>
export ALIBABA_CLOUD_YUNXIAO_API_BASE_URL=<your-region-api-base-url>[必须] 切勿要求中心站点用户提供API基础URL——默认值为(适用于CLI和MCP Server)。基础URL仅针对区域站点配置。openapi-rdc.aliyuncs.com
建议将这些配置添加到用户的Shell配置文件(、等)中以持久生效。
~/.bashrc~/.zshrc3b. 检测站点类型:
确认Token存在后,检测站点类型:
bash
[ -n "$ALIBABA_CLOUD_YUNXIAO_API_BASE_URL" ] && echo "region site" || echo "central site (default)"
[ -n "$ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID" ] && echo "org id configured" || echo "org id missing"- 已设置→ 区域站点:后续CLI调用无需使用
ALIBABA_CLOUD_YUNXIAO_API_BASE_URL;API基础URL会自动从环境变量读取--organization-id - 未设置 → 中心站点(默认):后续CLI调用需使用;如果组织ID缺失,引导用户设置
--organization-id(可通过ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID查询)aliyun devops base-get-user-by-token
[必须] 记住检测到的站点类型。本次会话中所有后续CLI调用必须使用对应的参数格式。CLI参数使用短横线命名法(kebab-case)(例如),而非驼峰命名法(camelCase)(--organization-id)。--organizationId
步骤4:[必须] 禁用交互式插件安装提示
devopsaliyun-cli-devopsaliyun devops <业务命令>Do you want to install it? [Y/n]:bash
aliyun configure set --auto-plugin-install true跳过此步骤会浪费首次业务调用的整个超时时间。
CLI就绪——如果步骤1-4全部通过,CLI渠道已就绪。完全跳过2.2小节,直接前往第3节。
2.2 Fallback Channel Setup (ONLY when CLI is unavailable)
2.2 备选渠道配置(仅当CLI不可用时)
[GATE] You may ONLY enter this section if both conditions are true:
- Step 1 (CLI check) returned "cli not available"
- Step 2 (CLI installation attempt) was executed and failed
If you have not attempted Step 2, go back and execute it now. Do NOT proceed here.
[准入条件] 仅当同时满足以下两个条件时,您才可以进入本节:
- 步骤1(CLI检查)返回"cli not available"
- 步骤2(CLI安装尝试)已执行且失败
如果您尚未尝试步骤2,请返回并立即执行。请勿继续此部分。
2.2.1 Node.js/Docker Runtime Check
2.2.1 Node.js/Docker运行时检查
This skill invokes via or . Verify:
alibabacloud-devops-mcp-server@0.3.38npxdockerbash
node --version # Node.js 18+ recommended
npx --versionRecommended: Pre-install dependencies (avoid runtime downloads)bashnpm install -g alibabacloud-devops-mcp-server@0.3.38 mcporter@0.11.1 --registry=https://registry.npmmirror.com
本技能通过或调用。请验证:
npxdockeralibabacloud-devops-mcp-server@0.3.38bash
node --version # 推荐使用Node.js 18+
npx --version推荐:预安装依赖(避免运行时下载)bashnpm install -g alibabacloud-devops-mcp-server@0.3.38 mcporter@0.11.1 --registry=https://registry.npmmirror.com
2.2.2 Yunxiao Personal Access Token (for MCP/mcporter)
2.2.2 Yunxiao个人访问Token(适用于MCP/mcporter)
MCP/mcporter uses (different from CLI's ):
YUNXIAO_ACCESS_TOKENALIBABA_CLOUD_YUNXIAO_ACCESS_TOKENbash
[ -n "$YUNXIAO_ACCESS_TOKEN" ] && echo "token configured" || echo "token missing"If missing, guide user to obtain a token and inject as env var (see Token Security Rules at the top of Section 2).
MCP/mcporter使用(与CLI的不同):
YUNXIAO_ACCESS_TOKENALIBABA_CLOUD_YUNXIAO_ACCESS_TOKENbash
[ -n "$YUNXIAO_ACCESS_TOKEN" ] && echo "token configured" || echo "token missing"如果缺失,引导用户获取Token并注入环境变量(请遵循第2节顶部的Token安全规则)。
2.2.3 MCP Server Setup
2.2.3 MCP Server配置
See references/mcp-setup.md for three connection modes (Stdio / Docker / SSE). Recommended — Stdio:
json
{
"mcpServers": {
"yunxiao": {
"command": "npx",
"args": ["-y", "alibabacloud-devops-mcp-server@0.3.38"],
"env": {
"YUNXIAO_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}Central site needs the token only —defaults toYUNXIAO_API_BASE_URL. Add it tohttps://openapi-rdc.aliyuncs.comonly for a region site.env
三种连接模式(标准输入输出/SSE/Docker)请查看 references/mcp-setup.md。推荐使用——标准输入输出:
json
{
"mcpServers": {
"yunxiao": {
"command": "npx",
"args": ["-y", "alibabacloud-devops-mcp-server@0.3.38"],
"env": {
"YUNXIAO_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}中心站点仅需Token——默认值为YUNXIAO_API_BASE_URL。仅针对区域站点将其添加到https://openapi-rdc.aliyuncs.com中。env
3. Authorization Failure Handling
3. 授权失败处理
[MUST] When any tool call returns an authentication/authorization error:
- Consult references/token-scopes.md for the required token scope
- Guide user to add the scope in Yunxiao console under "Personal Access Token"
- Pause execution, wait for user confirmation before proceeding
Common error codes:
| Error | Action |
|---|---|
| 401 Authentication failed | Check if token is valid/expired; prompt re-generation |
| 403 Insufficient permissions | Check token scopes (see token-scopes.md and references/ram-policies.md) |
| 404 Resource not found | Use |
| 400 Parameter error | Check field schema against MCP Schema |
| 500 Server error | Retry up to 3 times with backoff |
[必须] 当任何工具调用返回身份验证/授权错误时:
- 查阅 references/token-scopes.md 获取所需的Token权限范围
- 引导用户在Yunxiao控制台的「个人访问Token」中添加对应权限
- 暂停执行,等待用户确认后再继续
常见错误代码:
| 错误 | 操作 |
|---|---|
| 401 身份验证失败 | 检查Token是否有效/过期;提示重新生成 |
| 403 权限不足 | 检查Token权限范围(请查看token-scopes.md和 references/ram-policies.md) |
| 404 资源未找到 | 使用 |
| 400 参数错误 | 根据MCP Schema检查字段格式 |
| 500 服务器错误 | 最多重试3次,每次重试增加等待时间 |
4. Parameter Confirmation
4. 参数确认
IMPORTANT — Before executing any tool call, all user-defined parameters (organizationId, projectId, repositoryId, pipelineId, branch names, work item subject, sprint dates, app/env names, etc.) must be confirmed with the user. Never call based on defaults or guesses.
Common required parameters by product:
| Product | Universal required | Typical scenario parameters |
|---|---|---|
| All | | - |
| Codeup | | |
| Flow | | |
| Projex | | |
| Testhub | | |
| AppStack | | |
重要——在执行任何工具调用前,所有用户定义的参数(organizationId、projectId、repositoryId、pipelineId、分支名称、工作项主题、迭代日期、应用/环境名称等)必须与用户确认。切勿基于默认值或猜测执行调用。
各产品常见必填参数:
| 产品 | 通用必填参数 | 典型场景参数 |
|---|---|---|
| 所有产品 | | - |
| Codeup | | |
| Flow | | |
| Projex | | |
| Testhub | | |
| AppStack | | |
5. Core Execution Flow
5. 核心执行流程
User request → [Step 1] Intent classification → [Step 2] Ambiguity handling → [Step 3] Product mapping
→ [Step 4] Read product references → [Step 5] Execute tool calls → Return results用户请求 → [步骤1] 意图分类 → [步骤2] 歧义处理 → [步骤3] 产品映射
→ [步骤4] 查阅产品参考文档 → [步骤5] 执行工具调用 → 返回结果Step 1: Intent Classification
步骤1:意图分类
Core principle: Identify the core verb, not the noun.
| Action | Typical verbs | Tool prefix |
|---|---|---|
| Create | create, add, initialize, set up | |
| Query | view, get, list, search, find | |
| Update | update, modify, change, edit | |
| Delete | delete, remove, clean up | |
| Trigger | run, execute, trigger, start, deploy | |
| Configure | configure, set up, bind, associate | |
Decision tree and examples: references/intent-classification.md.
核心原则:识别核心动词,而非名词。
| 操作 | 典型动词 | 工具前缀 |
|---|---|---|
| 创建 | create、add、initialize、set up | |
| 查询 | view、get、list、search、find | |
| 更新 | update、modify、change、edit | |
| 删除 | delete、remove、clean up | |
| 触发 | run、execute、trigger、start、deploy | |
| 配置 | configure、set up、bind、associate | |
决策树与示例:references/intent-classification.md。
Step 2: Ambiguity Handling
步骤2:歧义处理
Core principle: If the instruction is vague or involves multi-product keywords, never guess — ask.
| Ambiguity type | Detection condition | Strategy |
|---|---|---|
| Product | Multi-product keywords present | Ask which product |
| Action | Action unclear | Ask for operation type |
| Object | Missing identifiers | Ask for resource name or ID |
| Parameter | Missing key parameters | Ask for missing values |
| Scope | Org/project not specified | Ask for org/project |
核心原则:如果指令模糊或涉及多产品关键词,切勿猜测——询问用户。
| 歧义类型 | 检测条件 | 处理策略 |
|---|---|---|
| 产品歧义 | 存在多产品关键词 | 询问用户目标产品 |
| 操作歧义 | 操作类型不明确 | 询问用户操作类型 |
| 对象歧义 | 缺少资源标识符 | 询问用户资源名称或ID |
| 参数歧义 | 缺少关键参数 | 询问用户缺失的参数值 |
| 范围歧义 | 未指定组织/项目 | 询问用户组织/项目信息 |
Step 3: Product Mapping
步骤3:产品映射
Full mapping: references/product-mapping.md.
| Keywords | Product | MCP toolset | CLI prefix |
|---|---|---|---|
| Pipeline, build, deploy, CI/CD | Flow | pipeline-management | flow- |
| Code, repo, branch, commit, MR, review | Codeup | code-management | codeup- |
| Artifact, package, Maven, NPM, Docker image | Packages | packages-management | packages- |
| Requirement, work item, sprint, bug, task | Projex | project-management | projex- |
| Test case, test plan, test report | Testhub | test-management | test-hub- |
| Application, orchestration, change order, release | AppStack | application-delivery | app-stack- |
| Organization, member, department, role | - | organization-management | base- |
| Current user info | - | base | base- |
Ambiguity decision points:
- "CI/CD full flow" → Build-only → Flow; app lifecycle → AppStack; both → ask
- "Repository" → Code repo → Codeup; artifact repo → Packages; unclear → ask
完整映射关系:references/product-mapping.md。
| 关键词 | 产品 | MCP工具集 | CLI前缀 |
|---|---|---|---|
| Pipeline、build、deploy、CI/CD | Flow | pipeline-management | flow- |
| Code、repo、branch、commit、MR、review | Codeup | code-management | codeup- |
| Artifact、package、Maven、NPM、Docker image | Packages | packages-management | packages- |
| Requirement、work item、sprint、bug、task | Projex | project-management | projex- |
| Test case、test plan、test report | Testhub | test-management | test-hub- |
| Application、orchestration、change order、release | AppStack | application-delivery | app-stack- |
| Organization、member、department、role | - | organization-management | base- |
| 当前用户信息 | - | base | base- |
歧义决策点:
- "CI/CD全流程" → 仅构建 → Flow;应用生命周期 → AppStack;两者皆有 → 询问用户
- "Repository" → 代码仓库 → Codeup;制品仓库 → Packages;不明确 → 询问用户
Step 4: Read Product References
步骤4:查阅产品参考文档
After determining the target product, must consult the Yunxiao documentation index at references/product-reference.md.
确定目标产品后,必须查阅位于 references/product-reference.md 的Yunxiao文档索引。
Step 5: Execute Tool Calls
步骤5:执行工具调用
Three invocation channels (functionally equivalent):
| Method | Scenario | Prerequisites |
|---|---|---|
Alibaba Cloud CLI ( | Shell environment available | |
| Platform-native MCP | IDE/platform with MCP Server | |
| Terminal CLI (mcporter) | Pure terminal, no MCP Server | Node.js 18+ installed |
Channel selection: Choose based on availability — CLI configured → CLI; MCP integrated → MCP; Shell + Node.js only → mcporter.
Region Site Routing (mandatory): When the user specifies a Yunxiao instance address or token differing from current MCP config:
- MUST prompt user to update MCP Server config (/
YUNXIAO_API_BASE_URL)YUNXIAO_ACCESS_TOKEN - MUST NOT bypass MCP Server via mcporter — mcporter is only for when MCP Server is absent
- URL with Region keywords (e.g., ) → Region edition;
cn-shanghaior unspecified → Central (default, no base URL config needed)openapi-rdc.aliyuncs.com
Method A: Alibaba Cloud CLI
bash
aliyun devops <command> --<param1> <value1> \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-devops/${SESSION_ID}"Allcommands must includealiyun devopswith the session-scoped UA value (see Section 7: Observability). When using environment variables for authentication, no additional auth parameters are needed. When using command-line parameters, append--user-agentand--yunxiao-access-token(central) or--organization-id(region) to each command.--api-base-url
For command discovery by product prefix, use or see references/tool-catalog.md.
scripts/discover-commands.shMethod B: Platform-native MCP
use_mcp_tool(
server_name: "yunxiao",
tool_name: "<tool>",
arguments: { "<key>": "<value>" }
)Method C: mcporter CLI
bash
npx -y mcporter@0.11.1 call --no-coerce --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" <tool_name> [key:"value" ...]MUST always useto prevent auto type conversion of string enums.--no-coerce
Parameter rules: Use format, space-separated. Do not pass JSON strings. Omit parameters for no-argument tools. Use for convenience.
key:"value"scripts/mcporter-call.shGet available tools:
bash
npx -y mcporter@0.11.1 list --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" --schema[MUST] Tool selection must be based on dynamic discovery: Select from registered tool list, never fabricate tool names. Useor references/tool-catalog.md.mcporter list
[MUST] Never fabricate results: All tool calls must be actually executed with real return values.
Pre-execution checklist (mandatory):
- Obtain via
organizationId(MCP:aliyun devops base-get-user-by-token)get_current_organization_info - [Mandatory] Verify target resource exists via /
list_*/search_*— even if ID is providedget_* - All required parameters confirmed with user (Section 4)
- Delete operations require confirmation
- [Mandatory] Dynamic schema validation before first call to any unfamiliar tool:
- Method B: Check platform tool registry
- Method C:
npx -y mcporter@0.11.1 list --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" --schema 2>&1 | grep -A 30 'function <tool_name>' - If schema returns a different tool name, use the schema's version
- For Testhub: call (MCP:
test-hub-get-testcase-field-config) first — it reports which fields are required (get_testcase_field_configis) and yields the per-library option IDs thatassignedTomust carry (e.g.customFieldValues; sending the label{"tc.priority": "<P1 option id>"}fails with"P1").400 字段【优先级】所填值无效must carry atestStepsarray — a payload using onlycontent[]/stepContent(which is the read-back shape) fails withexpectedResult. See references/common-scenarios.md Scenario 6.500 unknown exception - For Projex: call (MCP:
projex-list-workitem-types) first — never use hardcoded type IDslist_work_item_types
Full tool catalog: references/tool-catalog.md. Scenario examples: references/common-scenarios.md.
三种调用渠道(功能等效):
| 方法 | 适用场景 | 前置条件 |
|---|---|---|
Alibaba Cloud CLI( | 具备Shell环境 | 已安装 |
| 平台原生MCP | 集成了MCP Server的IDE/平台 | 支持 |
| 终端CLI(mcporter) | 纯终端环境,无MCP Server | 已安装Node.js 18+ |
渠道选择:根据可用性选择——已配置CLI → 使用CLI;已集成MCP → 使用MCP;仅具备Shell + Node.js → 使用mcporter。
区域站点路由(强制要求):当用户指定的Yunxiao实例地址或Token与当前MCP配置不同时:
- 必须提示用户更新MCP Server配置(/
YUNXIAO_API_BASE_URL)YUNXIAO_ACCESS_TOKEN - 不得通过mcporter绕过MCP Server——仅当MCP Server不可用时才使用mcporter
- 包含区域关键词的URL(例如)→ 区域版;
cn-shanghai或未指定 → 中心版(默认,无需配置基础URL)openapi-rdc.aliyuncs.com
方法A:Alibaba Cloud CLI
bash
aliyun devops <command> --<param1> <value1> \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-devops/${SESSION_ID}"所有命令必须包含aliyun devops标志,用于归属与追踪。UA值遵循固定模板,包含会话唯一标识符。当使用环境变量进行身份验证时,无需额外的身份验证参数。当使用命令行参数时,需在每个命令后附加--user-agent和--yunxiao-access-token(中心站点)或--organization-id(区域站点)。--api-base-url
如需按产品前缀查找命令,可使用或查看 references/tool-catalog.md。
scripts/discover-commands.sh方法B:平台原生MCP
use_mcp_tool(
server_name: "yunxiao",
tool_name: "<tool>",
arguments: { "<key>": "<value>" }
)方法C:mcporter CLI
bash
npx -y mcporter@0.11.1 call --no-coerce --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" <tool_name> [key:"value" ...]必须始终使用,以防止字符串枚举被自动类型转换。--no-coerce
参数规则:使用格式,空格分隔。请勿传递JSON字符串。无参数工具可省略参数。可使用简化操作。
key:"value"scripts/mcporter-call.sh获取可用工具:
bash
npx -y mcporter@0.11.1 list --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" --schema[必须] 工具选择必须基于动态发现:从已注册工具列表中选择,切勿编造工具名称。可使用或 references/tool-catalog.md。mcporter list
[必须] 切勿编造结果:所有工具调用必须实际执行并返回真实结果。
执行前检查清单(强制要求):
- 通过(MCP:
aliyun devops base-get-user-by-token)获取get_current_organization_infoorganizationId - [强制要求] 通过/
list_*/search_*验证目标资源是否存在——即使已提供IDget_* - 所有必填参数已与用户确认(第4节)
- 删除操作需要用户确认
- [强制要求] 在首次调用不熟悉的工具前进行动态Schema验证:
- 方法B:检查平台工具注册表
- 方法C:
npx -y mcporter@0.11.1 list --stdio "npx -y alibabacloud-devops-mcp-server@0.3.38" --schema 2>&1 | grep -A 30 'function <tool_name>' - 如果Schema返回不同的工具名称,使用Schema中的版本
- 对于Testhub:先调用(MCP:
test-hub-get-testcase-field-config)——该命令会返回必填字段(如get_testcase_field_config)以及assignedTo必须携带的每个库的选项ID(例如customFieldValues;发送标签{"tc.priority": "<P1 option id>"}会返回错误"P1")。400 字段【优先级】所填值无效必须携带testSteps数组——仅使用content[]/stepContent的负载(这是返回结果的格式)会返回错误expectedResult。详情请查看 references/common-scenarios.md 场景6。500 unknown exception - 对于Projex:先调用(MCP:
projex-list-workitem-types)——切勿使用硬编码的类型IDlist_work_item_types
完整工具目录:references/tool-catalog.md。场景示例:references/common-scenarios.md。
6. Success Verification
6. 成功验证
[RECOMMENDED] After/create_*, call the correspondingupdate_*to verify when budget permits. If API returned success with a resource ID, creation can be considered successful even without read-back.get_*Known API limitations: Some fields may differ between write and read-back — see references/verification-method.md.
| Operation | Verification command (CLI / MCP) | Check |
|---|---|---|
| Create pipeline | | pipelineId + name match |
| Run pipeline | | status != |
| Create branch | | Branch appears |
| Create MR | | state = |
| Create work item | | subject + workItemTypeId correct |
| Create sprint | | Date range matches |
More: references/verification-method.md.
[推荐] 在执行/create_*操作后,若预算允许,调用对应的update_*命令进行验证。如果API返回成功并返回资源ID,即使未执行回读操作,也可认为创建成功。get_*已知API限制:部分字段在写入和回读时可能存在差异——请查看 references/verification-method.md。
| 操作 | 验证命令(CLI / MCP) | 检查项 |
|---|---|---|
| 创建流水线 | | pipelineId与名称匹配 |
| 运行流水线 | | 状态 != |
| 创建分支 | | 分支已存在 |
| 创建MR | | 状态 = |
| 创建工作项 | | 主题与workItemTypeId正确 |
| 创建迭代 | | 日期范围匹配 |
更多内容:references/verification-method.md。
7. Observability
7. 可观测性
User-Agent Declaration (Mandatory)
User-Agent声明(强制要求)
[MUST] Everybusiness command must carry thealiyun devopsflag for attribution and tracing. The UA value follows a fixed template that includes a per-session identifier.--user-agent
UA Template:
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-devops/{session-id}Session-ID Generation Rule:
| Item | Rule |
|---|---|
| Format | 32-character lowercase hexadecimal string, e.g., |
| Lifecycle | Generate once at the start of each skill invocation session; reuse the same value across all channels (CLI, MCP, mcporter) within that session |
| Consistency | The same |
| Generation method | |
Usage — append to every command:
aliyun devopsbash
SESSION_ID=$(python3 -c "import uuid; print(uuid.uuid4().hex)")
aliyun devops <command> --<param1> <value1> \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-devops/${SESSION_ID}"Important: Theflag is applied directly on each business command. Do NOT configure UA through any global mode-setting command — always pass it inline per invocation.--user-agent
[必须] 每个业务命令必须携带aliyun devops标志,用于归属与追踪。UA值遵循固定模板,包含会话唯一标识符。--user-agent
UA模板:
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-devops/{session-id}会话ID生成规则:
| 项 | 规则 |
|---|---|
| 格式 | 32位小写十六进制字符串,例如 |
| 生命周期 | 在每次技能调用会话开始时生成一次;在该会话的所有渠道(CLI、MCP、mcporter)中重复使用同一值 |
| 一致性 | 同一会话中的CLI |
| 生成方法 | |
使用方式——附加到每个命令:
aliyun devopsbash
SESSION_ID=$(python3 -c "import uuid; print(uuid.uuid4().hex)")
aliyun devops <command> --<param1> <value1> \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-devops/${SESSION_ID}"重要:标志需直接附加到每个业务命令。请勿通过任何全局模式设置命令配置UA——始终在每次调用时内联传递。--user-agent
8. Best Practices
8. 最佳实践
- Read before write: before
get_*/update_*to confirm current statedelete_* - Pagination: List APIs paginate by default; pass /
pagefor large listsperPage - YAML first: Pipeline creation goes through (YAML is mandatory). Before composing the YAML, collect the three organization-specific values that are always rejected if guessed — the repository's
flow-create-pipeline --name --content(neverhttpUrlToRepo), the Codeup service connectionwebUrl(query with the lowercase filteruuid;--service-connection-type codeupreproducibly returns an empty list, which is not proof the connection is missing), and aCodeupharvested from an existing pipeline (no API lists build clusters, andrunsOn.groupoften does not exist). The Codeup credential is a nestedpublic/<region>object, not a barecertificatekey, and a build-only pipeline must omitserviceConnection. MCP'sArtifactUploadbuilds its YAML internally and cannot be corrected — on anycreate_pipeline_from_description/yaml校验失败error, stop retrying it and switch to the CLI path. Verified template and preflight steps: references/common-scenarios.md Scenario 1.服务连接[...]不存在 - Smart search: with timestamp parameters —
flow-list-pipelines/--execute-start-time/--execute-end-time/--create-start-timetake millisecond epoch values (13 digits, e.g.--create-end-time). Passing seconds (10 digits) is not rejected by the API; it silently filters against 1970 and returns misleading results, so always multiply by 1000 and sanity-check the digit count. (MCP provides$(($(date +%s) * 1000))supporting natural-language time ranges.)smart_list_pipelines - Read-only first: When uncertain, use /
list_*/search_*get_* - Fail fast: Two consecutive same-parameter failures → change approach. Report: methods tried, errors, root cause, next steps
- Budget discipline: Plan critical path first; debugging ≤3 steps; near limit (≤2 remaining) → stop and report
- Clean up: Delete experimental resources after use
- 先读后写:在执行/
update_*前调用delete_*确认当前状态get_* - 分页处理:列表API默认分页;对于大型列表,传递/
page参数perPage - 优先使用YAML:创建流水线需通过(YAML为必填项)。在编写YAML前,需收集三个组织特定值——猜测这些值会被拒绝:仓库的
flow-create-pipeline --name --content(切勿使用httpUrlToRepo)、Codeup服务连接webUrl(使用小写过滤器uuid查询;--service-connection-type codeup会返回空列表,但这并不证明连接不存在),以及从现有流水线获取的Codeup(没有API列出构建集群,且runsOn.group通常不存在)。Codeup凭证是嵌套的public/<region>对象,而非单独的certificate键,仅构建的流水线必须省略serviceConnection。MCP的ArtifactUpload会在内部构建YAML且无法修改——如果出现create_pipeline_from_description/yaml校验失败错误,请停止重试并切换到CLI路径。已验证的模板和预检步骤:references/common-scenarios.md 场景1。服务连接[...]不存在 - 智能搜索:支持时间戳参数——
flow-list-pipelines/--execute-start-time/--execute-end-time/--create-start-time接受毫秒级时间戳(13位数字,例如--create-end-time)。传递秒级时间戳(10位数字)不会被API拒绝,但会自动过滤1970年的数据并返回误导性结果,因此请始终乘以1000并检查位数是否正确。(MCP提供的$(($(date +%s) * 1000))支持自然语言时间范围。)smart_list_pipelines - 优先只读操作:不确定时,使用/
list_*/search_*get_* - 快速失败:连续两次相同参数调用失败 → 更换方法。报告:已尝试的方法、错误信息、根本原因、下一步计划
- 预算管控:优先规划关键路径;调试步骤≤3步;接近限制(剩余≤2步)→ 停止操作并报告
- 清理资源:使用后删除实验性资源
9. Scenario Quick Reference
9. 场景速查
Full examples: references/common-scenarios.md.
| Scenario | Product | Key CLI commands | Key MCP tools |
|---|---|---|---|
| Create Java build pipeline | Flow | | |
| Create MR with review comment | Codeup | | |
| Create sprint and add requirement | Projex | | |
| Run pipeline and view logs | Flow | | |
| Batch query artifacts | Packages | | |
| Create test cases | Testhub | | |
| Application release workflow | AppStack | | |
完整示例:references/common-scenarios.md。
| 场景 | 产品 | 核心CLI命令 | 核心MCP工具 |
|---|---|---|---|
| 创建Java构建流水线 | Flow | | |
| 创建带评审评论的MR | Codeup | | |
| 创建迭代并添加需求 | Projex | | |
| 运行流水线并查看日志 | Flow | | |
| 批量查询制品 | Packages | | |
| 创建测试用例 | Testhub | | |
| 应用发布工作流 | AppStack | | |
10. Reference Index
10. 参考索引
| Reference file | Content |
|---|---|
| references/aliyun-cli-install.md | Alibaba Cloud CLI installation guide (macOS/Linux/Windows) |
| references/mcp-setup.md | MCP Server connection modes and environment variables |
| references/intent-classification.md | Intent classification decision tree |
| references/product-mapping.md | Keyword → product mapping table |
| references/product-reference.md | Yunxiao documentation index and key concepts |
| references/tool-catalog.md | ~165 MCP tools grouped catalog |
| references/token-scopes.md | Token authorization scopes and troubleshooting |
| references/common-scenarios.md | End-to-end workflow examples |
| references/verification-method.md | Success verification and read-back methods |
| references/acceptance-criteria.md | Tool call correctness acceptance criteria |
| references/ram-policies.md | Yunxiao permission model vs. standard Alibaba Cloud RAM |
| 参考文件 | 内容 |
|---|---|
| references/aliyun-cli-install.md | Alibaba Cloud CLI安装指南(macOS/Linux/Windows) |
| references/mcp-setup.md | MCP Server连接模式与环境变量 |
| references/intent-classification.md | 意图分类决策树 |
| references/product-mapping.md | 关键词→产品映射表 |
| references/product-reference.md | Yunxiao文档索引与核心概念 |
| references/tool-catalog.md | 约165个MCP工具分组目录 |
| references/token-scopes.md | Token授权范围与故障排查 |
| references/common-scenarios.md | 端到端工作流示例 |
| references/verification-method.md | 成功验证与回读方法 |
| references/acceptance-criteria.md | 工具调用正确性验收标准 |
| references/ram-policies.md | Yunxiao权限模型与标准阿里云RAM对比 |