CoreDash Uptime API 和 MCP 工具:监控项与检查

用 CoreDash API key 列出、添加、修改和删除 uptime 监控项,查看检查记录,或通过 MCP 让 AI agent 直接操作。

Arjen Karel Core Web Vitals Consultant
Arjen Karel - linkedin
Last update: 2026-10-19

Trusted by market leaders · Client results

perionharvardvpnnina careworkivadpg mediaerasmusmcebaycomparefotocasasnvnestlesaturnhappyhorizonadevintaaleteiakpnmy work featured on web.devloopearplugsmarktplaatsmonarchwhowhatwear

认证

uptime 端点使用的 Bearer token 与 CoreDash API 的其余端点相同:

  • Project API key (cdk_...):查看关联到该 RUM 项目的监控项。用它创建的监控项也会直接关联到该项目。
  • Master key (cdk_master_...,Agency API):可访问账号下的所有监控项,以及该账号有权限打开的项目所关联的监控项。
  • MCP OAuth token:权限范围与 project key 相同。
 

端点

方法与路径说明
GET /api/uptime/monitors获取所有监控项及其状态、上次检查时间、7 天可用率,以及最近 48 次检查的结果。
POST /api/uptime/monitors添加监控项。返回 201 及该监控项对象。首次检查会在 1 分钟内执行。
GET /api/uptime/monitors/:id获取单个监控项及其近期检查记录,最新排在最前。?limit= 最大为 2100(开启源站检查时相当于 7 天数据)。
PATCH /api/uptime/monitors/:id更新提交的字段。paused: true 会停止检查。
DELETE /api/uptime/monitors/:id删除监控项及其检查历史。
POST /api/uptime/monitors/:id/check立即请求一次检查。返回 202;检查结果约在 1 分钟内生成。

添加监控项


字段说明
url必填。完整的 http 或 https URL。
name显示名称。默认取 URL 中的 host。
project_id仅限 Master key:将监控项关联到 RUM 项目,用于 TTFB 对比。
origin_ip服务器公网 IP。添加源站检查,绕过 DNS 和 CDN。传空字符串可移除。
headers最多 5 个请求头,[{ "name", "value" }],供防火墙规则放行检查节点。
expect_status判定为 up 的状态码。默认 200。
paused仅限 PATCH。true 停止检查,false 恢复检查。

监控项数据结构


state 为以下值之一:

  • up:最近一次检查通过。
  • failing:最近一次检查失败,前一次检查通过。
  • down:连续两次检查失败,两台服务器均判定失败。
  • blocked:返回 403、429 或触发 Cloudflare challenge。参见 放行检查节点。
  • warn:返回了判定为 up 之外的其他状态码。
  • pending 或 paused。

检查失败时会返回 error:dns、connect、connect_timeout、timeout(30 秒)、tls、redirects 或 network。源站 IP 和请求头的值仅在 GET /api/uptime/monitors/:id 中返回,列表接口与 MCP 响应均会对其脱敏。

MCP 工具

CoreDash MCP server 在 RUM 工具之外,还提供了 6 个 uptime 工具。配合 master key 使用时,无需传入 project_id。

工具用途
list_uptime_monitors“所有服务都正常吗?”
get_uptime_monitor“结算页这周宕机过吗?从什么时候开始的?”返回最近的检查记录以及这段时间的可用率。
create_uptime_monitor“把登录页也监控起来。”
update_uptime_monitor修改 URL、源站 IP 或请求头,或暂停监控项。
delete_uptime_monitor删除监控项及其历史记录。
check_uptime_now“现在立即检查一次。”
CoreDash Uptime API 和 MCP 工具:监控项与检查 Core Web Vitals CoreDash Uptime API 和 MCP 工具:监控项与检查