API Token Management
Obtaining a User API Token
The MCP server requires a PagerDuty User API Token for authentication:- Navigate to My Profile > User Settings in PagerDuty
- Locate the API Access section
- Click Create API User Token
- Copy the token immediately (it won’t be shown again)
- Store it securely
Token Permissions
User API Tokens inherit permissions from the user who created them:- Responder role: Read-only access to most resources
- Manager role: Can modify teams and schedules
- Admin role: Full account access
- Account Owner role: Complete control including billing
Secure Token Storage
Local Development
VS Code and Cursor: Use input prompts instead of hardcoding tokensProduction Deployments
For production use:- Use environment variables: Never hardcode tokens in configuration files
-
Use secrets management: Store tokens in tools like:
- AWS Secrets Manager
- HashiCorp Vault
- Kubernetes Secrets
- Cloud provider secret services
- Rotate regularly: Change tokens periodically and after any suspected compromise
- Audit token usage: Review which tokens are active and revoke unused ones
Token Rotation
Regularly rotate API tokens to minimize risk:- Create a new User API Token in PagerDuty
- Update your MCP server configuration with the new token
- Test that the server works with the new token
- Delete the old token from PagerDuty
Read-Only vs Write Mode
Understanding the Modes
The MCP server operates in two modes: Read-Only Mode (default):- Only tools that retrieve information are available
- Cannot create, modify, or delete resources
- Safer for exploration and read-only integrations
- Suitable for reporting and monitoring use cases
--enable-write-tools):
- All tools are available, including those that modify data
- Can create incidents, schedule overrides, update services, etc.
- Required for automation and incident response
- Higher risk of accidental or unauthorized changes
Choosing the Right Mode
Use Read-Only Mode for:
Use Read-Only Mode for:
- Reporting and dashboards: Display incident statistics, on-call schedules
- Learning and exploration: Safely explore your PagerDuty configuration
- Read-only assistants: AI assistants that only answer questions
- Audit and compliance: Review configurations without risk of changes
- Untrusted environments: When you’re unsure about safety
Use Write Mode for:
Use Write Mode for:
- Incident response: Create and manage incidents, add responders
- On-call management: Create schedule overrides
- Automation: Automated incident creation from external systems
- Configuration management: Update services, orchestrations, schedules
- Trusted environments: When you control the AI assistant behavior
Enabling Write Mode Safely
When enabling write tools:-
Understand the risks: Write operations can:
- Create incidents (triggering on-call notifications)
- Modify schedules (affecting on-call coverage)
- Change escalation policies (altering incident routing)
- Delete resources (potential data loss)
-
Use in controlled environments: Enable only when:
- You trust the AI assistant’s behavior
- You understand what operations will be performed
- You can undo changes if needed
- Start with read-only: Test your workflows in read-only mode first
- Review AI suggestions: Always review what the AI plans to do before confirming write operations
Client Configuration Security
Regional Endpoints
Configure the correct API endpoint for your account region: US region (default):Network Security
TLS/SSL: The MCP server always uses HTTPS for PagerDuty API communication. Never disable certificate verification. Firewall rules: If using in a restricted network, allow outbound HTTPS to:api.pagerduty.com(US)api.eu.pagerduty.com(EU)
- The proxy supports HTTPS
- Certificate validation works correctly
- Proxy logs don’t capture token headers
Docker Security
When running the MCP server in Docker:- Don’t commit images with tokens: Use environment variables, not baked-in tokens
- Use minimal base images: Smaller images have fewer vulnerabilities
- Run as non-root: The official image uses a non-root user
- Scan for vulnerabilities: Regularly scan Docker images
- Limit container permissions: Use Docker security options like
--read-onlywhere possible
Audit Logging Recommendations
Monitoring API Activity
PagerDuty provides audit logs for API activity:- Navigate to Account Settings > Audit Trail in PagerDuty
- Filter by:
- API authentication events
- Resource modifications
- User performing actions
- Review logs regularly for:
- Unexpected API calls
- Unauthorized access attempts
- Unusual patterns
What to Monitor
Incident Creation Patterns
Incident Creation Patterns
Monitor for:
- Unusual volumes of incidents
- Incidents created at odd hours
- Incidents with suspicious content
- Incidents targeting unexpected services
Schedule Modifications
Schedule Modifications
Watch for:
- Overrides created by unfamiliar users
- Changes to critical schedules
- Unexpected gaps in coverage
- Schedule deletions
Configuration Changes
Configuration Changes
Alert on:
- Service configuration modifications
- Escalation policy updates
- Integration key changes
- User permission changes
Authentication Events
Authentication Events
Track:
- Failed authentication attempts
- API token usage patterns
- Access from unusual locations
- Multiple tokens for same user
Least Privilege Principles
Creating Dedicated Users
For production integrations, create dedicated users:- Create a dedicated PagerDuty user (e.g.,
[email protected]) - Assign minimal required role:
- Read-only use cases: Responder role
- Incident management: Manager role
- Full automation: Admin role (use sparingly)
- Generate token from dedicated user
- Document the token’s purpose
- Set up monitoring for this user’s API activity
Restricting Tool Access
Consider creating multiple MCP server instances with different configurations: Monitoring instance (read-only):- Default configuration
- No
--enable-write-toolsflag - Used for dashboards and reporting
- Includes
--enable-write-toolsflag - Used only when changes are needed
- Access restricted to authorized personnel
Team Access Controls
Use PagerDuty teams to control data access:- Organize resources by team: Associate services, schedules, and escalation policies with teams
- Limit user team membership: Users only see resources for their teams
- Use team-scoped tokens: Tokens only have access to associated teams
- Review team membership regularly: Remove users who no longer need access
Incident Response for Token Compromise
If you suspect a token has been compromised:Immediate Actions
-
Revoke the token immediately:
- Go to User Settings > API Access
- Delete the compromised token
-
Review audit logs:
- Check for unauthorized API calls
- Identify what actions were performed
- Document the timeline
-
Generate a new token:
- Create a new User API Token
- Update all configurations using the old token
- Test the new token works correctly
-
Assess impact:
- Review incidents created
- Check for configuration changes
- Verify schedule integrity
- Look for data exfiltration
Prevention
- Never commit tokens to source control: Use
.gitignorefor config files - Don’t share tokens: Each person should have their own
- Avoid logging tokens: Ensure logs don’t capture environment variables
- Use short-lived credentials when possible: Rotate tokens regularly
- Monitor for exposed secrets: Use tools like GitHub Secret Scanning
Compliance Considerations
Data Privacy
When using AI assistants with PagerDuty data:-
Understand data flow: Know where your PagerDuty data goes:
- AI provider’s servers (OpenAI, Anthropic, etc.)
- MCP client applications
- Local storage and caches
-
Review privacy policies: Check if your AI provider:
- Uses data for training
- Stores conversation history
- Shares data with third parties
-
Anonymize sensitive data: Consider redacting:
- Customer names
- Personal information
- Proprietary technical details
- Internal system names
Regulatory Requirements
For regulated industries:- SOC 2: Ensure token management meets access control requirements
- HIPAA: Avoid including PHI in incident details visible to the AI
- GDPR: Be aware that PagerDuty data may include personal information
- PCI DSS: Never include payment card data in incident information