selfhosted-sentry-mcp

selfhosted-sentry-mcp

MCP server for self-hosted Sentry instances, providing tools to query and triage issues and events, inspect stack frames, manage releases, and access raw Sentry API.

Category
访问服务器

README

selfhosted-sentry-mcp

npm version License: MIT Model Context Protocol Add to Cursor

MCP server for self-hosted Sentry instances with debugging-focused tools.

Overview

This server provides MCP tools for querying and triaging issues and events in self-hosted Sentry.

Key capabilities:

  • Issue and project listing with pagination and search.
  • Event inspection with stack frame extraction.
  • Grouping analysis via issue hashes.
  • Debug symbol (dSYM) checks for iOS/macOS crashes.
  • Raw Sentry API access for edge cases.

Quickstart

Prerequisites

  • Node.js 20+
  • Self-hosted Sentry instance

Getting Sentry Credentials

You need 3 environment variables from your Sentry instance:

1. SENTRY_URL

https://your-sentry-instance.com

The base URL of your self-hosted Sentry.

2. SENTRY_AUTH_TOKEN

  1. Go to Settings > Auth Tokens
  2. Click Create New Token
  3. Select scopes: issue:read, project:read, event:read, issue:write, comment:write
  4. Copy the token

3. SENTRY_ORG_SLUG

  1. Go to Settings > General in your organization
  2. Find Organization Slug (e.g., my-org)
  3. Or check the URL: https://your-sentry.com/organizations/[slug]/

Install

Option 1: Install from npm (recommended)

npm install -g selfhosted-sentry-mcp

Option 2: Install from source

git clone https://github.com/HieuAnh87/sentry-selfhosted-mcp.git
cd sentry-selfhosted-mcp
npm install
npm run build

Tools

24 tools available across 6 categories:

Issue Tools

Tool Purpose Input
get_sentry_issue Issue details by ID or URL issue_id_or_url + optional filters
list_sentry_projects List all projects in org {}
list_sentry_issues List issues in a project project_slug + optional filters
list_issues Search issues with Sentry query syntax query, sort, limit, cursor
update_sentry_issue_status Update issue status issue_id, status
create_sentry_issue_comment Add issue comment issue_id, comment_text
get_issue_hashes Get fingerprint hashes issue_id, optional cursor
bulk_update_issues Bulk resolve/ignore issues project_slug + optional query, status, assigned_to, has_seen

Event Tools

Tool Purpose Input
get_sentry_event_details Event details with entry filtering project_slug, event_id
list_issue_events List events for an issue issue_id, optional limit, cursor, full
list_error_events Search error events in a project project_slug + optional filters
get_stack_frames Extract structured stack frames project_slug, event_id, in_app_only, max_frames
check_dsym_status Check missing dSYM symbols project_slug, optional event_id
list_breadcrumbs Extract breadcrumbs from event project_slug, event_id, optional limit, type

Release Tools

Tool Purpose Input
list_releases List releases in org query, date, limit, cursor, sort
get_release_details Release details with health stats version, optional full

Organization Tools

Tool Purpose Input
list_teams List all teams in org {}
get_issue_tags List all tags for an issue issue_id
get_issue_tag_values Get tag value distribution issue_id, tag_key, optional limit
list_activity Issue activity log issue_id, optional limit, cursor

Advanced Tools

Tool Purpose Input
get_trace_details Distributed trace with spans trace_id, optional max_spans
get_grouping_config Fingerprinting rules issue_id
merge_issues Merge issues by hash issue_id, target_ids

Raw API

Tool Purpose Input
raw_sentry_api Any Sentry API endpoint endpoint + optional method, params, body, grep_pattern

Configuration

Set environment variables:

  • SENTRY_URL: Base URL of your self-hosted Sentry instance.
  • SENTRY_AUTH_TOKEN: Sentry API token (recommended scopes: issue:read, project:read, event:read, issue:write, comment:write).
  • SENTRY_ORG_SLUG: Organization slug.

Claude Code / Cursor Configuration

Add to your MCP client configuration file:

  • Claude Code: ~/.claude/settings.json or project-level .claude/settings.json
  • Cursor: ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-level)

