@sentry/mcp-server 0.23.1 → 0.25.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 (67) hide show
  1. package/dist/cli/parse.cjs +1 -1
  2. package/dist/cli/parse.d.cts +1 -1
  3. package/dist/cli/parse.d.cts.map +1 -1
  4. package/dist/cli/parse.d.ts +1 -1
  5. package/dist/cli/parse.d.ts.map +1 -1
  6. package/dist/cli/parse.js +1 -1
  7. package/dist/cli/resolve.cjs +1 -2
  8. package/dist/cli/resolve.d.cts +2 -3
  9. package/dist/cli/resolve.d.cts.map +1 -1
  10. package/dist/cli/resolve.d.ts +2 -3
  11. package/dist/cli/resolve.d.ts.map +1 -1
  12. package/dist/cli/resolve.js +2 -2
  13. package/dist/cli/types.d.cts +1 -1
  14. package/dist/cli/types.d.ts +1 -1
  15. package/dist/cli/usage.cjs +1 -1
  16. package/dist/cli/usage.d.cts +1 -2
  17. package/dist/cli/usage.d.cts.map +1 -1
  18. package/dist/cli/usage.d.ts +1 -2
  19. package/dist/cli/usage.d.ts.map +1 -1
  20. package/dist/cli/usage.js +1 -1
  21. package/dist/config-BEgU9ylR.js +3 -0
  22. package/dist/{config-DtimzxvV-D3ccpxhQ.cjs → config-BoFBjXRq-CGHqlnJ9.cjs} +296 -4
  23. package/dist/config-BoFBjXRq-CGHqlnJ9.cjs.map +1 -0
  24. package/dist/{config-DtimzxvV-BItTrGiz.js → config-BoFBjXRq-CMdBQOkQ.js} +291 -5
  25. package/dist/config-BoFBjXRq-CMdBQOkQ.js.map +1 -0
  26. package/dist/config-rZ982IEm.cjs +7 -0
  27. package/dist/index.cjs +482 -316
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.js +438 -272
  30. package/dist/index.js.map +1 -1
  31. package/dist/{parse-Dn9XeQSj.js → parse-46t_fITC.js} +2 -26
  32. package/dist/parse-46t_fITC.js.map +1 -0
  33. package/dist/{parse-By6nDBNs.cjs → parse-BjIH83SX.cjs} +2 -26
  34. package/dist/parse-BjIH83SX.cjs.map +1 -0
  35. package/dist/resolve-CdTP9riu.cjs +286 -0
  36. package/dist/resolve-CdTP9riu.cjs.map +1 -0
  37. package/dist/resolve-Cg3SH2zt.js +232 -0
  38. package/dist/resolve-Cg3SH2zt.js.map +1 -0
  39. package/dist/{stdio-aCI9XyaI.cjs → stdio-Cl-Ib8bu.cjs} +4 -4
  40. package/dist/{stdio-aCI9XyaI.cjs.map → stdio-Cl-Ib8bu.cjs.map} +1 -1
  41. package/dist/{stdio-232a22j4.js → stdio-CwqdTAhY.js} +4 -4
  42. package/dist/{stdio-232a22j4.js.map → stdio-CwqdTAhY.js.map} +1 -1
  43. package/dist/transports/stdio.cjs +1 -1
  44. package/dist/transports/stdio.js +1 -1
  45. package/dist/{types-CM88pHH_.d.ts → types-D5f00mg9.d.ts} +2 -11
  46. package/dist/types-D5f00mg9.d.ts.map +1 -0
  47. package/dist/{types-CnLRMjvf.d.cts → types-DpmAC3S8.d.cts} +2 -11
  48. package/dist/types-DpmAC3S8.d.cts.map +1 -0
  49. package/dist/{usage-DMGbIpV-.js → usage-BzYvqaru.js} +3 -11
  50. package/dist/usage-BzYvqaru.js.map +1 -0
  51. package/dist/{usage-iwGZsu3a.cjs → usage-DD58xBe3.cjs} +3 -11
  52. package/dist/usage-DD58xBe3.cjs.map +1 -0
  53. package/package.json +7 -6
  54. package/dist/config-Bs1p6XwV.js +0 -3
  55. package/dist/config-DFewJLVx.cjs +0 -6
  56. package/dist/config-DtimzxvV-BItTrGiz.js.map +0 -1
  57. package/dist/config-DtimzxvV-D3ccpxhQ.cjs.map +0 -1
  58. package/dist/parse-By6nDBNs.cjs.map +0 -1
  59. package/dist/parse-Dn9XeQSj.js.map +0 -1
  60. package/dist/resolve-BCdS4js5.js +0 -590
  61. package/dist/resolve-BCdS4js5.js.map +0 -1
  62. package/dist/resolve-BMmRdCFJ.cjs +0 -692
  63. package/dist/resolve-BMmRdCFJ.cjs.map +0 -1
  64. package/dist/types-CM88pHH_.d.ts.map +0 -1
  65. package/dist/types-CnLRMjvf.d.cts.map +0 -1
  66. package/dist/usage-DMGbIpV-.js.map +0 -1
  67. package/dist/usage-iwGZsu3a.cjs.map +0 -1
@@ -12,9 +12,6 @@ function parseArgv(argv) {
12
12
  "openai-model": { type: "string" },
13
13
  "organization-slug": { type: "string" },
14
14
  "project-slug": { type: "string" },
15
- scopes: { type: "string" },
16
- "add-scopes": { type: "string" },
17
- "all-scopes": { type: "boolean" },
18
15
  skills: { type: "string" },
19
16
  agent: { type: "boolean" },
20
17
  help: {
@@ -50,9 +47,6 @@ function parseArgv(argv) {
50
47
  openaiModel: values["openai-model"],
51
48
  organizationSlug: values["organization-slug"],
52
49
  projectSlug: values["project-slug"],
53
- scopes: values.scopes,
54
- addScopes: values["add-scopes"],
55
- allScopes: values["all-scopes"] === true,
56
50
  skills: values.skills,
57
51
  agent: values.agent === true,
58
52
  help: values.help === true,
@@ -68,23 +62,11 @@ function parseEnv(env) {
68
62
  if (env.MCP_URL) fromEnv.mcpUrl = env.MCP_URL;
69
63
  if (env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN) fromEnv.sentryDsn = env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN;
70
64
  if (env.OPENAI_MODEL) fromEnv.openaiModel = env.OPENAI_MODEL;
71
- if (env.MCP_SCOPES) {
72
- fromEnv.scopes = env.MCP_SCOPES;
73
- console.warn("⚠️ Warning: MCP_SCOPES environment variable is deprecated.");
74
- console.warn(" Consider using MCP_SKILLS instead.");
75
- console.warn("");
76
- }
77
- if (env.MCP_ADD_SCOPES) {
78
- fromEnv.addScopes = env.MCP_ADD_SCOPES;
79
- console.warn("⚠️ Warning: MCP_ADD_SCOPES environment variable is deprecated.");
80
- console.warn(" Consider using MCP_SKILLS instead.");
81
- console.warn("");
82
- }
83
65
  if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;
84
66
  return fromEnv;
85
67
  }
86
68
  function merge(cli, env) {
87
- const merged = {
69
+ return {
88
70
  accessToken: cli.accessToken ?? env.accessToken,
89
71
  url: cli.url ?? env.url,
90
72
  host: cli.host ?? env.host,
@@ -92,9 +74,6 @@ function merge(cli, env) {
92
74
  sentryDsn: cli.sentryDsn ?? env.sentryDsn,
93
75
  openaiBaseUrl: cli.openaiBaseUrl,
94
76
  openaiModel: cli.openaiModel ?? env.openaiModel,
95
- scopes: cli.scopes ?? env.scopes,
96
- addScopes: cli.addScopes ?? env.addScopes,
97
- allScopes: cli.allScopes === true,
98
77
  skills: cli.skills ?? env.skills,
99
78
  agent: cli.agent === true,
100
79
  organizationSlug: cli.organizationSlug,
@@ -103,11 +82,8 @@ function merge(cli, env) {
103
82
  version: cli.version === true,
104
83
  unknownArgs: cli.unknownArgs
105
84
  };
106
- if (cli.scopes) merged.addScopes = cli.addScopes;
107
- if (cli.addScopes) merged.scopes = cli.scopes;
108
- return merged;
109
85
  }
110
86
 
111
87
  //#endregion
112
88
  export { merge, parseArgv, parseEnv };
113
- //# sourceMappingURL=parse-Dn9XeQSj.js.map
89
+ //# sourceMappingURL=parse-46t_fITC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-46t_fITC.js","names":["argv: string[]","unknownArgs: string[]","env: NodeJS.ProcessEnv","fromEnv: EnvArgs","cli: CliArgs","env: EnvArgs"],"sources":["../src/cli/parse.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport type { CliArgs, EnvArgs, MergedArgs } from \"./types\";\n\nexport function parseArgv(argv: string[]): CliArgs {\n const options = {\n \"access-token\": { type: \"string\" as const },\n host: { type: \"string\" as const },\n url: { type: \"string\" as const },\n \"mcp-url\": { type: \"string\" as const },\n \"sentry-dsn\": { type: \"string\" as const },\n \"openai-base-url\": { type: \"string\" as const },\n \"openai-model\": { type: \"string\" as const },\n \"organization-slug\": { type: \"string\" as const },\n \"project-slug\": { type: \"string\" as const },\n skills: { type: \"string\" as const },\n agent: { type: \"boolean\" as const },\n help: { type: \"boolean\" as const, short: \"h\" as const },\n version: { type: \"boolean\" as const, short: \"v\" as const },\n };\n\n const { values, positionals, tokens } = parseArgs({\n args: argv,\n options,\n allowPositionals: false,\n strict: false,\n tokens: true,\n });\n\n const knownLong = new Set(Object.keys(options));\n const knownShort = new Set([\n ...(Object.values(options)\n .map((o) => (\"short\" in o ? (o.short as string | undefined) : undefined))\n .filter(Boolean) as string[]),\n ]);\n\n const unknownArgs: string[] = [];\n for (const t of (tokens as any[]) || []) {\n if (t.kind === \"option\") {\n const name = t.name as string | undefined;\n if (name && !(knownLong.has(name) || knownShort.has(name))) {\n unknownArgs.push((t.raw as string) ?? `--${name}`);\n }\n } else if (t.kind === \"positional\") {\n unknownArgs.push((t.raw as string) ?? String(t.value ?? \"\"));\n }\n }\n\n return {\n accessToken: values[\"access-token\"] as string | undefined,\n host: values.host as string | undefined,\n url: values.url as string | undefined,\n mcpUrl: values[\"mcp-url\"] as string | undefined,\n sentryDsn: values[\"sentry-dsn\"] as string | undefined,\n openaiBaseUrl: values[\"openai-base-url\"] as string | undefined,\n openaiModel: values[\"openai-model\"] as string | undefined,\n organizationSlug: values[\"organization-slug\"] as string | undefined,\n projectSlug: values[\"project-slug\"] as string | undefined,\n skills: values.skills as string | undefined,\n agent: (values.agent as boolean | undefined) === true,\n help: (values.help as boolean | undefined) === true,\n version: (values.version as boolean | undefined) === true,\n unknownArgs:\n unknownArgs.length > 0 ? unknownArgs : (positionals as string[]) || [],\n };\n}\n\nexport function parseEnv(env: NodeJS.ProcessEnv): EnvArgs {\n const fromEnv: EnvArgs = {};\n if (env.SENTRY_ACCESS_TOKEN) fromEnv.accessToken = env.SENTRY_ACCESS_TOKEN;\n if (env.SENTRY_URL) fromEnv.url = env.SENTRY_URL;\n if (env.SENTRY_HOST) fromEnv.host = env.SENTRY_HOST;\n if (env.MCP_URL) fromEnv.mcpUrl = env.MCP_URL;\n if (env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN)\n fromEnv.sentryDsn = env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN;\n\n if (env.OPENAI_MODEL) fromEnv.openaiModel = env.OPENAI_MODEL;\n if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;\n return fromEnv;\n}\n\nexport function merge(cli: CliArgs, env: EnvArgs): MergedArgs {\n // CLI wins over env\n return {\n accessToken: cli.accessToken ?? env.accessToken,\n // If CLI provided url/host, prefer those; else fall back to env\n url: cli.url ?? env.url,\n host: cli.host ?? env.host,\n mcpUrl: cli.mcpUrl ?? env.mcpUrl,\n sentryDsn: cli.sentryDsn ?? env.sentryDsn,\n openaiBaseUrl: cli.openaiBaseUrl,\n openaiModel: cli.openaiModel ?? env.openaiModel,\n // Skills precedence: CLI skills override env\n skills: cli.skills ?? env.skills,\n agent: cli.agent === true,\n organizationSlug: cli.organizationSlug,\n projectSlug: cli.projectSlug,\n help: cli.help === true,\n version: cli.version === true,\n unknownArgs: cli.unknownArgs,\n };\n}\n"],"mappings":";;;AAGA,SAAgB,UAAUA,MAAyB;CACjD,MAAM,UAAU;EACd,gBAAgB,EAAE,MAAM,SAAmB;EAC3C,MAAM,EAAE,MAAM,SAAmB;EACjC,KAAK,EAAE,MAAM,SAAmB;EAChC,WAAW,EAAE,MAAM,SAAmB;EACtC,cAAc,EAAE,MAAM,SAAmB;EACzC,mBAAmB,EAAE,MAAM,SAAmB;EAC9C,gBAAgB,EAAE,MAAM,SAAmB;EAC3C,qBAAqB,EAAE,MAAM,SAAmB;EAChD,gBAAgB,EAAE,MAAM,SAAmB;EAC3C,QAAQ,EAAE,MAAM,SAAmB;EACnC,OAAO,EAAE,MAAM,UAAoB;EACnC,MAAM;GAAE,MAAM;GAAoB,OAAO;EAAc;EACvD,SAAS;GAAE,MAAM;GAAoB,OAAO;EAAc;CAC3D;CAED,MAAM,EAAE,QAAQ,aAAa,QAAQ,GAAG,UAAU;EAChD,MAAM;EACN;EACA,kBAAkB;EAClB,QAAQ;EACR,QAAQ;CACT,EAAC;CAEF,MAAM,YAAY,IAAI,I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AAE5D,QAAO;EACL,aAAa,IAAI,eAAe,IAAI;EAEpC,KAAK,IAAI,OAAO,IAAI;EACpB,MAAM,IAAI,QAAQ,IAAI;EACtB,QAAQ,IAAI,UAAU,IAAI;EAC1B,WAAW,IAAI,aAAa,IAAI;EAChC,eAAe,IAAI;EACnB,aAAa,IAAI,eAAe,IAAI;EAEpC,QAAQ,IAAI,UAAU,IAAI;EAC1B,OAAO,IAAI,UAAU;EACrB,kBAAkB,IAAI;EACtB,aAAa,IAAI;EACjB,MAAM,IAAI,SAAS;EACnB,SAAS,IAAI,YAAY;EACzB,aAAa,IAAI;CAClB;AACF"}
@@ -13,9 +13,6 @@ function parseArgv(argv) {
13
13
  "openai-model": { type: "string" },
14
14
  "organization-slug": { type: "string" },
15
15
  "project-slug": { type: "string" },
16
- scopes: { type: "string" },
17
- "add-scopes": { type: "string" },
18
- "all-scopes": { type: "boolean" },
19
16
  skills: { type: "string" },
20
17
  agent: { type: "boolean" },
21
18
  help: {
@@ -51,9 +48,6 @@ function parseArgv(argv) {
51
48
  openaiModel: values["openai-model"],
52
49
  organizationSlug: values["organization-slug"],
53
50
  projectSlug: values["project-slug"],
54
- scopes: values.scopes,
55
- addScopes: values["add-scopes"],
56
- allScopes: values["all-scopes"] === true,
57
51
  skills: values.skills,
58
52
  agent: values.agent === true,
59
53
  help: values.help === true,
@@ -69,23 +63,11 @@ function parseEnv(env) {
69
63
  if (env.MCP_URL) fromEnv.mcpUrl = env.MCP_URL;
70
64
  if (env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN) fromEnv.sentryDsn = env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN;
71
65
  if (env.OPENAI_MODEL) fromEnv.openaiModel = env.OPENAI_MODEL;
72
- if (env.MCP_SCOPES) {
73
- fromEnv.scopes = env.MCP_SCOPES;
74
- console.warn("⚠️ Warning: MCP_SCOPES environment variable is deprecated.");
75
- console.warn(" Consider using MCP_SKILLS instead.");
76
- console.warn("");
77
- }
78
- if (env.MCP_ADD_SCOPES) {
79
- fromEnv.addScopes = env.MCP_ADD_SCOPES;
80
- console.warn("⚠️ Warning: MCP_ADD_SCOPES environment variable is deprecated.");
81
- console.warn(" Consider using MCP_SKILLS instead.");
82
- console.warn("");
83
- }
84
66
  if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;
85
67
  return fromEnv;
86
68
  }
87
69
  function merge(cli, env) {
88
- const merged = {
70
+ return {
89
71
  accessToken: cli.accessToken ?? env.accessToken,
90
72
  url: cli.url ?? env.url,
91
73
  host: cli.host ?? env.host,
@@ -93,9 +75,6 @@ function merge(cli, env) {
93
75
  sentryDsn: cli.sentryDsn ?? env.sentryDsn,
94
76
  openaiBaseUrl: cli.openaiBaseUrl,
95
77
  openaiModel: cli.openaiModel ?? env.openaiModel,
96
- scopes: cli.scopes ?? env.scopes,
97
- addScopes: cli.addScopes ?? env.addScopes,
98
- allScopes: cli.allScopes === true,
99
78
  skills: cli.skills ?? env.skills,
100
79
  agent: cli.agent === true,
101
80
  organizationSlug: cli.organizationSlug,
@@ -104,9 +83,6 @@ function merge(cli, env) {
104
83
  version: cli.version === true,
105
84
  unknownArgs: cli.unknownArgs
106
85
  };
107
- if (cli.scopes) merged.addScopes = cli.addScopes;
108
- if (cli.addScopes) merged.scopes = cli.scopes;
109
- return merged;
110
86
  }
111
87
 
112
88
  //#endregion
@@ -128,4 +104,4 @@ Object.defineProperty(exports, 'parseEnv', {
128
104
  return parseEnv;
129
105
  }
130
106
  });
131
- //# sourceMappingURL=parse-By6nDBNs.cjs.map
107
+ //# sourceMappingURL=parse-BjIH83SX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-BjIH83SX.cjs","names":["argv: string[]","unknownArgs: string[]","env: NodeJS.ProcessEnv","fromEnv: EnvArgs","cli: CliArgs","env: EnvArgs"],"sources":["../src/cli/parse.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport type { CliArgs, EnvArgs, MergedArgs } from \"./types\";\n\nexport function parseArgv(argv: string[]): CliArgs {\n const options = {\n \"access-token\": { type: \"string\" as const },\n host: { type: \"string\" as const },\n url: { type: \"string\" as const },\n \"mcp-url\": { type: \"string\" as const },\n \"sentry-dsn\": { type: \"string\" as const },\n \"openai-base-url\": { type: \"string\" as const },\n \"openai-model\": { type: \"string\" as const },\n \"organization-slug\": { type: \"string\" as const },\n \"project-slug\": { type: \"string\" as const },\n skills: { type: \"string\" as const },\n agent: { type: \"boolean\" as const },\n help: { type: \"boolean\" as const, short: \"h\" as const },\n version: { type: \"boolean\" as const, short: \"v\" as const },\n };\n\n const { values, positionals, tokens } = parseArgs({\n args: argv,\n options,\n allowPositionals: false,\n strict: false,\n tokens: true,\n });\n\n const knownLong = new Set(Object.keys(options));\n const knownShort = new Set([\n ...(Object.values(options)\n .map((o) => (\"short\" in o ? (o.short as string | undefined) : undefined))\n .filter(Boolean) as string[]),\n ]);\n\n const unknownArgs: string[] = [];\n for (const t of (tokens as any[]) || []) {\n if (t.kind === \"option\") {\n const name = t.name as string | undefined;\n if (name && !(knownLong.has(name) || knownShort.has(name))) {\n unknownArgs.push((t.raw as string) ?? `--${name}`);\n }\n } else if (t.kind === \"positional\") {\n unknownArgs.push((t.raw as string) ?? String(t.value ?? \"\"));\n }\n }\n\n return {\n accessToken: values[\"access-token\"] as string | undefined,\n host: values.host as string | undefined,\n url: values.url as string | undefined,\n mcpUrl: values[\"mcp-url\"] as string | undefined,\n sentryDsn: values[\"sentry-dsn\"] as string | undefined,\n openaiBaseUrl: values[\"openai-base-url\"] as string | undefined,\n openaiModel: values[\"openai-model\"] as string | undefined,\n organizationSlug: values[\"organization-slug\"] as string | undefined,\n projectSlug: values[\"project-slug\"] as string | undefined,\n skills: values.skills as string | undefined,\n agent: (values.agent as boolean | undefined) === true,\n help: (values.help as boolean | undefined) === true,\n version: (values.version as boolean | undefined) === true,\n unknownArgs:\n unknownArgs.length > 0 ? unknownArgs : (positionals as string[]) || [],\n };\n}\n\nexport function parseEnv(env: NodeJS.ProcessEnv): EnvArgs {\n const fromEnv: EnvArgs = {};\n if (env.SENTRY_ACCESS_TOKEN) fromEnv.accessToken = env.SENTRY_ACCESS_TOKEN;\n if (env.SENTRY_URL) fromEnv.url = env.SENTRY_URL;\n if (env.SENTRY_HOST) fromEnv.host = env.SENTRY_HOST;\n if (env.MCP_URL) fromEnv.mcpUrl = env.MCP_URL;\n if (env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN)\n fromEnv.sentryDsn = env.SENTRY_DSN || env.DEFAULT_SENTRY_DSN;\n\n if (env.OPENAI_MODEL) fromEnv.openaiModel = env.OPENAI_MODEL;\n if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;\n return fromEnv;\n}\n\nexport function merge(cli: CliArgs, env: EnvArgs): MergedArgs {\n // CLI wins over env\n return {\n accessToken: cli.accessToken ?? env.accessToken,\n // If CLI provided url/host, prefer those; else fall back to env\n url: cli.url ?? env.url,\n host: cli.host ?? env.host,\n mcpUrl: cli.mcpUrl ?? env.mcpUrl,\n sentryDsn: cli.sentryDsn ?? env.sentryDsn,\n openaiBaseUrl: cli.openaiBaseUrl,\n openaiModel: cli.openaiModel ?? env.openaiModel,\n // Skills precedence: CLI skills override env\n skills: cli.skills ?? env.skills,\n agent: cli.agent === true,\n organizationSlug: cli.organizationSlug,\n projectSlug: cli.projectSlug,\n help: cli.help === true,\n version: cli.version === true,\n unknownArgs: cli.unknownArgs,\n };\n}\n"],"mappings":";;;;AAGA,SAAgB,UAAUA,MAAyB;CACjD,MAAM,UAAU;EACd,gBAAgB,EAAE,MAAM,SAAmB;EAC3C,MAAM,EAAE,MAAM,SAAmB;EACjC,KAAK,EAAE,MAAM,SAAmB;EAChC,WAAW,EAAE,MAAM,SAAmB;EACtC,cAAc,EAAE,MAAM,SAAmB;EACzC,mBAAmB,EAAE,MAAM,SAAmB;EAC9C,gBAAgB,EAAE,MAAM,SAAmB;EAC3C,qBAAqB,EAAE,MAAM,SAAmB;EAChD,gBAAgB,EAAE,MA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AAQ,MAAM,IAAI;AACtC,KAAI,IAAI,YAAa,SAAQ,OAAO,IAAI;AACxC,KAAI,IAAI,QAAS,SAAQ,SAAS,IAAI;AACtC,KAAI,IAAI,cAAc,IAAI,mBACxB,SAAQ,YAAY,IAAI,cAAc,IAAI;AAE5C,KAAI,IAAI,aAAc,SAAQ,cAAc,IAAI;AAChD,KAAI,IAAI,WAAY,SAAQ,SAAS,IAAI;AACzC,QAAO;AACR;AAED,SAAgB,MAAMC,KAAcC,KAA0B;AAE5D,QAAO;EACL,aAAa,IAAI,eAAe,IAAI;EAEpC,KAAK,IAAI,OAAO,IAAI;EACpB,MAAM,IAAI,QAAQ,IAAI;EACtB,QAAQ,IAAI,UAAU,IAAI;EAC1B,WAAW,IAAI,aAAa,IAAI;EAChC,eAAe,IAAI;EACnB,aAAa,IAAI,eAAe,IAAI;EAEpC,QAAQ,IAAI,UAAU,IAAI;EAC1B,OAAO,IAAI,UAAU;EACrB,kBAAkB,IAAI;EACtB,aAAa,IAAI;EACjB,MAAM,IAAI,SAAS;EACnB,SAAS,IAAI,YAAY;EACzB,aAAa,IAAI;CAClB;AACF"}
@@ -0,0 +1,286 @@
1
+
2
+ //#region ../mcp-core/dist/skills-DEPBbN1h.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 isEnabledBySkills(grantedSkills, toolSkills) {
47
+ if (!grantedSkills || toolSkills.length === 0) return false;
48
+ return toolSkills.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/url-utils-hSW2gkfr.js
73
+ /**
74
+ * Determines if a Sentry instance is SaaS or self-hosted based on the host.
75
+ * @param host The Sentry host (e.g., "sentry.io" or "sentry.company.com")
76
+ * @returns true if SaaS instance, false if self-hosted
77
+ */
78
+ function isSentryHost(host) {
79
+ return host === "sentry.io" || host.endsWith(".sentry.io");
80
+ }
81
+ /**
82
+ * Generates a Sentry issue URL.
83
+ * @param host The Sentry host (may include regional subdomain for API access)
84
+ * @param organizationSlug Organization identifier
85
+ * @param issueId Issue identifier (e.g., "PROJECT-123")
86
+ * @returns The complete issue URL
87
+ */
88
+ function getIssueUrl(host, organizationSlug, issueId) {
89
+ const isSaas = isSentryHost(host);
90
+ const webHost = isSaas ? "sentry.io" : host;
91
+ return isSaas ? `https://${organizationSlug}.${webHost}/issues/${issueId}` : `https://${host}/organizations/${organizationSlug}/issues/${issueId}`;
92
+ }
93
+ /**
94
+ * Generates a Sentry issues search URL.
95
+ * @param host The Sentry host (may include regional subdomain for API access)
96
+ * @param organizationSlug Organization identifier
97
+ * @param query Optional search query
98
+ * @param projectSlugOrId Optional project slug or ID
99
+ * @returns The complete issues search URL
100
+ */
101
+ function getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId) {
102
+ const isSaas = isSentryHost(host);
103
+ const webHost = isSaas ? "sentry.io" : host;
104
+ let url = isSaas ? `https://${organizationSlug}.${webHost}/issues/` : `https://${host}/organizations/${organizationSlug}/issues/`;
105
+ const params = new URLSearchParams();
106
+ if (projectSlugOrId) params.append("project", projectSlugOrId);
107
+ if (query) params.append("query", query);
108
+ const queryString = params.toString();
109
+ if (queryString) url += `?${queryString}`;
110
+ return url;
111
+ }
112
+ /**
113
+ * Generates a Sentry trace URL for performance investigation.
114
+ * @param host The Sentry host (may include regional subdomain for API access)
115
+ * @param organizationSlug Organization identifier
116
+ * @param traceId Trace identifier
117
+ * @returns The complete trace URL
118
+ */
119
+ function getTraceUrl(host, organizationSlug, traceId) {
120
+ const isSaas = isSentryHost(host);
121
+ const webHost = isSaas ? "sentry.io" : host;
122
+ return isSaas ? `https://${organizationSlug}.${webHost}/explore/traces/trace/${traceId}` : `https://${host}/organizations/${organizationSlug}/explore/traces/trace/${traceId}`;
123
+ }
124
+ /**
125
+ * Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).
126
+ * Throws an error if validation fails instead of exiting the process.
127
+ *
128
+ * @param host The hostname to validate
129
+ * @throws {Error} If the host contains a protocol
130
+ */
131
+ function _validateSentryHostInternal(host) {
132
+ 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.");
133
+ }
134
+ /**
135
+ * Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
136
+ * Throws an error if validation fails instead of exiting the process.
137
+ *
138
+ * @param url The HTTPS URL to validate and parse
139
+ * @returns The extracted hostname from the URL
140
+ * @throws {Error} If the URL is invalid or not HTTPS
141
+ */
142
+ function _validateAndParseSentryUrlInternal(url) {
143
+ if (!url.startsWith("https://")) throw new Error("SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).");
144
+ try {
145
+ const parsedUrl = new URL(url);
146
+ return parsedUrl.host;
147
+ } catch (error) {
148
+ throw new Error("SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).");
149
+ }
150
+ }
151
+ /**
152
+ * Validates that a SENTRY_HOST value contains only hostname (no protocol).
153
+ * Throws an error instead of exiting the process (for testing).
154
+ *
155
+ * @param host The hostname to validate
156
+ * @throws {Error} If the host contains a protocol
157
+ */
158
+ function validateSentryHostThrows(host) {
159
+ _validateSentryHostInternal(host);
160
+ }
161
+ /**
162
+ * Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
163
+ * Throws an error instead of exiting the process (for testing).
164
+ *
165
+ * @param url The HTTPS URL to validate and parse
166
+ * @returns The extracted hostname from the URL
167
+ * @throws {Error} If the URL is invalid or not HTTPS
168
+ */
169
+ function validateAndParseSentryUrlThrows(url) {
170
+ return _validateAndParseSentryUrlInternal(url);
171
+ }
172
+ /**
173
+ * Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.
174
+ *
175
+ * @param url The URL to validate and normalize
176
+ * @returns The normalized URL string
177
+ * @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol
178
+ */
179
+ function validateOpenAiBaseUrlThrows(url) {
180
+ const trimmed = url.trim();
181
+ if (trimmed.length === 0) throw new Error("OPENAI base URL must not be empty.");
182
+ let parsed;
183
+ try {
184
+ parsed = new URL(trimmed);
185
+ } catch (error) {
186
+ throw new Error("OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).", { cause: error });
187
+ }
188
+ 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).");
189
+ return parsed.toString();
190
+ }
191
+
192
+ //#endregion
193
+ //#region src/cli/resolve.ts
194
+ function formatInvalidSkills(invalid, envName) {
195
+ const where = envName ? `${envName} provided` : "Invalid skills provided";
196
+ const allSkills = Object.keys(SKILLS).join(", ");
197
+ return `Error: ${where}: ${invalid.join(", ")}\nAvailable skills: ${allSkills}`;
198
+ }
199
+ function finalize(input) {
200
+ if (!input.accessToken) throw new Error("Error: No access token was provided. Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.");
201
+ let sentryHost = "sentry.io";
202
+ if (input.url) sentryHost = validateAndParseSentryUrlThrows(input.url);
203
+ else if (input.host) {
204
+ validateSentryHostThrows(input.host);
205
+ sentryHost = input.host;
206
+ }
207
+ let finalSkills = void 0;
208
+ if (input.skills) {
209
+ const { valid, invalid } = parseSkills(input.skills);
210
+ if (invalid.length > 0) throw new Error(formatInvalidSkills(invalid));
211
+ if (valid.size === 0) throw new Error("Error: Invalid skills provided. No valid skills found.");
212
+ finalSkills = valid;
213
+ } else {
214
+ const allSkills = Object.keys(SKILLS);
215
+ finalSkills = new Set(allSkills);
216
+ }
217
+ const resolvedOpenAiBaseUrl = input.openaiBaseUrl ? validateOpenAiBaseUrlThrows(input.openaiBaseUrl) : void 0;
218
+ return {
219
+ accessToken: input.accessToken,
220
+ sentryHost,
221
+ mcpUrl: input.mcpUrl,
222
+ sentryDsn: input.sentryDsn,
223
+ openaiBaseUrl: resolvedOpenAiBaseUrl,
224
+ openaiModel: input.openaiModel,
225
+ finalSkills,
226
+ organizationSlug: input.organizationSlug,
227
+ projectSlug: input.projectSlug
228
+ };
229
+ }
230
+
231
+ //#endregion
232
+ Object.defineProperty(exports, 'ALL_SKILLS', {
233
+ enumerable: true,
234
+ get: function () {
235
+ return ALL_SKILLS;
236
+ }
237
+ });
238
+ Object.defineProperty(exports, 'SKILLS', {
239
+ enumerable: true,
240
+ get: function () {
241
+ return SKILLS;
242
+ }
243
+ });
244
+ Object.defineProperty(exports, 'finalize', {
245
+ enumerable: true,
246
+ get: function () {
247
+ return finalize;
248
+ }
249
+ });
250
+ Object.defineProperty(exports, 'formatInvalidSkills', {
251
+ enumerable: true,
252
+ get: function () {
253
+ return formatInvalidSkills;
254
+ }
255
+ });
256
+ Object.defineProperty(exports, 'getIssueUrl', {
257
+ enumerable: true,
258
+ get: function () {
259
+ return getIssueUrl;
260
+ }
261
+ });
262
+ Object.defineProperty(exports, 'getIssuesSearchUrl', {
263
+ enumerable: true,
264
+ get: function () {
265
+ return getIssuesSearchUrl;
266
+ }
267
+ });
268
+ Object.defineProperty(exports, 'getTraceUrl', {
269
+ enumerable: true,
270
+ get: function () {
271
+ return getTraceUrl;
272
+ }
273
+ });
274
+ Object.defineProperty(exports, 'isEnabledBySkills', {
275
+ enumerable: true,
276
+ get: function () {
277
+ return isEnabledBySkills;
278
+ }
279
+ });
280
+ Object.defineProperty(exports, 'isSentryHost', {
281
+ enumerable: true,
282
+ get: function () {
283
+ return isSentryHost;
284
+ }
285
+ });
286
+ //# sourceMappingURL=resolve-CdTP9riu.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-CdTP9riu.cjs","names":["invalid: string[]","envName?: string","input: MergedArgs","finalSkills: Set<Skill> | undefined"],"sources":["../../mcp-core/dist/skills-DEPBbN1h.js","../../mcp-core/dist/url-utils-hSW2gkfr.js","../src/cli/resolve.ts"],"sourcesContent":["//#region src/skills.ts\nconst SKILLS = {\n\tinspect: {\n\t\tid: \"inspect\",\n\t\tname: \"Inspect Issues & Events\",\n\t\tdescription: \"Search for errors, analyze traces, and explore event details\",\n\t\tdefaultEnabled: true,\n\t\torder: 1\n\t},\n\tseer: {\n\t\tid: \"seer\",\n\t\tname: \"Seer\",\n\t\tdescription: \"Sentry's AI debugger that helps you analyze, root cause, and fix issues\",\n\t\tdefaultEnabled: true,\n\t\torder: 2\n\t},\n\tdocs: {\n\t\tid: \"docs\",\n\t\tname: \"Documentation\",\n\t\tdescription: \"Search and read Sentry SDK documentation\",\n\t\tdefaultEnabled: false,\n\t\torder: 3\n\t},\n\ttriage: {\n\t\tid: \"triage\",\n\t\tname: \"Triage Issues\",\n\t\tdescription: \"Resolve, assign, and update issues\",\n\t\tdefaultEnabled: false,\n\t\torder: 4\n\t},\n\t\"project-management\": {\n\t\tid: \"project-management\",\n\t\tname: \"Manage Projects & Teams\",\n\t\tdescription: \"Create and modify projects, teams, and DSNs\",\n\t\tdefaultEnabled: false,\n\t\torder: 5\n\t}\n};\nconst SKILLS_ARRAY = Object.values(SKILLS).sort((a, b) => a.order - b.order);\nasync function getSkillsArrayWithCounts() {\n\tconst toolsModule = await import(\"./tools/index.js\");\n\tconst tools = toolsModule.default;\n\tconst counts = /* @__PURE__ */ new Map();\n\tfor (const skill of Object.keys(SKILLS)) counts.set(skill, 0);\n\tfor (const tool of Object.values(tools)) if (Array.isArray(tool.skills)) for (const skill of tool.skills) counts.set(skill, (counts.get(skill) || 0) + 1);\n\treturn SKILLS_ARRAY.map((skill) => ({\n\t\t...skill,\n\t\ttoolCount: counts.get(skill.id) || 0\n\t}));\n}\nconst ALL_SKILLS = Object.keys(SKILLS);\nconst DEFAULT_SKILLS = SKILLS_ARRAY.filter((s) => s.defaultEnabled).map((s) => s.id);\nfunction isValidSkill(skill) {\n\treturn skill in SKILLS;\n}\nfunction isEnabledBySkills(grantedSkills, toolSkills) {\n\tif (!grantedSkills || toolSkills.length === 0) return false;\n\treturn toolSkills.some((skill) => grantedSkills.has(skill));\n}\nfunction parseSkills(input) {\n\tconst valid = /* @__PURE__ */ new Set();\n\tconst invalid = [];\n\tif (!input) return {\n\t\tvalid,\n\t\tinvalid\n\t};\n\tlet skills = [];\n\tif (typeof input === \"string\") skills = input.split(\",\");\n\telse if (Array.isArray(input)) skills = input.map((v) => typeof v === \"string\" ? v : \"\");\n\tfor (const skill of skills) {\n\t\tconst trimmed = String(skill).trim();\n\t\tif (isValidSkill(trimmed)) valid.add(trimmed);\n\t\telse if (trimmed) invalid.push(trimmed);\n\t}\n\treturn {\n\t\tvalid,\n\t\tinvalid\n\t};\n}\nasync function getScopesForSkills(grantedSkills) {\n\tconst { DEFAULT_SCOPES } = await import(\"./constants.js\");\n\tconst toolsModule = await import(\"./tools/index.js\");\n\tconst tools = toolsModule.default;\n\tconst scopes = new Set(DEFAULT_SCOPES);\n\tfor (const tool of Object.values(tools)) {\n\t\tconst toolEnabled = tool.skills.some((skill) => grantedSkills.has(skill));\n\t\tif (toolEnabled) for (const scope of tool.requiredScopes) scopes.add(scope);\n\t}\n\treturn scopes;\n}\n\n//#endregion\nexport { ALL_SKILLS, DEFAULT_SKILLS, SKILLS, SKILLS_ARRAY, getScopesForSkills, getSkillsArrayWithCounts, isEnabledBySkills, isValidSkill, parseSkills };\n//# sourceMappingURL=skills-DEPBbN1h.js.map","//#region src/utils/url-utils.ts\n/**\n* Determines if a Sentry instance is SaaS or self-hosted based on the host.\n* @param host The Sentry host (e.g., \"sentry.io\" or \"sentry.company.com\")\n* @returns true if SaaS instance, false if self-hosted\n*/\nfunction isSentryHost(host) {\n\treturn host === \"sentry.io\" || host.endsWith(\".sentry.io\");\n}\n/**\n* Generates a Sentry issue URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param issueId Issue identifier (e.g., \"PROJECT-123\")\n* @returns The complete issue URL\n*/\nfunction getIssueUrl(host, organizationSlug, issueId) {\n\tconst isSaas = isSentryHost(host);\n\tconst webHost = isSaas ? \"sentry.io\" : host;\n\treturn isSaas ? `https://${organizationSlug}.${webHost}/issues/${issueId}` : `https://${host}/organizations/${organizationSlug}/issues/${issueId}`;\n}\n/**\n* Generates a Sentry issues search URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param query Optional search query\n* @param projectSlugOrId Optional project slug or ID\n* @returns The complete issues search URL\n*/\nfunction getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId) {\n\tconst isSaas = isSentryHost(host);\n\tconst webHost = isSaas ? \"sentry.io\" : host;\n\tlet url = isSaas ? `https://${organizationSlug}.${webHost}/issues/` : `https://${host}/organizations/${organizationSlug}/issues/`;\n\tconst params = new URLSearchParams();\n\tif (projectSlugOrId) params.append(\"project\", projectSlugOrId);\n\tif (query) params.append(\"query\", query);\n\tconst queryString = params.toString();\n\tif (queryString) url += `?${queryString}`;\n\treturn url;\n}\n/**\n* Generates a Sentry trace URL for performance investigation.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param traceId Trace identifier\n* @returns The complete trace URL\n*/\nfunction getTraceUrl(host, organizationSlug, traceId) {\n\tconst isSaas = isSentryHost(host);\n\tconst webHost = isSaas ? \"sentry.io\" : host;\n\treturn isSaas ? `https://${organizationSlug}.${webHost}/explore/traces/trace/${traceId}` : `https://${host}/organizations/${organizationSlug}/explore/traces/trace/${traceId}`;\n}\n/**\n* Generates a Sentry events explorer URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param query Search query\n* @param dataset Dataset type\n* @param projectSlug Optional project slug\n* @param fields Optional fields to display\n* @returns The complete events explorer URL\n*/\nfunction getEventsExplorerUrl(host, organizationSlug, query, dataset = \"spans\", projectSlug, fields) {\n\tconst isSaas = isSentryHost(host);\n\tconst webHost = isSaas ? \"sentry.io\" : host;\n\tlet url = isSaas ? `https://${organizationSlug}.${webHost}/explore/` : `https://${host}/organizations/${organizationSlug}/explore/`;\n\tconst params = new URLSearchParams();\n\tparams.append(\"query\", query);\n\tparams.append(\"dataset\", dataset);\n\tparams.append(\"layout\", \"table\");\n\tif (projectSlug) params.append(\"project\", projectSlug);\n\tif (fields && fields.length > 0) for (const field of fields) params.append(\"field\", field);\n\turl += `?${params.toString()}`;\n\treturn url;\n}\n/**\n* Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).\n* Throws an error if validation fails instead of exiting the process.\n*\n* @param host The hostname to validate\n* @throws {Error} If the host contains a protocol\n*/\nfunction _validateSentryHostInternal(host) {\n\tif (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.\");\n}\n/**\n* Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Throws an error if validation fails instead of exiting the process.\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n* @throws {Error} If the URL is invalid or not HTTPS\n*/\nfunction _validateAndParseSentryUrlInternal(url) {\n\tif (!url.startsWith(\"https://\")) throw new Error(\"SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).\");\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.host;\n\t} catch (error) {\n\t\tthrow new Error(\"SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).\");\n\t}\n}\n/**\n* Validates that a SENTRY_HOST value contains only hostname (no protocol).\n* Exits the process with error code 1 if validation fails (CLI behavior).\n*\n* @param host The hostname to validate\n*/\nfunction validateSentryHost(host) {\n\ttry {\n\t\t_validateSentryHostInternal(host);\n\t} catch (error) {\n\t\tconsole.error(`Error: ${error.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n/**\n* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Exits the process with error code 1 if validation fails (CLI behavior).\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n*/\nfunction validateAndParseSentryUrl(url) {\n\ttry {\n\t\treturn _validateAndParseSentryUrlInternal(url);\n\t} catch (error) {\n\t\tconsole.error(`Error: ${error.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n/**\n* Validates that a SENTRY_HOST value contains only hostname (no protocol).\n* Throws an error instead of exiting the process (for testing).\n*\n* @param host The hostname to validate\n* @throws {Error} If the host contains a protocol\n*/\nfunction validateSentryHostThrows(host) {\n\t_validateSentryHostInternal(host);\n}\n/**\n* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Throws an error instead of exiting the process (for testing).\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n* @throws {Error} If the URL is invalid or not HTTPS\n*/\nfunction validateAndParseSentryUrlThrows(url) {\n\treturn _validateAndParseSentryUrlInternal(url);\n}\n/**\n* Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.\n*\n* @param url The URL to validate and normalize\n* @returns The normalized URL string\n* @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol\n*/\nfunction validateOpenAiBaseUrlThrows(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw new Error(\"OPENAI base URL must not be empty.\");\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(trimmed);\n\t} catch (error) {\n\t\tthrow new Error(\"OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).\", { cause: error });\n\t}\n\tif (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") throw new Error(\"OPENAI base URL must use http or https scheme (e.g., https://example.com/v1).\");\n\treturn parsed.toString();\n}\n\n//#endregion\nexport { getEventsExplorerUrl, getIssueUrl, getIssuesSearchUrl, getTraceUrl, isSentryHost, validateAndParseSentryUrl, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHost, validateSentryHostThrows };\n//# sourceMappingURL=url-utils-hSW2gkfr.js.map","import { parseSkills, SKILLS, type Skill } from \"@sentry/mcp-core/skills\";\nimport {\n validateAndParseSentryUrlThrows,\n validateOpenAiBaseUrlThrows,\n validateSentryHostThrows,\n} from \"@sentry/mcp-core/utils/url-utils\";\nimport type { MergedArgs, ResolvedConfig } from \"./types\";\n\nexport function formatInvalidSkills(\n invalid: string[],\n envName?: string,\n): string {\n const where = envName ? `${envName} provided` : \"Invalid skills provided\";\n const allSkills = Object.keys(SKILLS).join(\", \");\n return `Error: ${where}: ${invalid.join(\", \")}\\nAvailable skills: ${allSkills}`;\n}\n\nexport function finalize(input: MergedArgs): ResolvedConfig {\n // Access token required\n if (!input.accessToken) {\n throw new Error(\n \"Error: No access token was provided. Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.\",\n );\n }\n\n // Determine host from url/host with validation\n let sentryHost = \"sentry.io\";\n if (input.url) {\n sentryHost = validateAndParseSentryUrlThrows(input.url);\n } else if (input.host) {\n validateSentryHostThrows(input.host);\n sentryHost = input.host;\n }\n\n // Skills resolution\n //\n // IMPORTANT: stdio (CLI) intentionally defaults to ALL skills when no --skills flag is provided\n //\n // This differs from the OAuth flow, which requires explicit user selection:\n // - stdio/CLI: Non-interactive, defaults to ALL skills (inspect, docs, seer, triage, project-management)\n // - OAuth: Interactive, requires user to explicitly select skills (with sensible defaults pre-checked)\n //\n // Rationale:\n // We don't want the MCP to break if users don't specify skills. stdio is typically used in\n // local development and CI/CD environments where maximum access by default is expected.\n // OAuth is used in multi-tenant hosted environments where users should consciously grant\n // permissions on a per-app basis.\n //\n // For OAuth validation that enforces minimum 1 skill selection, see:\n // packages/mcp-cloudflare/src/server/oauth/routes/callback.ts (lines 234-248)\n //\n let finalSkills: Set<Skill> | undefined = undefined;\n if (input.skills) {\n // Override: use only the specified skills\n const { valid, invalid } = parseSkills(input.skills);\n if (invalid.length > 0) {\n throw new Error(formatInvalidSkills(invalid));\n }\n if (valid.size === 0) {\n throw new Error(\"Error: Invalid skills provided. No valid skills found.\");\n }\n finalSkills = valid;\n } else {\n // Default: grant ALL skills when no flag is provided (see comment block above for rationale)\n const allSkills = Object.keys(SKILLS) as Skill[];\n finalSkills = new Set<Skill>(allSkills);\n }\n\n const resolvedOpenAiBaseUrl = input.openaiBaseUrl\n ? validateOpenAiBaseUrlThrows(input.openaiBaseUrl)\n : undefined;\n\n return {\n accessToken: input.accessToken,\n sentryHost,\n mcpUrl: input.mcpUrl,\n sentryDsn: input.sentryDsn,\n openaiBaseUrl: resolvedOpenAiBaseUrl,\n openaiModel: input.openaiModel,\n finalSkills,\n organizationSlug: input.organizationSlug,\n projectSlug: input.projectSlug,\n };\n}\n"],"mappings":";;AACA,MAAM,SAAS;CACd,SAAS;EACR,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;CACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;CACP;CACD,MAAM;EACL,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;CACP;CACD,QAAQ;EACP,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;CACP;CACD,sBAAsB;EACrB,IAAI;EACJ,MAAM;EACN,aAAa;EACb,gBAAgB;EAChB,OAAO;CACP;AACD;AACD,MAAM,eAAe,OAAO,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;AAY5E,MAAM,aAAa,OAAO,KAAK,OAAO;AACtC,MAAM,iBAAiB,aAAa,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG;AACpF,SAAS,aAAa,OAAO;AAC5B,QAAO,SAAS;AAChB;AACD,SAAS,kBAAkB,eAAe,YAAY;AACrD,MAAK,iBAAiB,WAAW,WAAW,EAAG,QAAO;AACtD,QAAO,WAAW,KAAK,CAAC,UAAU,cAAc,IAAI,MAAM,CAAC;AAC3D;AACD,SAAS,YAAY,OAAO;CAC3B,MAAM,wBAAwB,IAAI;CAClC,MAAM,UAAU,CAAE;AAClB,MAAK,MAAO,QAAO;EAClB;EACA;CACA;CACD,IAAI,SAAS,CAAE;AACf,YAAW,UAAU,SAAU,UAAS,MAAM,MAAM,IAAI;UAC/C,MAAM,QAAQ,MAAM,CAAE,UAAS,MAAM,IAAI,CAAC,aAAa,MAAM,WAAW,IAAI,GAAG;AACxF,MAAK,MAAM,SAA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