Blog Post

Apps on Azure Blog
11 MIN READ

Get started with the New Relic MCP server in Azure SRE Agent

dbandaru's avatar
dbandaru
Icon for Microsoft rankMicrosoft
Apr 29, 2026

Connect Azure SRE Agent to New Relic's observability platform using the official New Relic MCP server for NRQL queries, APM data, logs, infrastructure metrics, alerts, incidents, and entity exploration.

Overview

The New Relic MCP server is a cloud-hosted bridge between your New Relic account and Azure SRE Agent. Once configured, it enables real-time interaction with your observability data—APM traces, distributed traces, logs, metrics, alerts, incidents, dashboards, and entities—through natural language. All actions respect your existing New Relic role and capability assignments.

The server uses Streamable HTTP transport with a single Api-Key header for authentication. Azure SRE Agent connects directly to the New Relic-hosted endpoint (https://mcp.newrelic.com/mcp/)—no npm packages, local proxies, or container deployments are required. The SRE Agent portal includes a dedicated New Relic connector type that pre-populates the endpoint URL and the Api-Key header for streamlined setup.

Key capabilities

AreaCapabilities
NRQLRun NRQL queries against any event type, build queries from natural language, explain existing NRQL
APMSearch applications, view golden signals (throughput, errors, latency), inspect transactions
Distributed tracingFind slow or errored traces, fetch full trace details by trace ID
LogsSearch and filter logs by attribute, service, host, or time range
InfrastructureQuery host metrics (CPU, memory, disk, network), inspect Kubernetes clusters and containers
Alerts & IncidentsList alert policies and conditions, search open and closed incidents, view incident timelines
EntitiesSearch entities (services, hosts, databases, browsers, mobile apps) by name, tag, or domain
DashboardsSearch and retrieve dashboards by name, account, or tag
SyntheticsList synthetic monitors, view recent check results and failures
Errors InboxQuery error groups, occurrences, and stack traces
Change trackingInspect deployment markers and configuration changes correlated with incidents

Note: > This is the official New Relic-hosted MCP server (Preview). Tool availability depends on your New Relic plan, the data your account ingests, and your role-based access control assignments.


Prerequisites

  • Azure SRE Agent resource deployed in Azure
  • New Relic account with an active subscription (Free, Standard, Pro, or Enterprise)
  • New Relic user with appropriate role and capability assignments
  • User API key created from your New Relic account (NRAK-…)
  • (Optional) Your New Relic account ID for NRQL queries that explicitly target a specific account

Step 1: Get your New Relic credentials

The New Relic MCP server requires a User API key, which authenticates the user and inherits that user's role-based permissions. The key is created in the New Relic UI.

Create a User API key

  1. Sign in to New Relic One
  2. Select your user menu (your initials in the bottom-left corner)
  3. Select API keys
    • Direct URL: https://one.newrelic.com/api-keys
  4. Select Create a key in the top-right corner
  5. Configure the key:
    • Key type: Select User
    • Name: Enter a descriptive name (e.g., sre-agent-mcp)
  6. Select Create a key
  7. Copy the key value (starts with NRAK-…)—it is shown only once. If lost, you must create a new key.

Tip: > User API keys inherit the role and capabilities of the user who created them. For production use, create the key from a dedicated service user rather than a personal account so the integration continues to work if team members leave the organization.

Find your account ID

You don't need the account ID for the connector itself (the User API key carries the user's default account). It's still useful for NRQL queries that explicitly scope to a specific account when the user has access to multiple.

  1. From any page in New Relic One, select the account picker in the top navigation
  2. Note the numeric Account ID displayed next to your account name
    • Alternatively, navigate to Administration > Account settings
    • Direct URL: https://one.newrelic.com/admin-portal/organizations/organization-detail

Note: > If you have access to multiple accounts under one organization, the User API key uses the user's default account. Tools that accept an explicit accountId argument can target other accounts the user has access to.

Required role and capabilities

The User API key inherits the permissions of the underlying user. Configure the user's role to grant the capabilities your agent needs:

