New Relic MCP server

Integrates with New Relic monitoring platform through GraphQL and REST APIs to provide access to logs, metrics, alerts, dashboards, and application data for DevOps teams and site reliability engineers performing incident investigation and automated troubleshooting workflows.
Back to servers
Setup instructions
Provider
mohdhaji87
Release date
Jul 12, 2025
Language
Python

The New Relic MCP server provides a way to interact with New Relic's monitoring platform programmatically through the Model Context Protocol. It exposes various New Relic NerdGraph and REST API endpoints as tools that can be used with MCP-compatible clients.

Requirements

  • Python 3.12 or newer
  • uv (for running the server)
  • A valid New Relic API key and account ID

Installation and Setup

Installing Dependencies

First, install the required dependencies using uv:

uv pip install -r requirements.txt

Setting Environment Variables

Before running the server, you need to configure your New Relic credentials:

export NEW_RELIC_API_KEY=your_api_key
export NEW_RELIC_ACCOUNT_ID=your_account_id

Starting the Server

Start the MCP server using the following command:

uv --directory /path/to/newrelic-mcp run server.py

Replace /path/to/newrelic-mcp with the actual path to your newrelic-mcp directory.

Configuration

Configuration for Claude Desktop

Create a uv.mcpserver.json file with the following content:

{
  "mcpServers": {
    "NewRelicMCP": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/newrelic-mcp", "run", "server.py"
      ],
      "env": {
        "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
        "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
      }
    }
  }
}

Configuration for MCP Clients

Create a mcp.json file with the following content:

{
  "mcp": {
    "NewRelicMCP": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/newrelic-mcp", "run", "server.py"
      ],
      "env": {
        "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
        "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
      }
    }
  }
}

Make sure to replace the placeholder values with your actual New Relic credentials.

Available Tools

The server provides several tools for interacting with New Relic:

  • query_logs (using NerdGraph/GraphQL)
  • query_logs_rest (using REST API v2)
  • get_account_info
  • get_user_info
  • get_alerts
  • get_dashboards
  • get_entities

Using the Tools

Query Logs REST Example

The query_logs_rest tool allows you to query New Relic metrics using the REST API v2.

Arguments:

  • app_id: Application ID to query
  • names: Comma-separated metric names (e.g., 'HttpDispatcher,CPU/User Time')
  • from_timestamp: Start time in ISO8601 format (e.g., '2024-07-01T00:00:00+00:00')
  • to_timestamp: End time in ISO8601 format (e.g., '2024-07-02T00:00:00+00:00')

Example:

query_logs_rest(
  app_id="12345678",
  names="HttpDispatcher,CPU/User Time",
  from_timestamp="2024-07-01T00:00:00+00:00",
  to_timestamp="2024-07-02T00:00:00+00:00"
)

This will return the raw JSON response from the New Relic REST API v2 containing the specified metrics for the given time range.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "NewRelicMCP" '{"command":"uv","args":["--directory","/Users/mohaji/mcp-servers/newrelic-mcp","run","server.py"],"env":{"NEW_RELIC_API_KEY":"<YOUR_NEW_RELIC_API_KEY>","NEW_RELIC_ACCOUNT_ID":"<YOUR_NEW_RELIC_ACCOUNT_ID>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "NewRelicMCP": {
            "command": "uv",
            "args": [
                "--directory",
                "/Users/mohaji/mcp-servers/newrelic-mcp",
                "run",
                "server.py"
            ],
            "env": {
                "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
                "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your 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

2. Add this to your configuration file:

{
    "mcpServers": {
        "NewRelicMCP": {
            "command": "uv",
            "args": [
                "--directory",
                "/Users/mohaji/mcp-servers/newrelic-mcp",
                "run",
                "server.py"
            ],
            "env": {
                "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
                "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later