@davidcrocq/newrelic-mcp-server
v1.0.0
Published
New Relic MCP Server for Claude Desktop - Monitor applications, run NRQL queries, manage alerts via Model Context Protocol
Maintainers
Readme
New Relic MCP Server
A TypeScript-based Model Context Protocol (MCP) server for New Relic, designed for use with Claude Desktop. Query your New Relic data, monitor applications, run NRQL queries, and manage alerts directly from Claude.
Features
This MCP server provides 13 tools across 4 categories for interacting with New Relic:
Entity Tools
- newrelic-list-entities - Search for entities (applications, hosts, services, etc.)
- newrelic-get-entity - Get detailed entity information by GUID
- newrelic-get-golden-metrics - Retrieve golden metrics for an entity
NRQL Tools
- newrelic-execute-nrql - Execute NRQL queries
- newrelic-get-dashboards - List all dashboards
- newrelic-get-dashboard - Get dashboard details
APM Tools
- newrelic-list-applications - List all APM applications
- newrelic-get-application-metrics - Get application performance metrics
- newrelic-get-transactions - Get transaction data
- newrelic-get-errors - Get error analytics
Alert Tools
- newrelic-list-alert-policies - List alert policies
- newrelic-get-open-incidents - Get open incidents
- newrelic-get-incident-details - Get incident details
Prerequisites
- Node.js 18+ - Required for running the server
- New Relic Account - You need a New Relic account with API access
- New Relic API Key - A User API key from New Relic
Getting Your New Relic Credentials
API Key: Go to New Relic API Keys and create a new User API key (type:
NRAK-...)Account ID: Find your account ID in the URL when logged into New Relic:
https://one.newrelic.com/...?account=YOUR_ACCOUNT_ID- Or go to Administration → Access Management → Accounts
Installation
Quick Start with npx (Recommended)
No installation required! Configure Claude Desktop to use npx directly (see Configuration section below).
Global Installation
npm install -g @davidcrocq/newrelic-mcp-serverInstall from Source
git clone https://github.com/dcrocq/newrelic-mcp-local.git
cd newrelic-mcp-local
npm install
npm run buildConfiguration
Environment Variables
The server requires two environment variables:
| Variable | Description | Example |
|----------|-------------|---------|
| NEW_RELIC_API_KEY | Your New Relic User API Key | NRAK-XXXXXXXXXXXXXXXXXXXX |
| NEW_RELIC_ACCOUNT_ID | Your New Relic Account ID | 1234567 |
Claude Desktop Configuration
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Using npx (Recommended - No Installation Required)
{
"mcpServers": {
"newrelic": {
"command": "npx",
"args": ["-y", "@davidcrocq/newrelic-mcp-server"],
"env": {
"NEW_RELIC_API_KEY": "NRAK-your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}Using Global Installation
{
"mcpServers": {
"newrelic": {
"command": "newrelic-mcp-server",
"env": {
"NEW_RELIC_API_KEY": "NRAK-your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}Using Local Installation (from source)
{
"mcpServers": {
"newrelic": {
"command": "node",
"args": ["/absolute/path/to/newrelic-mcp-local/build/index.js"],
"env": {
"NEW_RELIC_API_KEY": "NRAK-your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}Important: Replace the API key and account ID with your actual New Relic credentials.
Verify Configuration
After updating the configuration:
- Restart Claude Desktop completely (quit and reopen)
- Look for the MCP server icon (hammer icon) in the input area
- Click it to see the available New Relic tools
Usage Examples
Once configured, you can ask Claude to use the New Relic tools:
Query Entities
"List all APM applications in my New Relic account"
"Get details for the entity with GUID MTIzNDU2..."
Run NRQL Queries
"Run this NRQL query: SELECT count(*) FROM Transaction SINCE 1 hour ago"
"Show me the average response time by transaction name for my app"
APM Monitoring
"Show me the top 10 slowest transactions for my-app"
"What errors occurred in my-app in the last hour?"
Check Alerts
"List all my alert policies"
"Are there any open incidents right now?"
Development
Build Commands
# Build the TypeScript code
npm run build
# Watch mode for development
npm run dev
# Clean build directory
npm run clean
# Rebuild from scratch
npm run rebuildProject Structure
newrelic-mcp-server/
├── src/
│ ├── index.ts # Main server entry point
│ ├── types.ts # TypeScript type definitions
│ ├── client.ts # New Relic GraphQL client
│ ├── logger.ts # Logging utility
│ └── tools/
│ ├── entity-tools.ts # Entity search & golden metrics
│ ├── nrql-tools.ts # NRQL queries & dashboards
│ ├── apm-tools.ts # APM monitoring
│ └── alert-tools.ts # Alert policies & incidents
├── build/ # Compiled JavaScript (after build)
├── package.json
├── tsconfig.json
├── LICENSE
└── README.mdTesting the Server
You can test the server directly by running:
# Set environment variables
export NEW_RELIC_API_KEY="NRAK-your-key"
export NEW_RELIC_ACCOUNT_ID="your-account-id"
# Run the server
npm startThe server will start and wait for MCP protocol messages on stdin.
Logging
The MCP server logs all New Relic API requests and tool calls to a log file for debugging and auditing purposes.
Log File Location
The log file is located at:
~/.newrelic-mcp/newrelic-mcp.log- macOS/Linux:
~/.newrelic-mcp/newrelic-mcp.log - Windows:
C:\Users\<username>\.newrelic-mcp\newrelic-mcp.log
Viewing Logs
Real-time monitoring (macOS/Linux):
tail -f ~/.newrelic-mcp/newrelic-mcp.logView recent logs:
# Last 50 lines
tail -50 ~/.newrelic-mcp/newrelic-mcp.log
# Search for errors
grep ERROR ~/.newrelic-mcp/newrelic-mcp.log
# Search for specific tool calls
grep "Tool Call" ~/.newrelic-mcp/newrelic-mcp.logWindows PowerShell:
# View log file
Get-Content $env:USERPROFILE\.newrelic-mcp\newrelic-mcp.log
# Real-time monitoring
Get-Content $env:USERPROFILE\.newrelic-mcp\newrelic-mcp.log -Wait -Tail 50Log Format
Each log entry includes:
- Timestamp: ISO 8601 format
- Level: DEBUG, INFO, WARN, or ERROR
- Context: Component that generated the log
- Message: Description of the event
- Data: Additional JSON data (for requests/responses)
Example log entries:
[2025-01-13T10:30:45.123Z] [INFO] [MCPServer] Tool Call: newrelic-list-applications
{
"tool": "newrelic-list-applications",
"arguments": {}
}
[2025-01-13T10:30:45.456Z] [INFO] [NewRelicClient] API Request: ListApplications
{
"operation": "ListApplications",
"variables": { "cursor": null }
}
[2025-01-13T10:30:46.789Z] [INFO] [NewRelicClient] API Response: ListApplications
{
"operation": "ListApplications",
"durationMs": 1333,
"success": true
}Log Rotation
- The log file is automatically rotated when it exceeds 10MB
- The previous log is saved as
newrelic-mcp.log.old - Only one backup file is kept
Clearing Logs
To clear the log file:
# macOS/Linux
rm ~/.newrelic-mcp/newrelic-mcp.log
# Windows PowerShell
Remove-Item $env:USERPROFILE\.newrelic-mcp\newrelic-mcp.logTroubleshooting
Server Not Appearing in Claude
- Ensure the build was successful:
npm run build - Check the path in
claude_desktop_config.jsonis correct and absolute - Verify environment variables are set in the config
- Restart Claude Desktop completely
Authentication Errors
- Verify your API key starts with
NRAK- - Ensure the API key has not expired
- Check that your account ID is correct
GraphQL Errors
- Some queries may require specific permissions
- Ensure your API key has access to the account
- Check New Relic's API Explorer to test queries
Debug Mode
To see server output, run Claude Desktop from a terminal:
macOS:
/Applications/Claude.app/Contents/MacOS/ClaudeServer logs will appear in the terminal (stderr).
API Reference
New Relic GraphQL API
This server uses the New Relic GraphQL API (NerdGraph) for all operations.
MCP Protocol
Learn more about the Model Context Protocol at modelcontextprotocol.io.
License
MIT License - See LICENSE for details.
