Prerequisites
Ensure you have the MCP extension installed in VS Code. You can find it in the Extensions marketplace.Setup
Open VS Code Settings
Navigate to File > Preferences > Settings, or use the keyboard shortcut:
- Mac:
Cmd+, - Windows/Linux:
Ctrl+,
Enable MCP
Search for “mcp” in the settings search bar and ensure “Mcp: Enabled” is checked under Features > Chat.
Open MCP Server Configuration
Click “Edit in settings.json” under “Mcp > Discovery: Servers” to open the configuration file.
Add Server Configuration
Add the following configuration to your The
settings.json:--enable-write-tools flag enables write operations, allowing you to create incidents, schedule overrides, and more.Using Agent Mode
Once configured, you can interact with PagerDuty through VS Code’s Chat view:Enable Agent Mode
Make sure
Agent mode is selected in the Chat view. You can enable or disable specific tools by clicking the 🛠️ icon.Start a Conversation
Enter commands to interact with your PagerDuty account:
- “Show me the latest incident”
- “List my event orchestrations”
- “Create a high-priority incident”
Configuration Details
Configuration File Location
The VS Code MCP configuration is stored in yoursettings.json file, typically located at:
- Mac/Linux:
~/.config/Code/User/settings.json - Windows:
%APPDATA%\Code\User\settings.json
Environment Variables
- PAGERDUTY_USER_API_KEY: Your PagerDuty User API Token. VS Code will securely prompt for this value.
- PAGERDUTY_API_HOST: The PagerDuty API endpoint. Use
https://api.pagerduty.comfor US accounts orhttps://api.eu.pagerduty.comfor EU accounts.
Testing the Integration
To verify the MCP server is working correctly:- Open the VS Code Chat view (
View>Chat) - Ensure Agent mode is selected
- Try a simple query: “Show me my latest PagerDuty incidents”
- Verify that the server responds with your incident data
MCP: List Servers).
Troubleshooting
MCP Not Enabled
If you don’t see MCP options:- Ensure the MCP extension is installed
- Search for “mcp” in VS Code settings
- Verify “Mcp: Enabled” is checked under Features > Chat
- Restart VS Code after enabling
Server Not Starting
If the MCP server doesn’t start:- Open the command palette (
Cmd+Shift+P/Ctrl+Shift+P) - Search for
MCP: List Serversto check server status - Verify that
uvxis installed and available in your PATH - Check the Output panel for error messages (View > Output > MCP)
- Try restarting the server using
MCP: Restart Server
API Key Issues
If you’re having trouble with API key authentication:- Ensure the
inputsconfiguration is correct in yoursettings.json - Verify your PagerDuty API key has the necessary permissions
- Re-enter your API key by restarting the server
- Check that the
${input:pagerduty-api-key}variable matches the inputid
Connection Issues for EU Accounts
If you’re in the EU region and experiencing connection issues:- Update
PAGERDUTY_API_HOSTtohttps://api.eu.pagerduty.com - Save the configuration file
- Restart the MCP server using the command palette
Write Operations Not Working
If you can read data but not create or modify resources:- Ensure the
--enable-write-toolsflag is included in theargsarray - Verify your API key has write permissions in PagerDuty
- Restart the MCP server after making configuration changes
Agent Mode Not Available
If Agent mode is not available in the Chat view:- Ensure you have the latest version of VS Code
- Verify MCP is enabled in settings
- Check that the MCP extension is up to date
- Try reloading the window (
Developer: Reload Window)