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