Creating a PagerDuty User API Token
To obtain a PagerDuty User API Token, follow these steps:Navigate to User Settings
Click on your user profile icon in PagerDuty, then select My Profile and then User Settings.
For Freemium accounts, the permissions for generating User API tokens are limited to the user role as defined in the PagerDuty user roles documentation.
Generate Token
Click the Create API User Token button and follow the prompts to generate a new token.
Token Permissions and Limitations
User API tokens inherit the permissions of the user who created them. This means:- The token has the same access level as your user account
- Any actions performed through the MCP server are subject to your user role permissions
- For Freemium accounts, permissions are more limited compared to paid accounts
- The token can be revoked at any time from your user settings
Use of the PagerDuty User API Token is subject to the PagerDuty Developer Agreement.
Setting Up Environment Variables
The MCP server expects your API token to be provided via thePAGERDUTY_USER_API_KEY environment variable. How you configure this depends on your MCP client.
VS Code
settings.json
Cursor
settings.json
Claude Desktop
claude_desktop_config.json
Docker
When running with Docker, pass the API key as an environment variable:Regional API Endpoints
By default, the MCP server connects to the US region API endpoint (https://api.pagerduty.com). If your PagerDuty account is located in the EU region, you’ll need to configure the regional endpoint.
See Regional Endpoints for detailed instructions.
Security Best Practices
Use secure input prompts when available
Use secure input prompts when available
VS Code and Cursor support secure input prompts that don’t store credentials in plain text configuration files. Always use these when available.
Protect configuration files
Protect configuration files
If you must store credentials in configuration files (like with Claude Desktop):
- Ensure the file has appropriate permissions (readable only by your user account)
- Never commit configuration files with credentials to version control
- Consider using environment variables instead of hardcoded values
Rotate tokens regularly
Rotate tokens regularly
Periodically generate new API tokens and revoke old ones to minimize security risks.
Use read-only mode when possible
Use read-only mode when possible
By default, the MCP server runs in read-only mode. Only enable write operations when necessary using the
--enable-write-tools flag.Monitor token usage
Monitor token usage
Keep track of your API token usage in PagerDuty to detect any unauthorized access.
Troubleshooting Authentication Issues
Error: An API key is required to call the PagerDuty API
Error: An API key is required to call the PagerDuty API
This error means the
PAGERDUTY_USER_API_KEY environment variable is not set or is empty. Verify your configuration includes the environment variable and that your client is passing it correctly.401 Unauthorized errors
401 Unauthorized errors
Token not being prompted in VS Code/Cursor
Token not being prompted in VS Code/Cursor
Make sure you’ve configured the
inputs section in your settings and are using the correct reference syntax ${input:pagerduty-api-key}.Next Steps
Understanding Write Mode
Learn about read-only vs write operations
Regional Endpoints
Configure EU region API endpoints
Client Integration
Set up your preferred MCP client
Security Best Practices
Comprehensive security guidance