newrelic-mcp
# newrelic-mcp
An MCP server for [New Relic](https://newrelic.com) — query your observability data from any AI agent or LLM client that supports the [Model Context Protocol](https://modelcontextprotocol.io).
No official New Relic MCP exists yet. This fills that gap.
## Tools
| Tool | Description |
|------|-------------|
| `nrql_query` | Run any NRQL query |
| `nrql_batch_query` | Run multiple NRQL queries in one request |
| `search_entities` | Search entities by name, type, domain, or tags |
| `get_entity` | Get detailed entity info by GUID |
| `get_alert_conditions` | List NRQL alert conditions |
| `get_open_incidents` | Get currently active incidents |
| `get_deployments` | Get recent deployments for an APM app |
| `get_golden_signals` | Get throughput, error rate, latency, saturation |
| `get_error_traces` | Get recent error traces with stacks |
| `get_throughput_timeseries` | Get traffic over time |
## Quick Start
### 1. Install
```bash
# With uv (recommended)
uv pip install .
# Or with pip
pip install .
```
### 2. Configure
Create a `.env` file (or set environment variables):
```env
NEW_RELIC_API_KEY=NRAK-XXXXXXXXXXXXXXXXXXXXXXXXXXXX
NEW_RELIC_ACCOUNT_ID=1234567
NEW_RELIC_REGION=US
```
You need a [New Relic User API key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#user-key).
### 3. Run
```bash
# stdio mode (for local MCP clients like Claude Desktop, Kiro, Cursor)
newrelic-mcp
# HTTP mode (for remote access)
newrelic-mcp --transport http --port 8000
```
### 4. Connect to your MCP client
#### Claude Desktop / Kiro / Cursor
Add to your MCP config (e.g. `~/.kiro/settings/mcp.json`):
```json
{
"mcpServers": {
"newrelic": {
"command": "newrelic-mcp",
"env": {
"NEW_RELIC_API_KEY": "NRAK-XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"NEW_RELIC_ACCOUNT_ID": "1234567"
}
}
}
}
```
#### With uvx (no install needed)
```json
{
"mcpServers": {
"newrelic": {
"command": "uvx",
"args": ["newrelic-mcp"],
"env": {
"NEW_RELIC_API_KEY": "NRAK-XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"NEW_RELIC_ACCOUNT_ID": "1234567"
}
}
}
}
```
#### Docker
```bash
docker compose up -d
```
## Examples
Once connected, you can ask your AI agent things like:
- "What's the error rate for my payments-api in the last hour?"
- "Show me open incidents"
- "What deployed recently to the checkout service?"
- "Run this NRQL: SELECT count(*) FROM Transaction SINCE 1 day ago FACET appName LIMIT 10"
- "What are the golden signals for auth-service?"
## Requirements
- Python 3.11+
- A New Relic account with a User API key
## EU Region
If your account is in the EU datacenter, set:
```env
NEW_RELIC_REGION=EU
```
## Development
```bash
uv sync --all-extras
uv run ruff check .
uv run mypy src/
uv run pytest
```
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 10 tools
Tools are mostly distinct: nrql_query and nrql_batch_query overlap in purpose but are clearly differentiated by efficiency, and search_entities vs get_entity serve different stages of entity interaction. Other tools each target a unique domain (alerts, incidents, deployments, golden signals, error traces, throughput), leaving little ambiguity.
All tool names follow a consistent snake_case verb_noun pattern (e.g., get_entity, search_entities, nrql_query). The two nrql tools deviate slightly from get_ but still maintain the same structural style, making the naming predictable and coherent.
With 10 tools, the server covers a broad but focused set of New Relic operations—querying, entity discovery, alerting, performance metrics, and deployment info. This is well-scoped for a monitoring MCP server, neither too sparse nor overloaded.
The surface covers core read-only workflows: flexible NRQL querying, entity lookup, alert/incident awareness, and APM performance details. Minor gaps exist (e.g., no log-specific query but nrql_query handles it, no entity mutation), but for a read-only monitoring server, it covers the essential needs without dead ends.