New Relic MCP Server
Enables natural language access to New Relic for monitoring, querying, and managing dashboards, entities, alerts, and deployments via the Model Context Protocol.
README
New Relic MCP Server
A comprehensive Model Context Protocol (MCP) server for New Relic monitoring, observability, and management operations.
Features
Core Monitoring & Observability
- NRQL Query Execution: Run custom New Relic Query Language queries
- Application Performance: Real-time performance metrics (response time, throughput)
- Error Monitoring: Error rates, counts, and detailed error analysis
- Infrastructure Monitoring: Host metrics, CPU, memory, disk usage
- Incident Management: Recent incidents, violations, and alert status
Dashboard Management
- Dashboard Operations: Create, read, update, and delete dashboards
- Widget Management: Add, update, and remove dashboard widgets with rawConfiguration support for dual y-axis, fixed y-axis ranges, legend control, and chart styles
- Search & Discovery: Find dashboards by name or GUID
- Visualization Support: Line charts, bar charts, pie charts, tables, billboards
Entity Management
- Entity Search: Find any New Relic entity (APM apps, hosts, synthetic monitors, browsers) by name, type, domain, or tags
- Entity Tagging: Add, update, and delete tags on any entity
- Service Levels: List all SLIs/SLOs with compliance data and objectives
- Synthetic Monitors: List monitors with status, success rate, and location health; query recent check results
Alert & Notification System
- Alert Policies: Create and manage alert policies with configurable incident preferences
- NRQL Conditions: Set up custom alert conditions with thresholds and triggers
- Notification Destinations: Configure email, Slack, webhook, PagerDuty integrations
- Notification Channels: Link destinations to specific notification preferences
- Workflows: Connect alert policies to notification channels with filtering
Deployment Tracking
- Deployment Markers: Track deployment events and their impact
- Release Correlation: Correlate performance changes with deployments
Installation
Prerequisites
- Python 3.11+ (recommended: use
uvfor fast dependency management) - New Relic User API Key (not Ingest key)
- New Relic Account ID
Quick Start
# Clone the repository
git clone <repository-url>
cd mcp-newrelic
# Install dependencies (using uv - recommended)
uv sync
# Or using pip
pip install -e .
# Configure your credentials (see Configuration section below)
Setup
Getting Your Credentials
- API Key: Go to New Relic API Keys → Create User API Key
- Account ID: Found in your New Relic URL:
https://one.newrelic.com/accounts/{ACCOUNT_ID}/... - Region: Use "EU" if your account is on
one.eu.newrelic.com, otherwise "US"
MCP Client Integration
Add the server to your MCP client config. You do not need to start the server manually — your MCP client launches it automatically.
{
"mcpServers": {
"newrelic": {
"command": "uv",
"args": ["run", "python", "/path/to/mcp-newrelic/server.py"],
"env": {
"NEW_RELIC_API_KEY": "your-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}
Where this config lives depends on your client (e.g., ~/.claude.json for Claude Code, claude_desktop_config.json for Claude Desktop, .cursor/mcp.json for Cursor, etc.). Replace /path/to/mcp-newrelic/server.py with the actual path to your clone.
Alternatively, use the newrelic-mcp console script instead of pointing at server.py:
{
"mcpServers": {
"newrelic": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-newrelic", "newrelic-mcp"],
"env": {
"NEW_RELIC_API_KEY": "your-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}
Advanced Configuration
If you need to run the server manually (e.g., for development or debugging), it supports flexible configuration with clear precedence (highest to lowest):
1. Command Line Arguments (Highest Priority)
uv run python server.py \
--api-key "NRAK-your-api-key" \
--account-id "your-account-id" \
--region "US"
2. JSON Configuration File
# Copy and edit the example config
cp newrelic-config.json.example config/newrelic-config.json
# Run with config file
uv run python server.py --config config/newrelic-config.json
Example newrelic-config.json:
{
"api_key": "NRAK-your-api-key",
"account_id": "your-account-id",
"region": "US",
"timeout": 30
}
3. Environment Variables (Lowest Priority)
export NEW_RELIC_API_KEY="NRAK-your-api-key"
export NEW_RELIC_ACCOUNT_ID="your-account-id"
export NEW_RELIC_REGION="US" # US or EU
export NEW_RELIC_TIMEOUT="30"
Available Tools
NRQL & Monitoring
query_nrql: Execute custom NRQL queries with full flexibilityget_app_performance: Application performance metrics (avg/p95 response time, throughput)get_app_errors: Error metrics, counts, and error analysisget_incidents: Recent incidents with time filteringget_infrastructure_hosts: Infrastructure host metrics (CPU, memory, disk)get_alert_violations: Recent alert violations and statusget_deployments: Deployment markers and impact analysis
Dashboard Management
get_dashboards: List and search dashboards with filteringget_dashboard_widgets: Retrieve all widgets from a dashboardcreate_dashboard: Create new dashboards for monitoringupdate_dashboard: Rename a dashboard and/or update its description (pages and widgets preserved)delete_dashboard: Delete a dashboard by GUIDadd_widget_to_dashboard: Add custom NRQL-based widgetsupdate_widget: Update existing dashboard widgetsdelete_widget: Remove widgets from dashboards
Entity Management
entity_search: Search for any entity by name, type (APPLICATION, HOST, MONITOR, KEY_TRANSACTION), or domain (APM, INFRA, SYNTH, BROWSER, EXT). Supportslimit(default 25, max 200) andminimal_outputto reduce response size.get_entity: Look up a single entity by GUID with full details (name, type, account, tags, permalink, type-specific metadata)decode_entity_guid: Decode a base64-encoded entity GUID to reveal account ID, domain, entity type, and domain ID without an API callget_entity_tags: Get all tags for an entity by GUIDadd_tags_to_entity: Add or update key-value tags on an entityreplace_tags_on_entity: Replace all tags on an entity (overwrites existing)delete_tags_from_entity: Remove tag keys from an entitydelete_tag_values: Delete specific tag key-value pairs from an entitylist_service_levels: List all SLIs/SLOs with compliance data and objectivesget_service_level: Get full SLI definitions (event queries, objectives, time windows) for an entitycreate_service_level: Create a Service Level Indicator on an entityupdate_service_level: Update an SLI's name, description, event queries, or objectivesdelete_service_level: Delete an SLI by its SERVICE_LEVEL entity GUIDlist_synthetic_monitors: List all synthetic monitors with status, success rate, and location healthget_synthetic_results: Get recent pass/fail check results per location for a specific monitor
Alert & Notification Management
create_alert_policy: Create alert policies with incident preferencesupdate_alert_policy: Update an existing alert policydelete_alert_policy: Delete an alert policy by IDcreate_nrql_condition: Create NRQL-based alert conditionsupdate_nrql_condition: Update an existing NRQL alert conditiondelete_nrql_condition: Delete a NRQL alert condition by IDcreate_notification_destination: Set up notification endpoints (email, Slack, webhook, PagerDuty)delete_notification_destination: Delete a notification destination by IDcreate_notification_channel: Create notification channelsdelete_notification_channel: Delete a notification channel by IDcreate_workflow: Connect alerts to notifications with filteringupdate_workflow: Update a workflow's name, enabled state, channels, or issues filterdelete_workflow: Delete a workflow by IDcreate_muting_rule: Create a muting rule to suppress alert notifications during scheduled windowslist_muting_rules: List all muting rules with their conditions and schedulesupdate_muting_rule: Update a muting rule's name, conditions, schedule, or enabled statedelete_muting_rule: Delete a muting rule by IDlist_alert_policies: List all alert policieslist_alert_conditions: List alert conditions with optional filters by policy, name, or NRQL querylist_notification_destinations: List all notification destinationslist_notification_channels: List all notification channelslist_workflows: List all alert workflows
MCP Resources
Access structured data through these MCP resources:
newrelic://applications: Complete list of monitored applicationsnewrelic://incidents/recent: Recent incidents and alert summarynewrelic://dashboards: Dashboard metadata (name, GUID, created date, URL)newrelic://alerts/policies: Alert policies and configurationsnewrelic://alerts/conditions: Alert conditions across all policiesnewrelic://alerts/workflows: Workflow configurations and notifications
Architecture
Design
- Strategy Pattern: Tool handlers using pluggable strategy implementations
- Composition:
NewRelicClientcomposes specialized sub-clients (monitoring,alerts,dashboards,entities) instead of using multiple inheritance - Configuration: Hierarchical config (CLI > file > env vars) with validation
- Error Handling: Typed
ApiErrordataclass for consistent error propagation - Pagination: Cursor-based pagination for NerdGraph queries (entity search, dashboards, alert policies, conditions, notification destinations/channels, workflows, service levels, synthetic monitors)
- Resilience: Bounded retry with backoff on HTTP 429/502/503/504, honoring
Retry-After
Key Components
NewRelicClient: Unified client composing all specialized sub-clientsAlertsClient: Alert policies, conditions, and notification managementDashboardsClient: Dashboard and widget operationsEntitiesClient: Entity search, tagging, service levels, and synthetic monitorsMonitoringClient: NRQL queries and performance monitoringToolHandlers: Strategy-based dispatcher for MCP tool callsResourceHandlers: MCP resource operations and data formatting
Docker Support
Build
docker build -t newrelic-mcp-server .
MCP Client Integration (Recommended)
The server speaks MCP over stdio, so your MCP client should launch the container itself with
docker run -i --rm (interactive stdin, removed on exit):
{
"mcpServers": {
"newrelic": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "NEW_RELIC_API_KEY",
"-e", "NEW_RELIC_ACCOUNT_ID",
"newrelic-mcp-server"
],
"env": {
"NEW_RELIC_API_KEY": "your-api-key",
"NEW_RELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}
A docker-compose.yml is included, but compose keeps an idle long-running container —
since MCP clients spawn the server on demand, prefer the docker run -i --rm client
config above. Compose is mainly useful for keeping a pre-built image and env wiring
around during development.
Image Details
The Dockerfile is a single-stage build on python:3.11-slim that:
- installs locked dependencies with
uv sync --frozen(dependency layer cached separately from source) - copies the application source and installs the project
- runs as a non-root
mcpuser - starts the stdio server via
uv run python server.py(no ports exposed — communication is over stdin/stdout)
Development
Development Setup
# Install development dependencies
uv sync --dev
# Install pre-commit hooks
uv run pre-commit install
# Run quality checks
uv run ruff check . # Linting
uv run ruff format . # Formatting
uv run mypy newrelic_mcp/ # Type checking
uv run pylint newrelic_mcp/ # Additional analysis
Code Quality
This project maintains high code quality with:
- Ruff: Fast linting and formatting
- MyPy: Static type checking
- Pylint: Additional code analysis
- Pre-commit hooks: Automated quality checks
- Comprehensive type annotations: Full type coverage
Testing
# Run all tests
uv run pytest tests/
# Run with verbose output
uv run pytest tests/ -v
For detailed development information, see DEVELOPMENT.md.
Example Usage
Complete Alert Setup Workflow
# 1. Create alert policy
create_alert_policy(name="High CPU Usage Policy")
# 2. Create NRQL condition
create_nrql_condition(
policy_id="policy-id-from-step-1",
name="High CPU Alert",
nrql_query="SELECT average(cpuPercent) FROM SystemSample",
threshold=80
)
# 3. Create notification destination
create_notification_destination(
name="Team Email",
type="EMAIL",
properties={"email": "alerts@company.com"}
)
# 4. Create notification channel
create_notification_channel(
name="CPU Alert Channel",
destination_id="destination-id-from-step-3",
type="EMAIL"
)
# 5. Create workflow
create_workflow(
name="CPU Alert Workflow",
channel_ids=["channel-id-from-step-4"]
)
Requirements
- Python: 3.11 or higher
- New Relic API Key: User API key (starts with
NRAK-orNRAA-) - New Relic Account: Valid account with appropriate permissions
- Dependencies: Managed automatically with
uvorpip
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please:
- Read DEVELOPMENT.md for setup instructions
- Follow the established code style and quality standards
- Add tests for new functionality
- Update documentation as needed
Support
- Documentation: Check DEVELOPMENT.md for detailed guides
- Issues: Report bugs and feature requests via GitHub Issues
- New Relic API: Official New Relic API Documentation
- MCP Protocol: Model Context Protocol Specification
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.