CapabilityDescriptionRequired?
Logs.readRead log dataRecommended
APM.readRead APM application data, transactions, and tracesRecommended
Infrastructure.readRead infrastructure metrics, hosts, and Kubernetes dataRecommended
Alerts.readRead alert policies, conditions, and incidentsRecommended
Dashboards.readRead dashboardsOptional
Synthetics.readRead synthetic monitor resultsOptional
Entities.readSearch and inspect entitiesRequired
NRQL.executeRun NRQL queriesRequired

Important: > Apply the principle of least privilege. Grant read-only capabilities unless the agent needs to acknowledge incidents, mute conditions, or modify other resources. Avoid using a full-admin user account.


Step 2: Add the MCP connector

Connect the New Relic MCP server to your SRE Agent using the portal. The portal includes a dedicated New Relic connector type that pre-populates the endpoint URL and the Api-Key header.

Using the SRE Agent portal

  1. In the SRE Agent portal, open your agent

  2. In the left navigation, expand Builder and select Connectors

     

  3. Select + Add connector in the toolbar

  4. In the Choose a connector step, scroll to the Additional connectors section under Telemetry and select the New Relic card. The card description reads "Connect to New Relic for application performance monitoring and analytics."

     

  5. Select Next.

  6. In the Set up New Relic connector step, configure the fields:

    FieldValue
    Namenewrelic-mcp (any unique name for this connector)
    URLhttps://mcp.newrelic.com/mcp/ (pre-populated)
    Authentication methodCustom headers (pre-selected)
    KeyApi-Key (pre-populated)
    ValueYour New Relic User API key (NRAK-…)

     

  7. Select Next to advance to Review + test connection. The portal validates the endpoint and credentials.

  8. In the Select tools step, choose which New Relic tools to expose to the agent (or leave the defaults selected).

  9. Select Add connector to save.

