根MCP服务器
](https://pypi.org/project/rootly-mcp-server/) ](https://pypi.org/project/rootly-mcp-server/) ](https://pypi.org/project/rootly-mcp-server/)
MCP服务器 根API 适用于Cursor、Windsurf、Claude和其他MCP客户。
快速开始
使用托管的MCP服务器。无需本地安装。
托管传输选项
- 流式HTTP(推荐):
https://mcp.rootly.com/mcp - SSE(稳定替代方案):
https://mcp.rootly.com/sse - 代码模式:
https://mcp.rootly.com/mcp-codemode
常规远程设置
默认远程配置(HTTP流式传输):
{
"mcpServers": {
"rootly": {
"url": "https://mcp.rootly.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_ROOTLY_API_TOKEN"
}
}
}
}SSE(备选方案):
{
"mcpServers": {
"rootly": {
"url": "https://mcp.rootly.com/sse",
"headers": {
"Authorization": "Bearer YOUR_ROOTLY_API_TOKEN"
}
}
}
}代码模式:
{
"mcpServers": {
"rootly": {
"url": "https://mcp.rootly.com/mcp-codemode",
"headers": {
"Authorization": "Bearer YOUR_ROOTLY_API_TOKEN"
}
}
}
}代理设置
Claude Code
可流式传输的HTTP
claude mcp add --transport http rootly https://mcp.rootly.com/mcp \
--header "Authorization: Bearer YOUR_ROOTLY_API_TOKEN"代码模式:
claude mcp add rootly-codemode --transport http https://mcp.rootly.com/mcp-codemode \
--header "Authorization: Bearer YOUR_ROOTLY_API_TOKEN"SSE(备选方案):
claude mcp add --transport sse rootly-sse https://mcp.rootly.com/sse \
--header "Authorization: Bearer YOUR_ROOTLY_API_TOKEN"手动配置
创建 .mcp.json 在项目根目录中:
{
"mcpServers": {
"rootly": {
"type": "http",
"url": "https://mcp.rootly.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_ROOTLY_API_TOKEN"
}
}
}
}更新配置后重新启动Claude Code。
Gemini CLI
安装扩展:
gemini extensions install https://github.com/Rootly-AI-Labs/Rootly-MCP-server或在中手动配置 ~/.gemini/settings.json:
{
"mcpServers": {
"rootly": {
"command": "uvx",
"args": ["--from", "rootly-mcp-server", "rootly-mcp-server"],
"env": {
"ROOTLY_API_TOKEN": ""
}
}
}
}Cursor
添加 .cursor/mcp.json 或 ~/.cursor/mcp.json:
{
"mcpServers": {
"rootly": {
"url": "https://mcp.rootly.com/mcp",
"headers": {
"Authorization": "Bearer "
}
}
}
}Windsurf
添加 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"rootly": {
"serverUrl": "https://mcp.rootly.com/mcp",
"headers": {
"Authorization": "Bearer "
}
}
}
}Codex
添加 ~/.codex/config.toml:
[mcp_servers.rootly]
url = "https://mcp.rootly.com/mcp"
bearer_token_env_var = "ROOTLY_API_TOKEN"Claude Desktop
添加 claude_desktop_config.json:
注: 这 --transport http 标志确保使用HTTP流式传输,而不是自动回退到SSE。{
"mcpServers": {
"rootly": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.rootly.com/mcp",
"--transport",
"http",
"--header",
"Authorization: Bearer "
]
}
}
}Rootly CLI
用于事件、警报、服务和随叫随到操作的独立CLI。
通过Homebrew安装:
brew install rootlyhq/tap/rootly-cli或者通过Go:
go install github.com/rootlyhq/rootly-cli/cmd/rootly@latest有关更多详细信息,请参阅 Rootly CLI存储库.
替代安装(本地)
如果不想使用托管服务,请在本地运行MCP服务器。
先决条件
- Python 3.12或更高版本
uv包管理器
curl -LsSf https://astral.sh/uv/install.sh | shAPI令牌类型
根据您需要的访问权限选择令牌类型:
- 全球API密钥:完全访问Rootly实例。最适合整个组织的可见性。
- API团队密钥:访问权限仅限于该团队拥有的实体。
- 个人API密钥:Access与创建它的用户匹配。
A. 全球API密钥 建议用于组织范围的查询和修改数据的操作,特别是当工作流可能跨越多个团队、计划或事件时。
带紫外线
{
"mcpServers": {
"rootly": {
"command": "uv",
"args": [
"tool",
"run",
"--from",
"rootly-mcp-server",
"rootly-mcp-server"
],
"env": {
"ROOTLY_API_TOKEN": "",
"ROOTLY_MCP_ENABLE_WRITE_TOOLS": "true"
}
}
}
}自托管传输选项
为每个服务器进程选择一种传输方式:
- 可流式传输的HTTP 端点路径:
/mcp - 上海证券交易所 端点路径:
/sse - 代码模式(实验) 端点路径:
/mcp-codemode在托管双传输模式下
默认情况下,托管和自托管部署都公开了相同的策划工具界面,包括默认的启用写入的工具。要将该表面限制为只读工具,请使用以下命令启动服务器 --no-enable-write-tools 或设置 ROOTLY_MCP_ENABLE_WRITE_TOOLS=false.
要在自托管部署上仅公开MCP工具的特定子集,请设置 ROOTLY_MCP_ENABLED_TOOLS (或通行证 --enabled-tools)例如,使用逗号分隔的精确工具名称列表 list_incidents,getIncident,get_server_version.
要查找当前自托管配置下可用的确切工具名称,请运行:
ROOTLY_API_TOKEN= \
uv run python -m rootly_mcp_server --list-tools这将在应用当前设置后打印有效的MCP工具名称,包括 ROOTLY_MCP_ENABLE_WRITE_TOOLS 和 ROOTLY_MCP_ENABLED_TOOLS.
吸烟测试一个自我托管的allowlist:
ROOTLY_API_TOKEN= \
ROOTLY_MCP_ENABLED_TOOLS=list_incidents,getIncident,get_server_version \
uv run python -m rootly_mcp_server --transport streamable-http --log-level ERROR然后将MCP客户端连接到 http://127.0.0.1:8000/mcp 并验证 tools/list 仅返回:
get_server_version
getIncident
list_incidents要包含用于自托管测试的特定写入工具,请添加写入标志和allowlist:
ROOTLY_API_TOKEN= \
ROOTLY_MCP_ENABLE_WRITE_TOOLS=true \
ROOTLY_MCP_ENABLED_TOOLS=createIncident,createWorkflowTask,listTeams \
uv run python -m rootly_mcp_server --transport streamable-http --log-level ERRORDocker运行示例(流式HTTP):
docker run -p 8000:8000 \
-e ROOTLY_TRANSPORT=streamable-http \
-e ROOTLY_API_TOKEN= \
-e ROOTLY_MCP_ENABLE_WRITE_TOOLS=true \
rootly-mcp-serverDocker运行示例(SSE):
docker run -p 8000:8000 \
-e ROOTLY_TRANSPORT=sse \
-e ROOTLY_API_TOKEN= \
rootly-mcp-serverDocker运行示例(双传输+代码模式):
docker run -p 8000:8000 \
-e ROOTLY_TRANSPORT=both \
-e ROOTLY_API_TOKEN= \
rootly-mcp-server以工作流为中心的工具子集
有150多种工具可供使用,您可能希望配置集中的子集以获得最佳的AI代理性能。使用 ROOTLY_MCP_ENABLED_TOOLS 要激活特定工作流,请执行以下操作:
🚨 事件响应(25个工具)
*应急响应人员和事件指挥官的基本工具*
ROOTLY_MCP_ENABLED_TOOLS="listIncidents,getIncident,createIncident,updateIncident,search_incidents,find_related_incidents,suggest_solutions,createIncidentActionItem,listIncidentActionItems,updateIncidentFormFieldSelection,listTeams,getCurrentUser,listServices,listSeverities,getAlert,listAlerts,updateAlert,listEscalationPolicies,getEscalationPolicy,listOnCallRoles,listSchedules,getScheduleShifts,get_oncall_handoff_summary,get_shift_incidents,list_endpoints"📅 随叫随到管理(35个工具)
*适用于日程协调员和随叫随到的经理*
ROOTLY_MCP_ENABLED_TOOLS="listSchedules,getSchedule,updateSchedule,getScheduleShifts,listShifts,list_shifts,createScheduleRotation,updateScheduleRotation,listScheduleRotations,getScheduleRotation,listScheduleRotationUsers,updateScheduleRotationUser,createOnCallShadow,updateOnCallShadow,listOnCallShadows,createOverrideShift,updateOverrideShift,listOverrideShifts,listOnCallRoles,updateOnCallRole,get_oncall_schedule_summary,get_oncall_shift_metrics,check_oncall_health_risk,check_responder_availability,create_override_recommendation,listTeams,getTeam,listUsers,getUser,getCurrentUser,listEscalationPolicies,updateEscalationPolicy,listEscalationPaths,updateEscalationPath,listEscalationLevels"📊 监控和警报(40个工具)
*为平台团队设置可观察性*
ROOTLY_MCP_ENABLED_TOOLS="listAlerts,getAlert,updateAlert,createAlertGroup,updateAlertGroup,listAlertGroups,createAlertRoutingRule,updateAlertRoutingRule,listAlertRoutingRules,listAlertEvents,getAlertEvent,updateAlertEvent,createHeartbeat,updateHeartbeat,listHeartbeats,getHeartbeat,createPulse,updatePulse,listPulses,getPulse,createDashboard,updateDashboard,listDashboards,getDashboard,createDashboardPanel,updateDashboardPanel,listStatusPages,getStatusPage,updateStatusPage,createStatusPageTemplate,updateStatusPageTemplate,listCommunicationsTemplates,updateCommunicationsTemplate,createLiveCallRouter,updateLiveCallRouter,listServices,listTeams,getCurrentUser,listEnvironments,listSeverities,list_endpoints"📋 事故后分析(30个工具)
*用于SRE进行回顾和流程改进*
ROOTLY_MCP_ENABLED_TOOLS="getIncident,updateIncident,find_related_incidents,suggest_solutions,listIncidentActionItems,createIncidentActionItem,updateIncidentFormFieldSelection,createPostIncidentReview,updatePostIncidentReview,listPostIncidentReviews,getPostIncidentReview,createRetrospectiveStep,updateRetrospectiveStep,listRetrospectiveSteps,createRetrospectiveProcess,updateRetrospectiveProcess,listRetrospectiveProcesses,createPlaybook,updatePlaybook,listPlaybooks,getPlaybook,createPlaybookTask,updatePlaybookTask,listCauses,getCause,updateCause,listIncidentTypes,getIncidentType,updateIncidentType,getCurrentUser"📈 分析和报告(15个工具)
*适用于领导力和指标团队(只读重点)*
ROOTLY_MCP_ENABLED_TOOLS="listIncidents,search_incidents,collect_incidents,listTeams,listServices,listSchedules,get_oncall_shift_metrics,get_shift_incidents,listDashboards,getDashboard,listAlerts,listHeartbeats,listPulses,getCurrentUser,list_endpoints"不同团队的多个MCP实例
您可以使用不同的工具子集运行多个MCP实例:
{
"mcpServers": {
"rootly-incident-response": {
"command": "uvx", "args": ["--from", "rootly-mcp-server", "rootly-mcp-server"],
"env": {
"ROOTLY_API_TOKEN": "",
"ROOTLY_MCP_ENABLED_TOOLS": "listIncidents,getIncident,createIncident,find_related_incidents,suggest_solutions..."
}
},
"rootly-oncall-management": {
"command": "uvx", "args": ["--from", "rootly-mcp-server", "rootly-mcp-server"],
"env": {
"ROOTLY_API_TOKEN": "",
"ROOTLY_MCP_ENABLED_TOOLS": "listSchedules,updateSchedule,createOverrideShift,get_oncall_shift_metrics..."
}
}
}
}使用uvx
{
"mcpServers": {
"rootly": {
"command": "uvx",
"args": [
"--from",
"rootly-mcp-server",
"rootly-mcp-server"
],
"env": {
"ROOTLY_API_TOKEN": ""
}
}
}
}特性
- 动态工具生成:根据Rootly的OpenAPI(Swagger)规范自动创建MCP资源
- 智能分页:使用有界分页和紧凑的事件响应来防止上下文窗口溢出
- API过滤:限制公开的API端点的安全性和性能
- 智能事件分析:分析历史事件数据的智能工具
- find_related_incidents:使用TF-IDF相似性分析来查找历史上类似的事件 - suggest_solutions:挖掘过去的事件解决方案,以建议可行的解决方案
- MCP资源:将事件、团队、随叫随到状态和工作流程指南作为人工智能上下文的结构化资源公开
- 智能模式识别:自动识别服务、错误类型和解决模式
- 随叫随到的健康整合:检测预定响应者的工作量健康风险
支持的工具
默认服务器配置公开 150+工具.
自定义代理工具
check_oncall_health_riskcheck_responder_availabilitycollect_incidentscreateIncident-使用代理工作流的一组范围字段创建新事件create_override_recommendationfind_related_incidentsgetIncident-检索单个事件以进行直接验证,包括PIR相关字段get_alert_by_short_idget_oncall_handoff_summaryget_oncall_schedule_summaryget_oncall_shift_metricsget_server_versionget_shift_incidentslist_endpointslist_incidentslist_shiftssearch_incidentssuggest_solutionsupdateIncident-范围事件更新工具summary和retrospective_progress_status
OpenAPI生成的工具
ListWorkflowRuns
createIncidentActionItem
createIncidentFormFieldSelection
createWorkflowTask
getAlert
getAlertEvent
getAlertGroup
getAlertRoutingRule
getAlertSource
getAlertUrgency
getCatalog
getCatalogEntity
getCause
getCurrentUser
getCustomForm
getEnvironment
getEscalationLevel
getEscalationPath
getEscalationPolicy
getFormField
getFormFieldOption
getFunctionality
getFunctionalityIncidentsChart
getFunctionalityUptimeChart
getIncidentActionItems
getIncidentFormFieldSelection
getIncidentType
getOnCallRole
getOnCallShadow
getOverrideShift
getSchedule
getScheduleRotation
getScheduleShifts
getService
getServiceIncidentsChart
getServiceUptimeChart
getSeverity
getStatusPage
getStatusPageTemplate
getTeam
getTeamIncidentsChart
getUser
getWorkflow
getWorkflowFormFieldCondition
getWorkflowGroup
getWorkflowTask
listAlertEvents
listAlertGroups
listAlertRoutingRules
listAlertSources
listAlertUrgencies
listAlerts
listAllIncidentActionItems
listCatalogEntities
listCatalogs
listCauses
listCustomForms
listEnvironments
listEscalationLevels
listEscalationLevelsPaths
listEscalationPaths
listEscalationPolicies
listFormFieldOptions
listFormFields
listFunctionalities
listIncidentActionItems
listIncidentAlerts
listIncidentFormFieldSelections
listIncident_Types
listIncidents
listOnCallRoles
listOnCallShadows
listOverrideShifts
listScheduleRotationActiveDays
listScheduleRotationUsers
listScheduleRotations
listSchedules
listServices
listSeverities
listShifts
listStatusPageTemplates
listStatusPages
listTeams
listUsers
listWorkflowFormFieldConditions
listWorkflowGroups
listWorkflows
listWorkflowTasks
updateEnvironment
updateEscalationLevel
updateEscalationPath
updateEscalationPolicy
updateFunctionality
updateIncidentType
updateOnCallRole
updateOnCallShadow
updateOverrideShift
updateSchedule
updateScheduleRotation
updateService
updateSeverity
updateTeam
updateWorkflow
updateIncidentFormFieldSelection
updateWorkflowTask大规模扩建:此版本包括50多个新端点,涵盖通信、仪表盘、行动手册、事件后审查、监控和高级表单管理,同时小心地排除了对安全敏感的操作,如API密钥管理、用户创建/删除、角色管理和webhook配置。
删除操作在默认工具曲面中保持禁用状态。
随叫随到的健康整合
与集成 随叫随到的健康 检测预定响应者的工作量健康风险。
设置
设置 ONCALLHEALTH_API_KEY 环境变量:
{
"mcpServers": {
"rootly": {
"command": "uvx",
"args": ["--from", "rootly-mcp-server", "rootly-mcp-server"],
"env": {
"ROOTLY_API_TOKEN": "your_rootly_token",
"ONCALLHEALTH_API_KEY": "och_live_your_key"
}
}
}
}用法
check_oncall_health_risk(
start_date="2026-02-09",
end_date="2026-02-15"
)返回已安排的高危用户、推荐的安全替换和行动摘要。
示例技能
预构建Claude代码技能:
🚨 根事件响应者
此技能:
- 全面分析生产事件
- 使用基于ML的相似性匹配查找类似的历史事件
- 根据过去的成功解决方案提出解决方案
- 跨时区与随叫随到的团队协调
- 将事件与最近的代码更改和部署相关联
- 创建行动项和补救计划
- 提供置信度评分和时间估计
快速入门:
# Copy the skill to your project
mkdir -p .claude/skills
cp examples/skills/rootly-incident-responder.md .claude/skills/
# Then in Claude Code, invoke it:
# @rootly-incident-responder analyze incident #12345它演示了使用Rootly工具和GitHub上下文的完整事件响应工作流程。
随叫随到轮班指标
获取任何时间段的随叫随到轮班指标,按用户、团队或时间表分组。包括主要/次要角色跟踪、轮班计数、小时数和待命天数。
get_oncall_shift_metrics(
start_date="2025-10-01",
end_date="2025-10-31",
group_by="user"
)随叫随到的交接总结
完成交接:当前/下一个待命+轮班期间的事件。
# All on-call (any timezone)
get_oncall_handoff_summary(
team_ids="team-1,team-2",
timezone="America/Los_Angeles"
)
# Regional filter - only show APAC on-call during APAC business hours
get_oncall_handoff_summary(
timezone="Asia/Tokyo",
filter_by_region=True
)区域筛选仅显示指定时区内工作时间(上午9点至下午5点)的通话人员。
退货: schedules 和 current_oncall, next_oncall,以及 shift_incidents
MCP上下文资源
AI代理可以访问这些资源进行态势感知:
incident://{incident_id}-特定事件的详细事件信息team://{team_id}-团队详细信息,包括名称、颜色和元数据rootly://incidents-近期事件列表,供快速参考rootly://oncall-status-所有时间表的当前随叫随到状态(对事件响应至关重要)rootly://workflow-guide-常见操作的分步工作流程指南
示例用法: *“检查当前的随叫随到状态”* → AI读取 rootly://oncall-status 资源
轮班事故
一段时间内的事件,按严重性/状态/标签进行过滤。
get_shift_incidents(
start_time="2025-10-20T09:00:00Z",
end_time="2025-10-20T17:00:00Z",
severity="critical", # optional
status="resolved", # optional
tags="database,api" # optional
)退货: incidents 列表+ summary (计数、平均分辨率时间、分组)
贡献
看 贡献.md 了解开发人员设置和指南。
在Postman上玩它
[](https://god.gw.postman.com/run-collection/45004446-1074ba3c-44fe-40e3-a932-af7c071b96eb?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D45004446-1074ba3c-44fe-40e3-a932-af7c071b96eb%26entityType%3Dcollection%26workspaceId%3D4bec6e3c-50a0-4746-85f1-00a703c32f24)
关于Rootly AI实验室
该项目由 Rootly人工智能实验室,我们正在建设系统可靠性和卓越运营的未来。作为一个开源孵化器,我们分享想法、实验和快速原型化解决方案,使整个社区受益。
