pagerduty-mcp-server


Namepagerduty-mcp-server JSON
Version 3.1.1 PyPI version JSON
download
home_pageNone
SummaryMCP server for LLM agents to interact with PagerDuty SaaS
upload_time2025-07-09 18:39:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseNone
keywords pagerduty mcp llm api server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PagerDuty MCP Server
A server that exposes PagerDuty API functionality to LLMs. This server is designed to be used programmatically, with structured inputs and outputs.

<a href="https://glama.ai/mcp/servers/@wpfleger96/pagerduty-mcp-server">
  <img width="380" height="200" src="https://glama.ai/mcp/servers/@wpfleger96/pagerduty-mcp-server/badge" alt="PagerDuty Server MCP server" />
</a>

[![PyPI Downloads](https://img.shields.io/pypi/dm/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)
[![GitHub Contributors](https://img.shields.io/github/contributors/wpfleger96/pagerduty-mcp-server.svg)](https://github.com/wpfleger96/pagerduty-mcp-server/graphs/contributors)
[![PyPI version](https://img.shields.io/pypi/v/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)
[![License](https://img.shields.io/github/license/wpfleger96/pagerduty-mcp-server.svg)](https://github.com/wpfleger96/pagerduty-mcp-server/blob/main/LICENSE)

## Overview
The PagerDuty MCP Server provides a set of tools for interacting with the PagerDuty API. These tools are designed to be used by LLMs to perform various operations on PagerDuty resources such as incidents, services, teams, and users.

## Getting Started

1. Initialize your local Python environment:
```sh
cd pagerduty-mcp-server
brew install uv
uv sync
```
2. The PagerDuty MCP Server requires a PagerDuty API token. You can provide this in two ways:

   **Option 1: Environment Variable**
   ```bash
   export PAGERDUTY_API_TOKEN=your_api_token_here
   ```

   **Option 2: .env File (Recommended)**
   Create a `.env` file in the project root:
   ```bash
   echo "PAGERDUTY_API_TOKEN=your_api_token_here" > .env
   ```
   
   The server will automatically load environment variables from the `.env` file if present.

## Usage
### As Goose Extension (Desktop)
In Goose:
1. Go to **Settings > Advanced Settings > Extensions > Add custom extension**.
2. Give the extension a name (e.g. `pagerduty-mcp-server`).
3. Set **Type** to **StandardIO**.
4. Enter the following in the **Command** field:
   ```bash
   uvx pagerduty-mcp-server
   ```
5. Click **Save**.
4. Enable the extension and confirm that Goose identifies your tools.

### As Goose Extension (CLI)
```yaml
  pagerduty:
    args:
      - pagerduty-mcp-server
    bundled: null
    cmd: uvx
    description: ''
    enabled: true
    env_keys:
      - PAGERDUTY_API_TOKEN
    envs: {}
    name: pagerduty
    timeout: 300
    type: stdio
```

### Claude/Cursor
```json
{
  "mcpServers": {
    "pagerduty-mcp-server": {
      "command": "uvx",
      "args": ["pagerduty-mcp-server"],
      "env": {
          "PAGERDUTY_API_TOKEN": <PAGERDUTY_API_TOKEN>
      }
    }
  }
}
```

### As Standalone Server
```sh
uv run path/to/repo/pagerduty-mcp-server/.venv/bin/pagerduty-mcp-server
```

## Response Format
All API responses follow a consistent format:
```json
{
  "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
  }
}
```

### Error Handling
When an error occurs, the response will include an error object with the following structure:
```json
{
  "metadata": {
    "count": 0,
    "description": "Error occurred while processing request"
  },
  "error": {
    "message": "Invalid user ID provided",
    "code": "INVALID_USER_ID"
  }
}
```

Common error scenarios include:
- Invalid resource IDs (e.g., user_id, team_id, service_id)
- Missing required parameters
- Invalid parameter values
- API request failures
- Response processing errors

### Parameter Validation
- All ID parameters must be valid PagerDuty resource IDs
- Date parameters must be valid ISO8601 timestamps
- List parameters (e.g., `statuses`, `team_ids`) must contain valid values
- Invalid values in list parameters will be ignored
- Required parameters cannot be `None` or empty strings
- For `statuses` in `list_incidents`, only `triggered`, `acknowledged`, and `resolved` are valid values
- For `urgency` in incidents, only `high` and `low` are valid values
- The `limit` parameter can be used to restrict the number of results returned by list operations

### Rate Limiting and Pagination
- The server respects PagerDuty's rate limits
- The server automatically handles pagination for you
- The `limit` parameter can be used to control the number of results returned by list operations
- If no limit is specified, the server will return up to {pagerduty-mcp-server.utils.RESPONSE_LIMIT} results by default

## User Context
Many functions accept a `current_user_context` parameter (defaults to `True`) which automatically filters results based on this context. When `current_user_context` is `True`, you cannot use certain filter parameters as they would conflict with the automatic filtering:

- For all resource types:
  - `user_ids` cannot be used with `current_user_context=True`
- For incidents:
  - `team_ids` and `service_ids` cannot be used with `current_user_context=True`
- For services:
  - `team_ids` cannot be used with `current_user_context=True`
- For escalation policies:
  - `team_ids` cannot be used with `current_user_context=True`
- For on-calls:
  - `user_ids` cannot be used with `current_user_context=True`
  - `schedule_ids` can still be used to filter by specific schedules
  - The query will show on-calls for all escalation policies associated with the current user's teams
  - This is useful for answering questions like "who is currently on-call for my team?"
  - The current user's ID is not used as a filter, so you'll see all team members who are on-call

## Development
### Running Tests
The test suite includes both unit tests and integration tests. Integration tests require a real connection to the PagerDuty API, while unit tests can run without API access.

The `pytest-cov` args are optional, use them to include a test coverage report in the output.

To run all tests (integration tests will be automatically skipped if `PAGERDUTY_API_TOKEN` is not set):
```bash
uv run pytest [--cov=src --cov-report=term-missing]
```

To run only unit tests (no API token required):
```bash
uv run pytest -m unit [--cov=src --cov-report=term-missing]
```

To run only integration tests (requires `PAGERDUTY_API_TOKEN` set in environment):
```bash
uv run pytest -m integration [--cov=src --cov-report=term-missing]
```

To run only parser tests:
```bash
uv run pytest -m parsers [--cov=src --cov-report=term-missing]
```

To run only tests related to a specific submodule:
```bash
uv run pytest -m <client|escalation_policies|...> [--cov=src --cov-report=term-missing]
```

### Debug Server with MCP Inspector
```bash
npx @modelcontextprotocol/inspector uv run path/to/repo/pagerduty-mcp-server/.venv/bin/pagerduty-mcp-server
```

### Documentation
[Tool Documentation](./docs/tools.md) - Detailed information about available tools including parameters, return types, and example queries

### Conventions
- All API responses follow the standard format with metadata, resource list, and optional error
- Resource names in responses are always pluralized for consistency
- All functions that return a single item still return a list with one element
- Error responses include both a message and a code
- All timestamps are in ISO8601 format
- Tests are marked with pytest markers to indicate their type (unit/integration), the resource they test (incidents, teams, etc.), and whether they test parsing functionality ("parsers" marker)


### Example Queries
- Are there any incidents assigned to me currently in pagerduty?
- Do I have any upcoming on call schedule in next 2 weeks?
- Who else is a member of the personalization team?

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pagerduty-mcp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "pagerduty, mcp, llm, api, server",
    "author": null,
    "author_email": "Will Pfleger <wpfleger@block.xyz>",
    "download_url": "https://files.pythonhosted.org/packages/fb/4a/1e788d9bfcef1fe35d5592c527ffa7579dad350ae870f78d558745d204fd/pagerduty_mcp_server-3.1.1.tar.gz",
    "platform": null,
    "description": "# PagerDuty MCP Server\nA server that exposes PagerDuty API functionality to LLMs. This server is designed to be used programmatically, with structured inputs and outputs.\n\n<a href=\"https://glama.ai/mcp/servers/@wpfleger96/pagerduty-mcp-server\">\n  <img width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/@wpfleger96/pagerduty-mcp-server/badge\" alt=\"PagerDuty Server MCP server\" />\n</a>\n\n[![PyPI Downloads](https://img.shields.io/pypi/dm/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)\n[![GitHub Contributors](https://img.shields.io/github/contributors/wpfleger96/pagerduty-mcp-server.svg)](https://github.com/wpfleger96/pagerduty-mcp-server/graphs/contributors)\n[![PyPI version](https://img.shields.io/pypi/v/pagerduty-mcp-server.svg)](https://pypi.org/project/pagerduty-mcp-server/)\n[![License](https://img.shields.io/github/license/wpfleger96/pagerduty-mcp-server.svg)](https://github.com/wpfleger96/pagerduty-mcp-server/blob/main/LICENSE)\n\n## Overview\nThe PagerDuty MCP Server provides a set of tools for interacting with the PagerDuty API. These tools are designed to be used by LLMs to perform various operations on PagerDuty resources such as incidents, services, teams, and users.\n\n## Getting Started\n\n1. Initialize your local Python environment:\n```sh\ncd pagerduty-mcp-server\nbrew install uv\nuv sync\n```\n2. The PagerDuty MCP Server requires a PagerDuty API token. You can provide this in two ways:\n\n   **Option 1: Environment Variable**\n   ```bash\n   export PAGERDUTY_API_TOKEN=your_api_token_here\n   ```\n\n   **Option 2: .env File (Recommended)**\n   Create a `.env` file in the project root:\n   ```bash\n   echo \"PAGERDUTY_API_TOKEN=your_api_token_here\" > .env\n   ```\n   \n   The server will automatically load environment variables from the `.env` file if present.\n\n## Usage\n### As Goose Extension (Desktop)\nIn Goose:\n1. Go to **Settings > Advanced Settings > Extensions > Add custom extension**.\n2. Give the extension a name (e.g. `pagerduty-mcp-server`).\n3. Set **Type** to **StandardIO**.\n4. Enter the following in the **Command** field:\n   ```bash\n   uvx pagerduty-mcp-server\n   ```\n5. Click **Save**.\n4. Enable the extension and confirm that Goose identifies your tools.\n\n### As Goose Extension (CLI)\n```yaml\n  pagerduty:\n    args:\n      - pagerduty-mcp-server\n    bundled: null\n    cmd: uvx\n    description: ''\n    enabled: true\n    env_keys:\n      - PAGERDUTY_API_TOKEN\n    envs: {}\n    name: pagerduty\n    timeout: 300\n    type: stdio\n```\n\n### Claude/Cursor\n```json\n{\n  \"mcpServers\": {\n    \"pagerduty-mcp-server\": {\n      \"command\": \"uvx\",\n      \"args\": [\"pagerduty-mcp-server\"],\n      \"env\": {\n          \"PAGERDUTY_API_TOKEN\": <PAGERDUTY_API_TOKEN>\n      }\n    }\n  }\n}\n```\n\n### As Standalone Server\n```sh\nuv run path/to/repo/pagerduty-mcp-server/.venv/bin/pagerduty-mcp-server\n```\n\n## Response Format\nAll API responses follow a consistent format:\n```json\n{\n  \"metadata\": {\n    \"count\": <int>,  // Number of results\n    \"description\": \"<str>\"  // A short summary of the results\n  },\n  <resource_type>: [ // Always pluralized for consistency, even if one result is returned\n    {\n      ...\n    },\n    ...\n  ],\n  \"error\": {  // Only present if there's an error\n    \"message\": \"<str>\",  // Human-readable error description\n    \"code\": \"<str>\"  // Machine-readable error code\n  }\n}\n```\n\n### Error Handling\nWhen an error occurs, the response will include an error object with the following structure:\n```json\n{\n  \"metadata\": {\n    \"count\": 0,\n    \"description\": \"Error occurred while processing request\"\n  },\n  \"error\": {\n    \"message\": \"Invalid user ID provided\",\n    \"code\": \"INVALID_USER_ID\"\n  }\n}\n```\n\nCommon error scenarios include:\n- Invalid resource IDs (e.g., user_id, team_id, service_id)\n- Missing required parameters\n- Invalid parameter values\n- API request failures\n- Response processing errors\n\n### Parameter Validation\n- All ID parameters must be valid PagerDuty resource IDs\n- Date parameters must be valid ISO8601 timestamps\n- List parameters (e.g., `statuses`, `team_ids`) must contain valid values\n- Invalid values in list parameters will be ignored\n- Required parameters cannot be `None` or empty strings\n- For `statuses` in `list_incidents`, only `triggered`, `acknowledged`, and `resolved` are valid values\n- For `urgency` in incidents, only `high` and `low` are valid values\n- The `limit` parameter can be used to restrict the number of results returned by list operations\n\n### Rate Limiting and Pagination\n- The server respects PagerDuty's rate limits\n- The server automatically handles pagination for you\n- The `limit` parameter can be used to control the number of results returned by list operations\n- If no limit is specified, the server will return up to {pagerduty-mcp-server.utils.RESPONSE_LIMIT} results by default\n\n## User Context\nMany functions accept a `current_user_context` parameter (defaults to `True`) which automatically filters results based on this context. When `current_user_context` is `True`, you cannot use certain filter parameters as they would conflict with the automatic filtering:\n\n- For all resource types:\n  - `user_ids` cannot be used with `current_user_context=True`\n- For incidents:\n  - `team_ids` and `service_ids` cannot be used with `current_user_context=True`\n- For services:\n  - `team_ids` cannot be used with `current_user_context=True`\n- For escalation policies:\n  - `team_ids` cannot be used with `current_user_context=True`\n- For on-calls:\n  - `user_ids` cannot be used with `current_user_context=True`\n  - `schedule_ids` can still be used to filter by specific schedules\n  - The query will show on-calls for all escalation policies associated with the current user's teams\n  - This is useful for answering questions like \"who is currently on-call for my team?\"\n  - The current user's ID is not used as a filter, so you'll see all team members who are on-call\n\n## Development\n### Running Tests\nThe test suite includes both unit tests and integration tests. Integration tests require a real connection to the PagerDuty API, while unit tests can run without API access.\n\nThe `pytest-cov` args are optional, use them to include a test coverage report in the output.\n\nTo run all tests (integration tests will be automatically skipped if `PAGERDUTY_API_TOKEN` is not set):\n```bash\nuv run pytest [--cov=src --cov-report=term-missing]\n```\n\nTo run only unit tests (no API token required):\n```bash\nuv run pytest -m unit [--cov=src --cov-report=term-missing]\n```\n\nTo run only integration tests (requires `PAGERDUTY_API_TOKEN` set in environment):\n```bash\nuv run pytest -m integration [--cov=src --cov-report=term-missing]\n```\n\nTo run only parser tests:\n```bash\nuv run pytest -m parsers [--cov=src --cov-report=term-missing]\n```\n\nTo run only tests related to a specific submodule:\n```bash\nuv run pytest -m <client|escalation_policies|...> [--cov=src --cov-report=term-missing]\n```\n\n### Debug Server with MCP Inspector\n```bash\nnpx @modelcontextprotocol/inspector uv run path/to/repo/pagerduty-mcp-server/.venv/bin/pagerduty-mcp-server\n```\n\n### Documentation\n[Tool Documentation](./docs/tools.md) - Detailed information about available tools including parameters, return types, and example queries\n\n### Conventions\n- All API responses follow the standard format with metadata, resource list, and optional error\n- Resource names in responses are always pluralized for consistency\n- All functions that return a single item still return a list with one element\n- Error responses include both a message and a code\n- All timestamps are in ISO8601 format\n- Tests are marked with pytest markers to indicate their type (unit/integration), the resource they test (incidents, teams, etc.), and whether they test parsing functionality (\"parsers\" marker)\n\n\n### Example Queries\n- Are there any incidents assigned to me currently in pagerduty?\n- Do I have any upcoming on call schedule in next 2 weeks?\n- Who else is a member of the personalization team?\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MCP server for LLM agents to interact with PagerDuty SaaS",
    "version": "3.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/wpfleger96/pagerduty-mcp-server/issues",
        "Changelog": "https://github.com/wpfleger96/pagerduty-mcp-server/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/wpfleger96/pagerduty-mcp-server#readme",
        "Homepage": "https://github.com/wpfleger96/pagerduty-mcp-server",
        "Repository": "https://github.com/wpfleger96/pagerduty-mcp-server.git"
    },
    "split_keywords": [
        "pagerduty",
        " mcp",
        " llm",
        " api",
        " server"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a57107c86855929c3560e0d4bf5fd5d6e8a678c35c63c9e87a90898da71f78ba",
                "md5": "f1f829ef3080521acf45d06c210d06fe",
                "sha256": "a61e4314e1281506e150f4e52b7fed6b3e3ce51836b1a5db2646e19a62ffc458"
            },
            "downloads": -1,
            "filename": "pagerduty_mcp_server-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1f829ef3080521acf45d06c210d06fe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 36988,
            "upload_time": "2025-07-09T18:39:33",
            "upload_time_iso_8601": "2025-07-09T18:39:33.914211Z",
            "url": "https://files.pythonhosted.org/packages/a5/71/07c86855929c3560e0d4bf5fd5d6e8a678c35c63c9e87a90898da71f78ba/pagerduty_mcp_server-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fb4a1e788d9bfcef1fe35d5592c527ffa7579dad350ae870f78d558745d204fd",
                "md5": "26e8951c60818b163fb13d3506749fbd",
                "sha256": "e25e277b65d314459acfd1a647651bce8763daf5c0e693a5ff46653d70abe19a"
            },
            "downloads": -1,
            "filename": "pagerduty_mcp_server-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "26e8951c60818b163fb13d3506749fbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 27516,
            "upload_time": "2025-07-09T18:39:35",
            "upload_time_iso_8601": "2025-07-09T18:39:35.049810Z",
            "url": "https://files.pythonhosted.org/packages/fb/4a/1e788d9bfcef1fe35d5592c527ffa7579dad350ae870f78d558745d204fd/pagerduty_mcp_server-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-09 18:39:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wpfleger96",
    "github_project": "pagerduty-mcp-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pagerduty-mcp-server"
}
        
Elapsed time: 0.74925s