Note: > The New Relic connector type pre-populates the endpoint URL (https://mcp.newrelic.com/mcp/), sets the authentication method to Custom headers, and adds the Api-Key header key automatically. You only need to paste in the User API key value (NRAK-…).

Tip: > The single https://mcp.newrelic.com/mcp/ endpoint serves accounts in all New Relic data centers. The User API key includes the account context required to route the request to the correct region.

Once the connector shows Connected status on the Connectors list, the New Relic MCP tools are automatically available to your agent.


Step 3: Create a New Relic subagent

Create a specialized subagent to give the AI focused New Relic observability expertise and better prompt responses.

  1. Navigate to Builder > Subagents
  2. Select Add subagent
  3. Paste the following YAML configuration:
api_version: azuresre.ai/v1
kind: AgentConfiguration
metadata:
  owner: your-team@contoso.com
  version: "1.0.0"
spec:
  name: NewRelicObservabilityExpert
  display_name: New Relic Observability Expert

  system_prompt: |
    You are a New Relic observability expert with access to NRQL, APM data,
    distributed traces, logs, infrastructure metrics, alerts, incidents,
    entities, dashboards, and synthetic monitors via the New Relic MCP server.

    ## Capabilities

    ### NRQL (New Relic Query Language)
    - Run NRQL queries with `run_nrql_query` against any event type
      (Transaction, TransactionError, Log, Metric, SystemSample, etc.)
    - Generate NRQL from natural language with `create_nrql_query`
    - Explain existing NRQL with `explain_nrql_query`
    - Always include a `SINCE` clause to bound the time range

    ### APM (Application Performance Monitoring)
    - Search APM applications with `search_apm_applications`
    - Get golden signals (throughput, errors, latency, Apdex) with
      `get_apm_golden_signals`
    - Inspect slow or errored transactions with NRQL on the Transaction event

    ### Distributed Tracing
    - Search traces with `search_traces` filtered by service, error, or duration
    - Fetch a full trace with `get_trace` using the trace ID
    - Identify the slowest span and the service that owns it

    ### Logs
    - Search logs with `search_logs` using attribute filters and time ranges
    - Use NRQL aggregation on the Log event for grouping and counts
    - Correlate logs with traces using `trace.id` and `span.id` attributes

    ### Infrastructure
    - List hosts with `search_hosts` and filter by tag or status
    - Query host metrics (CPU, memory, disk, network) with NRQL on
      SystemSample, ProcessSample, NetworkSample, StorageSample
    - For Kubernetes, use the K8sClusterSample, K8sPodSample, K8sNodeSample
      event types

    ### Alerts & Incidents
    - List alert policies with `search_alert_policies`
    - List alert conditions with `search_alert_conditions`
    - Search open and closed incidents with `search_incidents`
    - Get full incident details and timeline with `get_incident`

    ### Entities
    - Search entities with `search_entities` across services, hosts,
      databases, browsers, mobile apps, and synthetic monitors
    - Get entity details with `get_entity` including tags, golden metrics,
      and related entities

    ### Dashboards
    - Search dashboards with `search_dashboards`
    - Retrieve dashboard widgets and embedded NRQL with `get_dashboard`

    ### Synthetics
    - List synthetic monitors with `search_synthetic_monitors`
    - Inspect recent check results with `get_synthetic_check_results`

    ### Errors Inbox
    - Query error groups with `search_error_groups`
    - Get occurrences and stack traces with `get_error_group`

    ## Best Practices

    When investigating incidents:
    - Start with `search_incidents` or `get_incident` for context
    - Check related alert conditions with `search_alert_conditions`
    - Pull APM golden signals with `get_apm_golden_signals` for the affected
      service
    - Use `search_traces` to find slow or errored requests
    - Correlate with `search_logs` filtered by service and time range
    - Check `search_hosts` and SystemSample for infrastructure-level problems

    When writing NRQL:
    - Always include `SINCE` (e.g., `SINCE 30 minutes ago`)
    - Use `FACET` to group results by service, host, or status code
    - Use `TIMESERIES` to plot trends over time
    - Use `LIMIT` to bound result size
    - Filter by `appName`, `service.name`, or `host` to scope queries

    When handling errors:
    - If access is denied, explain which capability the user is missing
    - If no data is returned, suggest broadening the time range
    - For multi-account organizations, mention the `accountId` parameter
    - For NRQL syntax errors, use `explain_nrql_query` to validate

  mcp_connectors:
    - newrelic-mcp

  handoffs: []
  1. Select Save
  2. Click to edit the created sub-agent and scroll down to Tools to add the New Relic tools

 


Step 4: Add a New Relic skill (optional)

Skills provide contextual knowledge and best practices that help agents use tools more effectively. Create a New Relic skill to give your agent expertise in NRQL, APM analysis, and incident investigation workflows.

  1. Navigate to Builder > Skills
  2. Select Add skill
  3. Paste the following skill configuration:
api_version: azuresre.ai/v1
kind: SkillConfiguration
metadata:
  owner: your-team@contoso.com
  version: "1.0.0"
spec:
  name: newrelic_observability
  display_name: New Relic Observability

  description: |
    Expertise in New Relic's observability platform including NRQL, APM,
    distributed tracing, logs, infrastructure metrics, alerts, incidents,
    entities, dashboards, and synthetics. Use for running NRQL queries,
    investigating slow services, analyzing traces, searching logs, inspecting
    incidents, and navigating New Relic data via the New Relic MCP server.

  instructions: |
    ## Overview

    New Relic is a cloud-scale observability platform for APM, distributed
    tracing, logs, metrics, infrastructure, browser, mobile, and synthetics.
    NRQL (New Relic Query Language) is the unified query language across all
    event types.

    **Authentication:** A single `Api-Key` header containing a User API key
    (`NRAK-…`). The key inherits the role and capabilities of the user who
    created it, and the user's default account scopes the queries.

    **Endpoint:** `https://mcp.newrelic.com/mcp/` — a single endpoint serves
    accounts in all New Relic data centers (US, EU, FedRAMP).

    ## Writing NRQL queries

    NRQL syntax is similar to SQL but optimized for time-series event data.

    **Common patterns:**

    ```sql
    -- Errors per service in the last hour
    SELECT count(*) FROM TransactionError
    SINCE 1 hour ago
    FACET appName

    -- p95 latency by transaction
    SELECT percentile(duration, 95) FROM Transaction
    WHERE appName = 'checkout-api'
    SINCE 30 minutes ago
    FACET name TIMESERIES

    -- Top error messages from logs
    SELECT count(*) FROM Log
    WHERE level = 'ERROR' AND service.name = 'payment-api'
    SINCE 1 hour ago
    FACET message LIMIT 10

    -- Host CPU utilization
    SELECT average(cpuPercent) FROM SystemSample
    WHERE hostname LIKE 'web-prod-%'
    SINCE 30 minutes ago
    TIMESERIES

    -- Apdex by application
    SELECT apdex(duration, t: 0.5) FROM Transaction
    SINCE 1 hour ago
    FACET appName
    ```

    Always include `SINCE`. Use `FACET` for grouping, `TIMESERIES` for trends,
    `LIMIT` to bound results, and `WHERE` to filter.

    ## APM investigation workflow

    1. `search_apm_applications` — find the affected service
    2. `get_apm_golden_signals` — pull throughput, error rate, response time, Apdex
    3. NRQL on Transaction — drill into slow or failing transactions
    4. NRQL on TransactionError — identify error classes and frequencies
    5. `search_traces` — find specific slow or errored traces
    6. `get_trace` — inspect span timing and errors
    7. `search_logs` — correlate logs by `trace.id` or `service.name`

    ## Distributed trace investigation

    Use `search_traces` for span-level queries and `get_trace` for full traces.

    **Workflow:**
    1. Search for slow or errored traces with `search_traces`
    2. Get the full trace with `get_trace` using the trace ID
    3. Identify the bottleneck span (longest duration or error)
    4. Note the owning service and operation name
    5. Correlate with `search_logs` using the `trace.id` attribute
    6. Check `get_apm_golden_signals` for the bottleneck service

    ## Log analysis

    Use `search_logs` for filtered retrieval and NRQL on the Log event for
    aggregation.

    **Common log filters:**

    ```
    # Errors from a specific service
    service.name:payment-api level:ERROR

    # Logs containing a trace ID
    trace.id:abc123def456

    # Logs from a Kubernetes pod
    k8s.namespace.name:production k8s.deployment.name:checkout

    # HTTP 5xx responses
    http.statusCode:>=500
    ```

    **Aggregations on the Log event:**

    ```sql
    SELECT count(*) FROM Log
    WHERE level = 'ERROR'
    SINCE 1 hour ago
    FACET service.name
    LIMIT 20
    ```

    ## Infrastructure investigation

    New Relic infrastructure data lives in event types:

    | Event type | Purpose |
    |------------|---------|
    | `SystemSample` | Host CPU, memory, disk, load average |
    | `ProcessSample` | Per-process CPU and memory usage |
    | `NetworkSample` | Network interface throughput, errors, drops |
    | `StorageSample` | Disk capacity and I/O |
    | `K8sClusterSample` | Kubernetes cluster-level metrics |
    | `K8sNodeSample` | Kubernetes node metrics |
    | `K8sPodSample` | Pod-level CPU, memory, restart counts |
    | `K8sContainerSample` | Container-level metrics |

    ## Incident investigation workflow

    For structured incident investigation:
    1. `search_incidents` — find recent or active incidents
    2. `get_incident` — get full incident details and timeline
    3. `search_alert_conditions` — check which conditions triggered
    4. `search_logs` — search for errors around the incident time
    5. NRQL on Transaction/TransactionError — check service health
    6. `search_traces` — inspect request traces for latency or errors
    7. `search_hosts` — verify infrastructure health
    8. Check change tracking markers near the incident start time

    ## Working with entities

    New Relic entities include services (APM, browser, mobile), hosts,
    databases, queues, synthetic monitors, dashboards, and workloads.

    - Use `search_entities` to find entities by name, domain, or tag
    - Use `get_entity` to retrieve tags, golden metrics, and related entities
    - Filter by `domain` (APM, INFRA, BROWSER, MOBILE, SYNTH, EXT) to narrow

    ## Troubleshooting

    | Issue | Solution |
    |-------|----------|
    | 401 Unauthorized | Verify the User API key is valid and starts with `NRAK-` |
    | 403 Forbidden | The user's role lacks the required capability—check role assignments |
    | No data returned | Confirm the account ID is correct and contains data for the queried event type |
    | Wrong region | Ensure the connector URL matches your data center (US, EU, or FedRAMP) |
    | NRQL syntax error | Use `explain_nrql_query` to validate before running |
    | Cross-account query | Pass `accountId` explicitly if the user has access to multiple accounts |

  mcp_connectors:
    - newrelic-mcp
  1. Select Save

Reference the skill in your subagent

Update your subagent configuration to include the skill:

spec:
  name: NewRelicObservabilityExpert
  skills:
    - newrelic_observability
  mcp_connectors:
    - newrelic-mcp

Step 5: Test the integration

  1. Open a new chat session with your SRE Agent
  2. Try these example prompts:

NRQL queries

Run NRQL: SELECT count(*) FROM TransactionError SINCE 1 hour ago FACET appName

Show me the p95 response time for the checkout-api over the last 30 minutes

Build me an NRQL query to find the top 10 slowest transactions in the payment-api

Explain this NRQL query: SELECT rate(count(*), 1 minute) FROM Transaction FACET appName

APM and traces

Show me the golden signals for the payment-api service in the last hour

Find the slowest distributed traces for the checkout-api in the last 30 minutes

Get the full trace details for trace ID abc123def456

What is the error rate trend for the api-gateway over the last 4 hours?

Log analysis

Search for ERROR logs from the payment-api service in the last hour

Count log errors grouped by service over the last 24 hours

Find logs containing trace.id abc123def456

Show me HTTP 5xx responses across all services in the last 30 minutes

Incident investigation

Show me all open incidents in the last 24 hours

Get details for incident 12345 including the timeline and triggered condition

What alert conditions triggered during the most recent incident?

Correlate the latest incident with related logs and traces

Infrastructure

What is the CPU utilization across all production hosts in the last 30 minutes?

Show me memory pressure on web-prod-01 over the last hour

Find Kubernetes pods that have restarted in the last 24 hours

List hosts tagged with env:production and team:platform

Entities and dashboards

Search for all APM services tagged with team:checkout

Get details for the entity named payment-api including its tags and related services

List all dashboards related to "Checkout" or "Payments"

What synthetic monitors are currently failing?

Available tools

The New Relic MCP server exposes the following core tools. Tool availability depends on your New Relic plan and the user's role capabilities.

ToolDescription
run_nrql_queryExecute an NRQL query and return results
create_nrql_queryGenerate an NRQL query from a natural language prompt
explain_nrql_queryGet a plain English explanation of an NRQL query
search_apm_applicationsSearch APM applications by name, language, or tag
get_apm_golden_signalsGet throughput, error rate, response time, and Apdex for an APM service
search_tracesSearch distributed traces by service, error, or duration
get_traceFetch a full distributed trace by trace ID
search_logsSearch logs by attribute filters and time ranges
search_hostsSearch infrastructure hosts by name, tag, or status
search_entitiesSearch entities (services, hosts, dashboards, monitors) across domains
get_entityGet entity details including tags, golden metrics, and related entities
search_alert_policiesList alert policies in the account
search_alert_conditionsList alert conditions, optionally filtered by policy
search_incidentsSearch open and closed incidents
get_incidentGet full incident details and timeline
search_dashboardsSearch dashboards by title, account, or tag
get_dashboardRetrieve dashboard widgets and embedded NRQL
search_synthetic_monitorsList synthetic monitors
get_synthetic_check_resultsGet recent check results for a synthetic monitor
search_error_groupsQuery Errors Inbox for error groups
get_error_groupGet occurrences and stack traces for an error group
search_change_markersList deployment markers and configuration changes

 

Related content

Updated Apr 29, 2026
Version 1.0
No CommentsBe the first to comment