@sentry/mcp-server 0.41.0 → 0.48.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 (162) hide show
  1. package/README.md +54 -0
  2. package/dist/sentry-mcp.cjs +3436 -0
  3. package/package.json +22 -40
  4. package/LICENSE.md +0 -105
  5. package/dist/auth/constants.cjs +0 -9
  6. package/dist/auth/constants.d.cts +0 -31
  7. package/dist/auth/constants.d.cts.map +0 -1
  8. package/dist/auth/constants.d.ts +0 -31
  9. package/dist/auth/constants.d.ts.map +0 -1
  10. package/dist/auth/constants.js +0 -3
  11. package/dist/auth/device-code-flow.cjs +0 -10
  12. package/dist/auth/device-code-flow.d.cts +0 -34
  13. package/dist/auth/device-code-flow.d.cts.map +0 -1
  14. package/dist/auth/device-code-flow.d.ts +0 -34
  15. package/dist/auth/device-code-flow.d.ts.map +0 -1
  16. package/dist/auth/device-code-flow.js +0 -6
  17. package/dist/auth/resolve-token.cjs +0 -8
  18. package/dist/auth/resolve-token.d.cts +0 -17
  19. package/dist/auth/resolve-token.d.cts.map +0 -1
  20. package/dist/auth/resolve-token.d.ts +0 -17
  21. package/dist/auth/resolve-token.d.ts.map +0 -1
  22. package/dist/auth/resolve-token.js +0 -8
  23. package/dist/auth/token-cache.cjs +0 -5
  24. package/dist/auth/token-cache.d.cts +0 -11
  25. package/dist/auth/token-cache.d.cts.map +0 -1
  26. package/dist/auth/token-cache.d.ts +0 -11
  27. package/dist/auth/token-cache.d.ts.map +0 -1
  28. package/dist/auth/token-cache.js +0 -3
  29. package/dist/auth/types.cjs +0 -7
  30. package/dist/auth/types.d.cts +0 -2
  31. package/dist/auth/types.d.ts +0 -2
  32. package/dist/auth/types.js +0 -3
  33. package/dist/auth-CYOpb-jm.cjs +0 -90
  34. package/dist/auth-CYOpb-jm.cjs.map +0 -1
  35. package/dist/auth-YZqLxyqD.js +0 -79
  36. package/dist/auth-YZqLxyqD.js.map +0 -1
  37. package/dist/blob-utils-B0ae0K-m-BF8kTomr.cjs +0 -4724
  38. package/dist/blob-utils-B0ae0K-m-BF8kTomr.cjs.map +0 -1
  39. package/dist/blob-utils-B0ae0K-m-BhC2W04C.js +0 -4701
  40. package/dist/blob-utils-B0ae0K-m-BhC2W04C.js.map +0 -1
  41. package/dist/blob-utils-BM8EcgEO.js +0 -3
  42. package/dist/blob-utils-DBvCs9nw.cjs +0 -3
  43. package/dist/chunk-CunrlGP7.js +0 -37
  44. package/dist/chunk-Cv9WC9bY.cjs +0 -58
  45. package/dist/cli/commands/auth.cjs +0 -11
  46. package/dist/cli/commands/auth.d.cts +0 -8
  47. package/dist/cli/commands/auth.d.cts.map +0 -1
  48. package/dist/cli/commands/auth.d.ts +0 -8
  49. package/dist/cli/commands/auth.d.ts.map +0 -1
  50. package/dist/cli/commands/auth.js +0 -10
  51. package/dist/cli/output.cjs +0 -3
  52. package/dist/cli/output.d.cts +0 -7
  53. package/dist/cli/output.d.cts.map +0 -1
  54. package/dist/cli/output.d.ts +0 -7
  55. package/dist/cli/output.d.ts.map +0 -1
  56. package/dist/cli/output.js +0 -3
  57. package/dist/cli/parse.cjs +0 -5
  58. package/dist/cli/parse.d.cts +0 -11
  59. package/dist/cli/parse.d.cts.map +0 -1
  60. package/dist/cli/parse.d.ts +0 -11
  61. package/dist/cli/parse.d.ts.map +0 -1
  62. package/dist/cli/parse.js +0 -3
  63. package/dist/cli/resolve.cjs +0 -6
  64. package/dist/cli/resolve.d.cts +0 -16
  65. package/dist/cli/resolve.d.cts.map +0 -1
  66. package/dist/cli/resolve.d.ts +0 -16
  67. package/dist/cli/resolve.d.ts.map +0 -1
  68. package/dist/cli/resolve.js +0 -4
  69. package/dist/cli/types.cjs +0 -0
  70. package/dist/cli/types.d.cts +0 -2
  71. package/dist/cli/types.d.ts +0 -2
  72. package/dist/cli/types.js +0 -0
  73. package/dist/cli/usage.cjs +0 -3
  74. package/dist/cli/usage.d.cts +0 -9
  75. package/dist/cli/usage.d.cts.map +0 -1
  76. package/dist/cli/usage.d.ts +0 -9
  77. package/dist/cli/usage.d.ts.map +0 -1
  78. package/dist/cli/usage.js +0 -3
  79. package/dist/config-40SaJWzQ-Bxau3bPR.cjs +0 -928
  80. package/dist/config-40SaJWzQ-Bxau3bPR.cjs.map +0 -1
  81. package/dist/config-40SaJWzQ-Dz27jdMQ.js +0 -886
  82. package/dist/config-40SaJWzQ-Dz27jdMQ.js.map +0 -1
  83. package/dist/config-DeGbV11k.cjs +0 -7
  84. package/dist/config-NGx6OsOU.js +0 -3
  85. package/dist/constants-BqO-QSHl.cjs +0 -636
  86. package/dist/constants-BqO-QSHl.cjs.map +0 -1
  87. package/dist/constants-Da7VwSRQ.js +0 -450
  88. package/dist/constants-Da7VwSRQ.js.map +0 -1
  89. package/dist/device-code-flow-Bk6L232R.js +0 -124
  90. package/dist/device-code-flow-Bk6L232R.js.map +0 -1
  91. package/dist/device-code-flow-Dv-auCiV.cjs +0 -154
  92. package/dist/device-code-flow-Dv-auCiV.cjs.map +0 -1
  93. package/dist/index.cjs +0 -61541
  94. package/dist/index.cjs.map +0 -1
  95. package/dist/index.d.cts +0 -1
  96. package/dist/index.d.ts +0 -1
  97. package/dist/index.js +0 -61542
  98. package/dist/index.js.map +0 -1
  99. package/dist/output-A_-7o7gV.js +0 -8
  100. package/dist/output-A_-7o7gV.js.map +0 -1
  101. package/dist/output-DEoNyYz7.cjs +0 -14
  102. package/dist/output-DEoNyYz7.cjs.map +0 -1
  103. package/dist/parse-CPY7-_2_.cjs +0 -130
  104. package/dist/parse-CPY7-_2_.cjs.map +0 -1
  105. package/dist/parse-Dd3OOgIq.js +0 -112
  106. package/dist/parse-Dd3OOgIq.js.map +0 -1
  107. package/dist/resolve-CZUghJrC.cjs +0 -179
  108. package/dist/resolve-CZUghJrC.cjs.map +0 -1
  109. package/dist/resolve-CkkdMFiR.js +0 -144
  110. package/dist/resolve-CkkdMFiR.js.map +0 -1
  111. package/dist/resolve-token-4RkU7UPe.js +0 -47
  112. package/dist/resolve-token-4RkU7UPe.js.map +0 -1
  113. package/dist/resolve-token-Daqu57f-.cjs +0 -52
  114. package/dist/resolve-token-Daqu57f-.cjs.map +0 -1
  115. package/dist/stdio-4lgW_97D.cjs +0 -65
  116. package/dist/stdio-4lgW_97D.cjs.map +0 -1
  117. package/dist/stdio-C0wKX460.js +0 -59
  118. package/dist/stdio-C0wKX460.js.map +0 -1
  119. package/dist/token-3xpHVxQo.js +0 -51
  120. package/dist/token-3xpHVxQo.js.map +0 -1
  121. package/dist/token-C7MavkKX.cjs +0 -55
  122. package/dist/token-C7MavkKX.cjs.map +0 -1
  123. package/dist/token-cache-ATUcs1cg.cjs +0 -84
  124. package/dist/token-cache-ATUcs1cg.cjs.map +0 -1
  125. package/dist/token-cache-DbZp4rvg.js +0 -66
  126. package/dist/token-cache-DbZp4rvg.js.map +0 -1
  127. package/dist/token-error-CBmJNKLY.js +0 -43
  128. package/dist/token-error-CBmJNKLY.js.map +0 -1
  129. package/dist/token-error-x_miDBP3.cjs +0 -48
  130. package/dist/token-error-x_miDBP3.cjs.map +0 -1
  131. package/dist/token-util-4bIYDTMS.js +0 -4
  132. package/dist/token-util-BRoQwIG6.cjs +0 -363
  133. package/dist/token-util-BRoQwIG6.cjs.map +0 -1
  134. package/dist/token-util-DurDL44i.cjs +0 -9
  135. package/dist/token-util-batRsXGA.js +0 -358
  136. package/dist/token-util-batRsXGA.js.map +0 -1
  137. package/dist/transports/stdio.cjs +0 -4
  138. package/dist/transports/stdio.d.cts +0 -40
  139. package/dist/transports/stdio.d.cts.map +0 -1
  140. package/dist/transports/stdio.d.ts +0 -40
  141. package/dist/transports/stdio.d.ts.map +0 -1
  142. package/dist/transports/stdio.js +0 -4
  143. package/dist/types-BCSxlxZI.js +0 -57
  144. package/dist/types-BCSxlxZI.js.map +0 -1
  145. package/dist/types-BGyk9F4G.d.ts +0 -61
  146. package/dist/types-BGyk9F4G.d.ts.map +0 -1
  147. package/dist/types-C9HgNyIE.d.cts +0 -61
  148. package/dist/types-C9HgNyIE.d.cts.map +0 -1
  149. package/dist/types-D-BIcaY4.d.ts +0 -91
  150. package/dist/types-D-BIcaY4.d.ts.map +0 -1
  151. package/dist/types-Dyacb-A8.d.cts +0 -91
  152. package/dist/types-Dyacb-A8.d.cts.map +0 -1
  153. package/dist/types-dghCRFW4.cjs +0 -87
  154. package/dist/types-dghCRFW4.cjs.map +0 -1
  155. package/dist/usage-DZ4QDygT.cjs +0 -74
  156. package/dist/usage-DZ4QDygT.cjs.map +0 -1
  157. package/dist/usage-Hi-6-LDr.js +0 -68
  158. package/dist/usage-Hi-6-LDr.js.map +0 -1
  159. package/dist/version-B-XjWQrQ.cjs +0 -19
  160. package/dist/version-B-XjWQrQ.cjs.map +0 -1
  161. package/dist/version-CWKzsUXy.js +0 -7
  162. package/dist/version-CWKzsUXy.js.map +0 -1
