PagerDuty MCP Server
Servidor MCP de PagerDuty
Un servidor que expone la funcionalidad de la API de PagerDuty a los LLM. Este servidor está diseñado para usarse programáticamente, con entradas y salidas estructuradas.
Descripción general
El servidor MCP de PagerDuty proporciona un conjunto de herramientas para interactuar con la API de PagerDuty. Estas herramientas están diseñadas para que los LLM realicen diversas operaciones en recursos de PagerDuty, como incidentes, servicios, equipos y usuarios.
Related MCP server: Logseq MCP Server
Instalación
Desde PyPI
pip install pagerduty-mcp-serverDe la fuente
# Clone the repository
git clone https://github.com/wpfleger96/pagerduty-mcp-server.git
cd pagerduty-mcp-server
# Install dependencies
brew install uv
uv syncRequisitos
Python 3.13 o superior
Clave API de PagerDuty
Configuración
El servidor MCP de PagerDuty requiere que se configure una clave API de PagerDuty en el entorno:
PAGERDUTY_API_KEY=your_api_key_hereUso
Como extensión de ganso
{
"type": "stdio",
"enabled": true,
"args": [
"run",
"python",
"-m",
"pagerduty_mcp_server"
],
"commandInput": "uv run python -m pagerduty_mcp_server",
"timeout": 300,
"id": "pagerduty-mcp-server",
"name": "pagerduty-mcp-server",
"description": "pagerduty-mcp-server",
"env_keys": [
"PAGERDUTY_API_KEY"
],
"cmd": "uv"
}Como servidor independiente
uv run python -m pagerduty_mcp_serverFormato de respuesta
Todas las respuestas de la API siguen un formato consistente:
{
"metadata": {
"count": <int>, // Number of results
"description": "<str>" // A short summary of the results
},
<resource_type>: [ // Always pluralized for consistency, even if one result is returned
{
...
},
...
],
"error": { // Only present if there's an error
"message": "<str>", // Human-readable error description
"code": "<str>" // Machine-readable error code
}
}Manejo de errores
Cuando ocurre un error, la respuesta incluirá un objeto de error con la siguiente estructura:
{
"metadata": {
"count": 0,
"description": "Error occurred while processing request"
},
"error": {
"message": "Invalid user ID provided",
"code": "INVALID_USER_ID"
}
}Los escenarios de error más comunes incluyen:
ID de recursos no válidos (por ejemplo, user_id, team_id, service_id)
Faltan parámetros requeridos
Valores de parámetros no válidos
Errores en las solicitudes de API
Errores de procesamiento de respuesta
Validación de parámetros
Todos los parámetros de identificación deben ser identificaciones de recursos de PagerDuty válidas
Los parámetros de fecha deben ser marcas de tiempo ISO8601 válidas
Los parámetros de lista (por ejemplo,
statuses,team_ids) deben contener valores válidosLos valores no válidos en los parámetros de lista serán ignorados
Los parámetros obligatorios no pueden ser
Noneni cadenas vacíasPara
statusesenlist_incidents, solotriggered,acknowledgedyresolvedson valores válidosPara
urgencyen incidentes, solo valoreshighylowson válidosEl parámetro
limitse puede utilizar para restringir la cantidad de resultados devueltos por las operaciones de lista
Limitación de velocidad y paginación
El servidor respeta los límites de velocidad de PagerDuty
El servidor gestiona automáticamente la paginación por usted
El parámetro
limitse puede utilizar para controlar la cantidad de resultados devueltos por las operaciones de lista.Si no se especifica ningún límite, el servidor devolverá hasta {pagerduty_mcp_server.utils.RESPONSE_LIMIT} resultados de forma predeterminada
Ejemplo de uso
from pagerduty_mcp_server import incidents
from pagerduty_mcp_server.utils import RESPONSE_LIMIT
# List all incidents (including resolved) for the current user's teams
incidents_list = incidents.list_incidents()
# List only active incidents
active_incidents = incidents.list_incidents(statuses=['triggered', 'acknowledged'])
# List incidents for specific services
service_incidents = incidents.list_incidents(service_ids=['SERVICE-1', 'SERVICE-2'])
# List incidents for specific teams
team_incidents = incidents.list_incidents(team_ids=['TEAM-1', 'TEAM-2'])
# List incidents within a date range
date_range_incidents = incidents.list_incidents(
since='2024-03-01T00:00:00Z',
until='2024-03-14T23:59:59Z'
)
# List incidents with a limit on the number of results
limited_incidents = incidents.list_incidents(limit=10)
# List incidents with the default limit
default_limit_incidents = incidents.list_incidents(limit=RESPONSE_LIMIT)Contexto del usuario
Muchas funciones aceptan el parámetro current_user_context (valor predeterminado: True ), que filtra automáticamente los resultados según este contexto. Si current_user_context es True , no se pueden usar ciertos parámetros de filtro, ya que entrarían en conflicto con el filtrado automático:
Para todos los tipos de recursos:
user_idsno se puede utilizar concurrent_user_context=True
Para incidentes:
team_idsyservice_idsno se pueden usar concurrent_user_context=True
Para servicios:
team_idsno se puede utilizar concurrent_user_context=True
Para políticas de escalada:
team_idsno se puede utilizar concurrent_user_context=True
Para guardias:
user_idsno se puede utilizar concurrent_user_context=Trueschedule_idstodavía se puede usar para filtrar por horarios específicosLa consulta mostrará las llamadas disponibles para todas las políticas de escalamiento asociadas con los equipos del usuario actual.
Esto es útil para responder preguntas como "¿quién está actualmente de guardia en mi equipo?"
El ID del usuario actual no se utiliza como filtro, por lo que verá todos los miembros del equipo que están de guardia.
Desarrollo
Ejecución de pruebas
Tenga en cuenta que la mayoría de las pruebas requieren una conexión real a la API de PagerDuty, por lo que deberá configurar PAGERDUTY_API_KEY en el entorno antes de ejecutar el conjunto de pruebas completo.
uv run pytestPara ejecutar solo pruebas unitarias (es decir, pruebas que no requieren PAGERDUTY_API_KEY configurado en el entorno):
uv run pytest -m unitPara ejecutar solo pruebas de integración:
uv run pytest -m integrationPara ejecutar únicamente pruebas del analizador:
uv run pytest -m parsersPara ejecutar únicamente pruebas relacionadas con un submódulo específico:
uv run pytest -m <client|escalation_policies|...>Servidor de depuración con MCP Inspector
npx @modelcontextprotocol/inspector uv run python -m pagerduty_mcp_serverContribuciones
Lanzamientos
Este proyecto utiliza confirmaciones convencionales para lanzamientos automatizados. Los mensajes de confirmación determinan las actualizaciones de versión:
feat:→ versión menor (1.0.0 → 1.1.0)fix:→ versión del parche (1.0.0 → 1.0.1)BREAKING CHANGE:→ versión principal (1.0.0 → 2.0.0)
El CHANGELOG.md, las versiones de GitHub y los paquetes de PyPI se actualizan automáticamente.
Documentación
Documentación de herramientas : información detallada sobre las herramientas disponibles, incluidos parámetros, tipos de retorno y consultas de ejemplo
Convenciones
Todas las respuestas de la API siguen el formato estándar con metadatos, lista de recursos y error opcional.
Los nombres de los recursos en las respuestas siempre se pluralizan para mantener la coherencia.
Todas las funciones que devuelven un solo elemento aún devuelven una lista con un elemento
Las respuestas de error incluyen tanto un mensaje como un código
Todas las marcas de tiempo están en formato ISO8601
Las pruebas se marcan con marcadores pytest para indicar su tipo (unidad/integración), el recurso que prueban (incidentes, equipos, etc.) y si prueban la funcionalidad de análisis (marcador "parsers").
Available Tools
12 toolsacknowledge_incidentB
Acknowledge a PagerDuty incident. This signals that someone is actively working on the incident.
Inputs: incident_id (required), include. Returns: object
add_incident_noteA
Add a note to a PagerDuty incident. Notes are used to record additional context, investigation progress, or resolution details.
Inputs: content (required), incident_id (required). Returns: object
build_user_contextA
Validate and build the current user's context into a dictionary with the following format: { "user_id": str, "team_ids": List[str], "service_ids": List[str], "escalation_policy_ids": List[str] } The MCP server tools use this user context to filter the following resources: - Escalation policies - Incidents - Oncalls - Services - Users
Inputs: no named parameters. Returns: object
get_escalation_policiesA
Get PagerDuty escalation policies by filters or get details for a specific policy ID.
Call patterns:
Default: omit filters (uses current user's policies/teams).
By IDs: pass
user_idsand/orteam_ids(impliescurrent_user_context=False, including overriding an explicit True).By name: pass
querywith the default context (limited to your teams/policies); do not setcurrent_user_context=Falsewith onlyquery.
Inputs: limit, query, include, team_ids, +3 more. Returns: object
get_incidentsA
Get PagerDuty incidents by filters or get details for a specific incident ID or number.
Call patterns:
List my/team incidents: omit ID filters (default
current_user_context=True).List by service/team: pass
service_idsand/orteam_ids(impliescurrent_user_context=False, including overriding an explicit True). Do not also setinclude_notes/include_past_incidents/include_related_incidentson this list call.Detail + notes: second call with only
incident_id(and optional include_* flags).Account-wide list:
all_visible=Truealone (not scoped to the current user).
Inputs: limit, since, until, include, +10 more. Returns: object
get_oncallsA
List on-call entries for schedules, policies, or time ranges.
Call patterns:
Default: omit exclusive filters (uses escalation policies the current user is a target of).
By schedule:
schedule_idsmay be used with the default context (intersection) or withcurrent_user_context=False.By user/policy IDs: pass
user_idsand/orescalation_policy_ids(impliescurrent_user_context=False, including overriding an explicit True).
Behavior varies by time parameters:
Without since/until: Returns current on-calls Example: get_oncalls(current_user_context=False, schedule_ids=["PSCHED123"])
With since/until: Returns all on-calls in range Example: get_oncalls(current_user_context=False, schedule_ids=["PSCHED123"], since="2024-03-20T00:00:00Z", until="2024-03-27T00:00:00Z")
Inputs: limit, since, until, include, +5 more. Returns: object
get_schedulesB
Get PagerDuty schedules by filters or get details for a specific schedule ID.
Inputs: limit, query, since, until, +2 more. Returns: object
get_servicesA
Get PagerDuty services by filters or get details for a specific service ID.
Call patterns:
Search by name:
query="Service Name"with the default context (omitcurrent_user_context; limited to your teams).By team: pass
team_ids(impliescurrent_user_context=False, including overriding an explicit True).Do not set
current_user_context=Falsewith onlyquery; that errors becauseteam_idsare required in False mode.
Inputs: limit, query, include, team_ids, +2 more. Returns: object
get_teamsA
Get PagerDuty teams by filters or get details for a specific team ID.
Inputs: limit, query, include, team_id. Returns: object
get_usersA
Get PagerDuty users by filters or get details for a specific user ID.
Call patterns:
Search by name:
query="Name"with the default context (omitcurrent_user_context; limited to your teams).By team: pass
team_ids(impliescurrent_user_context=False, including overriding an explicit True).Do not set
current_user_context=Falsewith onlyquery; that errors becauseteam_idsare required in False mode.
Inputs: limit, query, include, user_id, +2 more. Returns: object
list_users_oncallC
List the users on call for a schedule during the specified time range.
Inputs: schedule_id (required), since, until, include. Returns: object
resolve_incidentA
Resolve a PagerDuty incident. This marks the incident as resolved and stops any further escalations.
Inputs: incident_id (required), include. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools map cleanly to distinct PagerDuty resources or incident actions. The main ambiguity is between get_oncalls and list_users_oncall, and several get_* tools combine list and detail modes, though the descriptions make reasonable distinctions.
All tool names follow a consistent snake_case verb_noun pattern using get_, list_, acknowledge_, resolve_, add_, and build_. The use of get_ for both listing and fetching details is a minor semantic issue rather than a naming inconsistency.
Twelve tools is a well-scoped size for a PagerDuty incident-management MCP server. Each tool covers a distinct resource or action, with no obvious filler tools.
The surface covers core read operations plus acknowledge, resolve, and note actions, which supports incident triage and response. However, it lacks create/update incident operations, assignment or priority changes, and write operations for schedules, teams, and services, leaving notable lifecycle gaps.
Maintenance
Related MCP Connectors
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseBqualityDmaintenanceThis server facilitates the invocation of AI models from providers like Anthropic, OpenAI, and Groq, enabling users to manage and configure large language model interactions seamlessly.240 PyPI13MIT
- AlicenseBqualityBmaintenanceA server that enables LLMs to programmatically interact with Logseq knowledge graphs, allowing creation and management of pages and blocks.1047MIT
- AlicenseNot gradedqualityAmaintenanceA server that enables Large Language Models to discover and interact with REST APIs defined by OpenAPI specifications through the Model Context Protocol.12,706 npm302MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol Server that enables LLMs to interact with and execute REST API calls through natural language prompts, supporting GET/PUT/POST/PATCH operations on configured APIs.6Apache 2.0