NewRelic MCP Server
A comprehensive MCP server providing over 26 tools for querying, monitoring, and analyzing NewRelic data through NRQL queries and entity management. It enables interaction with NewRelic's NerdGraph API for managing alerts, logs, and incidents directly within Claude Code sessions.
README
NewRelic MCP Server
A full-featured Model Context Protocol (MCP) server for NewRelic, providing 26+ tools for querying, monitoring, and analyzing NewRelic data from Claude Code sessions.
Features
- 26+ Tools covering all major NewRelic capabilities
- Stdio Transport for reliable multi-session support via Docker
- Rate Limiting with exponential backoff (25 concurrent requests)
- Full NerdGraph API coverage including experimental aiIssues endpoints
- Production Ready with comprehensive error handling and logging
Quick Start
Prerequisites
- Docker Desktop running
- NewRelic User API key
- NewRelic Account ID
Build the Image
docker build -t newrelic-mcp:local .
Configure Environment
Create a .env file (or export these variables):
export NEW_RELIC_API_KEY="NRAK-XXXXXXXXXXXX"
export NEW_RELIC_ACCOUNT_ID="1234567"
export NEW_RELIC_REGION="US" # or EU
Add to Claude Code
Add to your .mcp.json:
{
"mcpServers": {
"newrelic": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "NEW_RELIC_API_KEY",
"-e", "NEW_RELIC_ACCOUNT_ID",
"-e", "NEW_RELIC_REGION",
"newrelic-mcp:local"
],
"env": {
"NEW_RELIC_API_KEY": "${NEW_RELIC_API_KEY}",
"NEW_RELIC_ACCOUNT_ID": "${NEW_RELIC_ACCOUNT_ID}",
"NEW_RELIC_REGION": "US"
}
}
}
}
Available Tools
Data Access (5 tools)
| Tool | Description |
|---|---|
execute_nrql_query |
Execute arbitrary NRQL queries |
list_recent_logs |
List recent logs with filtering |
analyze_entity_logs |
Analyze logs for a specific entity |
query_logs |
Search logs by field/value |
natural_language_to_nrql_query |
Get NRQL query suggestions from natural language |
Entity Management (5 tools)
| Tool | Description |
|---|---|
get_entity |
Get entity details by GUID |
list_related_entities |
Find related entities |
search_entity_with_tag |
Search entities by tags |
list_entity_types |
List available entity types |
list_available_new_relic_accounts |
List accessible accounts |
Alerts & Incidents (8 tools)
| Tool | Description |
|---|---|
list_alert_policies |
List alert policies |
list_alert_conditions |
List NRQL alert conditions |
list_recent_issues |
List recent AI issues |
search_incident |
Search incidents |
analyze_deployment_impact |
Analyze deployment effects |
generate_alert_insights_report |
Generate alert reports |
get_entity_error_groups |
Get error groups for entity |
list_change_events |
List deployment/change events |
Dashboards & Synthetics (3 tools)
| Tool | Description |
|---|---|
get_dashboard |
Get dashboard details |
list_dashboards |
List all dashboards |
list_synthetic_monitors |
List synthetic monitors |
Performance Analysis (4 tools)
| Tool | Description |
|---|---|
analyze_golden_metrics |
Analyze entity golden metrics |
analyze_transactions |
Analyze transaction performance |
analyze_entity_logs |
Analyze entity logs (in Data Access) |
convert_time_period_to_epoch_ms |
Time period utility |
Example Usage
Query Error Rates
Use execute_nrql_query with:
query: "SELECT percentage(count(*), WHERE error IS true) FROM Transaction SINCE 1 hour ago"
Find Slow Transactions
Use analyze_transactions with:
entityGuid: "YOUR_APM_ENTITY_GUID"
sinceMinutesAgo: 60
Search Logs for Errors
Use query_logs with:
field: "level"
value: "ERROR"
limit: 100
Get Help Writing NRQL
Use natural_language_to_nrql_query with:
description: "Show me error rates by service over the last 6 hours"
Development
Local Development
# Install dependencies
npm install
# Type check
npx tsc --noEmit
# Run tests
npm test
# Build
npm run build
# Run locally (requires env vars)
npm run dev
Docker Development
# Build and run
docker compose build
docker compose run --rm newrelic-mcp
# Development mode with hot reload
docker compose --profile dev up newrelic-mcp-dev
Architecture
src/
├── index.ts # Entry point
├── server.ts # MCP server setup
├── config.ts # Environment configuration
├── services/ # NerdGraph API services
│ ├── nerdgraph-client.ts
│ ├── entity-service.ts
│ ├── alert-service.ts
│ ├── nrql-service.ts
│ └── ...
├── tools/ # MCP tool definitions
│ ├── nrql-tools.ts
│ ├── entity-tools.ts
│ ├── alert-tools.ts
│ └── ...
├── types/ # TypeScript types
└── utils/ # Utilities (logger, retry, errors)
Configuration
| Environment Variable | Required | Default | Description |
|---|---|---|---|
NEW_RELIC_API_KEY |
Yes | - | NewRelic User API key |
NEW_RELIC_ACCOUNT_ID |
Yes | - | NewRelic Account ID |
NEW_RELIC_REGION |
No | US |
API region (US or EU) |
LOG_LEVEL |
No | info |
Log level (debug/info/warn/error) |
Rate Limiting
The server implements NewRelic's rate limits:
- 25 concurrent requests per user
- Exponential backoff on 429 responses
- Automatic retry for rate limit and network errors
Troubleshooting
"Missing required environment variables"
Ensure NEW_RELIC_API_KEY and NEW_RELIC_ACCOUNT_ID are set and passed to Docker.
"Authentication failed"
Verify your API key has appropriate permissions. User API keys are recommended over license keys.
"Rate limit exceeded"
The server automatically retries. If persistent, reduce query frequency.
aiIssues endpoints failing
These require experimental headers. The server handles this automatically for list_recent_issues and search_incident.
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。