Back to MCP directory
publicPublicdnsLocal runtime

newrelicmcp

New Relic MCP服务器项目,通过暴露NerdGraph和REST API端点作为工具,允许用户以编程方式与New Relic账户交互。

article

README

🚀 新 relic MCP 服务器

这个 MCP 服务器将新 relic NerdGraph 和 REST API 端点作为工具公开,允许你以编程方式与你的新 relic 账户进行交互。

🚀 快速开始

✨ 主要特性

  • 公开新 relic NerdGraph 和 REST API 端点,支持以编程方式与新 relic 账户交互。
  • 提供多个工具,如查询日志、获取账户信息、获取用户信息等。

📦 安装指南

环境要求

  • Python 3.12+
  • uv(用于运行服务器)
  • 有效的新 relic API 密钥和账户 ID

安装步骤

  1. 安装依赖项(如果有):

    uv pip install -r requirements.txt
    

    (或者使用你首选的依赖管理方法)

  2. 设置环境变量:

    export NEW_RELIC_API_KEY=your_api_key
    export NEW_RELIC_ACCOUNT_ID=your_account_id
    
  3. 启动服务器:

    uv --directory /Users/mohaji/mcp-servers/newrelic-mcp run server.py
    

📚 详细文档

Claude Desktop 和 MCP 客户端的配置

uv.mcpserver.json 示例
{
  "mcpServers": {
    "NewRelicMCP": {
      "command": "uv",
      "args": [
        "--directory", "/Users/mohaji/mcp-servers/newrelic-mcp", "run", "server.py"
      ],
      "env": {
        "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
        "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
      }
    }
  }
}
mcp.json 示例
{
  "mcp": {
    "NewRelicMCP": {
      "command": "uv",
      "args": [
        "--directory", "/Users/mohaji/mcp-servers/newrelic-mcp", "run", "server.py"
      ],
      "env": {
        "NEW_RELIC_API_KEY": "<YOUR_NEW_RELIC_API_KEY>",
        "NEW_RELIC_ACCOUNT_ID": "<YOUR_NEW_RELIC_ACCOUNT_ID>"
      }
    }
  }
}

请将占位符值替换为你实际的新 relic 凭证。

可用工具

  • query_logs(NerdGraph/GraphQL)
  • query_logs_rest(REST API v2)
  • get_account_info
  • get_user_info
  • get_alerts
  • get_dashboards
  • get_entities

每个工具都作为 MCP 工具提供,可从兼容的客户端调用。

💻 使用示例

工具:query_logs_rest

使用 REST API v2 查询新 relic 指标/日志。

参数:

  • app_id:要查询的应用程序 ID。
  • names:以逗号分隔的指标名称(例如,'HttpDispatcher,CPU/User Time')。
  • from_timestamp:ISO8601 格式的开始时间(例如,'2024-07-01T00:00:00+00:00')。
  • to_timestamp:ISO8601 格式的结束时间(例如,'2024-07-02T00:00:00+00:00')。

调用示例:

query_logs_rest(
  app_id="12345678",
  names="HttpDispatcher,CPU/User Time",
  from_timestamp="2024-07-01T00:00:00+00:00",
  to_timestamp="2024-07-02T00:00:00+00:00"
)

返回新 relic REST API v2 针对指定指标和时间范围的原始 JSON 响应。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client