logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

nr-data-interrogator-mcp

Tool for executing customized New Relic Query Language (NRQL) statements against logs and performance metrics, designed for enhanced observability and detailed analytic retrieval. Ensures robust error reporting and presents final results in a highly consumable, human-centric format.

Author

nr-data-interrogator-mcp logo

Ivlad003

No License

Quick Info

GitHub GitHub Stars 26
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

nrqllogsrelicrelic logsinsights monitoringlogs metrics

New Relic Analytics Connector (MCP)

This Model Context Protocol (MCP) implementation facilitates secure, programmatic access to observational data residing within a New Relic instance. It empowers advanced conversational AI agents (e.g., LLMs such as Claude) to dynamically interrogate system performance and log streams.

MseeP.ai Security Assessment Badge

Core Capabilities

  • NRQL Execution: Run arbitrary NRQL queries against New Relic's metric and event data stores.
  • Diagnostic Fidelity: Incorporates comprehensive internal logging for troubleshooting execution failures.
  • AI Alignment: Output serialization is optimized for consumption by conversational interfaces.
  • Environment Agnostic: Supports configuration via environment variables for secure credential management.
  • Account Scoping: Parameterized to target a specific New Relic organizational account.

Deployment & Setup

Prerequisites: * A runtime environment supporting Python version 3.10 or later. * Valid New Relic Administrator API Key and corresponding Account Identifier. * A host application capable of initiating MCP connections (e.g., Claude Desktop).

Installation Sequence:

  1. Toolchain Initialization (using uv): bash # Unix/Linux/macOS curl -LsSf https://astral.sh/uv/install.sh | sh # Windows PowerShell powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

  2. Project Structure Creation: bash mkdir nr-mcp-agent && cd nr-mcp-agent uv venv source .venv/bin/activate # Shell dependent activation uv pip install "mcp[cli]" httpx

  3. Server Scripting: Create the primary execution file, named newrelic_logs_server.py.

  4. Credential Injection: Set necessary secrets as environment variables. Note: These must persist for the lifespan of the server process. bash # Example for POSIX systems export NEW_RELIC_API_KEY="your-secure-key" export NEW_RELIC_ACCOUNT_ID="your-account-id"

Integration with Host Application (Claude Desktop)

Modify the host application's configuration file (path dependent on OS, e.g., ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) to register this service:

{ "mcpServers": { "newrelic_analyzer": { "command": "uv", "args": [ "run", "newrelic_logs_server.py" ], "workingDirectory": "/absolute/path/to/nr-mcp-agent", "env": { "NEW_RELIC_API_KEY": "${env.NEW_RELIC_API_KEY}", "NEW_RELIC_ACCOUNT_ID": "${env.NEW_RELIC_ACCOUNT_ID}" } } } }

Practical Query Examples (NRQL)

  • Service Latency Overview: Retrieve aggregated duration statistics for all transactions over the last sixty minutes. sql SELECT * FROM Transaction SINCE 1 hour ago

  • Error Triage: Isolate the top ten transactional failures reported within the monitoring window. sql SELECT * FROM Transaction WHERE error IS TRUE SINCE 1 hour ago LIMIT 10

  • Bottleneck Identification: Rank the five slowest entry points based on mean execution time. sql SELECT average(duration) FROM Transaction FACET name ORDER BY average(duration) DESC LIMIT 5

User Interaction Prompts

Examples of queries suitable for direct input to the integrated AI:

  • "Provide a summary of all transactional activity recorded in the past hour."
  • "Scan recent data for any reported application exceptions."
  • "Identify which service endpoints are exhibiting the highest average latency."

Troubleshooting and Diagnostics

  • Log Retrieval: Consult the dedicated server log file for granular failure context. (Paths: tail -f ~/Library/Logs/Claude/mcp-server-newrelic.log or %APPDATA%\Claude\logs\mcp-server-newrelic.log).
  • Validation: Utilize the official MCP Inspector tool to confirm server responsiveness: bash npx @modelcontextprotocol/inspector uv run newrelic_logs_server.py

Security Posture

  • API credentials MUST be managed exclusively via secure environment variables, never hardcoded in source files.
  • Regularly audit third-party dependencies for vulnerabilities.
  • Implement audit logging on the New Relic side to track data access patterns originating from this tool.

See Also

`