npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@savvagent/mcp-pagerduty

v1.0.1

Published

Savvagent PagerDuty MCP integration - Connect feature flags with PagerDuty incident management

Downloads

101

Readme

@savvagent/mcp-pagerduty

PagerDuty MCP integration for Savvagent - Connect feature flags with PagerDuty incident management.

Installation

npm install @savvagent/mcp-pagerduty
# or
pnpm add @savvagent/mcp-pagerduty

Quick Start

import express from 'express';
import { PagerDutyMCPServer } from '@savvagent/mcp-pagerduty';
import { createHttpHandler } from '@savvagent/mcp-sdk';

const app = express();
app.use(express.json());

const mcpServer = new PagerDutyMCPServer(
  {
    name: 'my-pagerduty-server',
    version: '1.0.0',
  },
  {
    apiToken: process.env.PAGERDUTY_API_TOKEN!,
  }
);

// Create handler with Bearer token authentication
const handler = createHttpHandler(mcpServer, {
  auth: { token: process.env.MCP_AUTH_TOKEN! },
});

// Mount on /mcp endpoint (StreamableHTTP transport)
app.post('/mcp', handler);

await mcpServer.initialize();
app.listen(3007);

Configuration

| Option | Type | Required | Description | |--------|------|----------|-------------| | apiToken | string | Yes | PagerDuty REST API v2 token | | routingKey | string | No | Events API integration key (for sending events) |

Getting Your API Token

  1. Go to PagerDuty > Integrations > API Access Keys
  2. Click Create New API Key
  3. Give it a description and select Read/Write access
  4. Copy the generated token

Available Tools

get_incidents

Get PagerDuty incidents with filtering options.

{
  "method": "tools/call",
  "params": {
    "name": "get_incidents",
    "arguments": {
      "status": ["triggered", "acknowledged"],
      "urgency": "high",
      "limit": 25
    }
  }
}

get_incident_details

Get detailed information about a specific incident including timeline.

{
  "method": "tools/call",
  "params": {
    "name": "get_incident_details",
    "arguments": {
      "incident_id": "P123ABC"
    }
  }
}

get_services

List PagerDuty services.

{
  "method": "tools/call",
  "params": {
    "name": "get_services",
    "arguments": {
      "query": "production",
      "include": ["escalation_policies", "teams"]
    }
  }
}

get_on_call

Get current on-call users.

{
  "method": "tools/call",
  "params": {
    "name": "get_on_call",
    "arguments": {
      "escalation_policy_ids": ["POLICY123"]
    }
  }
}

get_schedules

List PagerDuty schedules.

{
  "method": "tools/call",
  "params": {
    "name": "get_schedules",
    "arguments": {
      "query": "primary"
    }
  }
}

get_escalation_policies

List escalation policies.

{
  "method": "tools/call",
  "params": {
    "name": "get_escalation_policies",
    "arguments": {}
  }
}

get_users

List PagerDuty users.

{
  "method": "tools/call",
  "params": {
    "name": "get_users",
    "arguments": {
      "query": "john",
      "include": ["contact_methods", "teams"]
    }
  }
}

get_analytics

Get incident analytics and metrics.

{
  "method": "tools/call",
  "params": {
    "name": "get_analytics",
    "arguments": {
      "since": "2024-01-01T00:00:00Z",
      "until": "2024-01-31T23:59:59Z"
    }
  }
}

create_incident

Create a new PagerDuty incident.

{
  "method": "tools/call",
  "params": {
    "name": "create_incident",
    "arguments": {
      "title": "Database connection failure",
      "service_id": "SERVICE123",
      "urgency": "high",
      "body": "Multiple connection timeouts detected"
    }
  }
}

update_incident

Update an incident (acknowledge, resolve).

{
  "method": "tools/call",
  "params": {
    "name": "update_incident",
    "arguments": {
      "incident_id": "P123ABC",
      "status": "resolved",
      "resolution": "Fixed by restarting the service"
    }
  }
}

get_alerts

Get alerts associated with an incident.

{
  "method": "tools/call",
  "params": {
    "name": "get_alerts",
    "arguments": {
      "incident_id": "P123ABC"
    }
  }
}

Authentication

This server uses Bearer token authentication. Include the token in requests:

curl -X POST http://localhost:3007/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

MCP Protocol

This server implements the Model Context Protocol using StreamableHTTP transport:

  • Endpoint: POST /mcp
  • Protocol: JSON-RPC 2.0
  • Authentication: Bearer token

Standard MCP Methods

| Method | Description | |--------|-------------| | initialize | Initialize the MCP session | | tools/list | List available tools | | tools/call | Execute a tool |

Example Requests

List Active Incidents

curl -X POST http://localhost:3007/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_incidents",
      "arguments": {
        "status": ["triggered", "acknowledged"]
      }
    },
    "id": 1
  }'

Get On-Call Schedule

curl -X POST http://localhost:3007/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_on_call",
      "arguments": {}
    },
    "id": 2
  }'

Create New Incident

curl -X POST http://localhost:3007/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "create_incident",
      "arguments": {
        "title": "Production API is down",
        "service_id": "SERVICE123",
        "urgency": "high"
      }
    },
    "id": 3
  }'

Health Check

The server provides a health check endpoint:

curl http://localhost:3007/health

Response:

{
  "status": "ok",
  "version": "1.0.0",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "details": {
    "connected": true
  }
}

Running the Example

# Set environment variables
export PAGERDUTY_API_TOKEN="your-pagerduty-api-token"
export MCP_AUTH_TOKEN="your-secret-token"

# Run the example server
pnpm example

License

MIT