Skip to main content
Glama
PagerDuty MCP Server

PagerDuty MCP Server

by wpfleger96

PagerDuty MCP サーバー

PagerDuty API機能をLLMに公開するサーバー。このサーバーは、構造化された入出力を用いてプログラム的に使用できるように設計されています。

PyPI ダウンロード Pythonのバージョン GitHub貢献者 PyPIバージョン ライセンス

概要

PagerDuty MCPサーバーは、PagerDuty APIと連携するためのツールセットを提供します。これらのツールは、LLMがインシデント、サービス、チーム、ユーザーなどのPagerDutyリソースに対してさまざまな操作を実行するために使用できるように設計されています。

Related MCP server: Logseq MCP Server

インストール

PyPIから

pip install pagerduty-mcp-server

ソースから

# Clone the repository
git clone https://github.com/wpfleger96/pagerduty-mcp-server.git
cd pagerduty-mcp-server

# Install dependencies
brew install uv
uv sync

要件

  • Python 3.13以上

  • PagerDuty APIキー

構成

PagerDuty MCP サーバーでは、環境に PagerDuty API キーを設定する必要があります。

PAGERDUTY_API_KEY=your_api_key_here

使用法

グースエクステンションとして

{
  "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"
}

スタンドアロンサーバーとして

uv run python -m pagerduty_mcp_server

応答フォーマット

すべての API 応答は一貫した形式に従います。

{
  "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
  }
}

エラー処理

エラーが発生すると、応答には次の構造のエラー オブジェクトが含まれます。

{
  "metadata": {
    "count": 0,
    "description": "Error occurred while processing request"
  },
  "error": {
    "message": "Invalid user ID provided",
    "code": "INVALID_USER_ID"
  }
}

一般的なエラーのシナリオは次のとおりです。

  • 無効なリソース ID (例: user_id、team_id、service_id)

  • 必要なパラメータが不足しています

  • 無効なパラメータ値

  • APIリクエストの失敗

  • 応答処理エラー

パラメータ検証

  • すべてのIDパラメータは有効なPagerDutyリソースIDである必要があります

  • 日付パラメータは有効なISO8601タイムスタンプである必要があります

  • リストパラメータ(例: statuses 、 team_ids )には有効な値が含まれている必要があります

  • リストパラメータ内の無効な値は無視されます

  • 必須パラメータはNoneまたは空の文字列にすることはできません

  • list_incidentsのstatusesの場合、有効な値はtriggered 、 acknowledged 、 resolvedのみです。

  • インシデントのurgencyについては、 highとlowのみが有効値です

  • limitパラメータはリスト操作によって返される結果の数を制限するために使用できます。

レート制限とページネーション

  • サーバーはPagerDutyのレート制限を尊重します

  • サーバーが自動的にページ区切りを処理します

  • limitパラメータはリスト操作によって返される結果の数を制御するために使用できます。

  • 制限が指定されていない場合、サーバーはデフォルトで最大{pagerduty_mcp_server.utils.RESPONSE_LIMIT}件の結果を返します。

使用例

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)

ユーザーコンテキスト

多くの関数はcurrent_user_contextパラメータ(デフォルトはTrue )を受け付けます。このパラメータは、このコンテキストに基づいて結果を自動的にフィルタリングします。current_user_context がTrueの場合、自動フィルタリングと競合するため、特定のフィルタパラメータは使用current_user_contextません。

  • すべてのリソース タイプの場合:

    • user_ids``current_user_context=Trueでは使用できません

  • インシデントの場合:

    • team_idsとservice_ids``current_user_context=Trueでは使用できません

  • サービスの場合:

    • team_ids``current_user_context=Trueでは使用できません

  • エスカレーション ポリシーの場合:

    • team_ids``current_user_context=Trueでは使用できません

  • オンコールの場合:

    • user_ids``current_user_context=Trueでは使用できません

    • schedule_ids特定のスケジュールでフィルタリングするために引き続き使用できます。

    • クエリは、現在のユーザーのチームに関連付けられているすべてのエスカレーション ポリシーのオンコールを表示します。

    • これは、「現在私のチームでオンコールになっているのは誰ですか?」などの質問に答えるのに役立ちます。

    • 現在のユーザーのIDはフィルターとして使用されないため、オンコール中のチームメンバー全員が表示されます。

発達

テストの実行

ほとんどのテストでは PagerDuty API への実際の接続が必要なので、完全なテスト スイートを実行する前に環境でPAGERDUTY_API_KEYを設定する必要があることに注意してください。

uv run pytest

ユニット テストのみ (つまり、環境でPAGERDUTY_API_KEY設定する必要のないテスト) を実行するには:

uv run pytest -m unit

統合テストのみを実行するには:

uv run pytest -m integration

パーサー テストのみを実行するには:

uv run pytest -m parsers

特定のサブモジュールに関連するテストのみを実行するには:

uv run pytest -m <client|escalation_policies|...>

MCP Inspector を使用したデバッグサーバー

npx @modelcontextprotocol/inspector uv run python -m pagerduty_mcp_server

貢献

リリース

このプロジェクトでは、自動リリースにConventional Commitsを使用しています。コミットメッセージによってバージョンアップが決定されます。

  • feat: → マイナーバージョンアップ (1.0.0 → 1.1.0)

  • fix: → パッチバージョン (1.0.0 → 1.0.1)

  • BREAKING CHANGE: → メジャーバージョン (1.0.0 → 2.0.0)

CHANGELOG.md、GitHub リリース、PyPI パッケージは自動的に更新されます。

ドキュメント

ツールドキュメント- パラメータ、戻り値の型、サンプルクエリなど、利用可能なツールに関する詳細情報

コンベンション

  • すべてのAPIレスポンスは、メタデータ、リソースリスト、およびオプションのエラーを含む標準形式に従います。

  • 応答内のリソース名は一貫性を保つために常に複数形になります

  • 単一の項目を返すすべての関数は、1つの要素を持つリストを返します。

  • エラー応答にはメッセージとコードの両方が含まれます

  • すべてのタイムスタンプはISO8601形式です

  • テストには、そのタイプ(ユニット/統合)、テスト対象のリソース(インシデント、チームなど)、解析機能をテストするかどうか(「パーサー」マーカー)を示す pytest マーカーが付けられます。

Available Tools

12 tools
acknowledge_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_ids and/or team_ids (implies current_user_context=False, including overriding an explicit True).

  • By name: pass query with the default context (limited to your teams/policies); do not set current_user_context=False with only query.

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_ids and/or team_ids (implies current_user_context=False, including overriding an explicit True). Do not also set include_notes / include_past_incidents / include_related_incidents on this list call.

  • Detail + notes: second call with only incident_id (and optional include_* flags).

  • Account-wide list: all_visible=True alone (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_ids may be used with the default context (intersection) or with current_user_context=False.

  • By user/policy IDs: pass user_ids and/or escalation_policy_ids (implies current_user_context=False, including overriding an explicit True).

Behavior varies by time parameters:

  1. Without since/until: Returns current on-calls Example: get_oncalls(current_user_context=False, schedule_ids=["PSCHED123"])

  2. 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 (omit current_user_context; limited to your teams).

  • By team: pass team_ids (implies current_user_context=False, including overriding an explicit True).

  • Do not set current_user_context=False with only query; that errors because team_ids are 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 (omit current_user_context; limited to your teams).

  • By team: pass team_ids (implies current_user_context=False, including overriding an explicit True).

  • Do not set current_user_context=False with only query; that errors because team_ids are 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

    A3.7/5.0

    Scored across 12 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness3/5

    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

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers