@sentry/mcp-server 0.24.0 → 0.26.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.
- package/dist/cli/parse.cjs +1 -1
- package/dist/cli/parse.d.cts +1 -1
- package/dist/cli/parse.d.cts.map +1 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/parse.js +1 -1
- package/dist/cli/resolve.cjs +1 -2
- package/dist/cli/resolve.d.cts +2 -3
- package/dist/cli/resolve.d.cts.map +1 -1
- package/dist/cli/resolve.d.ts +2 -3
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +2 -2
- package/dist/cli/types.d.cts +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.d.cts +1 -2
- package/dist/cli/usage.d.cts.map +1 -1
- package/dist/cli/usage.d.ts +1 -2
- package/dist/cli/usage.d.ts.map +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/config-BEgU9ylR.js +3 -0
- package/dist/{config-DtimzxvV-D3ccpxhQ.cjs → config-BoFBjXRq-CGHqlnJ9.cjs} +296 -4
- package/dist/config-BoFBjXRq-CGHqlnJ9.cjs.map +1 -0
- package/dist/{config-DtimzxvV-BItTrGiz.js → config-BoFBjXRq-CMdBQOkQ.js} +291 -5
- package/dist/config-BoFBjXRq-CMdBQOkQ.js.map +1 -0
- package/dist/config-rZ982IEm.cjs +7 -0
- package/dist/index.cjs +921 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +917 -169
- package/dist/index.js.map +1 -1
- package/dist/{parse-Dn9XeQSj.js → parse-46t_fITC.js} +2 -26
- package/dist/parse-46t_fITC.js.map +1 -0
- package/dist/{parse-By6nDBNs.cjs → parse-BjIH83SX.cjs} +2 -26
- package/dist/parse-BjIH83SX.cjs.map +1 -0
- package/dist/resolve-CdTP9riu.cjs +286 -0
- package/dist/resolve-CdTP9riu.cjs.map +1 -0
- package/dist/resolve-Cg3SH2zt.js +232 -0
- package/dist/resolve-Cg3SH2zt.js.map +1 -0
- package/dist/{stdio-Cp-EJZB9.js → stdio-C47PFfCl.js} +4 -4
- package/dist/{stdio-Cp-EJZB9.js.map → stdio-C47PFfCl.js.map} +1 -1
- package/dist/{stdio-iRuX-anh.cjs → stdio-DFfz0_Ua.cjs} +4 -4
- package/dist/{stdio-iRuX-anh.cjs.map → stdio-DFfz0_Ua.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.js +1 -1
- package/dist/{types-CM88pHH_.d.ts → types-D5f00mg9.d.ts} +2 -11
- package/dist/types-D5f00mg9.d.ts.map +1 -0
- package/dist/{types-CnLRMjvf.d.cts → types-DpmAC3S8.d.cts} +2 -11
- package/dist/types-DpmAC3S8.d.cts.map +1 -0
- package/dist/{usage-DMGbIpV-.js → usage-BzYvqaru.js} +3 -11
- package/dist/usage-BzYvqaru.js.map +1 -0
- package/dist/{usage-iwGZsu3a.cjs → usage-DD58xBe3.cjs} +3 -11
- package/dist/usage-DD58xBe3.cjs.map +1 -0
- package/package.json +7 -6
- package/dist/config-Bs1p6XwV.js +0 -3
- package/dist/config-DFewJLVx.cjs +0 -6
- package/dist/config-DtimzxvV-BItTrGiz.js.map +0 -1
- package/dist/config-DtimzxvV-D3ccpxhQ.cjs.map +0 -1
- package/dist/parse-By6nDBNs.cjs.map +0 -1
- package/dist/parse-Dn9XeQSj.js.map +0 -1
- package/dist/resolve-BCdS4js5.js +0 -590
- package/dist/resolve-BCdS4js5.js.map +0 -1
- package/dist/resolve-BMmRdCFJ.cjs +0 -692
- package/dist/resolve-BMmRdCFJ.cjs.map +0 -1
- package/dist/types-CM88pHH_.d.ts.map +0 -1
- package/dist/types-CnLRMjvf.d.cts.map +0 -1
- package/dist/usage-DMGbIpV-.js.map +0 -1
- package/dist/usage-iwGZsu3a.cjs.map +0 -1
|
@@ -1,692 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../mcp-core/dist/skills-BmFl7P6V.js
|
|
3
|
-
const SKILLS = {
|
|
4
|
-
inspect: {
|
|
5
|
-
id: "inspect",
|
|
6
|
-
name: "Inspect Issues & Events",
|
|
7
|
-
description: "Search for errors, analyze traces, and explore event details",
|
|
8
|
-
defaultEnabled: true,
|
|
9
|
-
order: 1
|
|
10
|
-
},
|
|
11
|
-
seer: {
|
|
12
|
-
id: "seer",
|
|
13
|
-
name: "Seer",
|
|
14
|
-
description: "Sentry's AI debugger that helps you analyze, root cause, and fix issues",
|
|
15
|
-
defaultEnabled: true,
|
|
16
|
-
order: 2
|
|
17
|
-
},
|
|
18
|
-
docs: {
|
|
19
|
-
id: "docs",
|
|
20
|
-
name: "Documentation",
|
|
21
|
-
description: "Search and read Sentry SDK documentation",
|
|
22
|
-
defaultEnabled: false,
|
|
23
|
-
order: 3
|
|
24
|
-
},
|
|
25
|
-
triage: {
|
|
26
|
-
id: "triage",
|
|
27
|
-
name: "Triage Issues",
|
|
28
|
-
description: "Resolve, assign, and update issues",
|
|
29
|
-
defaultEnabled: false,
|
|
30
|
-
order: 4
|
|
31
|
-
},
|
|
32
|
-
"project-management": {
|
|
33
|
-
id: "project-management",
|
|
34
|
-
name: "Manage Projects & Teams",
|
|
35
|
-
description: "Create and modify projects, teams, and DSNs",
|
|
36
|
-
defaultEnabled: false,
|
|
37
|
-
order: 5
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);
|
|
41
|
-
const ALL_SKILLS = Object.keys(SKILLS);
|
|
42
|
-
const DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);
|
|
43
|
-
function isValidSkill(skill) {
|
|
44
|
-
return skill in SKILLS;
|
|
45
|
-
}
|
|
46
|
-
function hasRequiredSkills(grantedSkills, requiredSkills) {
|
|
47
|
-
if (!grantedSkills || requiredSkills.length === 0) return false;
|
|
48
|
-
return requiredSkills.some((skill) => grantedSkills.has(skill));
|
|
49
|
-
}
|
|
50
|
-
function parseSkills(input) {
|
|
51
|
-
const valid = /* @__PURE__ */ new Set();
|
|
52
|
-
const invalid = [];
|
|
53
|
-
if (!input) return {
|
|
54
|
-
valid,
|
|
55
|
-
invalid
|
|
56
|
-
};
|
|
57
|
-
let skills = [];
|
|
58
|
-
if (typeof input === "string") skills = input.split(",");
|
|
59
|
-
else if (Array.isArray(input)) skills = input.map((v) => typeof v === "string" ? v : "");
|
|
60
|
-
for (const skill of skills) {
|
|
61
|
-
const trimmed = String(skill).trim();
|
|
62
|
-
if (isValidSkill(trimmed)) valid.add(trimmed);
|
|
63
|
-
else if (trimmed) invalid.push(trimmed);
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
valid,
|
|
67
|
-
invalid
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region ../mcp-core/dist/constants-D8axTonA.js
|
|
73
|
-
/**
|
|
74
|
-
* Constants for Sentry MCP server.
|
|
75
|
-
*
|
|
76
|
-
* Defines platform and framework combinations available in Sentry documentation.
|
|
77
|
-
*/
|
|
78
|
-
/**
|
|
79
|
-
* MCP Server identification
|
|
80
|
-
*/
|
|
81
|
-
const MCP_SERVER_NAME = "Sentry MCP";
|
|
82
|
-
/**
|
|
83
|
-
* Allowed region domains for sentry.io
|
|
84
|
-
* Only these specific domains are permitted when using Sentry's cloud service
|
|
85
|
-
* This is used to prevent SSRF attacks by restricting regionUrl to known domains
|
|
86
|
-
*/
|
|
87
|
-
const SENTRY_ALLOWED_REGION_DOMAINS = new Set([
|
|
88
|
-
"sentry.io",
|
|
89
|
-
"us.sentry.io",
|
|
90
|
-
"de.sentry.io"
|
|
91
|
-
]);
|
|
92
|
-
/**
|
|
93
|
-
* Common Sentry platforms that have documentation available
|
|
94
|
-
*/
|
|
95
|
-
const SENTRY_PLATFORMS_BASE = [
|
|
96
|
-
"javascript",
|
|
97
|
-
"python",
|
|
98
|
-
"java",
|
|
99
|
-
"dotnet",
|
|
100
|
-
"go",
|
|
101
|
-
"php",
|
|
102
|
-
"ruby",
|
|
103
|
-
"android",
|
|
104
|
-
"apple",
|
|
105
|
-
"unity",
|
|
106
|
-
"unreal",
|
|
107
|
-
"rust",
|
|
108
|
-
"elixir",
|
|
109
|
-
"kotlin",
|
|
110
|
-
"native",
|
|
111
|
-
"dart",
|
|
112
|
-
"godot",
|
|
113
|
-
"nintendo-switch",
|
|
114
|
-
"playstation",
|
|
115
|
-
"powershell",
|
|
116
|
-
"react-native",
|
|
117
|
-
"xbox"
|
|
118
|
-
];
|
|
119
|
-
/**
|
|
120
|
-
* Platform-specific frameworks that have Sentry guides
|
|
121
|
-
*/
|
|
122
|
-
const SENTRY_FRAMEWORKS = {
|
|
123
|
-
javascript: [
|
|
124
|
-
"nextjs",
|
|
125
|
-
"react",
|
|
126
|
-
"gatsby",
|
|
127
|
-
"remix",
|
|
128
|
-
"vue",
|
|
129
|
-
"angular",
|
|
130
|
-
"hono",
|
|
131
|
-
"svelte",
|
|
132
|
-
"express",
|
|
133
|
-
"fastify",
|
|
134
|
-
"astro",
|
|
135
|
-
"bun",
|
|
136
|
-
"capacitor",
|
|
137
|
-
"cloudflare",
|
|
138
|
-
"connect",
|
|
139
|
-
"cordova",
|
|
140
|
-
"deno",
|
|
141
|
-
"electron",
|
|
142
|
-
"ember",
|
|
143
|
-
"nuxt",
|
|
144
|
-
"solid",
|
|
145
|
-
"solidstart",
|
|
146
|
-
"sveltekit",
|
|
147
|
-
"tanstack-react",
|
|
148
|
-
"wasm",
|
|
149
|
-
"node",
|
|
150
|
-
"koa",
|
|
151
|
-
"nestjs",
|
|
152
|
-
"hapi"
|
|
153
|
-
],
|
|
154
|
-
python: [
|
|
155
|
-
"django",
|
|
156
|
-
"flask",
|
|
157
|
-
"fastapi",
|
|
158
|
-
"celery",
|
|
159
|
-
"tornado",
|
|
160
|
-
"pyramid",
|
|
161
|
-
"aiohttp",
|
|
162
|
-
"anthropic",
|
|
163
|
-
"airflow",
|
|
164
|
-
"aws-lambda",
|
|
165
|
-
"boto3",
|
|
166
|
-
"bottle",
|
|
167
|
-
"chalice",
|
|
168
|
-
"dramatiq",
|
|
169
|
-
"falcon",
|
|
170
|
-
"langchain",
|
|
171
|
-
"litestar",
|
|
172
|
-
"logging",
|
|
173
|
-
"loguru",
|
|
174
|
-
"openai",
|
|
175
|
-
"quart",
|
|
176
|
-
"ray",
|
|
177
|
-
"redis",
|
|
178
|
-
"rq",
|
|
179
|
-
"sanic",
|
|
180
|
-
"sqlalchemy",
|
|
181
|
-
"starlette"
|
|
182
|
-
],
|
|
183
|
-
dart: ["flutter"],
|
|
184
|
-
dotnet: [
|
|
185
|
-
"aspnetcore",
|
|
186
|
-
"maui",
|
|
187
|
-
"wpf",
|
|
188
|
-
"winforms",
|
|
189
|
-
"aspnet",
|
|
190
|
-
"aws-lambda",
|
|
191
|
-
"azure-functions",
|
|
192
|
-
"blazor-webassembly",
|
|
193
|
-
"entityframework",
|
|
194
|
-
"google-cloud-functions",
|
|
195
|
-
"extensions-logging",
|
|
196
|
-
"log4net",
|
|
197
|
-
"nlog",
|
|
198
|
-
"serilog",
|
|
199
|
-
"uwp",
|
|
200
|
-
"xamarin"
|
|
201
|
-
],
|
|
202
|
-
java: [
|
|
203
|
-
"spring",
|
|
204
|
-
"spring-boot",
|
|
205
|
-
"android",
|
|
206
|
-
"jul",
|
|
207
|
-
"log4j2",
|
|
208
|
-
"logback",
|
|
209
|
-
"servlet"
|
|
210
|
-
],
|
|
211
|
-
go: [
|
|
212
|
-
"echo",
|
|
213
|
-
"fasthttp",
|
|
214
|
-
"fiber",
|
|
215
|
-
"gin",
|
|
216
|
-
"http",
|
|
217
|
-
"iris",
|
|
218
|
-
"logrus",
|
|
219
|
-
"negroni",
|
|
220
|
-
"slog",
|
|
221
|
-
"zerolog"
|
|
222
|
-
],
|
|
223
|
-
php: ["laravel", "symfony"],
|
|
224
|
-
ruby: [
|
|
225
|
-
"delayed_job",
|
|
226
|
-
"rack",
|
|
227
|
-
"rails",
|
|
228
|
-
"resque",
|
|
229
|
-
"sidekiq"
|
|
230
|
-
],
|
|
231
|
-
android: ["kotlin"],
|
|
232
|
-
apple: [
|
|
233
|
-
"ios",
|
|
234
|
-
"macos",
|
|
235
|
-
"watchos",
|
|
236
|
-
"tvos",
|
|
237
|
-
"visionos"
|
|
238
|
-
],
|
|
239
|
-
kotlin: ["multiplatform"]
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* All valid guides for Sentry docs search filtering.
|
|
243
|
-
* A guide can be either a platform (e.g., 'javascript') or a platform/framework combination (e.g., 'javascript/nextjs').
|
|
244
|
-
*/
|
|
245
|
-
const SENTRY_GUIDES = [...SENTRY_PLATFORMS_BASE, ...Object.entries(SENTRY_FRAMEWORKS).flatMap(([platform, guides]) => guides.map((guide) => `${platform}/${guide}`))];
|
|
246
|
-
const DEFAULT_SCOPES = [
|
|
247
|
-
"org:read",
|
|
248
|
-
"project:read",
|
|
249
|
-
"team:read",
|
|
250
|
-
"event:read"
|
|
251
|
-
];
|
|
252
|
-
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region ../mcp-core/dist/permissions-DbIM2Lps.js
|
|
255
|
-
/**
|
|
256
|
-
* Scope hierarchy - higher scopes include lower ones
|
|
257
|
-
*/
|
|
258
|
-
const SCOPE_HIERARCHY = {
|
|
259
|
-
"org:read": new Set(["org:read"]),
|
|
260
|
-
"org:write": new Set(["org:read", "org:write"]),
|
|
261
|
-
"org:admin": new Set([
|
|
262
|
-
"org:read",
|
|
263
|
-
"org:write",
|
|
264
|
-
"org:admin"
|
|
265
|
-
]),
|
|
266
|
-
"project:read": new Set(["project:read"]),
|
|
267
|
-
"project:write": new Set(["project:read", "project:write"]),
|
|
268
|
-
"project:admin": new Set([
|
|
269
|
-
"project:read",
|
|
270
|
-
"project:write",
|
|
271
|
-
"project:admin"
|
|
272
|
-
]),
|
|
273
|
-
"team:read": new Set(["team:read"]),
|
|
274
|
-
"team:write": new Set(["team:read", "team:write"]),
|
|
275
|
-
"team:admin": new Set([
|
|
276
|
-
"team:read",
|
|
277
|
-
"team:write",
|
|
278
|
-
"team:admin"
|
|
279
|
-
]),
|
|
280
|
-
"member:read": new Set(["member:read"]),
|
|
281
|
-
"member:write": new Set(["member:read", "member:write"]),
|
|
282
|
-
"member:admin": new Set([
|
|
283
|
-
"member:read",
|
|
284
|
-
"member:write",
|
|
285
|
-
"member:admin"
|
|
286
|
-
]),
|
|
287
|
-
"event:read": new Set(["event:read"]),
|
|
288
|
-
"event:write": new Set(["event:read", "event:write"]),
|
|
289
|
-
"event:admin": new Set([
|
|
290
|
-
"event:read",
|
|
291
|
-
"event:write",
|
|
292
|
-
"event:admin"
|
|
293
|
-
]),
|
|
294
|
-
"project:releases": new Set(["project:releases"])
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* All available scopes as a readonly list
|
|
298
|
-
*/
|
|
299
|
-
function getAvailableScopes() {
|
|
300
|
-
return Object.keys(SCOPE_HIERARCHY);
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* All scopes available in the server, generated from the permission hierarchy.
|
|
304
|
-
* Exported here to keep scope consumers lightweight and avoid importing other
|
|
305
|
-
* unrelated constants.
|
|
306
|
-
*/
|
|
307
|
-
const ALL_SCOPES = getAvailableScopes();
|
|
308
|
-
const ALL_SCOPES_SET = new Set(ALL_SCOPES);
|
|
309
|
-
/**
|
|
310
|
-
* Expand a set of granted scopes to include all implied scopes
|
|
311
|
-
*/
|
|
312
|
-
function expandScopes(grantedScopes) {
|
|
313
|
-
const expandedScopes = /* @__PURE__ */ new Set();
|
|
314
|
-
for (const scope of grantedScopes) {
|
|
315
|
-
const implied = SCOPE_HIERARCHY[scope];
|
|
316
|
-
for (const s of implied) expandedScopes.add(s);
|
|
317
|
-
}
|
|
318
|
-
return expandedScopes;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Check if a set of scopes satisfies the required scopes
|
|
322
|
-
*/
|
|
323
|
-
function hasRequiredScopes(grantedScopes, requiredScopes) {
|
|
324
|
-
const expandedScopes = expandScopes(grantedScopes);
|
|
325
|
-
return requiredScopes.every((scope) => expandedScopes.has(scope));
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Check if a tool is allowed based on granted scopes
|
|
329
|
-
*/
|
|
330
|
-
function isToolAllowed(requiredScopes, grantedScopes) {
|
|
331
|
-
if (!requiredScopes || requiredScopes.length === 0) return true;
|
|
332
|
-
return hasRequiredScopes(grantedScopes, requiredScopes);
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Parse scopes from a comma-separated string
|
|
336
|
-
*/
|
|
337
|
-
/**
|
|
338
|
-
* Parse scopes from a comma-separated string.
|
|
339
|
-
* - Filters out invalid entries
|
|
340
|
-
* - Logs a console.warn listing any invalid values
|
|
341
|
-
*/
|
|
342
|
-
/**
|
|
343
|
-
* Parse scopes from an array of strings.
|
|
344
|
-
* - Filters out invalid entries
|
|
345
|
-
* - Logs a console.warn listing any invalid values
|
|
346
|
-
*/
|
|
347
|
-
/**
|
|
348
|
-
* Generic scope parser: accepts a comma-separated string or an array.
|
|
349
|
-
* Returns both valid and invalid tokens. No logging.
|
|
350
|
-
*/
|
|
351
|
-
function parseScopes(input) {
|
|
352
|
-
let tokens = [];
|
|
353
|
-
if (typeof input === "string") tokens = input.split(",");
|
|
354
|
-
else if (Array.isArray(input)) tokens = input.map((v) => typeof v === "string" ? v : "");
|
|
355
|
-
const valid = /* @__PURE__ */ new Set();
|
|
356
|
-
const invalid = [];
|
|
357
|
-
for (const raw of tokens.map((s) => s.trim()).filter(Boolean)) if (ALL_SCOPES_SET.has(raw)) valid.add(raw);
|
|
358
|
-
else invalid.push(raw);
|
|
359
|
-
return {
|
|
360
|
-
valid,
|
|
361
|
-
invalid
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Strict validation helper for scope strings supplied via flags/env.
|
|
366
|
-
* Returns both valid and invalid entries without side effects.
|
|
367
|
-
*/
|
|
368
|
-
/**
|
|
369
|
-
* Resolve final scopes from optional override/additive sets and provided defaults.
|
|
370
|
-
* - If override is provided, it replaces defaults and is expanded
|
|
371
|
-
* - Else if add is provided, it unions with defaults and is expanded
|
|
372
|
-
* - Else returns undefined to indicate default handling upstream
|
|
373
|
-
*/
|
|
374
|
-
function resolveScopes(options) {
|
|
375
|
-
const { override, add, defaults } = options;
|
|
376
|
-
if (override) return expandScopes(override);
|
|
377
|
-
if (add) {
|
|
378
|
-
const base = new Set(defaults);
|
|
379
|
-
for (const s of add) base.add(s);
|
|
380
|
-
return expandScopes(base);
|
|
381
|
-
}
|
|
382
|
-
return void 0;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
//#endregion
|
|
386
|
-
//#region ../mcp-core/dist/url-utils-DoqJlWab.js
|
|
387
|
-
/**
|
|
388
|
-
* Determines if a Sentry instance is SaaS or self-hosted based on the host.
|
|
389
|
-
* @param host The Sentry host (e.g., "sentry.io" or "sentry.company.com")
|
|
390
|
-
* @returns true if SaaS instance, false if self-hosted
|
|
391
|
-
*/
|
|
392
|
-
function isSentryHost(host) {
|
|
393
|
-
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Generates a Sentry issue URL.
|
|
397
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
398
|
-
* @param organizationSlug Organization identifier
|
|
399
|
-
* @param issueId Issue identifier (e.g., "PROJECT-123")
|
|
400
|
-
* @returns The complete issue URL
|
|
401
|
-
*/
|
|
402
|
-
function getIssueUrl(host, organizationSlug, issueId) {
|
|
403
|
-
const isSaas = isSentryHost(host);
|
|
404
|
-
const webHost = isSaas ? "sentry.io" : host;
|
|
405
|
-
return isSaas ? `https://${organizationSlug}.${webHost}/issues/${issueId}` : `https://${host}/organizations/${organizationSlug}/issues/${issueId}`;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Generates a Sentry issues search URL.
|
|
409
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
410
|
-
* @param organizationSlug Organization identifier
|
|
411
|
-
* @param query Optional search query
|
|
412
|
-
* @param projectSlugOrId Optional project slug or ID
|
|
413
|
-
* @returns The complete issues search URL
|
|
414
|
-
*/
|
|
415
|
-
function getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId) {
|
|
416
|
-
const isSaas = isSentryHost(host);
|
|
417
|
-
const webHost = isSaas ? "sentry.io" : host;
|
|
418
|
-
let url = isSaas ? `https://${organizationSlug}.${webHost}/issues/` : `https://${host}/organizations/${organizationSlug}/issues/`;
|
|
419
|
-
const params = new URLSearchParams();
|
|
420
|
-
if (projectSlugOrId) params.append("project", projectSlugOrId);
|
|
421
|
-
if (query) params.append("query", query);
|
|
422
|
-
const queryString = params.toString();
|
|
423
|
-
if (queryString) url += `?${queryString}`;
|
|
424
|
-
return url;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Generates a Sentry trace URL for performance investigation.
|
|
428
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
429
|
-
* @param organizationSlug Organization identifier
|
|
430
|
-
* @param traceId Trace identifier
|
|
431
|
-
* @returns The complete trace URL
|
|
432
|
-
*/
|
|
433
|
-
function getTraceUrl(host, organizationSlug, traceId) {
|
|
434
|
-
const isSaas = isSentryHost(host);
|
|
435
|
-
const webHost = isSaas ? "sentry.io" : host;
|
|
436
|
-
return isSaas ? `https://${organizationSlug}.${webHost}/explore/traces/trace/${traceId}` : `https://${host}/organizations/${organizationSlug}/explore/traces/trace/${traceId}`;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).
|
|
440
|
-
* Throws an error if validation fails instead of exiting the process.
|
|
441
|
-
*
|
|
442
|
-
* @param host The hostname to validate
|
|
443
|
-
* @throws {Error} If the host contains a protocol
|
|
444
|
-
*/
|
|
445
|
-
function _validateSentryHostInternal(host) {
|
|
446
|
-
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.");
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
|
|
450
|
-
* Throws an error if validation fails instead of exiting the process.
|
|
451
|
-
*
|
|
452
|
-
* @param url The HTTPS URL to validate and parse
|
|
453
|
-
* @returns The extracted hostname from the URL
|
|
454
|
-
* @throws {Error} If the URL is invalid or not HTTPS
|
|
455
|
-
*/
|
|
456
|
-
function _validateAndParseSentryUrlInternal(url) {
|
|
457
|
-
if (!url.startsWith("https://")) throw new Error("SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).");
|
|
458
|
-
try {
|
|
459
|
-
const parsedUrl = new URL(url);
|
|
460
|
-
return parsedUrl.host;
|
|
461
|
-
} catch (error) {
|
|
462
|
-
throw new Error("SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).");
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Validates that a SENTRY_HOST value contains only hostname (no protocol).
|
|
467
|
-
* Throws an error instead of exiting the process (for testing).
|
|
468
|
-
*
|
|
469
|
-
* @param host The hostname to validate
|
|
470
|
-
* @throws {Error} If the host contains a protocol
|
|
471
|
-
*/
|
|
472
|
-
function validateSentryHostThrows(host) {
|
|
473
|
-
_validateSentryHostInternal(host);
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
|
|
477
|
-
* Throws an error instead of exiting the process (for testing).
|
|
478
|
-
*
|
|
479
|
-
* @param url The HTTPS URL to validate and parse
|
|
480
|
-
* @returns The extracted hostname from the URL
|
|
481
|
-
* @throws {Error} If the URL is invalid or not HTTPS
|
|
482
|
-
*/
|
|
483
|
-
function validateAndParseSentryUrlThrows(url) {
|
|
484
|
-
return _validateAndParseSentryUrlInternal(url);
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.
|
|
488
|
-
*
|
|
489
|
-
* @param url The URL to validate and normalize
|
|
490
|
-
* @returns The normalized URL string
|
|
491
|
-
* @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol
|
|
492
|
-
*/
|
|
493
|
-
function validateOpenAiBaseUrlThrows(url) {
|
|
494
|
-
const trimmed = url.trim();
|
|
495
|
-
if (trimmed.length === 0) throw new Error("OPENAI base URL must not be empty.");
|
|
496
|
-
let parsed;
|
|
497
|
-
try {
|
|
498
|
-
parsed = new URL(trimmed);
|
|
499
|
-
} catch (error) {
|
|
500
|
-
throw new Error("OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).", { cause: error });
|
|
501
|
-
}
|
|
502
|
-
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).");
|
|
503
|
-
return parsed.toString();
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region src/cli/resolve.ts
|
|
508
|
-
function formatInvalid(invalid, envName) {
|
|
509
|
-
const where = envName ? `${envName} provided` : "Invalid scopes provided";
|
|
510
|
-
return `Error: ${where}: ${invalid.join(", ")}\nAvailable scopes: ${ALL_SCOPES.join(", ")}`;
|
|
511
|
-
}
|
|
512
|
-
function formatInvalidSkills(invalid, envName) {
|
|
513
|
-
const where = envName ? `${envName} provided` : "Invalid skills provided";
|
|
514
|
-
const allSkills = Object.keys(SKILLS).join(", ");
|
|
515
|
-
return `Error: ${where}: ${invalid.join(", ")}\nAvailable skills: ${allSkills}`;
|
|
516
|
-
}
|
|
517
|
-
function finalize(input) {
|
|
518
|
-
if (!input.accessToken) throw new Error("Error: No access token was provided. Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.");
|
|
519
|
-
let sentryHost = "sentry.io";
|
|
520
|
-
if (input.url) sentryHost = validateAndParseSentryUrlThrows(input.url);
|
|
521
|
-
else if (input.host) {
|
|
522
|
-
validateSentryHostThrows(input.host);
|
|
523
|
-
sentryHost = input.host;
|
|
524
|
-
}
|
|
525
|
-
let finalScopes = void 0;
|
|
526
|
-
if (input.allScopes) {
|
|
527
|
-
console.warn("⚠️ Warning: --all-scopes is deprecated. Consider using skills instead:");
|
|
528
|
-
console.warn(" --skills=inspect,triage,project-management,seer,docs");
|
|
529
|
-
console.warn(" Learn more about skills in the documentation.");
|
|
530
|
-
console.warn("");
|
|
531
|
-
finalScopes = new Set(ALL_SCOPES);
|
|
532
|
-
} else if (input.scopes || input.addScopes) {
|
|
533
|
-
if (input.scopes) {
|
|
534
|
-
console.warn("⚠️ Warning: --scopes is deprecated. Consider using skills instead:");
|
|
535
|
-
console.warn(" For example, instead of --scopes=event:write,project:write");
|
|
536
|
-
console.warn(" Use: --skills=triage,project-management");
|
|
537
|
-
console.warn(" Learn more about skills in the documentation.");
|
|
538
|
-
console.warn("");
|
|
539
|
-
} else if (input.addScopes) {
|
|
540
|
-
console.warn("⚠️ Warning: --add-scopes is deprecated. Consider using --skills instead:");
|
|
541
|
-
console.warn(" For example, instead of --add-scopes=event:write");
|
|
542
|
-
console.warn(" Use: --skills=triage");
|
|
543
|
-
console.warn(" Learn more about skills in the documentation.");
|
|
544
|
-
console.warn("");
|
|
545
|
-
}
|
|
546
|
-
if (input.scopes) {
|
|
547
|
-
const { valid, invalid } = parseScopes(input.scopes);
|
|
548
|
-
if (invalid.length > 0) throw new Error(formatInvalid(invalid));
|
|
549
|
-
if (valid.size === 0) throw new Error("Error: Invalid scopes provided. No valid scopes found.");
|
|
550
|
-
finalScopes = resolveScopes({
|
|
551
|
-
override: valid,
|
|
552
|
-
defaults: DEFAULT_SCOPES
|
|
553
|
-
});
|
|
554
|
-
} else if (input.addScopes) {
|
|
555
|
-
const { valid, invalid } = parseScopes(input.addScopes);
|
|
556
|
-
if (invalid.length > 0) throw new Error(formatInvalid(invalid));
|
|
557
|
-
if (valid.size === 0) throw new Error("Error: Invalid additional scopes provided. No valid scopes found.");
|
|
558
|
-
finalScopes = resolveScopes({
|
|
559
|
-
add: valid,
|
|
560
|
-
defaults: DEFAULT_SCOPES
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
let finalSkills = void 0;
|
|
565
|
-
if (input.skills) {
|
|
566
|
-
const { valid, invalid } = parseSkills(input.skills);
|
|
567
|
-
if (invalid.length > 0) throw new Error(formatInvalidSkills(invalid));
|
|
568
|
-
if (valid.size === 0) throw new Error("Error: Invalid skills provided. No valid skills found.");
|
|
569
|
-
finalSkills = valid;
|
|
570
|
-
} else {
|
|
571
|
-
const allSkills = Object.keys(SKILLS);
|
|
572
|
-
finalSkills = new Set(allSkills);
|
|
573
|
-
}
|
|
574
|
-
const resolvedOpenAiBaseUrl = input.openaiBaseUrl ? validateOpenAiBaseUrlThrows(input.openaiBaseUrl) : void 0;
|
|
575
|
-
return {
|
|
576
|
-
accessToken: input.accessToken,
|
|
577
|
-
sentryHost,
|
|
578
|
-
mcpUrl: input.mcpUrl,
|
|
579
|
-
sentryDsn: input.sentryDsn,
|
|
580
|
-
openaiBaseUrl: resolvedOpenAiBaseUrl,
|
|
581
|
-
openaiModel: input.openaiModel,
|
|
582
|
-
finalScopes,
|
|
583
|
-
finalSkills,
|
|
584
|
-
organizationSlug: input.organizationSlug,
|
|
585
|
-
projectSlug: input.projectSlug
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
//#endregion
|
|
590
|
-
Object.defineProperty(exports, 'ALL_SCOPES', {
|
|
591
|
-
enumerable: true,
|
|
592
|
-
get: function () {
|
|
593
|
-
return ALL_SCOPES;
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
Object.defineProperty(exports, 'ALL_SKILLS', {
|
|
597
|
-
enumerable: true,
|
|
598
|
-
get: function () {
|
|
599
|
-
return ALL_SKILLS;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
Object.defineProperty(exports, 'DEFAULT_SCOPES', {
|
|
603
|
-
enumerable: true,
|
|
604
|
-
get: function () {
|
|
605
|
-
return DEFAULT_SCOPES;
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
Object.defineProperty(exports, 'DEFAULT_SKILLS', {
|
|
609
|
-
enumerable: true,
|
|
610
|
-
get: function () {
|
|
611
|
-
return DEFAULT_SKILLS;
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
Object.defineProperty(exports, 'MCP_SERVER_NAME', {
|
|
615
|
-
enumerable: true,
|
|
616
|
-
get: function () {
|
|
617
|
-
return MCP_SERVER_NAME;
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
Object.defineProperty(exports, 'SENTRY_ALLOWED_REGION_DOMAINS', {
|
|
621
|
-
enumerable: true,
|
|
622
|
-
get: function () {
|
|
623
|
-
return SENTRY_ALLOWED_REGION_DOMAINS;
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
Object.defineProperty(exports, 'SENTRY_GUIDES', {
|
|
627
|
-
enumerable: true,
|
|
628
|
-
get: function () {
|
|
629
|
-
return SENTRY_GUIDES;
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
Object.defineProperty(exports, 'SKILLS', {
|
|
633
|
-
enumerable: true,
|
|
634
|
-
get: function () {
|
|
635
|
-
return SKILLS;
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
Object.defineProperty(exports, 'finalize', {
|
|
639
|
-
enumerable: true,
|
|
640
|
-
get: function () {
|
|
641
|
-
return finalize;
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
Object.defineProperty(exports, 'formatInvalid', {
|
|
645
|
-
enumerable: true,
|
|
646
|
-
get: function () {
|
|
647
|
-
return formatInvalid;
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
Object.defineProperty(exports, 'formatInvalidSkills', {
|
|
651
|
-
enumerable: true,
|
|
652
|
-
get: function () {
|
|
653
|
-
return formatInvalidSkills;
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
Object.defineProperty(exports, 'getIssueUrl', {
|
|
657
|
-
enumerable: true,
|
|
658
|
-
get: function () {
|
|
659
|
-
return getIssueUrl;
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
Object.defineProperty(exports, 'getIssuesSearchUrl', {
|
|
663
|
-
enumerable: true,
|
|
664
|
-
get: function () {
|
|
665
|
-
return getIssuesSearchUrl;
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
Object.defineProperty(exports, 'getTraceUrl', {
|
|
669
|
-
enumerable: true,
|
|
670
|
-
get: function () {
|
|
671
|
-
return getTraceUrl;
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
Object.defineProperty(exports, 'hasRequiredSkills', {
|
|
675
|
-
enumerable: true,
|
|
676
|
-
get: function () {
|
|
677
|
-
return hasRequiredSkills;
|
|
678
|
-
}
|
|
679
|
-
});
|
|
680
|
-
Object.defineProperty(exports, 'isSentryHost', {
|
|
681
|
-
enumerable: true,
|
|
682
|
-
get: function () {
|
|
683
|
-
return isSentryHost;
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
Object.defineProperty(exports, 'isToolAllowed', {
|
|
687
|
-
enumerable: true,
|
|
688
|
-
get: function () {
|
|
689
|
-
return isToolAllowed;
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
//# sourceMappingURL=resolve-BMmRdCFJ.cjs.map
|