For the full product and tool catalog (MCP tools and CLI commands by product), see references/tool-catalog.md.
2. Prerequisites
[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 echo or similar commands
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).
2.1 CLI Channel Setup (Primary — MUST complete first)
The Alibaba Cloud CLI (aliyun devops) is the primary invocation channel. MCP Server and mcporter are fallbacks only. Full configuration guide: references/aliyun-cli-setup.md.
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.
[MUST] Never ask the user for an API base URL on the central site — it defaults to openapi-rdc.aliyuncs.com (for both the CLI and the MCP Server). The base URL is a region-site-only setting.
Recommend adding these to the user's shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence.
3b. 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"
ALIBABA_CLOUD_YUNXIAO_API_BASE_URL set → Region site: subsequent CLI calls do NOT use --organization-id; the API base URL is read from the environment variable automatically
Not set → Central site (default): subsequent CLI calls use --organization-id; if the org id is missing, guide user to set ALIBABA_CLOUD_YUNXIAO_ORGANIZATION_ID (it can be looked up via 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., --organization-id), not camelCase (--organizationId).
Step 4: [MUST] Disable the interactive plugin-install prompt
The devops commands live in the aliyun-cli-devops plugin, which is not bundled with a fresh CLI install. The first aliyun devops <business-command> therefore prompts Do you want to install it? [Y/n]: and blocks until the command times out. Run this once per session, before any business command:
bash
aliyun configure set --auto-plugin-install true
Skipping 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.
2.2 Fallback Channel Setup (ONLY when CLI is unavailable)
[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.
2.2.1 Node.js/Docker Runtime Check
This skill invokes alibabacloud-devops-mcp-server@0.3.38 via npx or docker. Verify:
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.
All aliyun devops commands must include --user-agent with 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 --yunxiao-access-token and --organization-id (central) or --api-base-url (region) to each command.
For command discovery by product prefix, use scripts/discover-commands.sh or see references/tool-catalog.md.
MUST always use --no-coerce to prevent auto type conversion of string enums.
Parameter rules: Use key:"value" format, space-separated. Do not pass JSON strings. Omit parameters for no-argument tools. Use scripts/mcporter-call.sh for convenience.
Get 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. Use mcporter list or references/tool-catalog.md.
[MUST] Never fabricate results: All tool calls must be actually executed with real return values.
Pre-execution checklist (mandatory):
Obtain organizationId via aliyun devops base-get-user-by-token (MCP: get_current_organization_info)
[Mandatory] Verify target resource exists via list_* / search_* / get_* — even if ID is provided
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 test-hub-get-testcase-field-config (MCP: get_testcase_field_config) first — it reports which fields are required (assignedTo is) and yields the per-library option IDs that customFieldValues must carry (e.g. {"tc.priority": "<P1 option id>"}; sending the label "P1" fails with 400 字段【优先级】所填值无效). testSteps must carry a content[] array — a payload using only stepContent / expectedResult (which is the read-back shape) fails with 500 unknown exception. See references/common-scenarios.md Scenario 6.
For Projex: call projex-list-workitem-types (MCP: list_work_item_types) first — never use hardcoded type IDs
[RECOMMENDED] After create_* / update_*, call the corresponding get_* to verify when budget permits. If API returned success with a resource ID, creation can be considered successful even without read-back.
[MUST] Every aliyun devops business command must carry the --user-agent flag for attribution and tracing. The UA value follows a fixed template that includes a per-session identifier.
Important: The --user-agent flag is applied directly on each business command. Do NOT configure UA through any global mode-setting command — always pass it inline per invocation.
8. Best Practices
Read before write: get_* before update_* / delete_* to confirm current state
Pagination: List APIs paginate by default; pass page / perPage for large lists
YAML first: Pipeline creation goes through flow-create-pipeline --name --content (YAML is mandatory). Before composing the YAML, collect the three organization-specific values that are always rejected if guessed — the repository's httpUrlToRepo (never webUrl), the Codeup service connection uuid (query with the lowercase filter --service-connection-type codeup; Codeup reproducibly returns an empty list, which is not proof the connection is missing), and a runsOn.group harvested from an existing pipeline (no API lists build clusters, and public/<region> often does not exist). The Codeup credential is a nested certificate object, not a bare serviceConnection key, and a build-only pipeline must omit ArtifactUpload. MCP's create_pipeline_from_description builds its YAML internally and cannot be corrected — on any yaml校验失败 / 服务连接[...]不存在 error, stop retrying it and switch to the CLI path. Verified template and preflight steps: references/common-scenarios.md Scenario 1.
Smart search: flow-list-pipelines with timestamp parameters — --execute-start-time / --execute-end-time / --create-start-time / --create-end-time take millisecond epoch values (13 digits, e.g. $(($(date +%s) * 1000))). 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 smart_list_pipelines supporting natural-language time ranges.)
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
flow-get-pipeline → flow-create-pipeline-run (branch goes in --params '{"branchModeBranchs":"<branch>"}'; there is no --branch flag) → flow-get-pipeline-run --pipeline-run-id → flow-get-pipeline-job-run-log --job-id <stages[].stageInfo.jobs[].id>