Back to MCP directory
publicPublicdnsLocal runtime

sentry-selfhosted-mcp

一个专为自托管Sentry实例设计的MCP服务,提供问题查询、项目管理和状态更新等功能。

article

README

🚀 自托管 Sentry 的 MCP 服务器

这是一个专为与自托管 Sentry 实例交互而设计的模型上下文协议 (MCP) 服务器,它能提供检索信息和执行操作的工具,有效解决自托管 Sentry 环境中的问题。

🚀 快速开始

此服务器可从环境变量中读取 Sentry 实例 URL、认证令牌和组织标识符(slug),从而为自托管 Sentry 环境提供服务。

✨ 主要特性

  • 提供多种工具,可用于检索 Sentry 问题、项目信息,更新问题状态以及添加评论等。
  • 支持从环境变量读取配置,方便灵活部署。

📦 安装指南

  1. 克隆/放置项目:克隆此仓库或将其项目文件放在您选择的位置。
  2. 安装依赖项:进入项目目录 (sentry-selfhosted-mcp) 并运行:
    cd <path/to/sentry-selfhosted-mcp>
    npm install
    
  3. 构建服务器:从项目目录编译 TypeScript 代码:
    npm run build
    
    这将在 build/ 目录中创建可执行的 JavaScript 文件。

📚 详细文档

已提供的工具

以下工具可供使用:

  1. get_sentry_issue
    • 描述:通过 ID 或 URL 检索特定 Sentry 问题的详细信息。
    • 输入:{ "issue_id_or_url": "string" }(例如,"12345" 或 "https://sentry.example.com/organizations/org/issues/12345/")
  2. list_sentry_projects
    • 描述:列出配置的 Sentry 组织中的所有项目。
    • 输入:{}(无需参数)
  3. list_sentry_issues
    • 描述:按项目列出问题,可选过滤查询或状态。
    • 输入:{ "project_slug": "string", "query": "string" (可选), "status": "resolved" | "unresolved" | "ignored" (可选) }
  4. get_sentry_event_details
    • 描述:检索项目中特定事件 ID 的详细信息。
    • 输入:{ "project_slug": "string", "event_id": "string" }
  5. update_sentry_issue_status
    • 描述:更新 Sentry 问题的状态。
    • 输入:{ "issue_id": "string", "status": "resolved" | "ignored" | "unresolved" }
  6. create_sentry_issue_comment
    • 描述:在 Sentry 问题上添加评论。
    • 输入:{ "issue_id": "string", "comment_text": "string" }

配置

此服务器需要以下环境变量:

  • SENTRY_URL:您的自托管 Sentry 实例的基础 URL(例如,https://sentry.beoflow.app)。
  • SENTRY_AUTH_TOKEN:您的 Sentry API 认证令牌(确保具有必要的作用域,如 issue:readproject:readevent:readissue:writecomment:write)。
  • SENTRY_ORG_SLUG:您的 Sentry 组织的标识符(例如,beoflow)。

MCP 客户端配置示例: 在 MCP 客户端的配置文件中添加以下条目(例如,VS Code 扩展的 cline_mcp_settings.json 或 Claude.app 的 claude_desktop_config.json):

    "sentry-selfhosted-mcp": {
      "command": "node",
      "args": [
        "<full/path/to/sentry-selfhosted-mcp/build/index.js>"
      ],
      "env": {
        "SENTRY_URL": "YOUR_SENTRY_URL",
        "SENTRY_AUTH_TOKEN": "YOUR_SENTRY_AUTH_TOKEN",
        "SENTRY_ORG_SLUG": "YOUR_SENTRY_ORG_SLUG"
      }
    }
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