kivanio/mcp-new-relic
If you are the rightful owner of mcp-new-relic and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server for querying New Relic errors and metrics, providing tools for monitoring and analyzing application performance and errors.
MCP New Relic Server
A Model Context Protocol (MCP) server for querying New Relic errors and metrics. This server provides tools that Claude can use to monitor and analyze application performance and errors.
Features
- Error Querying: Query application errors with customizable time ranges and filters
- Custom NRQL Queries: Execute any NRQL query directly
- Performance Metrics: Query response times, throughput, error rates, and Apdex scores
- Easy Integration: Works seamlessly with Claude Desktop and other MCP clients
Installation
Option 1: NPM Package (Recommended)
Install globally via npm:
npm install -g mcp-new-relic
Or install locally in a project:
npm install mcp-new-relic
Option 2: Docker
Pull from Docker Hub:
docker pull kivanio/mcp-new-relic
Or build locally:
git clone https://github.com/kivanio/mcp-new-relic.git
cd mcp-new-relic
docker build -t mcp-new-relic .
Option 3: From Source
- Clone the repository:
git clone https://github.com/kivanio/mcp-new-relic.git cd mcp-new-relic
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
Configuration
-
Copy
.env.example
to.env
:cp .env.example .env
-
Edit
.env
with your New Relic credentials:NEW_RELIC_API_KEY=your-api-key-here NEW_RELIC_ACCOUNT_ID=your-account-id-here NEW_RELIC_REGION=US # or EU
To get your New Relic API key:
- Log in to New Relic
- Go to Account Settings ā API Keys
- Create a new User Key (not an Ingest Key)
Usage with Claude Desktop
Add the server to your Claude Desktop configuration. The configuration depends on how you installed the package:
If installed via NPM globally:
- Open Claude Desktop settings
- Go to the "Developer" tab
- Add to your MCP servers configuration:
{
"mcpServers": {
"new-relic": {
"command": "mcp-new-relic",
"env": {
"NEW_RELIC_API_KEY": "your-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id",
"NEW_RELIC_REGION": "US"
}
}
}
}
If installed locally or from source:
{
"mcpServers": {
"new-relic": {
"command": "node",
"args": ["/path/to/mcp-new-relic/dist/index.js"],
"env": {
"NEW_RELIC_API_KEY": "your-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id",
"NEW_RELIC_REGION": "US"
}
}
}
}
If using Docker:
{
"mcpServers": {
"new-relic": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/path/to/.env",
"kivanio/mcp-new-relic"
]
}
}
}
Using environment file:
If you have a .env
file configured, you can omit the env
section:
{
"mcpServers": {
"new-relic": {
"command": "mcp-new-relic"
}
}
}
Available Tools
1. query_errors
Query application errors from New Relic.
Parameters:
timeRange
(optional): Time range for the query (default: "4 hours ago")- Examples: "1 hour ago", "24 hours ago", "7 days ago"
appName
(optional): Application name pattern (default: "%kivanio%")- Supports SQL LIKE patterns
limit
(optional): Maximum number of error types to return (default: 20, max: 100)
Example usage in Claude:
Use the New Relic tool to check for errors in the last 24 hours
2. query_custom
Execute a custom NRQL query.
Parameters:
query
(required): The NRQL query to execute
Example usage in Claude:
Run this NRQL query: SELECT count(*) FROM Transaction WHERE appName = 'kivanio-production' SINCE 1 hour ago
3. query_metrics
Query application performance metrics.
Parameters:
timeRange
(optional): Time range for the query (default: "1 hour ago")appName
(optional): Application name pattern (default: "%kivanio%")metrics
(optional): Array of metrics to query (default: ["response_time", "throughput", "error_rate"])- Available metrics: "response_time", "throughput", "error_rate", "apdex"
Example usage in Claude:
Check the performance metrics for the last 6 hours
Development
Running in development mode:
npm run dev
Building:
npm run build
Project structure:
mcp-new-relic/
āāā src/
ā āāā index.ts # Main server implementation
āāā dist/ # Compiled JavaScript (generated)
āāā package.json # Dependencies and scripts
āāā tsconfig.json # TypeScript configuration
āāā .env.example # Example environment variables
āāā README.md # This file
Troubleshooting
Common Issues
- Authentication errors: Ensure your API key is valid and has the necessary permissions
- No results returned: Check that your application name pattern matches your New Relic app names
- Connection errors: Verify your region setting (US vs EU) matches your New Relic account
Debug Mode
To see detailed logs, run the server with debug output:
DEBUG=* node dist/index.js
License
MIT