Alibaba Cloud Monitor MCP: AI-Agent-Driven Incident Investigation in 20 Minutes
Alibaba Cloud Monitor MCP exposes nearly 200 tools via Model Context Protocol, letting AI agents query alerts, metrics, traces, and dashboards directly from a remote endpoint — eliminating local CLI setup and cutting a real-world checkout latency investigation from hours to 20 minutes.
At 21:47 on a Friday, an alert fires: checkout service P99 latency > 2s . Instead of opening five consoles, the on-call engineer asks his Cursor IDE — already connected to Cloud Monitor MCP — to "look at what happened to checkout, find the root cause, and fill any monitoring gaps." Twenty minutes later the team has a conclusion: the delay originates from a downstream payment gateway; no infrastructure event correlates; an error-rate alert has been added.
Why MCP Changes the Game
Large models can reason and hypothesize but cannot reach into cloud accounts, read Prometheus curves, or modify alert rules. MCP (Model Context Protocol) provides the missing tool layer : the model decides what to do next, while MCP tools execute the actual cloud operations. Think of it as an ID badge and toolbox for the agent — without it, the model only analyzes behind glass; with it, querying alerts, running PromQL, fetching call trees, and patching rules become auditable cloud actions.
From CLI to MCP: Same Command Tree, Different Runtime
Alibaba Cloud previously released the aliyun cms2 CLI, which wraps Cloud Monitor 2.0 query and control APIs into a stable command tree with structured JSON output, RAM-based credentials, and CI/CD-friendly execution. Example commands:
aliyun cms2 alert history list --workspace prod-ecommerce
aliyun cms2 metric promql query-range --prometheus-id pi-xxx --query '...'The friction with local CLI is the execution environment : the caller must install the binary, configure credentials via aliyun configure or env vars, allow subprocess spawning, and reach the Cloud Monitor OpenAPI. On a fresh laptop or a sandboxed agent without cloud credentials, the session breaks at "command not found" or "unconfigured."
Cloud Monitor MCP does not create a separate "AI API." It projects each leaf command of the same CLI tree 1:1 into an MCP Tool (e.g., alert rule list → alert_rule_list, metric promql query-range → metric_promql_query_range). Permissions, failure semantics, and audit objects remain identical. The difference is where execution happens : CLI runs locally (caller's responsibility); MCP hosts the tree on a remote endpoint reachable via tools/list / tools/call, with schemas built in — no CLI installation required on the agent host.
A 20-Minute Investigation Walk-Through
Workspace: prod-ecommerce. The agent follows an evidence-driven path:
Identify the firing rule. Calls alert_history_list filtered by workspace, severity, and time → locates rule checkout-p99-latency. Then alert_rule_get retrieves the full definition: monitors checkout P99 > 2s for 2 consecutive minutes, notifies on-call group.
Check curves to avoid title bias. Confirms Prometheus instance, calls metric_promql_query_range for the last hour of P99 and 5xx error rate. Latency rises from 21:40; error rate stays flat → shape is "slowdown," not "mass failure."
Grab a slow trace. trace_search finds spans > 2s in the time window; trace_tree on one trace ID reveals:
checkout
├─ inventory 80ms
├─ promotion 40ms
└─ payment-gateway 2100ms
└─ third-party 2050msRoot cause narrows: not checkout itself, but the downstream payment gateway.
Cross-verify with entities and dashboards. entity_query confirms checkout's production dependencies. grafana_dashboard_search finds checkout-overview; grafana_dashboard_panel_queries extracts panel PromQL to match earlier query. event_hub_list checks cloud product events (ECS/SLB/RDS) in the same window — none.
Remediate monitoring gap. Engineer asks: "Latency alert alone isn't enough. Add a checkout 5xx error rate > 1% for 2 minutes, same notification group." Agent calls alert_rule_create. (If only threshold tuning, alert_rule_patch preserves unspecified fields.)
By 22:05 the conclusion is posted — no screenshots, no console round-trips.
ToolSets: Curating the Agent's Menu
Full MCP exposes ~191 tools — too many for context windows and client limits, and risky for a single investigation. ToolSet acts as a connection-time gate: default core includes metric, meta, trace, alert, event-hub, integration, entity, prometheus, grafana. Construction/high-risk tools (workspace, datasource, umodel, apm, rum, synthetics, notification-channel, resource-watermark, aliyun-service, tag, resource-group) live in separate ToolSets, loaded on demand via toolsets=core,notification-channel or excluded via omit_tools. RAM still governs actual permissions; ToolSet only shapes the model's visible menu.
Endpoints & Quick Start
Fixed endpoints per region (Streamable HTTP recommended, fallback SSE):
Domestic:
https://openapi-mcp.cn-hangzhou.aliyuncs.com/s/Cms/cms/9fe79ff0bf5748e6923530c5097ec359/mcpInternational:
https://openapi-mcp.ap-southeast-1.aliyuncs.com/s/Cms/cms/9fe79ff0bf5748e6923530c5097ec359/mcpAppend ?toolsets=core (or core,notification-channel). Auth via OAuth or existing Alibaba Cloud login — never commit AccessKey to mcp.json.
Cursor ~/.cursor/mcp.json example:
{
"mcpServers": {
"aliyun-cms": {
"url": "https://openapi-mcp.cn-hangzhou.aliyuncs.com/s/Cms/cms/9fe79ff0bf5748e6923530c5097ec359/mcp?toolsets=core"
}
}
}Claude Code:
claude mcp add --transport http aliyun-cms "https://.../mcp?toolsets=core"Managed Alternative: Cloud Monitor StarOps
For teams that don't want to run their own agent, StarOps provides hosted "digital employees" inside the Cloud Monitor 2.0 console. Capabilities: (1) Fault investigation from an alert or natural language, correlating metrics, traces, logs, events, and UModel topology; (2) Scheduled inspections (cluster health, core service checks, ops reports) with historical diff; (3) Human-in-the-loop — separate RAM roles for operator vs. agent, optional manual approval for high-risk writes, full audit trail. Same Cloud Monitor 2.0 operation surface; execution runs in console-side sandboxes.
Three Coexisting Paths
Terminal/CI pipelines → aliyun cms2 CLI; Self-built agents → Cloud Monitor MCP; No-agent teams → StarOps hosted digital employees. The operation plane stays Cloud Monitor 2.0; only the agent holder changes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Observability
Driving continuous progress in observability technology!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
