Skip to main content
Glama
Sentry MCP

Sentry MCP

Official
by getsentry

sentry-mcp

SentryのMCPサービスは、主にヒューマン・イン・ザ・ループ(人間が介在する)コーディングエージェント向けに設計されています。ツールの選択や優先順位は、Sentryのすべての機能を提供する汎用的なMCPサーバーを目指すのではなく、開発者のワークフローやデバッグのユースケースに焦点を当てています。

このリモートMCPサーバーは、アップストリームのSentry APIに対するミドルウェアとして機能し、Cursor、Claude Code、その他の類似開発ツールのようなコーディングアシスタント向けに最適化されています。これはCloudflareによるリモートMCPへの取り組みに基づいています。

はじめに

必要な情報はすべて、本番環境にデプロイされたサービスにアクセスすることで確認できます:

https://mcp.sentry.dev

貢献したい場合、仕組みを知りたい場合、またはセルフホスト版Sentryでこれを実行したい場合は、以下を読み進めてください。

Claude Codeプラグイン

Claude Codeプラグインとしてインストールすると、サブエージェントの委任が自動化されます:

claude plugin marketplace add getsentry/sentry-mcp
claude plugin install sentry-mcp@sentry-mcp

これにより、Sentryのエラー、イシュー、トレース、パフォーマンスについて質問した際に、Claudeが自動的に委任するsentry-mcpサブエージェントが提供されます。

将来を見据えたツールバリエーションや機能については以下を参照してください:

claude plugin install sentry-mcp@sentry-mcp-experimental

Stdio vs リモート

このリポジトリはMCPサービスとしての動作に重点を置いていますが、stdioトランスポートもサポートしています。これは現在開発中ですが、セルフホスト版Sentryに対してMCPを実行する最も簡単な方法です。

注意: AIを活用した検索ツール(search_events、search_issuesなど)には、LLMプロバイダー(OpenAIまたはAnthropic)が必要です。これらのツールは自然言語処理を使用して、クエリをSentryのクエリ構文に変換します。プロバイダーが設定されていない場合、これらの特定のツールは使用できませんが、他のすべてのツールは通常通り機能します。

stdioトランスポートを利用するには、必要なスコープを持つユーザー認証トークンをSentryで作成する必要があります。執筆時点では以下の通りです:

org:read
project:read
project:write
team:read
team:write
event:write

トランスポートを起動します:

npx @sentry/mcp-server@latest --access-token=sentry-user-token

セルフホスト環境に接続する必要がありますか?コマンド実行時に --host(ホスト名のみ、例: --host=sentry.example.com)を追加してください。

一部の機能(Seerなど)は、セルフホストインスタンスでは利用できない場合があります。サポートされていないツールが公開されないように、特定のスキルを無効にすることができます:

npx @sentry/mcp-server@latest --access-token=TOKEN --host=sentry.example.com --disable-skills=seer

環境変数

SENTRY_ACCESS_TOKEN=         # Required: Your Sentry auth token

# LLM Provider Configuration (required for AI-powered search tools)
EMBEDDED_AGENT_PROVIDER=     # Required: 'openai' or 'anthropic'
OPENAI_API_KEY=              # Required if using OpenAI
ANTHROPIC_API_KEY=           # Required if using Anthropic

# Optional overrides
SENTRY_HOST=                 # For self-hosted deployments
MCP_DISABLE_SKILLS=          # Disable specific skills (comma-separated, e.g. 'seer')

重要: LLMプロバイダーを明示的に指定するために、常にEMBEDDED_AGENT_PROVIDERを設定してください。APIキーのみに基づく自動検出は非推奨であり、将来のリリースで削除される予定です。詳細な設定オプションについては、docs/embedded-agents.mdを参照してください。

MCP設定例

