Disclaimer: This is a personal project and is not an official New Relic product. It is not supported, endorsed, or maintained by New Relic, Inc. Use at your own risk.
An MCP (Model Context Protocol) server that gives Claude structured access to New Relic observability data with interactive chart visualizations, plus an AI-powered error inbox triage agent. Built for AI-driven incident investigation — tools are organized around investigation workflows, not data types.
Core Observability
| Tool | Type | Description |
|---|---|---|
| nrql-query | View | Execute custom NRQL with auto-detected charts (line, bar, area, table, funnel, raw JSON) |
| entity-health | View | Fleet-wide health overview across APM, Browser, Infrastructure, and Synthetics |
| alert-incidents | View | Active alert incidents and AI-grouped issues timeline |
| dashboard | View | List user-defined NR dashboards or render a specific dashboard inline (executes every widget's NRQL on the server) |
| describe-event | Text | Schema discovery for any event type — attributes, types, sample values |
APM
| Tool | Type | Description |
|---|---|---|
| apm-dashboard | View | Curated performance dashboard (response time percentiles, throughput, errors, Apdex, slowest txns) |
| deployment-impact | View | Deploy analysis — single deploy deep dive OR list recent deploys across all services with error rate correlation |
| service-dependencies | View | Upstream/downstream service topology with call counts, latency, and per-caller error rates |
Error Investigation (workflow tools)
| Tool | Type | Description |
|---|---|---|
| error-inbox | Text | Grouped errors with frequency, 7-day trend with change-point detection, and NEW error flagging |
| error-trace | Text | One-call root cause: error → distributed trace → correlated logs → request attributes → replay link |
| browser-error-trace | Text | JS error / AJAX analysis → backend trace → logs (also works as standalone AJAX failure analysis) |
| trace-detail | View | Full distributed trace waterfall with span timing, browser/APM origin tags, and auto-discovery |
Digital Experience Monitoring (DEM)
| Tool | Type | Description |
|---|---|---|
| browser-funnel | View | Conversion funnel with per-step performance, segmentation, auto-correlated errors, auto-detected steps |
| session-timeline | View | Session journey with replay link — PageView, BrowserInteraction, AjaxRequest, UserAction, PageAction, JavaScriptError |
Logs
| Tool | Type | Description |
|---|---|---|
| log-search | Text | Search logs with fuzzy entity matching, around timestamp parameter (±5min), and agent log filtering |
Compound Workflow Tools
| Tool | Type | Description |
|---|---|---|
| investigation-summary | Text | Fleet-wide triage in one call — find unhealthy services, top errors, recent deploys, trace root cause, pull logs |
| observability-audit | Text | Maturity scorecard across 10 dimensions — DT coverage, log correlation, alert noise, browser DT, deploy markers, ingest cost |
Tools with "View" type return interactive React chart widgets rendered inline in the chat. "Text" tools return structured text optimized for Claude's reasoning.
- Fuzzy entity resolution — all tools accept approximate app names (
shippingservice→Shipping Service) with automatic case-insensitive, normalized, and substring matching - Cross-service error propagation —
browser-error-tracewalks from a JS error through AJAX failures to backend distributed traces automatically - TraceId sampling fallback — when TransactionError traceIds don't have corresponding Span data (agent sampling), tools automatically fall back to Span-sourced traceIds
- Synthetic traffic filtering — browser tools exclude synthetic monitor traffic by default (
monitorId IS NULL) - Session replay detection —
error-trace,session-timeline, andbrowser-error-tracecheck for replay availability and surface links - SPA detection —
browser-funneldetects single-page apps via BrowserInteraction route changes and surfaces guidance
A standalone CLI tool that uses Claude to automatically triage New Relic Error Inbox errors. It:
- Prioritizes error groups by business impact (P0 / P1 / P2)
- Identifies noise — duplicate root causes, transient errors, mute candidates
- Flags regressions — recently introduced errors that need immediate attention
- Suggests verification steps — concrete NRQL queries, logs, and dashboards to investigate
- Finds cross-cutting patterns — systemic issues spanning multiple services
The output is a structured markdown report ready for engineers or downstream AI agents (bug fixers).
- Node.js 18+
- A New Relic User API key
- An Anthropic API key (for the triage agent only)
git clone git@github.com:adjohn/newrelic-mcp-app.git
cd newrelic-mcp-app
npm install
npm run buildAdd to your claude_desktop_config.json:
{
"mcpServers": {
"newrelic": {
"command": "npx",
"args": ["tsx", "/path/to/newrelic-mcp-app/server.ts"],
"env": {
"NEW_RELIC_API_KEY": "NRAK-your-key-here",
"NEW_RELIC_ACCOUNT_ID": "12345",
"NEW_RELIC_REGION": "US"
}
}
}
}Each user provides their own NR API key in the config. The key never leaves the local machine.
- Start the server with a tunnel (e.g., cloudflared):
npm run serve cloudflared tunnel --url http://localhost:3001
- In Claude.ai → Settings → Connectors → Add Custom Connector
- Set the endpoint URL to your tunnel URL +
/mcp - Add auth headers with your NR credentials:
x-nr-api-key: Your NR User API keyx-nr-account-id: Your account IDx-nr-region:USorEU(optional, defaults to US)
The server extracts credentials from these headers per-session, so each user can have their own key.
With environment variables:
NEW_RELIC_API_KEY=NRAK-... NEW_RELIC_ACCOUNT_ID=12345 npm run serveOr with a .env file:
cp .env.example .env
# Edit .env with your keys
npm run devNEW_RELIC_API_KEY=NRAK-... # New Relic User API key
NEW_RELIC_ACCOUNT_ID=12345 # Your account ID
NEW_RELIC_REGION=US # US or EU
ANTHROPIC_API_KEY=sk-ant-... # Anthropic API key (for triage agent only)
The server starts on http://localhost:3001 (configurable via PORT env var) with endpoints:
POST /mcp— MCP request handlerGET /mcp— Streamable HTTP transport (SSE)DELETE /mcp— Session cleanupGET /health— Health check
The server resolves credentials in this order (first wins):
- HTTP headers (
x-nr-api-key,x-nr-account-id) — for Claude.ai custom connectors - Environment variables (
NEW_RELIC_API_KEY,NEW_RELIC_ACCOUNT_ID) — for Claude Desktop / standalone - Tool parameters (
accountIdon individual tool calls) — per-request override
Run against your New Relic account (last 24 hours):
npm run triageRun with a wider time window:
npm run triage:weekUse mock data to test the full pipeline without New Relic:
npm run triage -- --mock--account-id <id> New Relic account ID (or set NEW_RELIC_ACCOUNT_ID)
--since <timerange> NRQL time range (default: "24 hours ago")
--limit <n> Max error groups to fetch (default: 50)
--output-dir <path> Report output directory (default: "reports/")
--model <model> Claude model for analysis
--mock Use realistic sample data instead of querying New Relic
--help Show help
The triage agent generates a markdown report in reports/ with:
- Executive Summary — high-level assessment of error inbox health
- Priority Errors — P0/P1/P2 ranked errors with business impact, reasoning, verification steps, and sample stack traces
- Regression Alerts — newly introduced errors with severity and evidence
- Noise Reduction — error groups to merge, mute, or reclassify
- Cross-Cutting Patterns — systemic issues spanning multiple services
- Appendix — full table of all error groups
server.ts # MCP server + 15 tool definitions + fuzzy entity resolution
src/
├── nerdgraph.ts # New Relic NerdGraph (GraphQL) API wrapper
├── triage/
│ ├── index.ts # CLI entrypoint
│ ├── fetcher.ts # Parallel NerdGraph/NRQL data fetching
│ ├── analyzer.ts # Claude-powered error analysis
│ ├── reporter.ts # Markdown report generation
│ ├── mock-data.ts # 13 realistic sample error groups
│ └── types.ts # TypeScript type definitions
└── views/
├── shared/ # Shared React components and theme
│ ├── theme.ts # Dark NR theme, global CSS
│ └── components.tsx # StatCard, ChartContainer, LoadingState, ErrorState
├── nrql-explorer/ # Interactive NRQL charts (line, bar, area, table, funnel, raw)
├── entity-health/ # Entity health dashboard
├── alert-timeline/ # Alert incident timeline
├── apm-dashboard/ # APM performance dashboard
├── deployment-impact/ # Deployment impact analysis
├── trace-waterfall/ # Distributed trace waterfall with span origin tags
├── service-dependencies/ # Service topology diagram + dependency tables
├── session-timeline/ # Per-session user journey timeline (6 event types)
└── browser-funnel/ # Conversion funnel with perf metrics + segmentation
- Workflow tools over data tools —
error-traceandbrowser-error-traceencode investigation patterns (error → trace → logs → replay), collapsing 4-5 manual tool calls into one - Dual content — tools return text summaries for Claude's reasoning AND JSON payloads for interactive React chart views bundled as single-file HTML via
vite-plugin-singlefile - Fuzzy resolution everywhere — entity names are resolved via a cached 4-phase matcher (exact → case-insensitive → normalized → substring) before any NRQL query runs
- Sampling-aware — trace tools detect when TransactionError traceIds have no corresponding Spans (due to agent sampling) and automatically fall back to Span-sourced traceIds
- Session-per-client — each MCP connection gets its own
McpServerinstance with all tools registered, managed viaStreamableHTTPServerTransportwith session IDs
The triage agent fetches error data via four parallel NerdGraph queries (counts, timings, user impact, sample details), sends the enriched data to Claude for analysis, and generates a structured markdown report.
MIT