Option 1: Using npx (recommended - simplest)

{
  "mcpServers": {
    "sentry-selfhosted-mcp": {
      "command": "npx",
      "args": ["-y", "selfhosted-sentry-mcp"],
      "env": {
        "SENTRY_URL": "https://your-sentry-instance.com",
        "SENTRY_AUTH_TOKEN": "your-auth-token",
        "SENTRY_ORG_SLUG": "your-org-slug"
      }
    }
  }
}

Option 2: Using global npm install

{
  "mcpServers": {
    "sentry-selfhosted-mcp": {
      "command": "selfhosted-sentry-mcp",
      "args": [],
      "env": {
        "SENTRY_URL": "https://your-sentry-instance.com",
        "SENTRY_AUTH_TOKEN": "your-auth-token",
        "SENTRY_ORG_SLUG": "your-org-slug"
      }
    }
  }
}

Option 3: From local source

{
  "mcpServers": {
    "sentry-selfhosted-mcp": {
      "command": "node",
      "args": ["<full/path/to/sentry-selfhosted-mcp/build/index.js>"],
      "env": {
        "SENTRY_URL": "https://your-sentry-instance.com",
        "SENTRY_AUTH_TOKEN": "your-auth-token",
        "SENTRY_ORG_SLUG": "your-org-slug"
      }
    }
  }
}

Docker

Build:

docker build -t sentry-selfhosted-mcp:latest .

Claude Code config:

{
  "mcpServers": {
    "sentry-selfhosted-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "SENTRY_URL",
        "-e", "SENTRY_AUTH_TOKEN",
        "-e", "SENTRY_ORG_SLUG",
        "sentry-selfhosted-mcp:latest"
      ],
      "env": {
        "SENTRY_URL": "https://your-sentry-instance.com",
        "SENTRY_AUTH_TOKEN": "your-auth-token",
        "SENTRY_ORG_SLUG": "your-org-slug"
      }
    }
  }
}

Use env file:

SENTRY_URL=https://your-sentry-instance.com
SENTRY_AUTH_TOKEN=your-auth-token
SENTRY_ORG_SLUG=your-org-slug
{
  "mcpServers": {
    "sentry-selfhosted-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--env-file", "/path/to/.env",
        "sentry-selfhosted-mcp:latest"
      ]
    }
  }
}

Verify:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | docker run -i --rm \
  -e SENTRY_URL=https://example.com \
  -e SENTRY_AUTH_TOKEN=test \
  -e SENTRY_ORG_SLUG=test \
  sentry-selfhosted-mcp:latest

Development

npm install
npm run build

Run MCP inspector:

npx @modelcontextprotocol/inspector build/index.js

Security

  • Use least-privilege Sentry API tokens.
  • Avoid logging sensitive data in MCP client logs.

Troubleshooting

Server not starting or tools not showing:

  • Verify SENTRY_URL, SENTRY_AUTH_TOKEN, and SENTRY_ORG_SLUG are set correctly.
  • Check the token has required scopes (issue:read, project:read, event:read, issue:write, comment:write).
  • Ensure Node.js 20+ is installed: node --version.

"Unauthorized" or "403" errors:

  • Verify your Sentry API token is valid and not expired.
  • Check that the token has permissions for the organization specified in SENTRY_ORG_SLUG.

"Project not found" errors:

  • Confirm the project slug exists in your Sentry organization.
  • Use list_sentry_projects tool to see available projects.

Empty or truncated responses:

  • For event details, use limit parameter to paginate through large events.
  • For raw_sentry_api, use grep_pattern to filter responses from large endpoints.

Docker container exits immediately:

  • Ensure all three environment variables are passed: SENTRY_URL, SENTRY_AUTH_TOKEN, SENTRY_ORG_SLUG.
  • Check Docker logs: docker logs <container-id>.

FAQ

Q: Is this server self-hosted only? A: It is designed for self-hosted Sentry, but it should also work with Sentry SaaS if the API token and org slug are valid.

Q: Why use raw_sentry_api if other tools exist? A: It exposes any API endpoint for edge cases not covered by typed tools. Use grep_pattern on event endpoints to keep responses small.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选