@sentry/mcp-server 0.11.0 → 0.12.0

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 (213) hide show
  1. package/dist/api-client/client.cjs +2 -2
  2. package/dist/api-client/client.d.cts +3 -3
  3. package/dist/api-client/client.d.ts +3 -3
  4. package/dist/api-client/client.js +2 -2
  5. package/dist/api-client/client.test.cjs +2 -2
  6. package/dist/api-client/client.test.js +2 -2
  7. package/dist/api-client/index.cjs +3 -2
  8. package/dist/api-client/index.d.cts +4 -4
  9. package/dist/api-client/index.d.ts +4 -4
  10. package/dist/api-client/index.js +3 -3
  11. package/dist/api-client/schema.cjs +2 -1
  12. package/dist/api-client/schema.d.cts +2 -2
  13. package/dist/api-client/schema.d.ts +2 -2
  14. package/dist/api-client/schema.js +2 -2
  15. package/dist/api-client/types.d.cts +3 -3
  16. package/dist/api-client/types.d.ts +3 -3
  17. package/dist/client-4jq_wVgn.d.ts +522 -0
  18. package/dist/client-4jq_wVgn.d.ts.map +1 -0
  19. package/dist/client-B7vZ6JMk.cjs +572 -0
  20. package/dist/client-B7vZ6JMk.cjs.map +1 -0
  21. package/dist/client-CAoHZbyK.js +561 -0
  22. package/dist/client-CAoHZbyK.js.map +1 -0
  23. package/dist/client-DkY0ifZf.d.cts +522 -0
  24. package/dist/client-DkY0ifZf.d.cts.map +1 -0
  25. package/dist/formatting-BaARL2gT.js.map +1 -1
  26. package/dist/formatting-C2kN0ok6.cjs.map +1 -1
  27. package/dist/index.cjs +13 -13
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.js +13 -13
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/formatting.d.cts +4 -3
  32. package/dist/internal/formatting.d.cts.map +1 -1
  33. package/dist/internal/formatting.d.ts +4 -3
  34. package/dist/internal/formatting.d.ts.map +1 -1
  35. package/dist/internal/issue-helpers.cjs +1 -1
  36. package/dist/internal/issue-helpers.d.cts +8 -0
  37. package/dist/internal/issue-helpers.d.cts.map +1 -1
  38. package/dist/internal/issue-helpers.d.ts +8 -0
  39. package/dist/internal/issue-helpers.d.ts.map +1 -1
  40. package/dist/internal/issue-helpers.js +1 -1
  41. package/dist/internal/issue-helpers.test.cjs +1 -1
  42. package/dist/internal/issue-helpers.test.js +1 -1
  43. package/dist/{issue-helpers-CSNNO03f.js → issue-helpers-BMVLc3mR.js} +9 -1
  44. package/dist/issue-helpers-BMVLc3mR.js.map +1 -0
  45. package/dist/{issue-helpers-71XgJVXC.cjs → issue-helpers-D712fGT2.cjs} +9 -1
  46. package/dist/issue-helpers-D712fGT2.cjs.map +1 -0
  47. package/dist/logging-ByvSjT6V.cjs.map +1 -1
  48. package/dist/logging-CXLD0FFB.js.map +1 -1
  49. package/dist/logging.d.cts +30 -1
  50. package/dist/logging.d.cts.map +1 -1
  51. package/dist/logging.d.ts +30 -1
  52. package/dist/logging.d.ts.map +1 -1
  53. package/dist/{promptDefinitions-D3ll3qCd.cjs → promptDefinitions-BTLIBcGt.cjs} +9 -2
  54. package/dist/promptDefinitions-BTLIBcGt.cjs.map +1 -0
  55. package/dist/{promptDefinitions-H0q1_X-K.d.ts → promptDefinitions-CF2VWdQ6.d.cts} +9 -1
  56. package/dist/promptDefinitions-CF2VWdQ6.d.cts.map +1 -0
  57. package/dist/{promptDefinitions-DMucOchd.d.cts → promptDefinitions-D5FSQckL.d.ts} +9 -1
  58. package/dist/promptDefinitions-D5FSQckL.d.ts.map +1 -0
  59. package/dist/{promptDefinitions-aKmUZWWO.js → promptDefinitions-D8yow1m0.js} +9 -2
  60. package/dist/promptDefinitions-D8yow1m0.js.map +1 -0
  61. package/dist/promptDefinitions.cjs +2 -2
  62. package/dist/promptDefinitions.d.cts +1 -1
  63. package/dist/promptDefinitions.d.ts +1 -1
  64. package/dist/promptDefinitions.js +2 -2
  65. package/dist/{prompts-DMwoay8l.cjs → prompts-CDbQrutV.cjs} +3 -2
  66. package/dist/prompts-CDbQrutV.cjs.map +1 -0
  67. package/dist/{prompts-CzD0yl7Z.js → prompts-Dt3A8Qfl.js} +4 -2
  68. package/dist/prompts-Dt3A8Qfl.js.map +1 -0
  69. package/dist/prompts.cjs +2 -1
  70. package/dist/prompts.d.cts +3 -3
  71. package/dist/prompts.d.cts.map +1 -1
  72. package/dist/prompts.d.ts +3 -3
  73. package/dist/prompts.d.ts.map +1 -1
  74. package/dist/prompts.js +2 -1
  75. package/dist/{resources-x-GaokG8.js → resources-Bol20Xuo.js} +13 -1
  76. package/dist/resources-Bol20Xuo.js.map +1 -0
  77. package/dist/{resources-D6TW2ER0.cjs → resources-DNyoutxH.cjs} +13 -1
  78. package/dist/resources-DNyoutxH.cjs.map +1 -0
  79. package/dist/resources.cjs +1 -1
  80. package/dist/resources.d.cts +9 -0
  81. package/dist/resources.d.cts.map +1 -1
  82. package/dist/resources.d.ts +9 -0
  83. package/dist/resources.d.ts.map +1 -1
  84. package/dist/resources.js +1 -1
  85. package/dist/{schema-C-MLkWMc.d.ts → schema-BJv7kREf.d.cts} +178 -66
  86. package/dist/schema-BJv7kREf.d.cts.map +1 -0
  87. package/dist/{schema-B8lT632E.cjs → schema-BTfISwFu.cjs} +29 -2
  88. package/dist/schema-BTfISwFu.cjs.map +1 -0
  89. package/dist/{schema-DqxkW9Tx.d.cts → schema-BnxGHL_i.d.ts} +178 -66
  90. package/dist/schema-BnxGHL_i.d.ts.map +1 -0
  91. package/dist/{schema-DkyWSqp_.cjs → schema-BsvGMALe.cjs} +37 -6
  92. package/dist/schema-BsvGMALe.cjs.map +1 -0
  93. package/dist/{schema-CewAKS9A.js → schema-C_hp0BR7.js} +32 -7
  94. package/dist/schema-C_hp0BR7.js.map +1 -0
  95. package/dist/schema-Dv6aLZgz.js +32 -0
  96. package/dist/schema-Dv6aLZgz.js.map +1 -0
  97. package/dist/schema.cjs +3 -1
  98. package/dist/schema.d.cts +13 -3
  99. package/dist/schema.d.cts.map +1 -1
  100. package/dist/schema.d.ts +13 -3
  101. package/dist/schema.d.ts.map +1 -1
  102. package/dist/schema.js +2 -2
  103. package/dist/{server-qpWdf-ST.js → server-C7cHq_pc.js} +57 -9
  104. package/dist/server-C7cHq_pc.js.map +1 -0
  105. package/dist/{server-pGtEIwE3.cjs → server-DeutbO8v.cjs} +57 -9
  106. package/dist/server-DeutbO8v.cjs.map +1 -0
  107. package/dist/server.cjs +10 -10
  108. package/dist/server.d.cts +23 -4
  109. package/dist/server.d.cts.map +1 -1
  110. package/dist/server.d.ts +23 -4
  111. package/dist/server.d.ts.map +1 -1
  112. package/dist/server.js +10 -10
  113. package/dist/stdio-B73CCTly.cjs +47 -0
  114. package/dist/stdio-B73CCTly.cjs.map +1 -0
  115. package/dist/stdio-ZQLC-i5Q.js +41 -0
  116. package/dist/stdio-ZQLC-i5Q.js.map +1 -0
  117. package/dist/test-setup.cjs +420 -257
  118. package/dist/test-setup.cjs.map +1 -1
  119. package/dist/test-setup.js +420 -257
  120. package/dist/test-setup.js.map +1 -1
  121. package/dist/{toolDefinitions-Dp13BpEu.d.cts → toolDefinitions-BOMF-zIC.d.ts} +115 -17
  122. package/dist/toolDefinitions-BOMF-zIC.d.ts.map +1 -0
  123. package/dist/{toolDefinitions-BtHN8t_d.cjs → toolDefinitions-CUegGcWU.cjs} +117 -6
  124. package/dist/toolDefinitions-CUegGcWU.cjs.map +1 -0
  125. package/dist/{toolDefinitions-BSC2D_S-.js → toolDefinitions-DFAxp3nr.js} +117 -6
  126. package/dist/toolDefinitions-DFAxp3nr.js.map +1 -0
  127. package/dist/{toolDefinitions-fQrpWznJ.d.ts → toolDefinitions-Ipvr4Acw.d.cts} +115 -17
  128. package/dist/toolDefinitions-Ipvr4Acw.d.cts.map +1 -0
  129. package/dist/toolDefinitions.cjs +2 -2
  130. package/dist/toolDefinitions.d.cts +1 -1
  131. package/dist/toolDefinitions.d.ts +1 -1
  132. package/dist/toolDefinitions.js +2 -2
  133. package/dist/toolDefinitions.test.cjs +2 -2
  134. package/dist/toolDefinitions.test.js +2 -2
  135. package/dist/{tools-4Rtn4WEf.js → tools-DpiQwSTY.js} +137 -11
  136. package/dist/tools-DpiQwSTY.js.map +1 -0
  137. package/dist/{tools-DHHqAqP9.cjs → tools-DyOqlsCW.cjs} +137 -11
  138. package/dist/tools-DyOqlsCW.cjs.map +1 -0
  139. package/dist/tools.cjs +4 -4
  140. package/dist/tools.d.cts +91 -7
  141. package/dist/tools.d.cts.map +1 -1
  142. package/dist/tools.d.ts +91 -7
  143. package/dist/tools.d.ts.map +1 -1
  144. package/dist/tools.js +4 -4
  145. package/dist/tools.test.cjs +290 -10
  146. package/dist/tools.test.cjs.map +1 -1
  147. package/dist/tools.test.js +290 -10
  148. package/dist/tools.test.js.map +1 -1
  149. package/dist/transports/stdio.cjs +11 -11
  150. package/dist/transports/stdio.d.cts +26 -4
  151. package/dist/transports/stdio.d.cts.map +1 -1
  152. package/dist/transports/stdio.d.ts +26 -4
  153. package/dist/transports/stdio.d.ts.map +1 -1
  154. package/dist/transports/stdio.js +11 -11
  155. package/dist/{types-CfJ51LyL.d.ts → types-D5TPcOfv.d.ts} +4 -3
  156. package/dist/types-D5TPcOfv.d.ts.map +1 -0
  157. package/dist/{types-CbLyQvVe.d.cts → types-DRF2IoP_.d.cts} +4 -3
  158. package/dist/types-DRF2IoP_.d.cts.map +1 -0
  159. package/dist/{types-DuUmV9zh.d.ts → types-Daq2fm0E.d.ts} +5 -3
  160. package/dist/types-Daq2fm0E.d.ts.map +1 -0
  161. package/dist/{types-CcffrLXB.d.cts → types-NIQW7KyF.d.cts} +5 -3
  162. package/dist/types-NIQW7KyF.d.cts.map +1 -0
  163. package/dist/types.d.cts +3 -3
  164. package/dist/types.d.ts +3 -3
  165. package/dist/{version-CRzAHHGZ.cjs → version-BNmubeQI.cjs} +2 -2
  166. package/dist/{version-CRzAHHGZ.cjs.map → version-BNmubeQI.cjs.map} +1 -1
  167. package/dist/version-CRto5Sn_.js +6 -0
  168. package/dist/{version-BT9r_3jm.js.map → version-CRto5Sn_.js.map} +1 -1
  169. package/dist/version.cjs +1 -1
  170. package/dist/version.js +1 -1
  171. package/package.json +3 -3
  172. package/dist/client-Bxf4MxOz.d.cts +0 -179
  173. package/dist/client-Bxf4MxOz.d.cts.map +0 -1
  174. package/dist/client-D5xFZtxK.js +0 -224
  175. package/dist/client-D5xFZtxK.js.map +0 -1
  176. package/dist/client-DOhBiaMJ.d.ts +0 -179
  177. package/dist/client-DOhBiaMJ.d.ts.map +0 -1
  178. package/dist/client-GKHZSXgV.cjs +0 -235
  179. package/dist/client-GKHZSXgV.cjs.map +0 -1
  180. package/dist/issue-helpers-71XgJVXC.cjs.map +0 -1
  181. package/dist/issue-helpers-CSNNO03f.js.map +0 -1
  182. package/dist/promptDefinitions-D3ll3qCd.cjs.map +0 -1
  183. package/dist/promptDefinitions-DMucOchd.d.cts.map +0 -1
  184. package/dist/promptDefinitions-H0q1_X-K.d.ts.map +0 -1
  185. package/dist/promptDefinitions-aKmUZWWO.js.map +0 -1
  186. package/dist/prompts-CzD0yl7Z.js.map +0 -1
  187. package/dist/prompts-DMwoay8l.cjs.map +0 -1
  188. package/dist/resources-D6TW2ER0.cjs.map +0 -1
  189. package/dist/resources-x-GaokG8.js.map +0 -1
  190. package/dist/schema-B8lT632E.cjs.map +0 -1
  191. package/dist/schema-BkHf97d7.js +0 -17
  192. package/dist/schema-BkHf97d7.js.map +0 -1
  193. package/dist/schema-C-MLkWMc.d.ts.map +0 -1
  194. package/dist/schema-CewAKS9A.js.map +0 -1
  195. package/dist/schema-DkyWSqp_.cjs.map +0 -1
  196. package/dist/schema-DqxkW9Tx.d.cts.map +0 -1
  197. package/dist/server-pGtEIwE3.cjs.map +0 -1
  198. package/dist/server-qpWdf-ST.js.map +0 -1
  199. package/dist/stdio-D8u2W847.js +0 -19
  200. package/dist/stdio-D8u2W847.js.map +0 -1
  201. package/dist/stdio-DydB2Pxu.cjs +0 -25
  202. package/dist/stdio-DydB2Pxu.cjs.map +0 -1
  203. package/dist/toolDefinitions-BSC2D_S-.js.map +0 -1
  204. package/dist/toolDefinitions-BtHN8t_d.cjs.map +0 -1
  205. package/dist/toolDefinitions-Dp13BpEu.d.cts.map +0 -1
  206. package/dist/toolDefinitions-fQrpWznJ.d.ts.map +0 -1
  207. package/dist/tools-4Rtn4WEf.js.map +0 -1
  208. package/dist/tools-DHHqAqP9.cjs.map +0 -1
  209. package/dist/types-CbLyQvVe.d.cts.map +0 -1
  210. package/dist/types-CcffrLXB.d.cts.map +0 -1
  211. package/dist/types-CfJ51LyL.d.ts.map +0 -1
  212. package/dist/types-DuUmV9zh.d.ts.map +0 -1
  213. package/dist/version-BT9r_3jm.js +0 -6
