New Relic MCP Server
Enables AI assistants to interact with New Relic monitoring and observability data through programmatic access to New Relic APIs. Supports APM management, NRQL queries, alert policies, synthetic monitoring, dashboards, infrastructure monitoring, and deployment tracking.
README
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.
Features
- APM Application Management: List and retrieve application details, metrics, and metric data
- NRQL Queries: Execute NRQL queries via NerdGraph
- 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
Installation
Option 1: Install from PyPI (Recommended)
pip install newrelic-mcp-server
Option 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
The server requires the following environment variables:
# 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 operations
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
Add the following to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"newrelic": {
"command": "newrelic-mcp-server",
"env": {
"NEWRELIC_API_KEY": "your-api-key-here",
"NEWRELIC_REGION": "US",
"NEWRELIC_ACCOUNT_ID": "your-account-id"
}
}
}
}
With Other MCP Clients
# Start the server directly
newrelic-mcp-server
# Or run as a module
python -m newrelic_mcp
Available 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
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'
)
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-files
Dependencies
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
- Never commit API keys to version control
- Use environment variables for sensitive configuration
- API keys should have minimal required permissions
- Consider using separate keys for different environments
Troubleshooting
Authentication Errors
- Ensure your API key starts with
NRAK - Verify the key has the necessary permissions
- Check if you're using the correct region (US/EU)
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.txt - Check 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-server - macOS (Python framework):
/Library/Frameworks/Python.framework/Versions/3.13/bin/newrelic-mcp-server - System-wide:
/usr/local/bin/newrelic-mcp-server
- Linux/macOS (user install):
- 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。