home / mcp / new relic mcp server
Provides access to New Relic logs and APM data via MCP tools including logs, queries, and metrics.
Configuration
View docs{
"mcpServers": {
"xelber-newrelic-mcp": {
"command": "node",
"args": [
"/absolute/path/to/newrelic-mcp/dist/index.js"
],
"env": {
"NEW_RELIC_API_KEY": "your-user-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}You can run a Model Context Protocol (MCP) server that gives AI agents like Claude Code access to New Relic logs and APM data through the NerdGraph API. This server lets you query logs, search across logs, and retrieve recent logs, as well as run NRQL queries against APM data, fetch performance metrics, and obtain transaction traces. It centralizes New Relic data access for conversational AI workflows and automates data retrieval for monitoring and debugging.
You connect to the MCP server from your MCP client and then issue tool commands to retrieve data from New Relic. The server supports log querying, log searching, and retrieving recent logs, along with APM querying, metrics gathering, and transaction trace retrieval. Use these capabilities to build AI-assisted observability workflows, answer questions about logs and performance, and surface actionable insights from your New Relic data.
Prerequisites: you need Node.js 18 or higher. You also need a New Relic account with a User API Key and an Account ID.
# 1) Clone the MCP server
git clone https://github.com/xelber/newrelic-mcp.git
cd newrelic-mcp
# 2) Install dependencies
npm install
# 3) Build the project
npm run buildSet your New Relic credentials as environment variables in your shell or a .env file at the project root. These values are required for the MCP server to authenticate with New Relic.
NEW_RELIC_API_KEY=your-user-api-key
NEW_RELIC_ACCOUNT_ID=your-account-idConfigure Claude Desktop to run the MCP server locally via Node.js and point it to the compiled entry point once you have built the project. The following configuration uses an absolute path to the built script.
{
"mcpServers": {
"newrelic": {
"command": "node",
"args": ["/absolute/path/to/newrelic-mcp/dist/index.js"],
"env": {
"NEW_RELIC_API_KEY": "your-user-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}After building, start the MCP server using the runtime command shown in the configuration. Ensure the path to the built entry point is correct and that the environment variables are set in the same process.
Once Claude Desktop is configured, Claude Code can automatically access the MCP server if Claude Desktop is running on the same machine. You can also add the MCP server directly to Claude Code’s MCP settings using the same configuration structure.
If the MCP server does not appear in Claude Desktop, verify that the configuration path is correct for your OS, the JSON syntax is valid, the dist/index.js path is absolute, and you have fully restarted Claude Desktop. For module or build errors, ensure you ran npm install and npm run build, and confirm the dist/ folder contains the compiled files.
Keep your New Relic credentials secure. Do not commit .env files to version control. Use environment-specific configurations and rotate your API key periodically according to your organization’s security policies.
Ask Claude to fetch the latest log entries, run a log query for errors in the last hour, or retrieve APM metrics for a specific application. You can combine log and APM data to investigate incidents, confirm hypotheses, and surface metrics like response time, throughput, error rate, and Apdex.
Execute custom NRQL queries against New Relic logs for filtering and aggregation.
Search logs with keywords and optional attribute filtering, time range, and limit.
Retrieve the most recent log entries within a specified time window.
Execute NRQL queries against APM data including transactions and metrics.
Fetch application performance metrics such as response time, throughput, error rate, and Apdex.
Retrieve transaction traces with optional filters for slow transactions.