@@ -1,636 +0,0 @@
1
-
2
- //#region ../mcp-core/dist/events-datasets-bC65QyVa.js
3
- const PUBLIC_EVENTS_DATASETS = [
4
- "spans",
5
- "errors",
6
- "logs",
7
- "metrics",
8
- "profiles"
9
- ];
10
- function isMetricsDataset(dataset) {
11
- return dataset === "metrics" || dataset === "tracemetrics";
12
- }
13
- function isProfilesDataset(dataset) {
14
- return dataset === "profiles";
15
- }
16
- /**
17
- * Sentry's product-facing Explore schemas already call this dataset "metrics",
18
- * but the current `/events/` and `/trace-items/attributes/` APIs still expect
19
- * the legacy `tracemetrics` identifier. Keep MCP aligned with the UI-facing
20
- * schema and swap only at the transport boundary until the upstream API name
21
- * catches up.
22
- */
23
- function normalizeEventsDataset(dataset) {
24
- return dataset === "metrics" ? "tracemetrics" : dataset;
25
- }
26
-
27
- //#endregion
28
- //#region ../mcp-core/dist/url-utils-CiXFWS0y.js
29
- /**
30
- * Determines if a Sentry instance is SaaS or self-hosted based on the host.
31
- * @param host The Sentry host (e.g., "sentry.io" or "sentry.company.com")
32
- * @returns true if SaaS instance, false if self-hosted
33
- */
34
- function isSentryHost(host) {
35
- return host === "sentry.io" || host.endsWith(".sentry.io");
36
- }
37
- function deriveSelectedFields(fields, aggregateFunctions, groupByFields) {
38
- if (fields && fields.length > 0) return fields;
39
- return Array.from(new Set([...groupByFields ?? [], ...aggregateFunctions ?? []]));
40
- }
41
- function getSentryWebBaseUrl(host, organizationSlug, path, protocol = "https") {
42
- const isSaas = isSentryHost(host);
43
- const webHost = isSaas ? "sentry.io" : host;
44
- return isSaas ? `${protocol}://${organizationSlug}.${webHost}${path}` : `${protocol}://${host}/organizations/${organizationSlug}${path}`;
45
- }
46
- function normalizeTraceMetric(metric) {
47
- if (!metric?.name || !metric.type) return null;
48
- return {
49
- name: metric.name,
50
- type: metric.type,
51
- unit: metric.unit && metric.unit !== "-" ? metric.unit : void 0
52
- };
53
- }
54
- function extractTraceMetricFromAggregate(field) {
55
- const match = field.match(/^[^(]+\((.*)\)$/);
56
- if (!match) return null;
57
- const args = match[1].split(",").map((arg) => arg.trim()).filter((arg) => arg.length > 0);
58
- if (args.length < 4) return null;
59
- return normalizeTraceMetric({
60
- name: args[1],
61
- type: args[2],
62
- unit: args[3]
63
- });
64
- }
65
- function extractTraceMetricFromQuery(query) {
66
- const extractValue = (field) => {
67
- const quotedMatch = query.match(new RegExp(`${field}:"([^"]+)"`, "i"));
68
- if (quotedMatch?.[1]) return quotedMatch[1];
69
- const unquotedMatch = query.match(new RegExp(`${field}:([^\\s]+)`, "i"));
70
- return unquotedMatch?.[1] ?? null;
71
- };
72
- return normalizeTraceMetric({
73
- name: extractValue("metric\\.name") ?? "",
74
- type: extractValue("metric\\.type") ?? "",
75
- unit: extractValue("metric\\.unit") ?? void 0
76
- });
77
- }
78
- function dedupeTraceMetrics(metrics) {
79
- const deduped = /* @__PURE__ */ new Map();
80
- for (const metric of metrics) {
81
- const normalizedMetric = normalizeTraceMetric(metric);
82
- if (!normalizedMetric) continue;
83
- const key = `${normalizedMetric.name}|${normalizedMetric.type}|${normalizedMetric.unit ?? ""}`;
84
- deduped.set(key, normalizedMetric);
85
- }
86
- return [...deduped.values()];
87
- }
88
- function buildMetricQueryState(params) {
89
- return JSON.stringify({
90
- metric: params.metric,
91
- query: params.query,
92
- aggregateFields: [...params.yAxes.map((yAxis) => ({ yAxes: [yAxis] })), ...(params.groupByFields ?? []).map((field) => ({ groupBy: field }))],
93
- aggregateSortBys: params.aggregateSortBys ?? [],
94
- mode: params.mode
95
- });
96
- }
97
- function getTraceMetricsExploreUrl(host, organizationSlug, options, protocol = "https") {
98
- const { query, projectId, statsPeriod, start, end, sort, aggregateFunctions, groupByFields, traceMetrics } = options;
99
- const urlParams = new URLSearchParams();
100
- if (projectId) urlParams.set("project", projectId);
101
- if (start && end) {
102
- urlParams.set("start", start);
103
- urlParams.set("end", end);
104
- } else urlParams.set("statsPeriod", statsPeriod || "24h");
105
- const aggregateFields = aggregateFunctions ?? [];
106
- const aggregateGroupByFields = groupByFields ?? [];
107
- const isAggregateQuery = aggregateFields.length > 0;
108
- const sortField = sort?.startsWith("-") ? sort.slice(1) : sort;
109
- const sortKind = sort?.startsWith("-") ? "desc" : "asc";
110
- if (isAggregateQuery) {
111
- const metricQueries = /* @__PURE__ */ new Map();
112
- for (const aggregateField of aggregateFields) {
113
- const metric = extractTraceMetricFromAggregate(aggregateField);
114
- if (!metric) continue;
115
- const key = `${metric.name}|${metric.type}|${metric.unit ?? ""}`;
116
- const existing = metricQueries.get(key);
117
- if (existing) existing.yAxes.push(aggregateField);
118
- else metricQueries.set(key, {
119
- metric,
120
- yAxes: [aggregateField]
121
- });
122
- }
123
- for (const { metric, yAxes } of metricQueries.values()) {
124
- const aggregateSortBys = sortField && (yAxes.includes(sortField) || aggregateGroupByFields.includes(sortField)) ? [{
125
- field: sortField,
126
- kind: sortKind
127
- }] : [];
128
- urlParams.append("metric", buildMetricQueryState({
129
- metric,
130
- query,
131
- mode: "aggregate",
132
- yAxes,
133
- groupByFields: aggregateGroupByFields,
134
- aggregateSortBys
135
- }));
136
- }
137
- } else {
138
- const sampleMetrics = dedupeTraceMetrics([...traceMetrics ?? [], extractTraceMetricFromQuery(query)]);
139
- for (const metric of sampleMetrics) urlParams.append("metric", buildMetricQueryState({
140
- metric,
141
- query,
142
- mode: "samples",
143
- yAxes: ["sum(value)"],
144
- aggregateSortBys: [{
145
- field: "sum(value)",
146
- kind: "desc"
147
- }]
148
- }));
149
- }
150
- return `${getSentryWebBaseUrl(host, organizationSlug, "/explore/metrics/", protocol)}?${urlParams.toString()}`;
151
- }
152
- function getProfilingExplorerUrl(host, organizationSlug, options, protocol = "https") {
153
- const { query, projectId, statsPeriod, start, end, sort, fields, aggregateFunctions, groupByFields } = options;
154
- const urlParams = new URLSearchParams();
155
- if (query) urlParams.set("query", query);
156
- if (projectId) urlParams.set("project", projectId);
157
- if (sort) urlParams.set("sort", sort);
158
- for (const field of deriveSelectedFields(fields, aggregateFunctions, groupByFields)) urlParams.append("field", field);
159
- if (start && end) {
160
- urlParams.set("start", start);
161
- urlParams.set("end", end);
162
- } else urlParams.set("statsPeriod", statsPeriod || "24h");
163
- return `${getSentryWebBaseUrl(host, organizationSlug, "/explore/profiling/", protocol)}?${urlParams.toString()}`;
164
- }
165
- /**
166
- * Generates a Sentry issue URL.
167
- * @param host The Sentry host (may include regional subdomain for API access)
168
- * @param organizationSlug Organization identifier
169
- * @param issueId Issue identifier (e.g., "PROJECT-123")
170
- * @returns The complete issue URL
171
- */
172
- function getIssueUrl(host, organizationSlug, issueId, protocol = "https") {
173
- return getSentryWebBaseUrl(host, organizationSlug, `/issues/${issueId}`, protocol);
174
- }
175
- /**
176
- * Generates a Sentry dashboard URL.
177
- * @param host The Sentry host (may include regional subdomain for API access)
178
- * @param organizationSlug Organization identifier
179
- * @param dashboardId Dashboard ID
180
- * @param options Optional dashboard view query parameters
181
- * @param protocol Protocol to use when building the web URL
182
- * @returns The complete dashboard URL
183
- */
184
- function getDashboardUrl(host, organizationSlug, dashboardId, options = {}, protocol = "https") {
185
- const encodedDashboardId = encodeURIComponent(dashboardId);
186
- const params = new URLSearchParams();
187
- if (options.projectId !== null && options.projectId !== void 0) params.set("project", String(options.projectId));
188
- if (options.statsPeriod) params.set("statsPeriod", options.statsPeriod);
189
- const queryString = params.toString();
190
- return `${getSentryWebBaseUrl(host, organizationSlug, `/dashboard/${encodedDashboardId}/`, protocol)}${queryString ? `?${queryString}` : ""}`;
191
- }
192
- /**
193
- * Generates a Sentry preprod snapshot URL.
194
- * @param host The Sentry host (may include regional subdomain for API access)
195
- * @param organizationSlug Organization identifier
196
- * @param snapshotId Preprod snapshot artifact ID
197
- * @returns The complete snapshot URL
198
- */
199
- function getPreprodSnapshotUrl(host, organizationSlug, snapshotId, protocol = "https") {
200
- return getSentryWebBaseUrl(host, organizationSlug, `/preprod/snapshots/${snapshotId}/`, protocol);
201
- }
202
- /**
203
- * Generates a Sentry cron monitor URL.
204
- * @param host The Sentry host (may include regional subdomain for API access)
205
- * @param organizationSlug Organization identifier
206
- * @param monitorSlug Monitor slug
207
- * @param projectSlug Optional project slug to disambiguate monitors with the same slug
208
- * @returns The complete monitor URL
209
- */
210
- function getMonitorUrl(host, organizationSlug, monitorSlug, protocol = "https", projectSlug) {
211
- const monitorPath = (projectSlug ? [projectSlug, monitorSlug] : [monitorSlug]).map((segment) => encodeURIComponent(segment)).join("/");
212
- return getSentryWebBaseUrl(host, organizationSlug, `/crons/${monitorPath}/`, protocol);
213
- }
214
- /**
215
- * Generates a Sentry release URL.
216
- * @param host The Sentry host (may include regional subdomain for API access)
217
- * @param organizationSlug Organization identifier
218
- * @param releaseVersion Release version identifier
219
- * @returns The complete release URL
220
- */
221
- /**
222
- * Generates a Sentry uptime monitor URL.
223
- *
224
- * Uses the monitors UI path (`/monitors/{id}/`), which is the current home for
225
- * uptime detectors in Sentry.
226
- */
227
- function getUptimeMonitorUrl(host, organizationSlug, uptimeMonitorId, protocol = "https") {
228
- const encodedId = encodeURIComponent(String(uptimeMonitorId));
229
- return getSentryWebBaseUrl(host, organizationSlug, `/monitors/${encodedId}/`, protocol);
230
- }
231
- function getReleaseUrl(host, organizationSlug, releaseVersion, protocol = "https") {
232
- const encodedReleaseVersion = encodeURIComponent(releaseVersion);
233
- return getSentryWebBaseUrl(host, organizationSlug, `/releases/${encodedReleaseVersion}/`, protocol);
234
- }
235
- /**
236
- * Generates a Sentry issues search URL.
237
- * @param host The Sentry host (may include regional subdomain for API access)
238
- * @param organizationSlug Organization identifier
239
- * @param query Optional search query
240
- * @param projectSlugOrId Optional project slug or ID
241
- * @returns The complete issues search URL
242
- */
243
- function getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId, protocol = "https") {
244
- let url = getSentryWebBaseUrl(host, organizationSlug, "/issues/", protocol);
245
- const params = new URLSearchParams();
246
- if (projectSlugOrId) params.append("project", projectSlugOrId);
247
- if (query) params.append("query", query);
248
- const queryString = params.toString();
249
- if (queryString) url += `?${queryString}`;
250
- return url;
251
- }
252
- /**
253
- * Generates a Sentry replay search URL.
254
- * @param host The Sentry host (may include regional subdomain for API access)
255
- * @param organizationSlug Organization identifier
256
- * @param options Replay search options
257
- * @returns The complete replay search URL
258
- */
259
- function getReplaysSearchUrl(host, organizationSlug, options = {}, protocol = "https") {
260
- const { query, projectSlugOrId, environment, sort, statsPeriod, start, end } = options;
261
- let url = getSentryWebBaseUrl(host, organizationSlug, "/explore/replays/", protocol);
262
- const params = new URLSearchParams();
263
- if (projectSlugOrId) params.append("project", projectSlugOrId);
264
- if (query) params.append("query", query);
265
- if (environment) {
266
- const environments = Array.isArray(environment) ? environment : [environment];
267
- for (const value of environments) params.append("environment", value);
268
- }
269
- if (sort) params.append("sort", sort);
270
- if (start && end) {
271
- params.append("start", start);
272
- params.append("end", end);
273
- } else if (statsPeriod) params.append("statsPeriod", statsPeriod);
274
- const queryString = params.toString();
275
- if (queryString) url += `?${queryString}`;
276
- return url;
277
- }
278
- /**
279
- * Generates a Sentry trace URL for performance investigation.
280
- * @param host The Sentry host (may include regional subdomain for API access)
281
- * @param organizationSlug Organization identifier
282
- * @param traceId Trace identifier
283
- * @returns The complete trace URL
284
- */
285
- function getTraceUrl(host, organizationSlug, traceId, protocol = "https") {
286
- return getSentryWebBaseUrl(host, organizationSlug, `/explore/traces/trace/${traceId}`, protocol);
287
- }
288
- /**
289
- * Generates a Sentry replay URL.
290
- * @param host The Sentry host (may include regional subdomain for API access)
291
- * @param organizationSlug Organization identifier
292
- * @param replayId Replay identifier
293
- * @returns The complete replay URL
294
- */
295
- function getReplayUrl(host, organizationSlug, replayId, protocol = "https") {
296
- return getSentryWebBaseUrl(host, organizationSlug, `/explore/replays/${replayId}/`, protocol);
297
- }
298
- /**
299
- * Generates a Sentry AI conversation URL.
300
- * @param host The Sentry host
301
- * @param organizationSlug Organization identifier
302
- * @param conversationId AI conversation identifier
303
- * @returns The complete AI conversation URL
304
- */
305
- function getAIConversationUrl(host, organizationSlug, conversationId, protocol = "https") {
306
- return getSentryWebBaseUrl(host, organizationSlug, `/explore/conversations/${encodeURIComponent(conversationId)}/`, protocol);
307
- }
308
- /**
309
- * Extract a single non-negated AI conversation ID from a Sentry search query
310
- * that filters on `gen_ai.conversation.id`. Returns undefined when the query
311
- * does not contain exactly one such filter or contains a negated filter.
312
- */
313
- function extractConversationIdFromSearchQuery(query) {
314
- if (!query) return void 0;
315
- if (/!gen_ai\.conversation\.id:|\bNOT\s+(?:\(\s*)?gen_ai\.conversation\.id:/i.test(query)) return void 0;
316
- const pattern = /gen_ai\.conversation\.id:(?:"([^"]+)"|([^\s)]+))/g;
317
- const matches = [...query.matchAll(pattern)];
318
- if (matches.length !== 1) return void 0;
319
- const conversationId = matches[0][1] ?? matches[0][2];
320
- if (conversationId.startsWith("[")) return void 0;
321
- return conversationId;
322
- }
323
- /**
324
- * Generates a Sentry AI conversations list URL with optional search filters.
325
- */
326
- function getAIConversationsUrl(host, organizationSlug, options = {}, protocol = "https") {
327
- const urlParams = new URLSearchParams();
328
- if (options.query) urlParams.set("query", options.query);
329
- for (const projectId of options.project ?? []) urlParams.append("project", projectId);
330
- const environments = Array.isArray(options.environment) ? options.environment : options.environment ? [options.environment] : [];
331
- for (const environmentName of environments) urlParams.append("environment", environmentName);
332
- if (options.start && options.end) {
333
- urlParams.set("start", options.start);
334
- urlParams.set("end", options.end);
335
- } else if (options.statsPeriod) urlParams.set("statsPeriod", options.statsPeriod);
336
- const baseUrl = getSentryWebBaseUrl(host, organizationSlug, "/explore/conversations/", protocol);
337
- const queryString = urlParams.toString();
338
- return queryString ? `${baseUrl}?${queryString}` : baseUrl;
339
- }
340
- function getProfileUrl(host, organizationSlug, projectSlug, profileId, protocol = "https") {
341
- return getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/${profileId}/flamegraph/`, protocol);
342
- }
343
- function getContinuousProfileUrl(host, organizationSlug, projectSlug, options, protocol = "https") {
344
- const url = new URL(getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/flamegraph/`, protocol));
345
- url.searchParams.set("profilerId", options.profilerId);
346
- url.searchParams.set("start", options.start);
347
- url.searchParams.set("end", options.end);
348
- return url.toString();
349
- }
350
- /**
351
- * Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).
352
- * Throws an error if validation fails instead of exiting the process.
353
- *
354
- * @param host The hostname to validate
355
- * @throws {Error} If the host contains a protocol
356
- */
357
- function _validateSentryHostInternal(host) {
358
- if (host.startsWith("http://") || host.startsWith("https://")) throw new Error("SENTRY_HOST should only contain a hostname (e.g., sentry.example.com). Use SENTRY_URL if you want to provide a full URL.");
359
- }
360
- /**
361
- * Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
362
- * Throws an error if validation fails instead of exiting the process.
363
- *
364
- * @param url The HTTPS URL to validate and parse
365
- * @returns The extracted hostname from the URL
366
- * @throws {Error} If the URL is invalid or not HTTPS
367
- */
368
- function _validateAndParseSentryUrlInternal(url) {
369
- if (!url.startsWith("https://")) throw new Error("SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).");
370
- try {
371
- const parsedUrl = new URL(url);
372
- return parsedUrl.host;
373
- } catch (error) {
374
- throw new Error("SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).");
375
- }
376
- }
377
- /**
378
- * Validates that a SENTRY_HOST value contains only hostname (no protocol).
379
- * Throws an error instead of exiting the process (for testing).
380
- *
381
- * @param host The hostname to validate
382
- * @throws {Error} If the host contains a protocol
383
- */
384
- function validateSentryHostThrows(host) {
385
- _validateSentryHostInternal(host);
386
- }
387
- /**
388
- * Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
389
- * Throws an error instead of exiting the process (for testing).
390
- *
391
- * @param url The HTTPS URL to validate and parse
392
- * @returns The extracted hostname from the URL
393
- * @throws {Error} If the URL is invalid or not HTTPS
394
- */
395
- function validateAndParseSentryUrlThrows(url) {
396
- return _validateAndParseSentryUrlInternal(url);
397
- }
398
- /**
399
- * Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.
400
- *
401
- * @param url The URL to validate and normalize
402
- * @returns The normalized URL string
403
- * @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol
404
- */
405
- function validateOpenAiBaseUrlThrows(url) {
406
- const trimmed = url.trim();
407
- if (trimmed.length === 0) throw new Error("OPENAI base URL must not be empty.");
408
- let parsed;
409
- try {
410
- parsed = new URL(trimmed);
411
- } catch (error) {
412
- throw new Error("OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).", { cause: error });
413
- }
414
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error("OPENAI base URL must use http or https scheme (e.g., https://example.com/v1).");
415
- return parsed.toString();
416
- }
417
-
418
- //#endregion
419
- //#region ../mcp-core/dist/scopes.js
420
- const SCOPES = {
421
- "org:read": "Read organization data",
422
- "project:write": "Write project data",
423
- "team:write": "Write team data",
424
- "event:write": "Write event data",
425
- "alerts:write": "Write alert rules"
426
- };
427
-
428
- //#endregion
429
- //#region src/auth/constants.ts
430
- /**
431
- * Public OAuth app registered on sentry.io for the stdio device code flow.
432
- * No client secret — device code grant is a public client flow.
433
- * The Cloudflare transport uses a separate OAuth app with a secret.
434
- * Override via SENTRY_CLIENT_ID environment variable.
435
- * See docs/operations/stdio-auth.md for the full credential architecture.
436
- */
437
- const DEFAULT_SENTRY_CLIENT_ID = "0acbeba7d07d58076dd7dbde8cea2fed8ab525ce3713bda604988009ab35d765";
438
- const DEVICE_CODE_ENDPOINT = "/oauth/device/code/";
439
- const TOKEN_ENDPOINT = "/oauth/token/";
440
- const DEVICE_CODE_SCOPES = Object.keys(SCOPES).join(" ");
441
- /** Interval increment on slow_down response (RFC 8628). */
442
- const SLOW_DOWN_INCREMENT_SEC = 5;
443
- /**
444
- * OAuth endpoints live on sentry.io regardless of regional host.
445
- * Always use this as the host for device code and token requests.
446
- */
447
- const OAUTH_HOST = "sentry.io";
448
-
449
- //#endregion
450
- Object.defineProperty(exports, 'DEFAULT_SENTRY_CLIENT_ID', {
451
- enumerable: true,
452
- get: function () {
453
- return DEFAULT_SENTRY_CLIENT_ID;
454
- }
455
- });
456
- Object.defineProperty(exports, 'DEVICE_CODE_ENDPOINT', {
457
- enumerable: true,
458
- get: function () {
459
- return DEVICE_CODE_ENDPOINT;
460
- }
461
- });
462
- Object.defineProperty(exports, 'DEVICE_CODE_SCOPES', {
463
- enumerable: true,
464
- get: function () {
465
- return DEVICE_CODE_SCOPES;
466
- }
467
- });
468
- Object.defineProperty(exports, 'OAUTH_HOST', {
469
- enumerable: true,
470
- get: function () {
471
- return OAUTH_HOST;
472
- }
473
- });
474
- Object.defineProperty(exports, 'PUBLIC_EVENTS_DATASETS', {
475
- enumerable: true,
476
- get: function () {
477
- return PUBLIC_EVENTS_DATASETS;
478
- }
479
- });
480
- Object.defineProperty(exports, 'SLOW_DOWN_INCREMENT_SEC', {
481
- enumerable: true,
482
- get: function () {
483
- return SLOW_DOWN_INCREMENT_SEC;
484
- }
485
- });
486
- Object.defineProperty(exports, 'TOKEN_ENDPOINT', {
487
- enumerable: true,
488
- get: function () {
489
- return TOKEN_ENDPOINT;
490
- }
491
- });
492
- Object.defineProperty(exports, 'extractConversationIdFromSearchQuery', {
493
- enumerable: true,
494
- get: function () {
495
- return extractConversationIdFromSearchQuery;
496
- }
497
- });
498
- Object.defineProperty(exports, 'getAIConversationUrl', {
499
- enumerable: true,
500
- get: function () {
501
- return getAIConversationUrl;
502
- }
503
- });
504
- Object.defineProperty(exports, 'getAIConversationsUrl', {
505
- enumerable: true,
506
- get: function () {
507
- return getAIConversationsUrl;
508
- }
509
- });
510
- Object.defineProperty(exports, 'getContinuousProfileUrl', {
511
- enumerable: true,
512
- get: function () {
513
- return getContinuousProfileUrl;
514
- }
515
- });
516
- Object.defineProperty(exports, 'getDashboardUrl', {
517
- enumerable: true,
518
- get: function () {
519
- return getDashboardUrl;
520
- }
521
- });
522
- Object.defineProperty(exports, 'getIssueUrl', {
523
- enumerable: true,
524
- get: function () {
525
- return getIssueUrl;
526
- }
527
- });
528
- Object.defineProperty(exports, 'getIssuesSearchUrl', {
529
- enumerable: true,
530
- get: function () {
531
- return getIssuesSearchUrl;
532
- }
533
- });
534
- Object.defineProperty(exports, 'getMonitorUrl', {
535
- enumerable: true,
536
- get: function () {
537
- return getMonitorUrl;
538
- }
539
- });
540
- Object.defineProperty(exports, 'getPreprodSnapshotUrl', {
541
- enumerable: true,
542
- get: function () {
543
- return getPreprodSnapshotUrl;
544
- }
545
- });
546
- Object.defineProperty(exports, 'getProfileUrl', {
547
- enumerable: true,
548
- get: function () {
549
- return getProfileUrl;
550
- }
551
- });
552
- Object.defineProperty(exports, 'getProfilingExplorerUrl', {
553
- enumerable: true,
554
- get: function () {
555
- return getProfilingExplorerUrl;
556
- }
557
- });
558
- Object.defineProperty(exports, 'getReleaseUrl', {
559
- enumerable: true,
560
- get: function () {
561
- return getReleaseUrl;
562
- }
563
- });
564
- Object.defineProperty(exports, 'getReplayUrl', {
565
- enumerable: true,
566
- get: function () {
567
- return getReplayUrl;
568
- }
569
- });
570
- Object.defineProperty(exports, 'getReplaysSearchUrl', {
571
- enumerable: true,
572
- get: function () {
573
- return getReplaysSearchUrl;
574
- }
575
- });
576
- Object.defineProperty(exports, 'getTraceMetricsExploreUrl', {
577
- enumerable: true,
578
- get: function () {
579
- return getTraceMetricsExploreUrl;
580
- }
581
- });
582
- Object.defineProperty(exports, 'getTraceUrl', {
583
- enumerable: true,
584
- get: function () {
585
- return getTraceUrl;
586
- }
587
- });
588
- Object.defineProperty(exports, 'getUptimeMonitorUrl', {
589
- enumerable: true,
590
- get: function () {
591
- return getUptimeMonitorUrl;
592
- }
593
- });
594
- Object.defineProperty(exports, 'isMetricsDataset', {
595
- enumerable: true,
596
- get: function () {
597
- return isMetricsDataset;
598
- }
599
- });
600
- Object.defineProperty(exports, 'isProfilesDataset', {
601
- enumerable: true,
602
- get: function () {
603
- return isProfilesDataset;
604
- }
605
- });
606
- Object.defineProperty(exports, 'isSentryHost', {
607
- enumerable: true,
608
- get: function () {
609
- return isSentryHost;
610
- }
611
- });
612
- Object.defineProperty(exports, 'normalizeEventsDataset', {
613
- enumerable: true,
614
- get: function () {
615
- return normalizeEventsDataset;
616
- }
617
- });
618
- Object.defineProperty(exports, 'validateAndParseSentryUrlThrows', {
619
- enumerable: true,
620
- get: function () {
621
- return validateAndParseSentryUrlThrows;
622
- }
623
- });
624
- Object.defineProperty(exports, 'validateOpenAiBaseUrlThrows', {
625
- enumerable: true,
626
- get: function () {
627
- return validateOpenAiBaseUrlThrows;
628
- }
629
- });
630
- Object.defineProperty(exports, 'validateSentryHostThrows', {
631
- enumerable: true,
632
- get: function () {
633
- return validateSentryHostThrows;
634
- }
635
- });
636
- //# sourceMappingURL=constants-BqO-QSHl.cjs.map