跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 PagerDuty,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 使用 PagerDuty:查看未解决的事件及其时间线、告警和备注,了解谁在值班,读取服务、升级策略、排班和团队,经你同意后确认、解决、重新分配或升级事件,并获取事件分析数据。
试试这样问
PagerDuty 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → PagerDuty、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
PagerDuty + Gemini
让你的 AI 使用 PagerDuty:查看未解决的事件及其时间线、告警和备注,了解谁在值班,读取服务、升级策略、排班和团队,经你同意后确认、解决、重新分配或升级事件,并获取事件分析数据。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
PAGERDUTY_API_KEY, PAGERDUTY_API_HOST
步骤 1 — 获取凭证
- 登录 PagerDuty 并选择密钥类型。用户令牌(user token)以你本人身份操作,能看到你能看到的内容:点开头像,进入 My Profile → User Settings → Create API User Token。通用访问密钥(general access key)代表整个账户,需要管理员创建:Integrations → API Access Keys → Create New API Key。如果连接器只需读取,请在那里勾选 Read-only。
- 只把密钥本身粘贴到
PAGERDUTY_API_KEY,前面不要加Token token=。 - 把
PAGERDUTY_API_HOST设为api.pagerduty.com(美国服务区域)或api.eu.pagerduty.com(欧盟服务区域);你的区域显示在 Account Settings 中。密钥只能在其所属区域的主机上使用。 - 可选:使用通用访问密钥时,把
PAGERDUTY_FROM_EMAIL设为某个 PagerDuty 用户的邮箱。每次修改 PagerDuty 都需要它,并把修改记录在该用户名下。使用用户令牌时留空即可。 - 用
pagerduty_list_services检查设置。pagerduty_get_current_user只适用于用户令牌;使用通用访问密钥时 PagerDuty 会返回 400,因为该密钥不属于任何用户。
谁能看到什么:用户令牌只能查看和修改其所有者在 PagerDuty 中有权操作的内容。通用访问密钥覆盖整个账户;只读密钥无法修改任何内容。请只把 MCP 服务器分享给有权处理你们事件的人。
修改会呼叫他人并关闭事件,所以 AI 会先问你:执行以下操作前,AI 会给你看事件(编号和标题)以及要做的修改,并等你同意。pagerduty_acknowledge_incident 会停止呼叫,但事件仍保持打开。pagerduty_resolve_incident 会关闭事件。pagerduty_reassign_incident 会呼叫新用户并移除当前负责人。pagerduty_escalate_incident 会呼叫你所选级别的值班人员。pagerduty_update_incident 修改标题、紧急程度或优先级(按名称,例如 P1);更改紧急程度可能会改变呼叫谁以及如何呼叫。pagerduty_add_incident_note 添加一条事件相关人员都能看到的备注,之后无法编辑。pagerduty_create_incident 在某个服务上创建事件,并立即呼叫该服务的值班人员。安装时没有工具被关闭,也没有任何工具会删除内容;如需只读使用,请使用只读的通用访问密钥,或关闭这些工具。
使用方法:用 pagerduty_list_incidents 按 triggered 和 acknowledged 状态筛选出未解决的事件;然后用 pagerduty_get_incident、pagerduty_list_incident_log_entries(时间线)、pagerduty_list_incident_alerts(监控工具发送的内容)和 pagerduty_list_incident_notes。当前谁在值班:pagerduty_list_oncalls。排班的班次:先 pagerduty_list_schedules,再 pagerduty_get_schedule。升级级别:pagerduty_list_escalation_policies 和 pagerduty_get_escalation_policy。目录信息:pagerduty_list_services、pagerduty_get_service、pagerduty_list_users(重新分配所需的用户 ID)、pagerduty_get_user、pagerduty_list_teams 和 pagerduty_list_priorities。
ID 和日期:ID 是类似 PT4KHLK 的短字符串;事件编号(#1234)不是 ID。日期使用 ISO 8601 格式。除非指定开始和结束时间(间隔最多 6 个月)或要求查询全部事件,pagerduty_list_incidents 只覆盖最近 30 天。
分析:pagerduty_get_incident_analytics(按事件:确认和解决所用时间、升级、打扰次数)和 pagerduty_get_incident_metrics(整个时段或按天、周、月汇总)需要包含 Analytics 的 PagerDuty 套餐。使用用户令牌时必须按 service_ids 或 team_ids 筛选。数据比实时延迟几个小时。
常见错误:401:密钥错误、已删除,或属于另一个区域的主机。与 From 请求头相关的 400:通用访问密钥在未设置 PAGERDUTY_FROM_EMAIL 的情况下做了修改,或该邮箱不是账户中的用户。pagerduty_get_current_user 返回 400:该密钥是通用访问密钥。403:只读密钥尝试修改、用户角色不允许,或套餐不含该功能(团队、分析)。404:此账户中没有该 ID。429:请求过多;请稍候重试。
该连接器不涉及 Events API(用集成的 routing key 发送告警)、创建或修改服务、排班、升级策略和用户、状态页、事件工作流、Webhook,以及任何删除操作。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Gemini 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Gemini CLI 从 ~/.gemini/settings.json(Windows 上为 %USERPROFILE%\.gemini\settings.json)读取 MCP 服务器。添加:
{
"mcpServers": {
"anythingmcp": {
"httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换
YOUR_MCP_API_KEY。 - 保存文件并重启
gemini。 - 在 Gemini CLI 中运行
/mcp(或在终端运行gemini mcp list),anythingmcp应显示为已连接。 - 开始输入提示,Gemini CLI 现在可以调用
PagerDuty的工具。
可用工具
| Tool | What it does |
|---|---|
pagerduty_get_current_user | Read the PagerDuty user behind the API key: id, name, email, role, time zone and teams |
pagerduty_list_incidents | List incidents, newest first by default: id, number, title, status, urgency, priority, service, escalation policy, who it is assigned to… |
pagerduty_get_incident | Read one incident: number, title, status, urgency, priority, service, escalation policy, assignees, acknowledgements, teams, alert counts… |
pagerduty_list_incident_notes | List the notes on an incident, oldest first: id, text, who wrote it and when |
pagerduty_list_incident_log_entries | Read the timeline of an incident: triggers, notifications, acknowledgements, escalations, reassignments, notes and resolution, each with… |
pagerduty_list_incident_alerts | List the alerts grouped into an incident: id, summary, status, severity, alert key, service, created time and the event details the… |
pagerduty_acknowledge_incident | Acknowledge an incident: it stops escalating and the responders are no longer paged for it, but it stays open |
pagerduty_resolve_incident | Resolve an incident: it is closed, its alerts are resolved and nobody is paged for it any more |
pagerduty_reassign_incident | Reassign an incident to one user: PagerDuty pages that user and removes the current assignees |
pagerduty_escalate_incident | Escalate an incident to a level of its escalation policy: PagerDuty pages the on-call responders of that level |
pagerduty_update_incident | Change an incident's title, urgency or priority |
pagerduty_add_incident_note | Add a note to an incident's timeline |
pagerduty_create_incident | Open a new incident on a service: PagerDuty pages the on-call responders of the service's escalation policy right away |
pagerduty_list_services | List services (the things PagerDuty raises incidents for): id, name, description, status (active, warning, critical, maintenance… |
pagerduty_get_service | Read one service: name, description, status, escalation policy, teams, urgency rule, acknowledgement and auto-resolve timeouts, alert… |
pagerduty_list_escalation_policies | List escalation policies: id, name, description, how many times they repeat, the levels with their delay and targets (users or schedules)… |
pagerduty_get_escalation_policy | Read one escalation policy: levels in order with their delay in minutes and targets (users and schedules), repeat count, services and teams |
pagerduty_list_oncalls | Who is on call: one entry per user, escalation policy and level, with the schedule behind it and the shift start and end |
pagerduty_list_schedules | List on-call schedules: id, name, description, time zone, the users in them and the escalation policies that use them |
pagerduty_get_schedule | Read one schedule with its final rotation for a time window: who is on call from when to when, after overrides |
pagerduty_list_users | List users: id, name, email, role, job title, time zone and teams |
pagerduty_get_user | Read one user: name, email, role, job title, time zone, teams and the type of each contact method (email, phone, push) without the addresses |
pagerduty_list_teams | List teams: id, name and description |
pagerduty_list_priorities | List the incident priorities of the account in order (for example P1 to P5): id, name and description |
pagerduty_get_incident_analytics | Analytics per incident: seconds to first acknowledgement, to engage, to mobilise and to resolve, escalations, reassignments, interruptions… |
pagerduty_get_incident_metrics | Aggregated incident metrics for a period: incident count, mean and percentile times to acknowledge and resolve, escalations, interruptions… |
示例提示
- “现在有哪些 PagerDuty 事件还没解决?按紧急程度排序,并列出每个事件的负责人。”
- “Checkout API 现在是谁在值班?按升级策略下一个是谁?”
- “确认事件 #4821,并添加一条备注,说明我正在排查数据库故障切换。先把这两项给我看,修改之前问我。”
- “把支付网关那个未解决的事件重新分配给王芳。执行前告诉我是哪个事件和哪个人。”
- “Platform 团队上个月每周的平均确认时间和平均解决时间是怎么变化的?”
FAQ
Gemini CLI 从哪里读取 MCP 服务器? 用户级配置位于 ~/.gemini/settings.json,项目级配置位于项目内的 .gemini/settings.json。gemini mcp list 会列出每个服务器及其连接状态。
下一步
这份指南对你有帮助吗?