
一个用于使用 NRQL 查询 New Relic 日志的模型上下文协议(MCP)服务器。该服务器使大型语言模型(LLM)如 Claude 能够与您的 New Relic 数据交互。
概览
一个用于使用 NRQL 查询 New Relic 日志的模型上下文协议(MCP)服务器。该服务器使大型语言模型(LLM)如 Claude 能够与您的 New Relic 数据交互。 也作为可安装插件,包含斜杠命令、技能和调查代理——无需MCP服务器。安装方式:/plugin marketplace 添加 Ivlad003/plugins,然后 /plugin install newrelic-observability@ivlad-plugins 详情请参见 Ivlad003/plugins。 - 使用 NRQL 查询 New Relic 日志和指标 - 详细错误记录 - 与 Claude Desktop 的便捷集成 - 可读输出格式 - 可配置 New Relic 账户 ID - Python 3.10及以上版本 - 新Relic账户和API密钥 - Claude桌面应用 3. 使用提供的代码创建服务器文件newrelic_logs_server.py。 4. 配置环境变量: 通过编辑配置文件配置Claude Desktop: - macOS:~/库/应用支持/Claude/claude_desktop_config。
概述(AI 翻译)
一个用于使用 NRQL 查询 New Relic 日志的模型上下文协议(MCP)服务器。该服务器使大型语言模型(LLM)如 Claude 能够与您的 New Relic 数据交互。
Claude Code 用户: 也可作为可安装插件,包含斜杠命令、技能和调查代理——无需 MCP 服务器。 安装顺序:
/plugin marketplace add Ivlad003/plugins然后/plugin install newrelic-observability@ivlad-plugins详情请参见 Ivlad003/plugins。
特色
- 使用 NRQL 查询 New Relic 日志和指标
- 详细的错误记录
- 与 Claude Desktop 的轻松集成
- 人类可读的输出格式化
- 可配置新遗物账户ID
设置说明
先决条件
- Python 3.10 或更高版本
- 新遗物账户和API密钥
- Claude桌面应用程序
安装步骤
-
安装
uv包管理器: -
创建和搭建项目:
-
用提供的代码创建服务器文件
newrelic_logs_server.py。 -
配置环境变量:
Claude桌面集成
通过编辑配置文件配置Claude Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
New Relic MCP Server
A Model Context Protocol (MCP) server for querying New Relic logs using NRQL queries. This server enables Large Language Models (LLMs) like Claude to interact with your New Relic data.
Claude Code users: Also available as an installable plugin with slash commands, skills, and an investigation agent — no MCP server needed. Install with:
/plugin marketplace add Ivlad003/pluginsthen/plugin install newrelic-observability@ivlad-pluginsSee Ivlad003/plugins for details.
Features
- Query New Relic logs and metrics using NRQL
- Detailed error logging
- Easy integration with Claude Desktop
- Human-readable output formatting
- Configurable New Relic account ID
Setup Instructions
Prerequisites
- Python 3.10 or higher
- New Relic account and API key
- Claude Desktop application
Installation Steps
- Install
uvpackage manager:
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- Create and setup project:
# Create directory
mkdir newrelic-mcp
cd newrelic-mcp
# Create virtual environment
uv venv
# Activate virtual environment
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
# Install dependencies
uv pip install "mcp[cli]" httpx
-
Create server file
newrelic_logs_server.pywith the provided code. -
Configure your environment variables:
# On Unix/macOS
export NEW_RELIC_API_KEY="your-api-key-here"
export NEW_RELIC_ACCOUNT_ID="your-account-id-here"
# On Windows (CMD)
set NEW_RELIC_API_KEY=your-api-key-here
set NEW_RELIC_ACCOUNT_ID=your-account-id-here
# On Windows (PowerShell)
$env:NEW_RELIC_API_KEY = "your-api-key-here"
$env:NEW_RELIC_ACCOUNT_ID = "your-account-id-here"
Claude Desktop Integration
Configure Claude Desktop by editing your configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"newrelic": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/newrelic-mcp",
"run",
"app.py"
],
"env": {
"NEW_RELIC_API_KEY": "your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id-here"
}
}
}
}
Usage
Example NRQL Queries
- Basic Transaction Query:
SELECT * FROM Transaction SINCE 1 hour ago
- Error Analysis:
SELECT * FROM Transaction WHERE error IS TRUE SINCE 1 hour ago LIMIT 10
- Performance Analysis:
安装
npx @modelcontextprotocol/inspector uv run newrelic_logs_server.py配置
{
"mcpServers": {
"newrelic": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/newrelic-mcp",
"run",
"app.py"
],
"env": {
"NEW_RELIC_API_KEY": "your-api-key-here",
"NEW_RELIC_ACCOUNT_ID": "your-account-id-here"
}
}
}
}