@rui.branco/sentry-mcp 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +246 -246
  2. package/index.js +1398 -1389
  3. package/package.json +35 -35
  4. package/setup.js +267 -266
package/README.md CHANGED
@@ -1,246 +1,246 @@
1
- # Sentry MCP Server
2
-
3
- A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that brings Sentry error tracking context directly into any MCP-compatible AI client — Claude Code, Codex CLI, Google's Antigravity (Gemini), Cursor, Windsurf, Zed, and others. Fetch issues, inspect stack traces, manage issue status, and search errors without leaving your development environment.
4
-
5
- ## Overview
6
-
7
- When debugging production errors, context switching between Sentry and your code editor breaks flow and wastes time. This MCP server solves that by:
8
-
9
- - **Fetching full issue details** - Get error metadata, event counts, assignment, and status instantly
10
- - **Inspecting stack traces** - View full stack traces with in-app frame markers, breadcrumbs, and HTTP request context
11
- - **Managing issues** - Resolve, reopen, ignore, and assign issues directly from your AI client
12
- - **Searching errors** - Use Sentry's search syntax to find issues across your project
13
-
14
- ## Features
15
-
16
- | Feature | Description |
17
- |---------|-------------|
18
- | Issue Details | Title, level, status, event count, user count, culprit, assignee |
19
- | Stack Traces | Full exception chain with in-app frames highlighted |
20
- | Breadcrumbs | Last N events leading up to the error |
21
- | HTTP Request | Method, URL, headers from the request that triggered the error |
22
- | Tags & Contexts | Device, browser, OS, user info, and custom tags |
23
- | Attachments | List and download event attachments (minidumps, screenshots, logs) to disk |
24
- | Search | Full Sentry search syntax support |
25
- | Multi-Instance | Support for multiple Sentry organizations/instances |
26
-
27
- ## Installation
28
-
29
- ### Prerequisites
30
-
31
- - Node.js 18+
32
- - An MCP-compatible AI client (see [Step 1](#step-1-register-with-your-mcp-client) below)
33
- - Sentry account with API access
34
-
35
- ### Step 1: Register with your MCP client
36
-
37
- Pick the snippet for your client. All of them launch the server over stdio.
38
-
39
- **Claude Code:**
40
-
41
- ```bash
42
- claude mcp add --transport stdio sentry -- npx -y @rui.branco/sentry-mcp
43
- ```
44
-
45
- **Codex CLI:** add to `~/.codex/config.toml`:
46
-
47
- ```toml
48
- [mcp_servers.sentry]
49
- command = "npx"
50
- args = ["-y", "@rui.branco/sentry-mcp"]
51
- ```
52
-
53
- **Google Antigravity / Gemini CLI:** add to `~/.gemini/settings.json`:
54
-
55
- ```json
56
- {
57
- "mcpServers": {
58
- "sentry": { "command": "npx", "args": ["-y", "@rui.branco/sentry-mcp"] }
59
- }
60
- }
61
- ```
62
-
63
- **Cursor, Windsurf, Zed, Cline, Continue, etc.:** add the same `command`/`args` pair to whatever JSON config that client uses for MCP servers (the exact path varies, but the shape is standard across clients).
64
-
65
- ### Step 2: Get Your Sentry API Token
66
-
67
- 1. Go to [Sentry Auth Tokens](https://sentry.io/settings/account/api/auth-tokens/) (or your self-hosted Sentry equivalent)
68
- 2. Click **"Create New Token"**
69
- 3. Select scopes: `event:read`, `project:read`, `org:read`, `member:read`
70
- 4. Click **"Create Token"**
71
- 5. Copy the token
72
-
73
- ### Step 3: Configure Credentials
74
-
75
- Run the setup with your credentials:
76
-
77
- ```bash
78
- npx @rui.branco/sentry-mcp setup "YOUR_AUTH_TOKEN" "https://sentry.io" "your-org-slug" "your-project-slug"
79
- ```
80
-
81
- | Parameter | Description | Example |
82
- |-----------|-------------|---------|
83
- | Auth Token | The token you created in Step 2 | `sntrys_eyJpYX...` |
84
- | Base URL | Your Sentry instance URL | `https://sentry.io` or `https://my-org.sentry.io` |
85
- | Org Slug | Your Sentry organization slug | `my-company` |
86
- | Project Slug | Default project slug (optional) | `frontend` |
87
-
88
- Or run interactively (will prompt for each value):
89
-
90
- ```bash
91
- npx @rui.branco/sentry-mcp setup
92
- ```
93
-
94
- ### Step 4: Verify
95
-
96
- Restart your AI client and check its MCP status (e.g. `/mcp` in Claude Code, `mcp` in Codex CLI, or the equivalent panel in your client) to verify the server is connected.
97
-
98
- ### Alternative: Manual Installation
99
-
100
- If you prefer to install manually:
101
-
102
- ```bash
103
- git clone https://github.com/rui-branco/sentry-mcp.git ~/.config/sentry-mcp
104
- cd ~/.config/sentry-mcp && npm install
105
- node setup.js
106
- ```
107
-
108
- Then register the local entry point with your MCP client (replace the `npx -y @rui.branco/sentry-mcp` command from Step 1 with `node $HOME/.config/sentry-mcp/index.js`). Example for Claude Code:
109
-
110
- ```bash
111
- claude mcp add --transport stdio sentry -- node $HOME/.config/sentry-mcp/index.js
112
- ```
113
-
114
- ## Usage
115
-
116
- ### List Issues
117
-
118
- ```
119
- > Show me unresolved Sentry issues
120
-
121
- # Returns all unresolved issues with metadata
122
- ```
123
-
124
- ### Inspect an Error
125
-
126
- ```
127
- > Get the latest event for Sentry issue 12345
128
-
129
- # Returns full stack trace, breadcrumbs, HTTP request, tags, and contexts
130
- ```
131
-
132
- ### Resolve After Fixing
133
-
134
- ```
135
- > Resolve Sentry issue 12345
136
-
137
- # Marks the issue as resolved in Sentry
138
- ```
139
-
140
- ### Search Issues
141
-
142
- ```
143
- > Search Sentry for "TypeError" errors in the last 24 hours
144
-
145
- # Uses Sentry search: is:unresolved TypeError lastSeen:-24h
146
- ```
147
-
148
- ### Example Output
149
-
150
- ```
151
- ## Stack Trace
152
-
153
- **TypeError:** Cannot read properties of undefined (reading 'map')
154
-
155
- ```
156
- -> renderItems (src/components/List.tsx:42:15)
157
- -> List (src/components/List.tsx:28:3)
158
- React.createElement (react-dom.js:1234)
159
- ```
160
-
161
- ## Breadcrumbs (last 5)
162
-
163
- - **navigation** [info] /dashboard -> /items
164
- - **http** [info] GET /api/items (200)
165
- - **ui.click** [info] button.load-more
166
- - **http** [error] GET /api/items?page=2 (500)
167
- - **console** [error] Unhandled error in component
168
-
169
- ## HTTP Request
170
-
171
- `GET /api/items?page=2`
172
- ```
173
-
174
- ## Multi-Instance Setup
175
-
176
- For multiple Sentry organizations, add instances via setup:
177
-
178
- ```bash
179
- npx @rui.branco/sentry-mcp setup add "work" "TOKEN_1" "https://sentry.io" "work-org" "work-project"
180
- npx @rui.branco/sentry-mcp setup add "personal" "TOKEN_2" "https://sentry.io" "personal-org" "side-project"
181
- ```
182
-
183
- Or via MCP tool at runtime:
184
-
185
- ```
186
- > Add a new Sentry instance called "work" with org "my-company"
187
- ```
188
-
189
- Use the `instance` parameter on any tool to target a specific instance, or omit it to use the default.
190
-
191
- ## API Reference
192
-
193
- ### Tools
194
-
195
- | Tool | Description | Parameters |
196
- |------|-------------|------------|
197
- | `sentry_list_projects` | List all Sentry projects accessible by the token | `instance` |
198
- | `sentry_get_issues` | Get unresolved issues for the configured project | `query`, `instance` |
199
- | `sentry_get_issue` | Get full details for a specific issue | `issueId` (required), `instance` |
200
- | `sentry_get_latest_event` | Get latest event with stack trace, breadcrumbs, HTTP request | `issueId` (required), `instance` |
201
- | `sentry_resolve_issue` | Mark an issue as resolved | `issueId` (required), `instance` |
202
- | `sentry_unresolve_issue` | Reopen a resolved issue | `issueId` (required), `instance` |
203
- | `sentry_ignore_issue` | Ignore/snooze an issue | `issueId` (required), `instance` |
204
- | `sentry_search_issues` | Search with custom Sentry query | `query` (required), `instance` |
205
- | `sentry_assign_issue` | Assign an issue to a user or team | `issueId` (required), `assignee` (required), `instance` |
206
- | `sentry_list_event_attachments` | List attachments (minidumps, screenshots, logs) stored on an event | `eventId` or `issueId`, `instance` |
207
- | `sentry_download_event_attachment` | Download an event attachment to disk and return the saved path | `attachmentId` (required), `eventId` or `issueId`, `outputPath`, `instance` |
208
- | `sentry_list_instances` | List all configured instances | none |
209
- | `sentry_add_instance` | Add or update an instance at runtime | `name`, `token`, `baseUrl`, `orgSlug` (all required), `projectSlug`, `projects`, `setDefault` |
210
- | `sentry_remove_instance` | Remove an instance | `name` (required) |
211
-
212
- ### Configuration
213
-
214
- Config stored at `~/.config/sentry-mcp/config.json`:
215
-
216
- ```json
217
- {
218
- "instances": [
219
- {
220
- "name": "work",
221
- "token": "YOUR_AUTH_TOKEN",
222
- "baseUrl": "https://sentry.io",
223
- "orgSlug": "my-company",
224
- "projectSlug": "frontend",
225
- "projects": ["frontend", "backend"]
226
- }
227
- ],
228
- "defaultInstance": "work"
229
- }
230
- ```
231
-
232
- ## Security
233
-
234
- - API tokens are stored locally in `~/.config/sentry-mcp/config.json`
235
- - Config files are excluded from git via `.gitignore`
236
- - Tokens are never logged or transmitted except to the Sentry API
237
-
238
- ## License
239
-
240
- MIT
241
-
242
- ## Related
243
-
244
- - [jira-mcp](https://github.com/rui-branco/jira-mcp) - Jira MCP server (works with any MCP-compatible AI client)
245
- - [figma-mcp](https://github.com/rui-branco/figma-mcp) - Figma MCP server (works with any MCP-compatible AI client)
246
- - [Model Context Protocol](https://modelcontextprotocol.io/) - MCP specification
1
+ # Sentry MCP Server
2
+
3
+ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that brings Sentry error tracking context directly into any MCP-compatible AI client — Claude Code, Codex CLI, Google's Antigravity (Gemini), Cursor, Windsurf, Zed, and others. Fetch issues, inspect stack traces, manage issue status, and search errors without leaving your development environment.
4
+
5
+ ## Overview
6
+
7
+ When debugging production errors, context switching between Sentry and your code editor breaks flow and wastes time. This MCP server solves that by:
8
+
9
+ - **Fetching full issue details** - Get error metadata, event counts, assignment, and status instantly
10
+ - **Inspecting stack traces** - View full stack traces with in-app frame markers, breadcrumbs, and HTTP request context
11
+ - **Managing issues** - Resolve, reopen, ignore, and assign issues directly from your AI client
12
+ - **Searching errors** - Use Sentry's search syntax to find issues across your project
13
+
14
+ ## Features
15
+
16
+ | Feature | Description |
17
+ |---------|-------------|
18
+ | Issue Details | Title, level, status, event count, user count, culprit, assignee |
19
+ | Stack Traces | Full exception chain with in-app frames highlighted |
20
+ | Breadcrumbs | Last N events leading up to the error |
21
+ | HTTP Request | Method, URL, headers from the request that triggered the error |
22
+ | Tags & Contexts | Device, browser, OS, user info, and custom tags |
23
+ | Attachments | List and download event attachments (minidumps, screenshots, logs) to disk |
24
+ | Search | Full Sentry search syntax support |
25
+ | Multi-Instance | Support for multiple Sentry organizations/instances |
26
+
27
+ ## Installation
28
+
29
+ ### Prerequisites
30
+
31
+ - Node.js 18+
32
+ - An MCP-compatible AI client (see [Step 1](#step-1-register-with-your-mcp-client) below)
33
+ - Sentry account with API access
34
+
35
+ ### Step 1: Register with your MCP client
36
+
37
+ Pick the snippet for your client. All of them launch the server over stdio.
38
+
39
+ **Claude Code:**
40
+
41
+ ```bash
42
+ claude mcp add --transport stdio sentry -- npx -y @rui.branco/sentry-mcp
43
+ ```
44
+
45
+ **Codex CLI:** add to `~/.codex/config.toml`:
46
+
47
+ ```toml
48
+ [mcp_servers.sentry]
49
+ command = "npx"
50
+ args = ["-y", "@rui.branco/sentry-mcp"]
51
+ ```
52
+
53
+ **Google Antigravity / Gemini CLI:** add to `~/.gemini/settings.json`:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "sentry": { "command": "npx", "args": ["-y", "@rui.branco/sentry-mcp"] }
59
+ }
60
+ }
61
+ ```
62
+
63
+ **Cursor, Windsurf, Zed, Cline, Continue, etc.:** add the same `command`/`args` pair to whatever JSON config that client uses for MCP servers (the exact path varies, but the shape is standard across clients).
64
+
65
+ ### Step 2: Get Your Sentry API Token
66
+
67
+ 1. Go to [Sentry Auth Tokens](https://sentry.io/settings/account/api/auth-tokens/) (or your self-hosted Sentry equivalent)
68
+ 2. Click **"Create New Token"**
69
+ 3. Select scopes: `event:read`, `project:read`, `org:read`, `member:read`
70
+ 4. Click **"Create Token"**
71
+ 5. Copy the token
72
+
73
+ ### Step 3: Configure Credentials
74
+
75
+ Run the setup with your credentials:
76
+
77
+ ```bash
78
+ npx @rui.branco/sentry-mcp setup "YOUR_AUTH_TOKEN" "https://sentry.io" "your-org-slug" "your-project-slug"
79
+ ```
80
+
81
+ | Parameter | Description | Example |
82
+ |-----------|-------------|---------|
83
+ | Auth Token | The token you created in Step 2 | `sntrys_eyJpYX...` |
84
+ | Base URL | Your Sentry instance URL | `https://sentry.io` or `https://my-org.sentry.io` |
85
+ | Org Slug | Your Sentry organization slug | `my-company` |
86
+ | Project Slug | Default project slug (optional) | `frontend` |
87
+
88
+ Or run interactively (will prompt for each value):
89
+
90
+ ```bash
91
+ npx @rui.branco/sentry-mcp setup
92
+ ```
93
+
94
+ ### Step 4: Verify
95
+
96
+ Restart your AI client and check its MCP status (e.g. `/mcp` in Claude Code, `mcp` in Codex CLI, or the equivalent panel in your client) to verify the server is connected.
97
+
98
+ ### Alternative: Manual Installation
99
+
100
+ If you prefer to install manually:
101
+
102
+ ```bash
103
+ git clone https://github.com/rui-branco/sentry-mcp.git ~/.config/sentry-mcp
104
+ cd ~/.config/sentry-mcp && npm install
105
+ node setup.js
106
+ ```
107
+
108
+ Then register the local entry point with your MCP client (replace the `npx -y @rui.branco/sentry-mcp` command from Step 1 with `node $HOME/.config/sentry-mcp/index.js`). Example for Claude Code:
109
+
110
+ ```bash
111
+ claude mcp add --transport stdio sentry -- node $HOME/.config/sentry-mcp/index.js
112
+ ```
113
+
114
+ ## Usage
115
+
116
+ ### List Issues
117
+
118
+ ```
119
+ > Show me unresolved Sentry issues
120
+
121
+ # Returns all unresolved issues with metadata
122
+ ```
123
+
124
+ ### Inspect an Error
125
+
126
+ ```
127
+ > Get the latest event for Sentry issue 12345
128
+
129
+ # Returns full stack trace, breadcrumbs, HTTP request, tags, and contexts
130
+ ```
131
+
132
+ ### Resolve After Fixing
133
+
134
+ ```
135
+ > Resolve Sentry issue 12345
136
+
137
+ # Marks the issue as resolved in Sentry
138
+ ```
139
+
140
+ ### Search Issues
141
+
142
+ ```
143
+ > Search Sentry for "TypeError" errors in the last 24 hours
144
+
145
+ # Uses Sentry search: is:unresolved TypeError lastSeen:-24h
146
+ ```
147
+
148
+ ### Example Output
149
+
150
+ ```
151
+ ## Stack Trace
152
+
153
+ **TypeError:** Cannot read properties of undefined (reading 'map')
154
+
155
+ ```
156
+ -> renderItems (src/components/List.tsx:42:15)
157
+ -> List (src/components/List.tsx:28:3)
158
+ React.createElement (react-dom.js:1234)
159
+ ```
160
+
161
+ ## Breadcrumbs (last 5)
162
+
163
+ - **navigation** [info] /dashboard -> /items
164
+ - **http** [info] GET /api/items (200)
165
+ - **ui.click** [info] button.load-more
166
+ - **http** [error] GET /api/items?page=2 (500)
167
+ - **console** [error] Unhandled error in component
168
+
169
+ ## HTTP Request
170
+
171
+ `GET /api/items?page=2`
172
+ ```
173
+
174
+ ## Multi-Instance Setup
175
+
176
+ For multiple Sentry organizations, add instances via setup:
177
+
178
+ ```bash
179
+ npx @rui.branco/sentry-mcp setup add "work" "TOKEN_1" "https://sentry.io" "work-org" "work-project"
180
+ npx @rui.branco/sentry-mcp setup add "personal" "TOKEN_2" "https://sentry.io" "personal-org" "side-project"
181
+ ```
182
+
183
+ Or via MCP tool at runtime:
184
+
185
+ ```
186
+ > Add a new Sentry instance called "work" with org "my-company"
187
+ ```
188
+
189
+ Use the `instance` parameter on any tool to target a specific instance, or omit it to use the default.
190
+
191
+ ## API Reference
192
+
193
+ ### Tools
194
+
195
+ | Tool | Description | Parameters |
196
+ |------|-------------|------------|
197
+ | `sentry_list_projects` | List all Sentry projects accessible by the token | `instance` |
198
+ | `sentry_get_issues` | Get unresolved issues for the configured project | `query`, `instance` |
199
+ | `sentry_get_issue` | Get full details for a specific issue | `issueId` (required), `instance` |
200
+ | `sentry_get_latest_event` | Get latest event with stack trace, breadcrumbs, HTTP request | `issueId` (required), `instance` |
201
+ | `sentry_resolve_issue` | Mark an issue as resolved | `issueId` (required), `instance` |
202
+ | `sentry_unresolve_issue` | Reopen a resolved issue | `issueId` (required), `instance` |
203
+ | `sentry_ignore_issue` | Ignore/snooze an issue | `issueId` (required), `instance` |
204
+ | `sentry_search_issues` | Search with custom Sentry query | `query` (required), `instance` |
205
+ | `sentry_assign_issue` | Assign an issue to a user or team | `issueId` (required), `assignee` (required), `instance` |
206
+ | `sentry_list_event_attachments` | List attachments (minidumps, screenshots, logs) stored on an event | `eventId` or `issueId`, `instance` |
207
+ | `sentry_download_event_attachment` | Download an event attachment to disk and return the saved path | `attachmentId` (required), `eventId` or `issueId`, `outputPath`, `instance` |
208
+ | `sentry_list_instances` | List all configured instances | none |
209
+ | `sentry_add_instance` | Add or update an instance at runtime | `name`, `token`, `baseUrl`, `orgSlug` (all required), `projectSlug`, `projects`, `setDefault` |
210
+ | `sentry_remove_instance` | Remove an instance | `name` (required) |
211
+
212
+ ### Configuration
213
+
214
+ Config stored at `~/.config/sentry-mcp/config.json`:
215
+
216
+ ```json
217
+ {
218
+ "instances": [
219
+ {
220
+ "name": "work",
221
+ "token": "YOUR_AUTH_TOKEN",
222
+ "baseUrl": "https://sentry.io",
223
+ "orgSlug": "my-company",
224
+ "projectSlug": "frontend",
225
+ "projects": ["frontend", "backend"]
226
+ }
227
+ ],
228
+ "defaultInstance": "work"
229
+ }
230
+ ```
231
+
232
+ ## Security
233
+
234
+ - API tokens are stored locally in `~/.config/sentry-mcp/config.json`
235
+ - Config files are excluded from git via `.gitignore`
236
+ - Tokens are never logged or transmitted except to the Sentry API
237
+
238
+ ## License
239
+
240
+ MIT
241
+
242
+ ## Related
243
+
244
+ - [jira-mcp](https://github.com/rui-branco/jira-mcp) - Jira MCP server (works with any MCP-compatible AI client)
245
+ - [figma-mcp](https://github.com/rui-branco/figma-mcp) - Figma MCP server (works with any MCP-compatible AI client)
246
+ - [Model Context Protocol](https://modelcontextprotocol.io/) - MCP specification