@@ -0,0 +1,522 @@
1
+ import { AutofixRun, AutofixRunState, ClientKey, ClientKeyList, Event, Issue, IssueList, OrganizationList, Project, ProjectList, ReleaseList, TagList, Team, TeamList, User } from "./types-NIQW7KyF.cjs";
2
+
3
+ //#region src/api-client/client.d.ts
4
+
5
+ /**
6
+ * Custom error class for Sentry API responses.
7
+ *
8
+ * Provides enhanced error messages for LLM consumption and handles
9
+ * common API error scenarios with user-friendly messaging.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * try {
14
+ * await apiService.listIssues({ organizationSlug: "invalid" });
15
+ * } catch (error) {
16
+ * if (error instanceof ApiError) {
17
+ * console.log(`API Error ${error.status}: ${error.message}`);
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ declare class ApiError extends Error {
23
+ status: number;
24
+ constructor(message: string, status: number);
25
+ }
26
+ type RequestOptions = {
27
+ host?: string;
28
+ };
29
+ /**
30
+ * Sentry API client service for interacting with Sentry's REST API.
31
+ *
32
+ * This service provides a comprehensive interface to Sentry's API endpoints,
33
+ * handling authentication, error processing, multi-region support, and
34
+ * response validation through Zod schemas.
35
+ *
36
+ * Key Features:
37
+ * - Multi-region support for Sentry SaaS and self-hosted instances
38
+ * - Automatic schema validation with Zod
39
+ * - Enhanced error handling with LLM-friendly messages
40
+ * - URL generation for Sentry resources (issues, traces)
41
+ * - Bearer token authentication
42
+ *
43
+ * @example Basic Usage
44
+ * ```typescript
45
+ * const apiService = new SentryApiService({
46
+ * accessToken: "your-token",
47
+ * host: "sentry.io"
48
+ * });
49
+ *
50
+ * const orgs = await apiService.listOrganizations();
51
+ * const issues = await apiService.listIssues({
52
+ * organizationSlug: "my-org",
53
+ * query: "is:unresolved"
54
+ * });
55
+ * ```
56
+ *
57
+ * @example Multi-Region Support
58
+ * ```typescript
59
+ * // Self-hosted instance
60
+ * const selfHosted = new SentryApiService({
61
+ * accessToken: "token",
62
+ * host: "sentry.company.com"
63
+ * });
64
+ *
65
+ * // Regional endpoint override
66
+ * const issues = await apiService.listIssues(
67
+ * { organizationSlug: "org" },
68
+ * { host: "eu.sentry.io" }
69
+ * );
70
+ * ```
71
+ */
72
+ declare class SentryApiService {
73
+ private accessToken;
74
+ protected host: string;
75
+ protected apiPrefix: string;
76
+ /**
77
+ * Creates a new Sentry API service instance.
78
+ *
79
+ * @param config Configuration object
80
+ * @param config.accessToken OAuth access token for authentication (optional for some endpoints)
81
+ * @param config.host Sentry host (defaults to sentry.io)
82
+ */
83
+ constructor({
84
+ accessToken,
85
+ host
86
+ }: {
87
+ accessToken?: string | null;
88
+ host?: string;
89
+ });
90
+ /**
91
+ * Updates the host for API requests.
92
+ *
93
+ * Used for multi-region support or switching between Sentry instances.
94
+ *
95
+ * @param host New host to use for API requests
96
+ */
97
+ setHost(host: string): void;
98
+ /**
99
+ * Internal method for making authenticated requests to Sentry API.
100
+ *
101
+ * Handles:
102
+ * - Bearer token authentication
103
+ * - Error response parsing and enhancement
104
+ * - Multi-region host overrides
105
+ * - Fetch availability validation
106
+ *
107
+ * @param path API endpoint path (without /api/0 prefix)
108
+ * @param options Fetch options
109
+ * @param requestOptions Additional request configuration
110
+ * @returns Promise resolving to Response object
111
+ * @throws {ApiError} Enhanced API errors with user-friendly messages
112
+ * @throws {Error} Network or parsing errors
113
+ */
114
+ private request;
115
+ /**
116
+ * Generates a Sentry issue URL for browser navigation.
117
+ *
118
+ * Handles both SaaS (subdomain-based) and self-hosted URL formats.
119
+ *
120
+ * @param organizationSlug Organization identifier
121
+ * @param issueId Issue identifier (short ID or numeric ID)
122
+ * @returns Full HTTPS URL to the issue in Sentry UI
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // SaaS: https://my-org.sentry.io/issues/PROJ-123
127
+ * apiService.getIssueUrl("my-org", "PROJ-123")
128
+ *
129
+ * // Self-hosted: https://sentry.company.com/organizations/my-org/issues/PROJ-123
130
+ * apiService.getIssueUrl("my-org", "PROJ-123")
131
+ * ```
132
+ */
133
+ getIssueUrl(organizationSlug: string, issueId: string): string;
134
+ /**
135
+ * Generates a Sentry trace URL for performance investigation.
136
+ *
137
+ * @param organizationSlug Organization identifier
138
+ * @param traceId Trace identifier (hex string)
139
+ * @returns Full HTTPS URL to the trace in Sentry UI
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const traceUrl = apiService.getTraceUrl("my-org", "6a477f5b0f31ef7b6b9b5e1dea66c91d");
144
+ * // https://my-org.sentry.io/explore/traces/trace/6a477f5b0f31ef7b6b9b5e1dea66c91d
145
+ * ```
146
+ */
147
+ getTraceUrl(organizationSlug: string, traceId: string): string;
148
+ /**
149
+ * Retrieves the authenticated user's profile information.
150
+ *
151
+ * @param opts Request options including host override
152
+ * @returns User profile data
153
+ * @throws {ApiError} If authentication fails or user not found
154
+ */
155
+ getAuthenticatedUser(opts?: RequestOptions): Promise<User>;
156
+ /**
157
+ * Lists all organizations accessible to the authenticated user.
158
+ *
159
+ * Automatically handles multi-region queries by fetching from all
160
+ * available regions and combining results.
161
+ *
162
+ * @param opts Request options
163
+ * @returns Array of organizations across all accessible regions
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * const orgs = await apiService.listOrganizations();
168
+ * orgs.forEach(org => {
169
+ * // regionUrl present for Cloud Service, empty for self-hosted
170
+ * console.log(`${org.name} (${org.slug}) - ${org.links?.regionUrl || 'No region URL'}`);
171
+ * });
172
+ * ```
173
+ */
174
+ listOrganizations(opts?: RequestOptions): Promise<OrganizationList>;
175
+ /**
176
+ * Lists teams within an organization.
177
+ *
178
+ * @param organizationSlug Organization identifier
179
+ * @param opts Request options including host override
180
+ * @returns Array of teams in the organization
181
+ */
182
+ listTeams(organizationSlug: string, opts?: RequestOptions): Promise<TeamList>;
183
+ /**
184
+ * Creates a new team within an organization.
185
+ *
186
+ * @param params Team creation parameters
187
+ * @param params.organizationSlug Organization identifier
188
+ * @param params.name Team name
189
+ * @param opts Request options
190
+ * @returns Created team data
191
+ * @throws {ApiError} If team creation fails (e.g., name conflicts)
192
+ */
193
+ createTeam({
194
+ organizationSlug,
195
+ name
196
+ }: {
197
+ organizationSlug: string;
198
+ name: string;
199
+ }, opts?: RequestOptions): Promise<Team>;
200
+ /**
201
+ * Lists projects within an organization.
202
+ *
203
+ * @param organizationSlug Organization identifier
204
+ * @param opts Request options
205
+ * @returns Array of projects in the organization
206
+ */
207
+ listProjects(organizationSlug: string, opts?: RequestOptions): Promise<ProjectList>;
208
+ /**
209
+ * Creates a new project within a team.
210
+ *
211
+ * @param params Project creation parameters
212
+ * @param params.organizationSlug Organization identifier
213
+ * @param params.teamSlug Team identifier
214
+ * @param params.name Project name
215
+ * @param params.platform Platform identifier (e.g., "javascript", "python")
216
+ * @param opts Request options
217
+ * @returns Created project data
218
+ */
219
+ createProject({
220
+ organizationSlug,
221
+ teamSlug,
222
+ name,
223
+ platform
224
+ }: {
225
+ organizationSlug: string;
226
+ teamSlug: string;
227
+ name: string;
228
+ platform?: string;
229
+ }, opts?: RequestOptions): Promise<Project>;
230
+ /**
231
+ * Updates an existing project's configuration.
232
+ *
233
+ * @param params Project update parameters
234
+ * @param params.organizationSlug Organization identifier
235
+ * @param params.projectSlug Current project identifier
236
+ * @param params.name New project name (optional)
237
+ * @param params.slug New project slug (optional)
238
+ * @param params.platform New platform identifier (optional)
239
+ * @param opts Request options
240
+ * @returns Updated project data
241
+ */
242
+ updateProject({
243
+ organizationSlug,
244
+ projectSlug,
245
+ name,
246
+ slug,
247
+ platform
248
+ }: {
249
+ organizationSlug: string;
250
+ projectSlug: string;
251
+ name?: string;
252
+ slug?: string;
253
+ platform?: string;
254
+ }, opts?: RequestOptions): Promise<Project>;
255
+ /**
256
+ * Assigns a team to a project.
257
+ *
258
+ * @param params Assignment parameters
259
+ * @param params.organizationSlug Organization identifier
260
+ * @param params.projectSlug Project identifier
261
+ * @param params.teamSlug Team identifier to assign
262
+ * @param opts Request options
263
+ */
264
+ addTeamToProject({
265
+ organizationSlug,
266
+ projectSlug,
267
+ teamSlug
268
+ }: {
269
+ organizationSlug: string;
270
+ projectSlug: string;
271
+ teamSlug: string;
272
+ }, opts?: RequestOptions): Promise<void>;
273
+ /**
274
+ * Creates a new client key (DSN) for a project.
275
+ *
276
+ * Client keys are used to identify and authenticate SDK requests to Sentry.
277
+ *
278
+ * @param params Key creation parameters
279
+ * @param params.organizationSlug Organization identifier
280
+ * @param params.projectSlug Project identifier
281
+ * @param params.name Human-readable name for the key (optional)
282
+ * @param opts Request options
283
+ * @returns Created client key with DSN information
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * const key = await apiService.createClientKey({
288
+ * organizationSlug: "my-org",
289
+ * projectSlug: "my-project",
290
+ * name: "Production"
291
+ * });
292
+ * console.log(`DSN: ${key.dsn.public}`);
293
+ * ```
294
+ */
295
+ createClientKey({
296
+ organizationSlug,
297
+ projectSlug,
298
+ name
299
+ }: {
300
+ organizationSlug: string;
301
+ projectSlug: string;
302
+ name?: string;
303
+ }, opts?: RequestOptions): Promise<ClientKey>;
304
+ /**
305
+ * Lists all client keys (DSNs) for a project.
306
+ *
307
+ * @param params Query parameters
308
+ * @param params.organizationSlug Organization identifier
309
+ * @param params.projectSlug Project identifier
310
+ * @param opts Request options
311
+ * @returns Array of client keys with DSN information
312
+ */
313
+ listClientKeys({
314
+ organizationSlug,
315
+ projectSlug
316
+ }: {
317
+ organizationSlug: string;
318
+ projectSlug: string;
319
+ }, opts?: RequestOptions): Promise<ClientKeyList>;
320
+ /**
321
+ * Lists releases for an organization or specific project.
322
+ *
323
+ * @param params Query parameters
324
+ * @param params.organizationSlug Organization identifier
325
+ * @param params.projectSlug Project identifier (optional, scopes to specific project)
326
+ * @param params.query Search query for filtering releases
327
+ * @param opts Request options
328
+ * @returns Array of releases with deployment and commit information
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * // All releases for organization
333
+ * const releases = await apiService.listReleases({
334
+ * organizationSlug: "my-org"
335
+ * });
336
+ *
337
+ * // Search for specific version
338
+ * const filtered = await apiService.listReleases({
339
+ * organizationSlug: "my-org",
340
+ * query: "v1.2.3"
341
+ * });
342
+ * ```
343
+ */
344
+ listReleases({
345
+ organizationSlug,
346
+ projectSlug,
347
+ query
348
+ }: {
349
+ organizationSlug: string;
350
+ projectSlug?: string;
351
+ query?: string;
352
+ }, opts?: RequestOptions): Promise<ReleaseList>;
353
+ /**
354
+ * Lists available tags for search queries.
355
+ *
356
+ * Tags represent indexed fields that can be used in Sentry search queries.
357
+ *
358
+ * @param params Query parameters
359
+ * @param params.organizationSlug Organization identifier
360
+ * @param params.dataset Dataset to query tags for ("errors" or "search_issues")
361
+ * @param opts Request options
362
+ * @returns Array of available tags with metadata
363
+ *
364
+ * @example
365
+ * ```typescript
366
+ * const tags = await apiService.listTags({
367
+ * organizationSlug: "my-org",
368
+ * dataset: "errors"
369
+ * });
370
+ * tags.forEach(tag => console.log(`${tag.key}: ${tag.name}`));
371
+ * ```
372
+ */
373
+ listTags({
374
+ organizationSlug,
375
+ dataset
376
+ }: {
377
+ organizationSlug: string;
378
+ dataset?: "errors" | "search_issues";
379
+ }, opts?: RequestOptions): Promise<TagList>;
380
+ /**
381
+ * Lists issues within an organization or project.
382
+ *
383
+ * Issues represent groups of similar errors or problems in your application.
384
+ * Supports Sentry's powerful query syntax for filtering and sorting.
385
+ *
386
+ * @param params Query parameters
387
+ * @param params.organizationSlug Organization identifier
388
+ * @param params.projectSlug Project identifier (optional, scopes to specific project)
389
+ * @param params.query Sentry search query (e.g., "is:unresolved browser:chrome")
390
+ * @param params.sortBy Sort order ("user", "freq", "date", "new")
391
+ * @param opts Request options
392
+ * @returns Array of issues with metadata and statistics
393
+ *
394
+ * @example
395
+ * ```typescript
396
+ * // Recent unresolved issues
397
+ * const issues = await apiService.listIssues({
398
+ * organizationSlug: "my-org",
399
+ * query: "is:unresolved",
400
+ * sortBy: "date"
401
+ * });
402
+ *
403
+ * // High-frequency errors in specific project
404
+ * const critical = await apiService.listIssues({
405
+ * organizationSlug: "my-org",
406
+ * projectSlug: "backend",
407
+ * query: "level:error",
408
+ * sortBy: "freq"
409
+ * });
410
+ * ```
411
+ */
412
+ listIssues({
413
+ organizationSlug,
414
+ projectSlug,
415
+ query,
416
+ sortBy
417
+ }: {
418
+ organizationSlug: string;
419
+ projectSlug?: string;
420
+ query?: string;
421
+ sortBy?: "user" | "freq" | "date" | "new";
422
+ }, opts?: RequestOptions): Promise<IssueList>;
423
+ getIssue({
424
+ organizationSlug,
425
+ issueId
426
+ }: {
427
+ organizationSlug: string;
428
+ issueId: string;
429
+ }, opts?: RequestOptions): Promise<Issue>;
430
+ getEventForIssue({
431
+ organizationSlug,
432
+ issueId,
433
+ eventId
434
+ }: {
435
+ organizationSlug: string;
436
+ issueId: string;
437
+ eventId: string;
438
+ }, opts?: RequestOptions): Promise<Event>;
439
+ getLatestEventForIssue({
440
+ organizationSlug,
441
+ issueId
442
+ }: {
443
+ organizationSlug: string;
444
+ issueId: string;
445
+ }, opts?: RequestOptions): Promise<Event>;
446
+ updateIssue({
447
+ organizationSlug,
448
+ issueId,
449
+ status,
450
+ assignedTo
451
+ }: {
452
+ organizationSlug: string;
453
+ issueId: string;
454
+ status?: string;
455
+ assignedTo?: string;
456
+ }, opts?: RequestOptions): Promise<Issue>;
457
+ searchErrors({
458
+ organizationSlug,
459
+ projectSlug,
460
+ filename,
461
+ transaction,
462
+ query,
463
+ sortBy
464
+ }: {
465
+ organizationSlug: string;
466
+ projectSlug?: string;
467
+ filename?: string;
468
+ transaction?: string;
469
+ query?: string;
470
+ sortBy?: "last_seen" | "count";
471
+ }, opts?: RequestOptions): Promise<{
472
+ issue: string;
473
+ title: string;
474
+ project: string;
475
+ "issue.id": string | number;
476
+ "count()": number;
477
+ "last_seen()": string;
478
+ }[]>;
479
+ searchSpans({
480
+ organizationSlug,
481
+ projectSlug,
482
+ transaction,
483
+ query,
484
+ sortBy
485
+ }: {
486
+ organizationSlug: string;
487
+ projectSlug?: string;
488
+ transaction?: string;
489
+ query?: string;
490
+ sortBy?: "timestamp" | "duration";
491
+ }, opts?: RequestOptions): Promise<{
492
+ id: string;
493
+ project: string;
494
+ transaction: string;
495
+ timestamp: string;
496
+ trace: string;
497
+ "span.op": string;
498
+ "span.description": string;
499
+ "span.duration": number;
500
+ }[]>;
501
+ startAutofix({
502
+ organizationSlug,
503
+ issueId,
504
+ eventId,
505
+ instruction
506
+ }: {
507
+ organizationSlug: string;
508
+ issueId: string;
509
+ eventId?: string;
510
+ instruction?: string;
511
+ }, opts?: RequestOptions): Promise<AutofixRun>;
512
+ getAutofixState({
513
+ organizationSlug,
514
+ issueId
515
+ }: {
516
+ organizationSlug: string;
517
+ issueId: string;
518
+ }, opts?: RequestOptions): Promise<AutofixRunState>;
519
+ }
520
+ //#endregion
521
+ export { ApiError, SentryApiService };
522
+ //# sourceMappingURL=client-DkY0ifZf.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-DkY0ifZf.d.cts","names":[],"sources":["../src/api-client/client.ts"],"sourcesContent":[],"mappings":";;;;;;AA2DA;AAkBC;AAiDD;;;;;;;;;;;;;AAoPM,cAvTO,QAAA,SAAiB,KAAK,CAuT7B;EAAgB,MAChB,EAAA,MAAA;EAAI,WAKC,CAAA,OAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA;;KAzSN,cAAA,GA0SA;EAAO,IAsBD,CAAA,EAAA,MAAA;CAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Dd,iBACN,QAAQ;;;;;;;YAyBF,iBACN,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatting-BaARL2gT.js","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event","data: z.infer<typeof ErrorEntrySchema>","data: z.infer<typeof RequestEntrySchema>","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n output += formatExceptionInterfaceOutput(\n event,\n entry.data as z.infer<typeof ErrorEntrySchema>,\n );\n }\n if (entry.type === \"request\") {\n output += formatRequestInterfaceOutput(\n event,\n entry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n }\n output += formatContexts(event.contexts);\n return output;\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n let output = \"\";\n // TODO: support chained exceptions\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n return \"\";\n }\n output += `### Error\\n\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n return output;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n return output;\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";AAWA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KAAK,IAAI,CAAC,EAAE,MAAM,YAAY,IAAI,MAAM,SAAS,KAAK,GAAG;AAE9D,SAAQ,EAAE,MAAM,YAAY,GAAG,MAAM,SAAS,KAAK,mBAAmB,OAAO,MAAM,YAAY,MAAM,OAAO,GAC1G,MAAM,UACD,WAAW,MAAM,OAAO,EAAE,MAAM,UAAU,QAAQ,GAAG,MAAM,MAAM,IAAI,GAAG,IACzE,GACL;AACF;AAED,SAAgB,kBAAkBC,OAAc;CAC9C,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,MAAM,SAAS;AACjC,MAAI,MAAM,SAAS,YACjB,WAAU,+BACR,OACA,MAAM,KACP;AAEH,MAAI,MAAM,SAAS,UACjB,WAAU,6BACR,OACA,MAAM,KACP;CAEJ;AACD,WAAU,eAAe,MAAM,SAAS;AACxC,QAAO;AACR;AAED,SAAS,+BACPA,OACAC,MACA;CACA,IAAI,SAAS;CAEb,MAAM,aAAa,KAAK,SAAS,KAAK,OAAO;AAC7C,MAAK,WACH,QAAO;AAET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iB,IAAI,KAAK,MAAM,UAAU,aAAa,CAAC;AACnE,YAAW,mBAAmB,MAAM,MAAM;AAC1C,YAAW,sBAAsB,MAAM,UAAU;AACjD,YAAW,cAAc,MAAM,OAAO;AACtC,YAAW,gBAAgB,MAAM,SAAS;AAC1C,YAAW,eAAe,MAAM,QAAQ,KAAK;AAC7C,YAAW,WAAW,WAAW,YAAY,kBAAkB,MAAM,QAAQ,CAAC;AAC9E,WAAU;AACV,WAAU;AACV,YAAW,gBAAgB,MAAM,GAAG;AACpC,KAAI,MAAM,SAAS,QACjB,YAAW,mBAAmB,IAAI,KAAM,MAA2C,aAAa,aAAa,CAAC;AAEhH,KAAI,MAAM,QACR,YAAW,gBAAgB,MAAM,QAAQ;AAE3C,WAAU;AACV,WAAU,kBAAkB,MAAM;AAClC,WAAU;AACV,YAAW,mEAAmE,MAAM,QAAQ;AAC5F,WACE;AACF,QAAO;AACR"}
1
+ {"version":3,"file":"formatting-BaARL2gT.js","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event","data: z.infer<typeof ErrorEntrySchema>","data: z.infer<typeof RequestEntrySchema>","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n output += formatExceptionInterfaceOutput(\n event,\n entry.data as z.infer<typeof ErrorEntrySchema>,\n );\n }\n if (entry.type === \"request\") {\n output += formatRequestInterfaceOutput(\n event,\n entry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n }\n output += formatContexts(event.contexts);\n return output;\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n let output = \"\";\n // TODO: support chained exceptions\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n return \"\";\n }\n output += `### Error\\n\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n return output;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n return output;\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";AAkBA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KA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ting-C2kN0ok6.cjs","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event","data: z.infer<typeof ErrorEntrySchema>","data: z.infer<typeof RequestEntrySchema>","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n output += formatExceptionInterfaceOutput(\n event,\n entry.data as z.infer<typeof ErrorEntrySchema>,\n );\n }\n if (entry.type === \"request\") {\n output += formatRequestInterfaceOutput(\n event,\n entry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n }\n output += formatContexts(event.contexts);\n return output;\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n let output = \"\";\n // TODO: support chained exceptions\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n return \"\";\n }\n output += `### Error\\n\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n return output;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n return output;\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";;AAWA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KAAK,IAAI,CAAC,EAAE,MAAM,YAAY,IAAI,MAAM,SAAS,KAAK,GAAG;AAE9D,SAAQ,EAAE,MAAM,YAAY,GAAG,MAAM,SAAS,KAAK,mBAAmB,OAAO,MAAM,YAAY,MAAM,OAAO,GAC1G,MAAM,UACD,WAAW,MAAM,OAAO,EAAE,MAAM,UAAU,QAAQ,GAAG,MAAM,MAAM,IAAI,GAAG,IACzE,GACL;AACF;AAED,SAAgB,kBAAkBC,OAAc;CAC9C,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,MAAM,SAAS;AACjC,MAAI,MAAM,SAAS,YACjB,WAAU,+BACR,OACA,MAAM,KACP;AAEH,MAAI,MAAM,SAAS,UACjB,WAAU,6BACR,OACA,MAAM,KACP;CAEJ;AACD,WAAU,eAAe,MAAM,SAAS;AACxC,QAAO;AACR;AAED,SAAS,+BACPA,OACAC,MACA;CACA,IAAI,SAAS;CAEb,MAAM,aAAa,KAAK,SAAS,KAAK,OAAO;AAC7C,MAAK,WACH,QAAO;AAET,YAAW,uBAAyB,WAAW,KAAK,IAClD,WAAW,MACZ;AACD,MAAK,WAAW,eAAe,WAAW,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C1C,YAAW,sBAAsB,MAAM,UAAU;AACjD,YAAW,cAAc,MAAM,OAAO;AACtC,YAAW,gBAAgB,MAAM,SAAS;AAC1C,YAAW,eAAe,MAAM,QAAQ,KAAK;AAC7C,YAAW,WAAW,WAAW,YAAY,kBAAkB,MAAM,QAAQ,CAAC;AAC9E,WAAU;AACV,WAAU;AACV,YAAW,gBAAgB,MAAM,GAAG;AACpC,KAAI,MAAM,SAAS,QACjB,YAAW,mBAAmB,IAAI,KAAM,MAA2C,aAAa,aAAa,CAAC;AAEhH,KAAI,MAAM,QACR,YAAW,gBAAgB,MAAM,QAAQ;AAE3C,WAAU;AACV,WAAU,kBAAkB,MAAM;AAClC,WAAU;AACV,YAAW,mEAAmE,MAAM,QAAQ;AAC5F,WACE;AACF,QAAO;AACR"}
1
+ {"version":3,"file":"formatting-C2kN0ok6.cjs","names":["frame: z.infer<typeof FrameInterface>","platform: string | undefined | null","event: Event","data: z.infer<typeof ErrorEntrySchema>","data: z.infer<typeof RequestEntrySchema>","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n platform: string | undefined | null,\n) {\n if (platform?.startsWith(\"javascript\")) {\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n return `${frame.function ? `\"${frame.function}\"` : \"unknown function\"} in \"${frame.filename || frame.module}\"${\n frame.lineNo\n ? ` at line ${frame.lineNo}${frame.colNo !== null ? `:${frame.colNo}` : \"\"}`\n : \"\"\n }`;\n}\n\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n for (const entry of event.entries) {\n if (entry.type === \"exception\") {\n output += formatExceptionInterfaceOutput(\n event,\n entry.data as z.infer<typeof ErrorEntrySchema>,\n );\n }\n if (entry.type === \"request\") {\n output += formatRequestInterfaceOutput(\n event,\n entry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n }\n output += formatContexts(event.contexts);\n return output;\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n let output = \"\";\n // TODO: support chained exceptions\n const firstError = data.value ?? data.values[0];\n if (!firstError) {\n return \"\";\n }\n output += `### Error\\n\\n${\"```\"}\\n${firstError.type}: ${\n firstError.value\n }\\n${\"```\"}\\n\\n`;\n if (!firstError.stacktrace || !firstError.stacktrace.frames) {\n return output;\n }\n output += `**Stacktrace:**\\n${\"```\"}\\n${firstError.stacktrace.frames\n .map((frame) => {\n const context = frame.context?.length\n ? `${frame.context\n .filter(([lineno, _]) => lineno === frame.lineNo)\n .map(([_, code]) => `\\n${code}`)\n .join(\"\")}`\n : \"\";\n\n return `${formatFrameHeader(frame, event.platform)}${context}`;\n })\n .join(\"\\n\")}\\n${\"```\"}\\n\\n`;\n return output;\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";;AAkBA,SAAgB,kBACdA,OACAC,UACA;AACA,KAAI,UAAU,WAAW,aAAa,CACpC,SAAQ,EAAE;EAAC,MAAM;EAAU,MAAM;EAAQ,MAAM;CAAM,EAClD,OAAO,CAAC,QAAQ,EAAE,CAClB,KAAK,IAAI,CAAC,EAAE,MAAM,YAAY,IAAI,MAAM,SAAS,KAAK,GAAG;AAE9D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  require('./errors-B9fwS-aP.cjs');
4
- require('./schema-DkyWSqp_.cjs');
5
- require('./client-GKHZSXgV.cjs');
4
+ require('./schema-BsvGMALe.cjs');
5
+ require('./client-B7vZ6JMk.cjs');
6
6
  require('./types-MYBaygjr.cjs');
7
7
  require('./api-client-CL1WDkw9.cjs');
8
8
  require('./formatting-C2kN0ok6.cjs');
9
- require('./issue-helpers-71XgJVXC.cjs');
9
+ require('./issue-helpers-D712fGT2.cjs');
10
10
  require('./logging-ByvSjT6V.cjs');
11
- require('./tools-DHHqAqP9.cjs');
12
- require('./schema-B8lT632E.cjs');
13
- require('./toolDefinitions-BtHN8t_d.cjs');
14
- require('./resources-D6TW2ER0.cjs');
15
- require('./promptDefinitions-D3ll3qCd.cjs');
16
- require('./prompts-DMwoay8l.cjs');
17
- require('./server-pGtEIwE3.cjs');
18
- const require_stdio = require('./stdio-DydB2Pxu.cjs');
19
- const require_version = require('./version-CRzAHHGZ.cjs');
11
+ require('./tools-DyOqlsCW.cjs');
12
+ require('./schema-BTfISwFu.cjs');
13
+ require('./toolDefinitions-CUegGcWU.cjs');
14
+ require('./resources-DNyoutxH.cjs');
15
+ require('./promptDefinitions-BTLIBcGt.cjs');
16
+ require('./prompts-CDbQrutV.cjs');
17
+ require('./server-DeutbO8v.cjs');
18
+ const require_stdio = require('./stdio-B73CCTly.cjs');
19
+ const require_version = require('./version-BNmubeQI.cjs');
20
20
  const __modelcontextprotocol_sdk_server_mcp_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/mcp.js"));
21
21
  const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
22
22
 
@@ -56,7 +56,7 @@ __sentry_node.init({
56
56
  "mcp.transport": "stdio",
57
57
  "sentry.host": host
58
58
  } },
59
- release: "0.11.0",
59
+ release: "0.12.0",
60
60
  integrations: [__sentry_node.consoleLoggingIntegration(), __sentry_node.zodErrorsIntegration()],
61
61
  environment: "stdio"
62
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["accessToken: string | undefined","host: string | undefined","sentryDsn: string | undefined","LIB_VERSION","McpServer"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { startStdio } from \"./transports/stdio\";\nimport * as Sentry from \"@sentry/node\";\nimport { LIB_VERSION } from \"./version\";\n\n// SENTRY_AUTH_TOKEN is deprecated, but we support it for backwards compatibility\nlet accessToken: string | undefined =\n process.env.SENTRY_ACCESS_TOKEN ?? process.env.SENTRY_AUTH_TOKEN;\nlet host: string | undefined = process.env.SENTRY_HOST;\nlet sentryDsn: string | undefined =\n process.env.SENTRY_DSN || process.env.DEFAULT_SENTRY_DSN;\n\nconst packageName = \"@sentry/mcp-server\";\n\nfunction getUsage() {\n return `Usage: ${packageName} --access-token=<token> [--host=<host>] [--sentry-dsn=<dsn>]`;\n}\n\nfor (const arg of process.argv.slice(2)) {\n if (arg === \"--version\" || arg === \"-v\") {\n console.log(`${packageName} ${LIB_VERSION}`);\n process.exit(0);\n }\n if (arg.startsWith(\"--access-token=\")) {\n accessToken = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--host=\")) {\n host = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--sentry-dsn=\")) {\n sentryDsn = arg.split(\"=\")[1];\n } else {\n console.error(\"Error: Invalid argument:\", arg);\n console.error(getUsage());\n process.exit(1);\n }\n}\n\nif (!accessToken) {\n console.error(\n \"Error: No access token was provided. Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.\",\n );\n console.error(getUsage());\n process.exit(1);\n}\n\nSentry.init({\n dsn: sentryDsn,\n sendDefaultPii: true,\n tracesSampleRate: 1,\n initialScope: {\n tags: {\n \"mcp.server_version\": LIB_VERSION,\n \"mcp.transport\": \"stdio\",\n \"sentry.host\": host,\n },\n },\n release: process.env.SENTRY_RELEASE,\n integrations: [\n Sentry.consoleLoggingIntegration(),\n Sentry.zodErrorsIntegration(),\n ],\n environment:\n process.env.SENTRY_ENVIRONMENT ??\n (process.env.NODE_ENV !== \"production\" ? \"development\" : \"production\"),\n});\n\nconst server = new McpServer({\n name: \"Sentry MCP\",\n version: LIB_VERSION,\n});\n\nconst instrumentedServer = Sentry.wrapMcpServerWithSentry(server);\n\nconst SENTRY_TIMEOUT = 5000; // 5 seconds\n\n// XXX: we could do what we're doing in routes/auth.ts and pass the context\n// identically, but we don't really need userId and userName yet\nstartStdio(instrumentedServer, {\n accessToken,\n organizationSlug: null,\n host,\n}).catch((err) => {\n console.error(\"Server error:\", err);\n // ensure we've flushed all events\n Sentry.flush(SENTRY_TIMEOUT);\n process.exit(1);\n});\n\n// ensure we've flushed all events\nSentry.flush(SENTRY_TIMEOUT);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAIA,cACF,QAAQ,IAAI,uBAAuB,QAAQ,IAAI;AACjD,IAAIC,OAA2B,QAAQ,IAAI;AAC3C,IAAIC,YACF,QAAQ,IAAI;AAEd,MAAM,cAAc;AAEpB,SAAS,WAAW;AAClB,SAAQ,SAAS,YAAY;AAC9B;AAED,KAAK,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,EAAE;AACvC,KAAI,QAAQ,eAAe,QAAQ,MAAM;AACvC,UAAQ,KAAK,EAAE,YAAY,GAAGC,4BAAY,EAAE;AAC5C,UAAQ,KAAK,EAAE;CAChB;AACD,KAAI,IAAI,WAAW,kBAAkB,CACnC,eAAc,IAAI,MAAM,IAAI,CAAC;UACpB,IAAI,WAAW,UAAU,CAClC,QAAO,IAAI,MAAM,IAAI,CAAC;UACb,IAAI,WAAW,gBAAgB,CACxC,aAAY,IAAI,MAAM,IAAI,CAAC;MACtB;AACL,UAAQ,MAAM,4BAA4B,IAAI;AAC9C,UAAQ,MAAM,UAAU,CAAC;AACzB,UAAQ,KAAK,EAAE;CAChB;AACF;AAED,KAAK,aAAa;AAChB,SAAQ,MACN,oGACD;AACD,SAAQ,MAAM,UAAU,CAAC;AACzB,SAAQ,KAAK,EAAE;AAChB;AAED,cAAO,KAAK;CACV,KAAK;CACL,gBAAgB;CAChB,kBAAkB;CAClB,cAAc,EACZ,MAAM;EACJ,sBAAsBA;EACtB,iBAAiB;EACjB,eAAe;CAChB,EACF;CACD;CACA,cAAc,CACZ,cAAO,2BAA2B,EAClC,cAAO,sBAAsB,AAC9B;CACD;AAGD,EAAC;AAEF,MAAM,SAAS,IAAIC,mDAAU;CAC3B,MAAM;CACN,SAASD;AACV;AAED,MAAM,qBAAqB,cAAO,wBAAwB,OAAO;AAEjE,MAAM,iBAAiB;AAIvB,yBAAW,oBAAoB;CAC7B;CACA,kBAAkB;CAClB;AACD,EAAC,CAAC,MAAM,CAAC,QAAQ;AAChB,SAAQ,MAAM,iBAAiB,IAAI;AAEnC,eAAO,MAAM,eAAe;AAC5B,SAAQ,KAAK,EAAE;AAChB,EAAC;AAGF,cAAO,MAAM,eAAe"}
1
+ {"version":3,"file":"index.cjs","names":["accessToken: string | undefined","host: string | undefined","sentryDsn: string | undefined","LIB_VERSION","McpServer"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Main CLI entry point for the Sentry MCP server.\n *\n * Handles command-line argument parsing, environment configuration, Sentry\n * initialization, and starts the MCP server with stdio transport. Requires\n * a Sentry access token and optionally accepts host and DSN configuration.\n *\n * @example CLI Usage\n * ```bash\n * npx @sentry/mcp-server --access-token=TOKEN --host=sentry.io\n * ```\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { startStdio } from \"./transports/stdio\";\nimport * as Sentry from \"@sentry/node\";\nimport { LIB_VERSION } from \"./version\";\n\n// SENTRY_AUTH_TOKEN is deprecated, but we support it for backwards compatibility\nlet accessToken: string | undefined =\n process.env.SENTRY_ACCESS_TOKEN ?? process.env.SENTRY_AUTH_TOKEN;\nlet host: string | undefined = process.env.SENTRY_HOST;\nlet sentryDsn: string | undefined =\n process.env.SENTRY_DSN || process.env.DEFAULT_SENTRY_DSN;\n\nconst packageName = \"@sentry/mcp-server\";\n\nfunction getUsage() {\n return `Usage: ${packageName} --access-token=<token> [--host=<host>] [--sentry-dsn=<dsn>]`;\n}\n\nfor (const arg of process.argv.slice(2)) {\n if (arg === \"--version\" || arg === \"-v\") {\n console.log(`${packageName} ${LIB_VERSION}`);\n process.exit(0);\n }\n if (arg.startsWith(\"--access-token=\")) {\n accessToken = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--host=\")) {\n host = arg.split(\"=\")[1];\n } else if (arg.startsWith(\"--sentry-dsn=\")) {\n sentryDsn = arg.split(\"=\")[1];\n } else {\n console.error(\"Error: Invalid argument:\", arg);\n console.error(getUsage());\n process.exit(1);\n }\n}\n\nif (!accessToken) {\n console.error(\n \"Error: No access token was provided. Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.\",\n );\n console.error(getUsage());\n process.exit(1);\n}\n\nSentry.init({\n dsn: sentryDsn,\n sendDefaultPii: true,\n tracesSampleRate: 1,\n initialScope: {\n tags: {\n \"mcp.server_version\": LIB_VERSION,\n \"mcp.transport\": \"stdio\",\n \"sentry.host\": host,\n },\n },\n release: process.env.SENTRY_RELEASE,\n integrations: [\n Sentry.consoleLoggingIntegration(),\n Sentry.zodErrorsIntegration(),\n ],\n environment:\n process.env.SENTRY_ENVIRONMENT ??\n (process.env.NODE_ENV !== \"production\" ? \"development\" : \"production\"),\n});\n\nconst server = new McpServer({\n name: \"Sentry MCP\",\n version: LIB_VERSION,\n});\n\nconst instrumentedServer = Sentry.wrapMcpServerWithSentry(server);\n\nconst SENTRY_TIMEOUT = 5000; // 5 seconds\n\n// XXX: we could do what we're doing in routes/auth.ts and pass the context\n// identically, but we don't really need userId and userName yet\nstartStdio(instrumentedServer, {\n accessToken,\n organizationSlug: null,\n host,\n}).catch((err) => {\n console.error(\"Server error:\", err);\n // ensure we've flushed all events\n Sentry.flush(SENTRY_TIMEOUT);\n process.exit(1);\n});\n\n// ensure we've flushed all events\nSentry.flush(SENTRY_T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