{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["@sentry/mcp-server"],
      "env": {
        "SENTRY_ACCESS_TOKEN": "your-token",
        "EMBEDDED_AGENT_PROVIDER": "openai",
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

ホスト変数を未設定のままにすると、CLIは自動的にSentry SaaSサービスをターゲットにします。セルフホスト版Sentryを運用する場合のみ、オーバーライドを設定してください。

Seerをサポートしていないセルフホストインスタンスの場合:

{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["@sentry/mcp-server"],
      "env": {
        "SENTRY_ACCESS_TOKEN": "your-token",
        "SENTRY_HOST": "sentry.example.com",
        "MCP_DISABLE_SKILLS": "seer"
      }
    }
  }
}

MCP Inspector

MCPには、サービスを簡単にテストするためのInspectorが含まれています:

pnpm inspector

MCPサーバーのURL(http://localhost:5173)を入力して接続をクリックします。これにより、認証フローがトリガーされます。

注意: 127.0.0.1でインスペクターにアクセスする際にOAuthフローで問題が発生した場合は、代わりにhttp://localhost:6274にアクセスしてlocalhostを使用してみてください。

Related MCP server: Sentry MCP Server

ローカル開発

変更を貢献するには、ローカル環境をセットアップする必要があります:

  1. 環境とエージェントスキルのセットアップ:

    npx @sentry/dotagents install

    これはnpx @sentry/dotagents installも実行し、getsentry/skillsから共有スキルを.agents/skills/にインストールします(.claude/skillsおよび.cursor/skillsにシンボリックリンクされます)。後でスキルを更新する必要がある場合は、直接実行してください:

    npx @sentry/dotagents install
  2. SentryでOAuthアプリを作成する(設定 => API => アプリケーション):

    • ホームページURL: http://localhost:5173

    • 許可されたリダイレクトURI: http://localhost:5173/oauth/callback

    • クライアントIDをメモし、クライアントシークレットを生成してください

  3. 認証情報を設定する:

    • ルートディレクトリの.envを編集し、OPENAI_API_KEYを追加します

    • packages/mcp-cloudflare/.envを編集し、以下を追加します:

      • SENTRY_CLIENT_ID=your_development_sentry_client_id

      • SENTRY_CLIENT_SECRET=your_development_sentry_client_secret

      • COOKIE_SECRET=my-super-secret-cookie

  4. 開発サーバーを起動する:

    pnpm dev

検証

サーバーをローカルで実行し、http://localhost:5173で利用できるようにします

pnpm dev

ローカルサーバーをテストするには、Inspectorにhttp://localhost:5173/mcpを入力して接続をクリックします。プロンプトに従うと、「List Tools」ができるようになります。

テスト

ユニットテスト、評価、手動テストの3つのテストスイートが含まれています。

ユニットテストは以下を使用して実行できます:

pnpm test

評価には、プロジェクトルートに設定を含む.envファイルが必要です:

# .env (in project root)
OPENAI_API_KEY=  # Also required for AI-powered search tools in production

注意: ルートの.envファイルはすべてのパッケージのデフォルトを提供します。個々のパッケージは、開発中にこれらのデフォルトを上書きするために独自の.envファイルを持つことができます。

完了したら、以下を使用して実行できます:

pnpm eval

手動テスト(MCPの変更をテストする場合に推奨):

# Test with local dev server (default: http://localhost:5173)
pnpm -w run cli "who am I?"

# Test agent mode (use_sentry tool only)
pnpm -w run cli --agent "who am I?"

# Test against production
pnpm -w run cli --mcp-host=https://mcp.sentry.dev "query"

# Test with local stdio mode (requires SENTRY_ACCESS_TOKEN)
pnpm -w run cli --access-token=TOKEN "query"

注意: CLIのデフォルトはhttp://localhost:5173です。--mcp-hostで上書きするか、MCP_URL環境変数を設定してください。

包括的なテストプレイブック:

  • Stdioテスト: stdio実装(IDE、MCP Inspector)の構築、実行、テストに関する完全ガイドについては、docs/testing-stdio.mdを参照してください。

  • リモートテスト: リモートサーバー(OAuth、Web UI、CLIクライアント)のテストに関する完全ガイドについては、docs/testing-remote.mdを参照してください。

開発メモ

自動コードレビュー

このリポジトリでは、プルリクエスト内の潜在的な問題を特定するために、自動コードレビューツール(Cursor BugBotなど)を使用しています。これらのツールは役立つフィードバックや提案を提供しますが、精度は発展途上であり誤検知が発生する可能性があるため、これらのチェックを必須にすることは推奨しません。

自動レビューは以下のように扱う必要があります:

  • ✅ コードレビュー中に検討すべき役立つ提案

  • ✅ 議論や改善のための出発点

  • ❌ マージのためのブロック要件ではない

  • ❌ 人間によるコードレビューの代替ではない

自動フィードバックに対処する際は、すべての提案に厳密に従うのではなく、根本的な懸念事項に焦点を当ててください。

コントリビューター向けドキュメント

貢献したい場合や、ドキュメントマップ全体を確認したい場合は、コントリビューターのワークフローと完全なドキュメントインデックスが記載されたCLAUDE.md(AGENTS.mdとしても利用可能)を参照してください。docs/フォルダーには、トピックごとのガイドとツール統合された.mdファイルが含まれています。

Available Tools

7 tools
create_projectBInspect

Create a new project in Sentry, giving you access to a new SENTRY_DSN.

Use this tool when you need to:

  • Create a new project in a Sentry organization

Inputs: name (required), teamSlug (required), organizationSlug, platform.

create_teamBInspect

Create a new team in Sentry.

Use this tool when you need to:

  • Create a new team in a Sentry organization

Inputs: name (required), organizationSlug.

get_error_detailsAInspect

Retrieve error details from Sentry for a specific Issue ID, including the stacktrace and error message. Either issueId or issueUrl MUST be provided.

Use this tool when you need to:

  • Investigate a specific production error

  • Access detailed error information and stacktraces from Sentry

Inputs: issueId, issueUrl, organizationSlug.

list_organizationsBInspect

List all organizations that the user has access to in Sentry.

Use this tool when you need to:

  • View all organizations in Sentry

Inputs: no named parameters.

list_projectsBInspect

Retrieve a list of projects in Sentry.

Use this tool when you need to:

  • View all projects in a Sentry organization

Inputs: organizationSlug.

list_teamsAInspect

List all teams in an organization in Sentry.

Use this tool when you need to:

  • View all teams in a Sentry organization

Inputs: organizationSlug.

search_errors_in_fileAInspect

Search for errors recently occurring in a specific file. This is a suffix based search, so only using the filename or the direct parent folder of the file. The parent folder is preferred when the filename is in a subfolder or a common filename.

Use this tool when you need to:

  • Search for production errors in a specific file

  • Analyze error patterns and frequencies

  • Find recent or frequently occurring errors.

Inputs: filename (required), organizationSlug, sortBy.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 7 tools

    Disambiguation4/5

    Most tools have distinct purposes, such as create_project vs. list_projects, but get_error_details and search_errors_in_file could potentially overlap in error investigation scenarios, which might cause slight confusion. Overall, the boundaries are clear with only minor ambiguity.

    Naming Consistency5/5

    All tools follow a consistent verb_noun naming pattern using snake_case, such as create_project, list_organizations, and search_errors_in_file. This uniformity makes the tool set predictable and easy to understand.

    Tool Count4/5

    With 7 tools, the count is reasonable for a Sentry-focused server, covering core operations like project, team, and error management. However, it feels slightly thin as it lacks update or delete operations, which are common in such domains.

    Completeness3/5

    The tool set covers creation and listing for projects, teams, and organizations, plus error retrieval and search, but it has notable gaps. Missing update/delete tools for projects and teams, and no error resolution or comment features, limit full lifecycle coverage for Sentry's domain.

    Maintenance

    ActivityActive
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that retrieves and analyzes Sentry.io issues, allowing users to inspect error reports, stacktraces, and debugging information from their Sentry account.
      2
      23
      -
    • A
      license
      B
      quality
      F
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with Sentry for error tracking and monitoring, allowing retrieval and analysis of error data, project management, and performance monitoring through the Sentry API.
      11
      21
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      A TypeScript implementation of a Model Context Protocol server that connects to Sentry error tracking service, allowing AI models to query and analyze error reports and events.
      17 npm
      MIT