Home / MCP / New Relic MCP Server
Provides NRQL-based access to New Relic logs and metrics via an MCP endpoint for LLM-assisted analytics.
Configuration
View docs{
"mcpServers": {
"newrelic_mcp": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/newrelic-mcp",
"run",
"newrelic_logs_server.py"
],
"env": {
"NEW_RELIC_API_KEY": "your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id-here"
}
}
}
}This MCP server lets you query New Relic logs and metrics using NRQL, enabling precise data access through an MCP client. It provides structured results, detailed error handling, and easy integration with Claude Desktop so you can ask natural questions and get actionable NRQL responses.
You connect an MCP client to the New Relic MCP Server to run NRQL queries and receive human-friendly results. Start the server with the configured command, then ask Claude or any MCP client to run NRQL statements such as basic queries, error checks, or performance analyses. Use natural language prompts to request what you want, for example: “Show me the top 5 transactions by duration in the last hour” or “Are there any errors in the latest transactions?” The server handles authentication with your API key and account ID behind the scenes and returns formatted results suitable for browsing or further analysis.
Practical usage patterns include: - Running basic NRQL queries to fetch transaction data - Checking for errors within a time window - Analyzing performance by aggregating duration or other metrics - Requesting clearly formatted outputs for quick decision-making When you finish a session, you can continue asking for follow-up analyses or refine your NRQL queries based on the results.
Prerequisites you need before installation: - Python 3.10 or higher - New Relic account and API key - Claude Desktop application - A network path where you will run the MCP server and where Claude Desktop can access it.
# Install the uv package manager
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"Create a working directory for the MCP server, set up a Python virtual environment using uv, and install the necessary dependencies.
# Create directory
mkdir newrelic-mcp
cd newrelic-mcp
# Create virtual environment
uv venv
# Activate virtual environment
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
# Install dependencies
uv pip install "mcp[cli]" httpxCreate the server file named newrelic_logs_server.py in your project directory and populate it with the provided server code that handles NRQL querying, error reporting, and formatted responses.
Configure environment variables to securely store your New Relic credentials. Use these variables in your shell before starting the server.
# On Unix/macOS
export NEW_RELIC_API_KEY="your-api-key-here"
export NEW_RELIC_ACCOUNT_ID="your-account-id-here"
# On Windows (CMD)
set NEW_RELIC_API_KEY=your-api-key-here
set NEW_RELIC_ACCOUNT_ID=your-account-id-here
# On Windows (PowerShell)
$env:NEW_RELIC_API_KEY = "your-api-key-here"
$env:NEW_RELIC_ACCOUNT_ID = "your-account-id-here"Configure Claude Desktop to run the MCP server via the uv runner. The configuration points Claude to the local project directory and starts the server script.
{
"mcpServers": {
"newrelic": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/newrelic-mcp",
"run",
"newrelic_logs_server.py"
],
"env": {
"NEW_RELIC_API_KEY": "your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id-here"
}
}
}
}Run queries by sending NRQL statements through Claude Desktop or your MCP client. Typical queries include basic data retrieval, error checks, and performance analysis. The server returns results in a readable format suitable for quick interpretation.
SELECT * FROM Transaction SINCE 1 hour agoIf you encounter issues, start by checking that the environment variables are set correctly and that the API key has the proper permissions. Review NRQL syntax in your queries and confirm that the requested data exists in the specified time window. If Claude cannot connect, verify that the Claude Desktop configuration uses the absolute path to your MCP project and that the server process is running.
Never commit API keys to version control. Use environment variables for sensitive data and keep dependencies up to date. Monitor query patterns and access logs to detect unusual activity.
For local testing, set up the environment variables and run the MCP server using the uv runner, then verify that Claude Desktop can connect and issue NRQL queries.
export NEW_RELIC_API_KEY="your-api-key-here"
export NEW_RELIC_ACCOUNT_ID="your-account-id-here"
uv run newrelic_logs_server.pyCommon issues include server not starting, queries not returning results, or Claude failing to connect. Check the Python version, dependency installation, and that the virtual environment is activated. Inspect logs for detailed error messages and ensure the configured NRQL queries are valid and data exists for the requested window.
This server provides a focused interface to New Relic NRQL data via MCP, with a direct path from your MCP client to NRQL execution and readable results.
Executes NRQL queries against New Relic data and returns results in a readable format.
Formats raw NRQL results into a human-friendly response suitable for display in MCP clients.