New Relic MCP Server
The New Relic MCP Server provides programmatic access to New Relic's monitoring and observability platform, enabling AI assistants and tools to interact with New Relic data.
Capabilities:
APM Application Management: List applications, retrieve details, metrics, and metric data with customizable time ranges
Data Querying & Analysis: Execute NRQL queries and custom NerdGraph GraphQL queries with variables; search across all entity types with query filtering
Log Management: Create, update, delete, and test log parsing rules; intelligently generate GROK patterns and NRQL filters from log samples or live queries with field type hints
Alerting & Monitoring: List and retrieve alert policy details; access synthetic monitor information and configurations
Dashboards: List dashboards and retrieve configurations with widget details
Infrastructure Monitoring: List monitored servers and retrieve detailed server information
Deployment Tracking: List application deployments and create new deployment markers with revision, changelog, and metadata
User Management: List account users and retrieve user details
Credential Management: Securely manage API credentials in macOS keychain with store, status check, and delete operations
Provides comprehensive access to New Relic's monitoring and observability platform, enabling management of APM applications, execution of NRQL queries, alert policy management, synthetic monitoring, dashboard access, infrastructure monitoring, deployment tracking, and user management through both REST APIs and NerdGraph GraphQL interface.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@New Relic MCP Server show me the top 5 slowest applications in the last hour"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
New Relic MCP Server
A Model Context Protocol (MCP) server that provides programmatic access to New Relic APIs, enabling AI assistants and other tools to interact with New Relic monitoring and observability data.
See also: newrelic-cli - Command-line interface with the same New Relic functionality.
Features
APM Application Management: List and retrieve application details, metrics, and metric data
NRQL Queries: Execute NRQL queries via NerdGraph
Log Parsing Rules: Intelligently create, manage, and test GROK patterns for log parsing
Alert Policies: List and manage alert policies
Synthetic Monitoring: Access synthetic monitor information
Dashboards: List and retrieve dashboard configurations
Entity Search: Search across all New Relic entities
Infrastructure: Monitor servers and infrastructure components
Deployments: Track and create application deployments
User Management: List and manage users
NerdGraph: Execute custom GraphQL queries
Related MCP server: New Relic NerdGraph MCP Server
Installation
Option 1: Install from PyPI (Recommended)
pip install newrelic-mcp-serverOption 2: Install from Source
# Clone this repository
git clone https://github.com/piekstra/newrelic-mcp-server.git
cd newrelic-mcp-server
# Install in development mode
pip install -e .Configuration
Secure Credential Setup (Recommended for macOS)
For enhanced security on macOS, use the built-in keychain storage instead of environment variables:
# Run the secure setup wizard
newrelic-mcp-setup
# Or set up manually with Python
python -m newrelic_mcp.credentialsThis will securely store your API key and account ID in the macOS Keychain, eliminating the need to store sensitive credentials in plain text files.
Environment Variables (Alternative)
If you prefer environment variables or are not on macOS, you can use:
# Required
export NEWRELIC_API_KEY="your-api-key-here" # Your New Relic User API key
# Optional
export NEWRELIC_REGION="US" # or "EU" (default: "US")
export NEWRELIC_ACCOUNT_ID="your-account-id" # Required for some operationsNote: The server will automatically prefer keychain storage over environment variables when both are available.
Getting Your API Key
Log in to New Relic
Navigate to the API Keys page
Create a new User API key (starts with
NRAK)Copy the key and set it as the
NEWRELIC_API_KEYenvironment variable
Usage
With Claude Desktop
Option 1: Using Secure Keychain (Recommended for macOS)
After setting up credentials with newrelic-mcp-setup, add the following to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"newrelic": {
"command": "newrelic-mcp-server",
"env": {
"NEWRELIC_REGION": "US"
}
}
}
}Option 2: Using Environment Variables (Less Secure)
{
"mcpServers": {
"newrelic": {
"command": "newrelic-mcp-server",
"env": {
"NEWRELIC_API_KEY": "your-api-key-here",
"NEWRELIC_REGION": "US",
"NEWRELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}Security Note: Option 1 is strongly recommended as it keeps your sensitive API key out of configuration files.
With Other MCP Clients
# Start the server directly
newrelic-mcp-server
# Or run as a module
python -m newrelic_mcpAvailable Tools
Application Management
list_applications- List all APM applicationsget_application- Get details for a specific applicationget_application_metrics- Get available metrics for an applicationget_application_metric_data- Get metric data with time range filtering
Querying
query_nrql- Execute NRQL queries for data analysisnerdgraph_query- Execute custom NerdGraph GraphQL queries
Monitoring
list_alert_policies- List all alert policiesget_alert_policy- Get specific alert policy detailslist_synthetic_monitors- List synthetic monitorsget_synthetic_monitor- Get synthetic monitor details
Dashboards & Visualization
list_dashboards- List all dashboardsget_dashboard- Get dashboard configuration and widgets
Infrastructure
list_servers- List monitored serversget_server- Get server detailssearch_entities- Search across all entity types
Deployment Tracking
list_deployments- List application deploymentscreate_deployment- Record new deployments
User Management
list_users- List account usersget_user- Get user details
Log Parsing Rules
list_log_parsing_rules- List all log parsing rules for an accountcreate_log_parsing_rule- Create a new log parsing rule with GROK pattern and NRQL filterupdate_log_parsing_rule- Update an existing log parsing ruledelete_log_parsing_rule- Delete a log parsing ruletest_log_parsing_rule- Test a GROK pattern against sample logs (generates pattern if not provided)generate_log_parsing_rule- Intelligently generate GROK patterns from log samples or NRQL queries
Credential Management
manage_credentials- Securely manage API credentials in keychainaction="status"- Show current credential storage statusaction="store"- Store new credentials securely (requiresapi_keyparameter)action="delete"- Remove all stored credentials
Examples
Query Application Performance
# List all applications
await list_applications()
# Get specific application metrics
await get_application_metric_data(
app_id='123456',
metric_names=['HttpDispatcher', 'Apdex'],
from_time='2024-01-01T00:00:00Z',
to_time='2024-01-02T00:00:00Z'
)Execute NRQL Query
await query_nrql(
account_id='1234567',
nrql='SELECT average(duration) FROM Transaction WHERE appName = "My App" SINCE 1 hour ago'
)Search Entities
await search_entities(
query='name LIKE "%production%"',
limit=50
)Create Deployment Marker
await create_deployment(
app_id='123456',
revision='v2.0.1',
description='Production deployment',
user='deploy-bot',
changelog='Fixed critical bug in payment processing'
)Log Parsing Rules
Generate GROK Pattern from Log Samples
# Generate parsing rule from sample logs (sanitized example)
await generate_log_parsing_rule(
log_samples=[
"Updated info for user 12345678-1234-5678-9012-123456789012 (updated 1 rows, expected 1) - updated values: EmailAddress test@example.com, FirstName TestName, LastName TestLast, Active True, EmailConfirmed False"
]
)
# Returns generated GROK pattern and NRQL filter:
# {
# "grok_pattern": "Updated info for user %{UUID:user_id:string} \\(updated %{INT:rows_affected:long} rows, expected %{INT:rows_expected:long}\\) - updated values: EmailAddress %{DATA:email:string}, FirstName %{WORD:first_name:string}, LastName %{WORD:last_name:string}, Active %{WORD:active:string}, EmailConfirmed %{WORD:emailconfirmed:string}",
# "nrql_pattern": "SELECT * FROM Log WHERE message LIKE 'Updated info for user % (updated % rows, expected %) - updated values: EmailAddress %, FirstName %, LastName %, Active %, EmailConfirmed %'",
# "suggested_description": "Auto-generated parsing rule for single log sample"
# }Create Log Parsing Rule
# Create a new parsing rule using generated patterns
await create_log_parsing_rule(
description="User update audit log parsing",
grok="Updated info for user %{UUID:user_id:string} \\(updated %{INT:rows_affected:long} rows, expected %{INT:rows_expected:long}\\) - updated values: EmailAddress %{DATA:email:string}, FirstName %{WORD:first_name:string}, LastName %{WORD:last_name:string}, Active %{WORD:active:string}, EmailConfirmed %{WORD:emailconfirmed:string}",
nrql="SELECT * FROM Log WHERE message LIKE 'Updated info for user % (updated % rows, expected %) - updated values: EmailAddress %, FirstName %, LastName %, Active %, EmailConfirmed %'",
enabled=True
)Generate from Live Logs
# Generate patterns from logs matching a query
await generate_log_parsing_rule(
log_query="service = 'user-service' AND message LIKE '%Updated info for user%'",
time_range="1 day ago",
field_hints={"user_id": "UUID", "email": "EMAIL"}
)Test Parsing Rules
# Test a GROK pattern against samples
await test_log_parsing_rule(
log_samples=["Updated info for user 12345678-1234-5678-9012-123456789012 (updated 1 rows, expected 1)"],
grok_pattern="Updated info for user %{UUID:user_id:string} \\(updated %{INT:rows_affected:long} rows, expected %{INT:rows_expected:long}\\)"
)Manage Parsing Rules
# List all parsing rules
await list_log_parsing_rules()
# Update a rule
await update_log_parsing_rule(
rule_id="12345",
description="Updated user audit log parsing",
enabled=False
)
# Delete a rule
await delete_log_parsing_rule(rule_id="12345")Development
# Clone the repository
git clone https://github.com/piekstra/newrelic-mcp-server.git
cd newrelic-mcp-server
# Install in development mode
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
# Run the server
newrelic-mcp-server
# Run tests (when available)
pytest
# Format code
black newrelic_mcp
# Lint code
flake8 newrelic_mcp
# Run all pre-commit checks
pre-commit run --all-filesDependencies
fastmcp- FastMCP framework for building MCP servershttpx- Async HTTP client for API requestspython-dotenv- Environment variable management (optional)
API Rate Limits
Be aware of New Relic's API rate limits:
REST API v2: Subject to rate limiting per account
NerdGraph: Higher rate limits but still enforced
Synthetic Monitoring API: 3 requests per second
Security
Use keychain storage on macOS: Run
newrelic-mcp-setupto store credentials securely in the system keychainNever commit API keys to version control
Avoid storing sensitive credentials in plain text configuration files
API keys should have minimal required permissions
Consider using separate keys for different environments
The server automatically prioritizes keychain storage over environment variables for enhanced security
Troubleshooting
Authentication Errors
Ensure your API key starts with
NRAKVerify the key has the necessary permissions
Check if you're using the correct region (US/EU)
If using keychain storage, verify credentials are stored with
manage_credentialsaction="status"Try re-running
newrelic-mcp-setupif keychain access fails
Rate Limiting
If you encounter rate limit errors:
Implement exponential backoff in your client code
Cache frequently accessed data
Batch operations where possible
Connection Issues
Verify network connectivity
Check firewall rules for API endpoints
Ensure correct base URLs for your region
Python Environment
Ensure Python 3.10+ is installed
Install dependencies with
pip install -r requirements.txtCheck that the script is executable:
chmod +x newrelic_mcp_server.py
Command Not Found Issues
If you encounter "command not found" errors after installation:
Try using the full path to the installed package:
Linux/macOS (user install):
~/.local/bin/newrelic-mcp-servermacOS (Python framework):
/Library/Frameworks/Python.framework/Versions/3.13/bin/newrelic-mcp-serverSystem-wide:
/usr/local/bin/newrelic-mcp-server
Or add the installation directory to your PATH:
export PATH="$HOME/.local/bin:$PATH"In Claude Desktop config, use the full path if the command isn't found:
{ "mcpServers": { "newrelic": { "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/newrelic-mcp-server", "env": { "NEWRELIC_API_KEY": "your-api-key-here", "NEWRELIC_REGION": "US", "NEWRELIC_ACCOUNT_ID": "your-account-id" } } } }
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Support
For issues and questions:
GitHub Issues: Create an issue
New Relic Documentation: docs.newrelic.com
Available Tools
27 toolscreate_deploymentCreate DeploymentC
Record a new deployment for an application
Inputs: app_id (required), revision (required), user, changelog, +1 more. Returns: result
create_log_parsing_ruleCreate Log Parsing RuleD
Create a new log parsing rule
Inputs: grok (required), nrql (required), description (required), lucene, +2 more. Returns: result
delete_log_parsing_ruleDelete Log Parsing RuleD
Delete a log parsing rule
Inputs: rule_id (required), account_id. Returns: result
generate_log_parsing_ruleGenerate Log Parsing RuleB
Generate a log parsing rule from either a query or provided samples.
Inputs: log_query, account_id, time_range, field_hints, +1 more. Returns: result
get_alert_policyGet Alert PolicyC
Get details for a specific alert policy
Inputs: policy_id (required). Returns: result
get_applicationGet ApplicationB
Get details for a specific New Relic application
Inputs: app_id (required). Returns: result
get_application_metric_dataGet Application Metric DataC
Get metric data for an application
Inputs: app_id (required), metric_names (required), to_time, from_time. Returns: result
get_application_metricsGet Application MetricsC
Get available metrics for an application
Inputs: app_id (required), names. Returns: result
get_dashboardGet DashboardC
Get details for a specific dashboard
Inputs: guid (required). Returns: result
get_serverGet ServerC
Get details for a specific server
Inputs: server_id (required). Returns: result
get_synthetic_monitorGet Synthetic MonitorC
Get details for a specific synthetic monitor
Inputs: monitor_id (required). Returns: result
get_userGet UserC
Get details for a specific user
Inputs: user_id (required). Returns: result
list_alert_policiesList Alert PoliciesC
List all alert policies
Inputs: no named parameters. Returns: result
list_applicationsList ApplicationsA
List all New Relic APM applications
Inputs: no named parameters. Returns: result
list_dashboardsList DashboardsC
List all dashboards for an account
Inputs: account_id. Returns: result
list_deploymentsList DeploymentsC
List deployments for an application
Inputs: app_id (required). Returns: result
list_log_parsing_rulesList Log Parsing RulesC
List all log parsing rules for an account
Inputs: account_id. Returns: result
list_serversList ServersA
List all servers monitored by New Relic Infrastructure
Inputs: no named parameters. Returns: result
list_synthetic_monitorsList Synthetic MonitorsB
List all synthetic monitors
Inputs: no named parameters. Returns: result
list_usersList UsersB
List all users in the New Relic account
Inputs: no named parameters. Returns: result
manage_credentialsManage CredentialsA
Manage New Relic credentials securely in keychain.
Actions:
'status': Show current credential status
'store': Store new credentials (requires api_key parameter)
'delete': Remove all credentials from keychain
Inputs: action (required), api_key, account_id. Returns: result
nerdgraph_queryNerdgraph QueryC
Execute a custom NerdGraph GraphQL query
Inputs: query (required), variables. Returns: result
query_nrqlQuery NrqlC
Execute an NRQL query
Inputs: nrql (required), account_id (required). Returns: result
search_entitiesSearch EntitiesC
Search for entities in New Relic
Inputs: query (required), limit. Returns: result
test_log_parsing_ruleTest Log Parsing RuleB
Test a log parsing rule against sample logs. If no grok_pattern is provided, it will generate one automatically.
Inputs: log_samples (required), account_id, grok_pattern. Returns: result
update_dashboardUpdate DashboardC
Update a widget in a dashboard page.
Inputs: title (required), page_guid (required), widget_id (required), nrql_query (required), +2 more. Returns: result
update_log_parsing_ruleUpdate Log Parsing RuleC
Update an existing log parsing rule
Inputs: rule_id (required), grok, nrql, lucene, +3 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Most tools map cleanly to a resource+action (list/get per entity, CRUD for log parsing rules), so selection is usually obvious. The main friction points are get_application_metrics vs get_application_metric_data (metadata vs time-series data is only inferable from descriptions) and the three log-parsing-rule tools (create/update/test/generate) whose boundaries overlap somewhat. query_nrql vs nerdgraph_query are distinguishable by query language but could be mispicked by a naive agent.
Nearly everything follows a predictable snake_case verb_noun pattern (list_applications, get_dashboard, update_dashboard, create_log_parsing_rule). Deviations are minor: query_nrql and nerdgraph_query drop the verb-first ordering, and manage_credentials is a single tool multiplexing status/store/delete via an action parameter rather than following the one-verb-per-tool convention.
27 tools is heavy and pushes past the comfortable range, though it is partly justified by the broad surface (APM, alerts, synthetics, dashboards, infrastructure, users, logs, credentials, ad-hoc querying). Some redundancy exists — dual metric tools, dual query tools, and four log-parsing-rule tools — plus a multi-action credentials tool that could be split or trimmed. It is defensible but not tight.
Log parsing rules have full CRUD plus test/generate, and deployments/applications/dashboards cover their core lifecycles. However, many resources are read-only stubs — alert policies, synthetic monitors, servers, and users only support list/get, and dashboards lack create/delete — leaving noticeable gaps for common workflows. Ad-hoc NRQL/NerdGraph querying partially compensates by providing an escape hatch.
Maintenance
Related MCP Connectors
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Manage uptime monitors and incidents and search logs, metrics and traces from an AI assistant.
Query your app's logs, metrics and incidents from your AI assistant.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to access New Relic logs and APM data through the NerdGraph API. It allows users to execute NRQL queries, retrieve application performance metrics, and analyze transaction traces using natural language.61MIT
- FlicenseNot gradedqualityDmaintenanceEnables users to query and manage New Relic account data and features through natural language or specific commands, including NRQL queries, entity search, APM, Synthetics, and alerts management.3-
- FlicenseNot gradedqualityDmaintenanceProvides New Relic observability tools for AI assistants, enabling discovery, data access, alerting, incident response, and performance analytics via natural language queries.-
- FlicenseNot gradedqualityCmaintenanceProvides comprehensive access to the New Relic observability platform through 55 MCP tools, enabling APM, infrastructure, logs, traces, alerts, dashboards, synthetics, workflows, notifications, service levels, tags, entities, and workloads via a single GraphQL endpoint.-