@sentry/mcp-server 0.31.0 → 0.33.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/auth/constants.cjs +1 -1
- package/dist/auth/constants.js +1 -1
- package/dist/auth/device-code-flow.cjs +4 -4
- package/dist/auth/device-code-flow.d.cts +1 -1
- package/dist/auth/device-code-flow.d.cts.map +1 -1
- package/dist/auth/device-code-flow.d.ts +1 -1
- package/dist/auth/device-code-flow.d.ts.map +1 -1
- package/dist/auth/device-code-flow.js +4 -4
- package/dist/auth/resolve-token.cjs +5 -5
- package/dist/auth/resolve-token.d.cts +1 -1
- package/dist/auth/resolve-token.d.ts +1 -1
- package/dist/auth/resolve-token.js +5 -5
- package/dist/auth/token-cache.d.cts +1 -1
- package/dist/auth/token-cache.d.ts +1 -1
- package/dist/auth/types.cjs +2 -1
- package/dist/auth/types.d.cts +2 -2
- package/dist/auth/types.d.ts +2 -2
- package/dist/auth/types.js +2 -2
- package/dist/{auth-BIb4PBnL.js → auth-BJo6H1uD.js} +6 -6
- package/dist/{auth-BIb4PBnL.js.map → auth-BJo6H1uD.js.map} +1 -1
- package/dist/{auth-BK5LL8QY.cjs → auth-UwueZrbT.cjs} +6 -6
- package/dist/{auth-BK5LL8QY.cjs.map → auth-UwueZrbT.cjs.map} +1 -1
- package/dist/cli/commands/auth.cjs +7 -7
- package/dist/cli/commands/auth.js +7 -7
- 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 +2 -2
- package/dist/cli/resolve.d.cts +1 -1
- package/dist/cli/resolve.d.cts.map +1 -1
- package/dist/cli/resolve.d.ts +1 -1
- 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.js +1 -1
- package/dist/{config-BYPjNBPX-Bqwc8iZW.cjs → config-CSIYxVpS-ClZCOpEv.cjs} +287 -14
- package/dist/config-CSIYxVpS-ClZCOpEv.cjs.map +1 -0
- package/dist/{config-BYPjNBPX-7d8TAxBc.js → config-CSIYxVpS-cfJbXQHs.js} +282 -15
- package/dist/config-CSIYxVpS-cfJbXQHs.js.map +1 -0
- package/dist/config-gtQq2u0M.cjs +7 -0
- package/dist/config-k-CwrU2A.js +3 -0
- package/dist/constants-DjY87Pdc.js +367 -0
- package/dist/constants-DjY87Pdc.js.map +1 -0
- package/dist/constants-wVeitIuo.cjs +517 -0
- package/dist/constants-wVeitIuo.cjs.map +1 -0
- package/dist/{device-code-flow-DmgeS5QN.js → device-code-flow-BJxgQqnk.js} +5 -5
- package/dist/device-code-flow-BJxgQqnk.js.map +1 -0
- package/dist/{device-code-flow-CpGZ3Eqv.cjs → device-code-flow-BMOB5yEt.cjs} +5 -5
- package/dist/device-code-flow-BMOB5yEt.cjs.map +1 -0
- package/dist/index.cjs +4252 -2127
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4247 -2122
- package/dist/index.js.map +1 -1
- package/dist/{parse-BC0czE2L.js → parse-B7klESpr.js} +4 -1
- package/dist/parse-B7klESpr.js.map +1 -0
- package/dist/{parse-CBlXTQfk.cjs → parse-BR-mFmYz.cjs} +4 -1
- package/dist/parse-BR-mFmYz.cjs.map +1 -0
- package/dist/{resolve-D0W2gbu8.js → resolve-BrniID8M.js} +7 -3
- package/dist/resolve-BrniID8M.js.map +1 -0
- package/dist/{resolve-BfYJ9Cqy.cjs → resolve-C24qYHAk.cjs} +7 -3
- package/dist/resolve-C24qYHAk.cjs.map +1 -0
- package/dist/{resolve-token-C2eTEtoo.cjs → resolve-token-ZTTdPX3U.cjs} +4 -4
- package/dist/{resolve-token-C2eTEtoo.cjs.map → resolve-token-ZTTdPX3U.cjs.map} +1 -1
- package/dist/{resolve-token-pfPBO9EK.js → resolve-token-xrdqUeT7.js} +4 -4
- package/dist/{resolve-token-pfPBO9EK.js.map → resolve-token-xrdqUeT7.js.map} +1 -1
- package/dist/{stdio-B08zZS4X.cjs → stdio-CMTtwTjK.cjs} +2 -2
- package/dist/{stdio-B08zZS4X.cjs.map → stdio-CMTtwTjK.cjs.map} +1 -1
- package/dist/{stdio-CUhyR_jH.js → stdio-CrPIATQh.js} +2 -2
- package/dist/{stdio-CUhyR_jH.js.map → stdio-CrPIATQh.js.map} +1 -1
- package/dist/transports/stdio.cjs +2 -2
- package/dist/transports/stdio.d.cts +1 -1
- package/dist/transports/stdio.js +2 -2
- package/dist/{types-rlmLVpNO.d.cts → types-BHd78Leq.d.cts} +6 -2
- package/dist/types-BHd78Leq.d.cts.map +1 -0
- package/dist/{types-ClEPUb_D.d.cts → types-BJpeKPWI.d.cts} +8 -7
- package/dist/types-BJpeKPWI.d.cts.map +1 -0
- package/dist/{types-C8FoyqMN.js → types-C336ZSwF.js} +7 -4
- package/dist/types-C336ZSwF.js.map +1 -0
- package/dist/{types-BN426G4g.d.ts → types-DDkgkRP9.d.ts} +8 -7
- package/dist/types-DDkgkRP9.d.ts.map +1 -0
- package/dist/{types-CX4uOY82.d.ts → types-DEixQGjv.d.ts} +6 -2
- package/dist/types-DEixQGjv.d.ts.map +1 -0
- package/dist/{types-xUmfecYm.cjs → types-DViCeKUc.cjs} +12 -3
- package/dist/types-DViCeKUc.cjs.map +1 -0
- package/dist/{usage-DRK6TiDr.cjs → usage-5IJewEUC.cjs} +7 -4
- package/dist/usage-5IJewEUC.cjs.map +1 -0
- package/dist/{usage-DB-MGezA.js → usage-CJXm-LBM.js} +7 -4
- package/dist/usage-CJXm-LBM.js.map +1 -0
- package/dist/version-C-VwoRFq.js +7 -0
- package/dist/version-C-VwoRFq.js.map +1 -0
- package/dist/{version-Ca7qUBih.cjs → version-CG1gvrBK.cjs} +3 -3
- package/dist/version-CG1gvrBK.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/config--FiEKpQR.js +0 -3
- package/dist/config-BYPjNBPX-7d8TAxBc.js.map +0 -1
- package/dist/config-BYPjNBPX-Bqwc8iZW.cjs.map +0 -1
- package/dist/config-DU03TDiU.cjs +0 -7
- package/dist/constants-Ciwj7kb9.js +0 -153
- package/dist/constants-Ciwj7kb9.js.map +0 -1
- package/dist/constants-DmV1Benp.cjs +0 -231
- package/dist/constants-DmV1Benp.cjs.map +0 -1
- package/dist/device-code-flow-CpGZ3Eqv.cjs.map +0 -1
- package/dist/device-code-flow-DmgeS5QN.js.map +0 -1
- package/dist/parse-BC0czE2L.js.map +0 -1
- package/dist/parse-CBlXTQfk.cjs.map +0 -1
- package/dist/resolve-BfYJ9Cqy.cjs.map +0 -1
- package/dist/resolve-D0W2gbu8.js.map +0 -1
- package/dist/types-BN426G4g.d.ts.map +0 -1
- package/dist/types-C8FoyqMN.js.map +0 -1
- package/dist/types-CX4uOY82.d.ts.map +0 -1
- package/dist/types-ClEPUb_D.d.cts.map +0 -1
- package/dist/types-rlmLVpNO.d.cts.map +0 -1
- package/dist/types-xUmfecYm.cjs.map +0 -1
- package/dist/usage-DB-MGezA.js.map +0 -1
- package/dist/usage-DRK6TiDr.cjs.map +0 -1
- package/dist/version-CYYpU4RZ.js +0 -7
- package/dist/version-CYYpU4RZ.js.map +0 -1
- package/dist/version-Ca7qUBih.cjs.map +0 -1
|
@@ -5,6 +5,7 @@ function parseArgv(argv) {
|
|
|
5
5
|
const options = {
|
|
6
6
|
"access-token": { type: "string" },
|
|
7
7
|
host: { type: "string" },
|
|
8
|
+
"insecure-http": { type: "boolean" },
|
|
8
9
|
url: { type: "string" },
|
|
9
10
|
"mcp-url": { type: "string" },
|
|
10
11
|
"sentry-dsn": { type: "string" },
|
|
@@ -45,6 +46,7 @@ function parseArgv(argv) {
|
|
|
45
46
|
return {
|
|
46
47
|
accessToken: values["access-token"],
|
|
47
48
|
host: values.host,
|
|
49
|
+
insecureHttp: values["insecure-http"] === true,
|
|
48
50
|
url: values.url,
|
|
49
51
|
mcpUrl: values["mcp-url"],
|
|
50
52
|
sentryDsn: values["sentry-dsn"],
|
|
@@ -84,6 +86,7 @@ function merge(cli, env) {
|
|
|
84
86
|
accessToken: cli.accessToken ?? env.accessToken,
|
|
85
87
|
url: cli.url ?? env.url,
|
|
86
88
|
host: cli.host ?? env.host,
|
|
89
|
+
insecureHttp: cli.insecureHttp === true,
|
|
87
90
|
mcpUrl: cli.mcpUrl ?? env.mcpUrl,
|
|
88
91
|
sentryDsn: cli.sentryDsn ?? env.sentryDsn,
|
|
89
92
|
openaiBaseUrl: cli.openaiBaseUrl,
|
|
@@ -106,4 +109,4 @@ function merge(cli, env) {
|
|
|
106
109
|
|
|
107
110
|
//#endregion
|
|
108
111
|
export { merge, parseArgv, parseEnv };
|
|
109
|
-
//# sourceMappingURL=parse-
|
|
112
|
+
//# sourceMappingURL=parse-B7klESpr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-B7klESpr.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 \"insecure-http\": { type: \"boolean\" 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 \"anthropic-base-url\": { type: \"string\" as const },\n \"anthropic-model\": { type: \"string\" as const },\n \"agent-provider\": { 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 \"disable-skills\": { type: \"string\" as const },\n agent: { type: \"boolean\" as const },\n experimental: { 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 insecureHttp: values[\"insecure-http\"] === true,\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 anthropicBaseUrl: values[\"anthropic-base-url\"] as string | undefined,\n anthropicModel: values[\"anthropic-model\"] as string | undefined,\n agentProvider: values[\"agent-provider\"] 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 disableSkills: values[\"disable-skills\"] as string | undefined,\n agent: values.agent === true,\n experimental: values.experimental === 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.ANTHROPIC_MODEL) fromEnv.anthropicModel = env.ANTHROPIC_MODEL;\n if (env.EMBEDDED_AGENT_PROVIDER)\n fromEnv.agentProvider = env.EMBEDDED_AGENT_PROVIDER;\n if (env.SENTRY_CLIENT_ID) fromEnv.clientId = env.SENTRY_CLIENT_ID;\n if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;\n if (env.MCP_DISABLE_SKILLS) fromEnv.disableSkills = env.MCP_DISABLE_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 insecureHttp: cli.insecureHttp === true,\n mcpUrl: cli.mcpUrl ?? env.mcpUrl,\n sentryDsn: cli.sentryDsn ?? env.sentryDsn,\n openaiBaseUrl: cli.openaiBaseUrl,\n openaiModel: cli.openaiModel ?? env.openaiModel,\n anthropicBaseUrl: cli.anthropicBaseUrl,\n anthropicModel: cli.anthropicModel ?? env.anthropicModel,\n agentProvider: cli.agentProvider ?? env.agentProvider,\n clientId: env.clientId,\n // Skills precedence: CLI skills override env\n skills: cli.skills ?? env.skills,\n disableSkills: cli.disableSkills ?? env.disableSkills,\n agent: cli.agent === true,\n experimental: cli.experimental === true,\n organizationSlug: cli.organizationSlug,\n projectSlug: cli.projectSlug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A0B;AAE5D,QAAO;EACL,aAAa,IAAI,eAAe,IAAI;EAEpC,KAAK,IAAI,OAAO,IAAI;EACpB,MAAM,IAAI,QAAQ,IAAI;EACtB,cAAc,IAAI,iBAAiB;EACnC,QAAQ,IAAI,UAAU,IAAI;EAC1B,WAAW,IAAI,aAAa,IAAI;EAChC,eAAe,IAAI;EACnB,aAAa,IAAI,eAAe,IAAI;EACpC,kBAAkB,IAAI;EACtB,gBAAgB,IAAI,kBAAkB,IAAI;EAC1C,eAAe,IAAI,iBAAiB,IAAI;EACxC,UAAU,IAAI;EAEd,QAAQ,IAAI,UAAU,IAAI;EAC1B,eAAe,IAAI,iBAAiB,IAAI;EACxC,OAAO,IAAI,UAAU;EACrB,cAAc,IAAI,iBAAiB;EACnC,kBAAkB,IAAI;EACtB,aAAa,IAAI;EACjB,MAAM,IAAI,SAAS;EACnB,SAAS,IAAI,YAAY;EACzB,aAAa,IAAI;CAClB;AACF"}
|
|
@@ -6,6 +6,7 @@ function parseArgv(argv) {
|
|
|
6
6
|
const options = {
|
|
7
7
|
"access-token": { type: "string" },
|
|
8
8
|
host: { type: "string" },
|
|
9
|
+
"insecure-http": { type: "boolean" },
|
|
9
10
|
url: { type: "string" },
|
|
10
11
|
"mcp-url": { type: "string" },
|
|
11
12
|
"sentry-dsn": { type: "string" },
|
|
@@ -46,6 +47,7 @@ function parseArgv(argv) {
|
|
|
46
47
|
return {
|
|
47
48
|
accessToken: values["access-token"],
|
|
48
49
|
host: values.host,
|
|
50
|
+
insecureHttp: values["insecure-http"] === true,
|
|
49
51
|
url: values.url,
|
|
50
52
|
mcpUrl: values["mcp-url"],
|
|
51
53
|
sentryDsn: values["sentry-dsn"],
|
|
@@ -85,6 +87,7 @@ function merge(cli, env) {
|
|
|
85
87
|
accessToken: cli.accessToken ?? env.accessToken,
|
|
86
88
|
url: cli.url ?? env.url,
|
|
87
89
|
host: cli.host ?? env.host,
|
|
90
|
+
insecureHttp: cli.insecureHttp === true,
|
|
88
91
|
mcpUrl: cli.mcpUrl ?? env.mcpUrl,
|
|
89
92
|
sentryDsn: cli.sentryDsn ?? env.sentryDsn,
|
|
90
93
|
openaiBaseUrl: cli.openaiBaseUrl,
|
|
@@ -124,4 +127,4 @@ Object.defineProperty(exports, 'parseEnv', {
|
|
|
124
127
|
return parseEnv;
|
|
125
128
|
}
|
|
126
129
|
});
|
|
127
|
-
//# sourceMappingURL=parse-
|
|
130
|
+
//# sourceMappingURL=parse-BR-mFmYz.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-BR-mFmYz.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 \"insecure-http\": { type: \"boolean\" 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 \"anthropic-base-url\": { type: \"string\" as const },\n \"anthropic-model\": { type: \"string\" as const },\n \"agent-provider\": { 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 \"disable-skills\": { type: \"string\" as const },\n agent: { type: \"boolean\" as const },\n experimental: { 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 insecureHttp: values[\"insecure-http\"] === true,\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 anthropicBaseUrl: values[\"anthropic-base-url\"] as string | undefined,\n anthropicModel: values[\"anthropic-model\"] as string | undefined,\n agentProvider: values[\"agent-provider\"] 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 disableSkills: values[\"disable-skills\"] as string | undefined,\n agent: values.agent === true,\n experimental: values.experimental === 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.ANTHROPIC_MODEL) fromEnv.anthropicModel = env.ANTHROPIC_MODEL;\n if (env.EMBEDDED_AGENT_PROVIDER)\n fromEnv.agentProvider = env.EMBEDDED_AGENT_PROVIDER;\n if (env.SENTRY_CLIENT_ID) fromEnv.clientId = env.SENTRY_CLIENT_ID;\n if (env.MCP_SKILLS) fromEnv.skills = env.MCP_SKILLS;\n if (env.MCP_DISABLE_SKILLS) fromEnv.disableSkills = env.MCP_DISABLE_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 insecureHttp: cli.insecureHttp === true,\n mcpUrl: cli.mcpUrl ?? env.mcpUrl,\n sentryDsn: cli.sentryDsn ?? env.sentryDsn,\n openaiBaseUrl: cli.openaiBaseUrl,\n openaiModel: cli.openaiModel ?? env.openaiModel,\n anthropicBaseUrl: cli.anthropicBaseUrl,\n anthropicModel: cli.anthropicModel ?? env.anthropicModel,\n agentProvider: cli.agentProvider ?? env.agentProvider,\n clientId: env.clientId,\n // Skills precedence: CLI skills override env\n skills: cli.skills ?? env.skills,\n disableSkills: cli.disableSkills ?? env.disableSkills,\n agent: cli.agent === true,\n experimental: cli.experimental === 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,iBAAiB,EAAE,MAAM,UAAoB;EAC7C,KAAK,EAAE,MAAM,SAAmB;EAChC,WAAW,EAAE,MAAM,SAAmB;EACtC,cAAc,EAA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,IAAI;EAC1C,eAAe,IAAI,iBAAiB,IAAI;EACxC,UAAU,IAAI;EAEd,QAAQ,IAAI,UAAU,IAAI;EAC1B,eAAe,IAAI,iBAAiB,IAAI;EACxC,OAAO,IAAI,UAAU;EACrB,cAAc,IAAI,iBAAiB;EACnC,kBAAkB,IAAI;EACtB,aAAa,IAAI;EACjB,MAAM,IAAI,SAAS;EACnB,SAAS,IAAI,YAAY;EACzB,aAAa,IAAI;CAClB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_SENTRY_CLIENT_ID, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHostThrows } from "./constants-
|
|
1
|
+
import { DEFAULT_SENTRY_CLIENT_ID, isSentryHost, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHostThrows } from "./constants-DjY87Pdc.js";
|
|
2
2
|
|
|
3
3
|
//#region ../mcp-core/dist/skills-DN-CVDkO.js
|
|
4
4
|
const SKILLS = {
|
|
@@ -89,7 +89,10 @@ function resolveHost(url, host) {
|
|
|
89
89
|
return "sentry.io";
|
|
90
90
|
}
|
|
91
91
|
function finalize(input) {
|
|
92
|
+
if (input.insecureHttp && input.url) throw new Error("Error: --insecure-http cannot be used with --url or SENTRY_URL. Use --host for insecure self-hosted instances.");
|
|
92
93
|
const sentryHost = resolveHost(input.url, input.host);
|
|
94
|
+
if (input.insecureHttp && isSentryHost(sentryHost)) throw new Error("Error: --insecure-http is only supported for self-hosted Sentry hosts.");
|
|
95
|
+
const sentryProtocol = input.insecureHttp ? "http" : "https";
|
|
93
96
|
let finalSkills;
|
|
94
97
|
if (input.skills) {
|
|
95
98
|
const { valid, invalid } = parseSkills(input.skills);
|
|
@@ -108,13 +111,14 @@ function finalize(input) {
|
|
|
108
111
|
let agentProvider = void 0;
|
|
109
112
|
if (input.agentProvider) {
|
|
110
113
|
const provider = input.agentProvider.toLowerCase();
|
|
111
|
-
if (provider !== "openai" && provider !== "anthropic") throw new Error(`Error: Invalid agent provider "${input.agentProvider}". Must be "openai" or "anthropic".`);
|
|
114
|
+
if (provider !== "openai" && provider !== "azure-openai" && provider !== "anthropic") throw new Error(`Error: Invalid agent provider "${input.agentProvider}". Must be "openai", "azure-openai", or "anthropic".`);
|
|
112
115
|
agentProvider = provider;
|
|
113
116
|
}
|
|
114
117
|
return {
|
|
115
118
|
accessToken: input.accessToken,
|
|
116
119
|
clientId: input.clientId || DEFAULT_SENTRY_CLIENT_ID,
|
|
117
120
|
sentryHost,
|
|
121
|
+
sentryProtocol,
|
|
118
122
|
mcpUrl: input.mcpUrl,
|
|
119
123
|
sentryDsn: input.sentryDsn,
|
|
120
124
|
openaiBaseUrl: resolvedOpenAiBaseUrl,
|
|
@@ -130,4 +134,4 @@ function finalize(input) {
|
|
|
130
134
|
|
|
131
135
|
//#endregion
|
|
132
136
|
export { ALL_SKILLS, SKILLS, finalize, formatInvalidSkills, isEnabledBySkills, resolveHost };
|
|
133
|
-
//# sourceMappingURL=resolve-
|
|
137
|
+
//# sourceMappingURL=resolve-BrniID8M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-BrniID8M.js","names":["invalid: string[]","source?: string","url?: string","host?: string","input: MergedArgs","finalSkills: Set<Skill>","agentProvider: \"openai\" | \"azure-openai\" | \"anthropic\" | undefined"],"sources":["../../mcp-core/dist/skills-DN-CVDkO.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)) {\n\t\tif (tool.internalOnly) continue;\n\t\tif (Array.isArray(tool.skills)) for (const skill of tool.skills) counts.set(skill, (counts.get(skill) || 0) + 1);\n\t}\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\tif (tool.internalOnly) continue;\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-DN-CVDkO.js.map","import { ALL_SKILLS, parseSkills, type Skill } from \"@sentry/mcp-core/skills\";\nimport {\n isSentryHost,\n validateAndParseSentryUrlThrows,\n validateOpenAiBaseUrlThrows,\n validateSentryHostThrows,\n} from \"@sentry/mcp-core/utils/url-utils\";\nimport { DEFAULT_SENTRY_CLIENT_ID } from \"../auth/constants\";\nimport type { MergedArgs, PartiallyResolvedConfig } from \"./types\";\n\nexport function formatInvalidSkills(\n invalid: string[],\n source?: string,\n): string {\n const prefix = source ? `${source} provided` : \"Invalid skills provided\";\n return `Error: ${prefix}: ${invalid.join(\", \")}\\nAvailable skills: ${ALL_SKILLS.join(\", \")}`;\n}\n\n/**\n * Resolves the Sentry host from url/host inputs with validation.\n * Used by both the server flow (finalize) and auth commands (resolveAuthContext)\n * to ensure cache keys always match.\n */\nexport function resolveHost(url?: string, host?: string): string {\n if (url) {\n return validateAndParseSentryUrlThrows(url);\n }\n if (host) {\n validateSentryHostThrows(host);\n return host;\n }\n return \"sentry.io\";\n}\n\nexport function finalize(input: MergedArgs): PartiallyResolvedConfig {\n if (input.insecureHttp && input.url) {\n throw new Error(\n \"Error: --insecure-http cannot be used with --url or SENTRY_URL. Use --host for insecure self-hosted instances.\",\n );\n }\n\n const sentryHost = resolveHost(input.url, input.host);\n\n if (input.insecureHttp && isSentryHost(sentryHost)) {\n throw new Error(\n \"Error: --insecure-http is only supported for self-hosted Sentry hosts.\",\n );\n }\n\n const sentryProtocol = input.insecureHttp ? \"http\" : \"https\";\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>;\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 finalSkills = new Set<Skill>(ALL_SKILLS);\n }\n\n // Disable-skills: remove specific skills from the active set\n if (input.disableSkills) {\n const { valid: skillsToDisable, invalid } = parseSkills(\n input.disableSkills,\n );\n if (invalid.length > 0) {\n throw new Error(formatInvalidSkills(invalid, \"--disable-skills\"));\n }\n for (const skill of skillsToDisable) {\n finalSkills.delete(skill);\n }\n if (finalSkills.size === 0) {\n throw new Error(\n \"Error: All skills have been disabled. At least one skill must remain enabled.\",\n );\n }\n }\n\n const resolvedOpenAiBaseUrl = input.openaiBaseUrl\n ? validateOpenAiBaseUrlThrows(input.openaiBaseUrl)\n : undefined;\n\n // Validate anthropic base URL if provided (same validation as OpenAI)\n const resolvedAnthropicBaseUrl = input.anthropicBaseUrl\n ? validateOpenAiBaseUrlThrows(input.anthropicBaseUrl)\n : undefined;\n\n // Validate agent provider if explicitly set\n let agentProvider: \"openai\" | \"azure-openai\" | \"anthropic\" | undefined =\n undefined;\n if (input.agentProvider) {\n const provider = input.agentProvider.toLowerCase();\n if (\n provider !== \"openai\" &&\n provider !== \"azure-openai\" &&\n provider !== \"anthropic\"\n ) {\n throw new Error(\n `Error: Invalid agent provider \"${input.agentProvider}\". Must be \"openai\", \"azure-openai\", or \"anthropic\".`,\n );\n }\n agentProvider = provider;\n }\n\n return {\n accessToken: input.accessToken,\n clientId: input.clientId || DEFAULT_SENTRY_CLIENT_ID,\n sentryHost,\n sentryProtocol,\n mcpUrl: input.mcpUrl,\n sentryDsn: input.sentryDsn,\n openaiBaseUrl: resolvedOpenAiBaseUrl,\n openaiModel: input.openaiModel,\n anthropicBaseUrl: resolvedAnthropicBaseUrl,\n anthropicModel: input.anthropicModel,\n agentProvider,\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,OAA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1
|
-
const require_constants = require('./constants-
|
|
1
|
+
const require_constants = require('./constants-wVeitIuo.cjs');
|
|
2
2
|
|
|
3
3
|
//#region ../mcp-core/dist/skills-DN-CVDkO.js
|
|
4
4
|
const SKILLS = {
|
|
@@ -89,7 +89,10 @@ function resolveHost(url, host) {
|
|
|
89
89
|
return "sentry.io";
|
|
90
90
|
}
|
|
91
91
|
function finalize(input) {
|
|
92
|
+
if (input.insecureHttp && input.url) throw new Error("Error: --insecure-http cannot be used with --url or SENTRY_URL. Use --host for insecure self-hosted instances.");
|
|
92
93
|
const sentryHost = resolveHost(input.url, input.host);
|
|
94
|
+
if (input.insecureHttp && require_constants.isSentryHost(sentryHost)) throw new Error("Error: --insecure-http is only supported for self-hosted Sentry hosts.");
|
|
95
|
+
const sentryProtocol = input.insecureHttp ? "http" : "https";
|
|
93
96
|
let finalSkills;
|
|
94
97
|
if (input.skills) {
|
|
95
98
|
const { valid, invalid } = parseSkills(input.skills);
|
|
@@ -108,13 +111,14 @@ function finalize(input) {
|
|
|
108
111
|
let agentProvider = void 0;
|
|
109
112
|
if (input.agentProvider) {
|
|
110
113
|
const provider = input.agentProvider.toLowerCase();
|
|
111
|
-
if (provider !== "openai" && provider !== "anthropic") throw new Error(`Error: Invalid agent provider "${input.agentProvider}". Must be "openai" or "anthropic".`);
|
|
114
|
+
if (provider !== "openai" && provider !== "azure-openai" && provider !== "anthropic") throw new Error(`Error: Invalid agent provider "${input.agentProvider}". Must be "openai", "azure-openai", or "anthropic".`);
|
|
112
115
|
agentProvider = provider;
|
|
113
116
|
}
|
|
114
117
|
return {
|
|
115
118
|
accessToken: input.accessToken,
|
|
116
119
|
clientId: input.clientId || require_constants.DEFAULT_SENTRY_CLIENT_ID,
|
|
117
120
|
sentryHost,
|
|
121
|
+
sentryProtocol,
|
|
118
122
|
mcpUrl: input.mcpUrl,
|
|
119
123
|
sentryDsn: input.sentryDsn,
|
|
120
124
|
openaiBaseUrl: resolvedOpenAiBaseUrl,
|
|
@@ -165,4 +169,4 @@ Object.defineProperty(exports, 'resolveHost', {
|
|
|
165
169
|
return resolveHost;
|
|
166
170
|
}
|
|
167
171
|
});
|
|
168
|
-
//# sourceMappingURL=resolve-
|
|
172
|
+
//# sourceMappingURL=resolve-C24qYHAk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-C24qYHAk.cjs","names":["invalid: string[]","source?: string","url?: string","host?: string","input: MergedArgs","finalSkills: Set<Skill>","agentProvider: \"openai\" | \"azure-openai\" | \"anthropic\" | undefined","DEFAULT_SENTRY_CLIENT_ID"],"sources":["../../mcp-core/dist/skills-DN-CVDkO.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)) {\n\t\tif (tool.internalOnly) continue;\n\t\tif (Array.isArray(tool.skills)) for (const skill of tool.skills) counts.set(skill, (counts.get(skill) || 0) + 1);\n\t}\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\tif (tool.internalOnly) continue;\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-DN-CVDkO.js.map","import { ALL_SKILLS, parseSkills, type Skill } from \"@sentry/mcp-core/skills\";\nimport {\n isSentryHost,\n validateAndParseSentryUrlThrows,\n validateOpenAiBaseUrlThrows,\n validateSentryHostThrows,\n} from \"@sentry/mcp-core/utils/url-utils\";\nimport { DEFAULT_SENTRY_CLIENT_ID } from \"../auth/constants\";\nimport type { MergedArgs, PartiallyResolvedConfig } from \"./types\";\n\nexport function formatInvalidSkills(\n invalid: string[],\n source?: string,\n): string {\n const prefix = source ? `${source} provided` : \"Invalid skills provided\";\n return `Error: ${prefix}: ${invalid.join(\", \")}\\nAvailable skills: ${ALL_SKILLS.join(\", \")}`;\n}\n\n/**\n * Resolves the Sentry host from url/host inputs with validation.\n * Used by both the server flow (finalize) and auth commands (resolveAuthContext)\n * to ensure cache keys always match.\n */\nexport function resolveHost(url?: string, host?: string): string {\n if (url) {\n return validateAndParseSentryUrlThrows(url);\n }\n if (host) {\n validateSentryHostThrows(host);\n return host;\n }\n return \"sentry.io\";\n}\n\nexport function finalize(input: MergedArgs): PartiallyResolvedConfig {\n if (input.insecureHttp && input.url) {\n throw new Error(\n \"Error: --insecure-http cannot be used with --url or SENTRY_URL. Use --host for insecure self-hosted instances.\",\n );\n }\n\n const sentryHost = resolveHost(input.url, input.host);\n\n if (input.insecureHttp && isSentryHost(sentryHost)) {\n throw new Error(\n \"Error: --insecure-http is only supported for self-hosted Sentry hosts.\",\n );\n }\n\n const sentryProtocol = input.insecureHttp ? \"http\" : \"https\";\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>;\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 finalSkills = new Set<Skill>(ALL_SKILLS);\n }\n\n // Disable-skills: remove specific skills from the active set\n if (input.disableSkills) {\n const { valid: skillsToDisable, invalid } = parseSkills(\n input.disableSkills,\n );\n if (invalid.length > 0) {\n throw new Error(formatInvalidSkills(invalid, \"--disable-skills\"));\n }\n for (const skill of skillsToDisable) {\n finalSkills.delete(skill);\n }\n if (finalSkills.size === 0) {\n throw new Error(\n \"Error: All skills have been disabled. At least one skill must remain enabled.\",\n );\n }\n }\n\n const resolvedOpenAiBaseUrl = input.openaiBaseUrl\n ? validateOpenAiBaseUrlThrows(input.openaiBaseUrl)\n : undefined;\n\n // Validate anthropic base URL if provided (same validation as OpenAI)\n const resolvedAnthropicBaseUrl = input.anthropicBaseUrl\n ? validateOpenAiBaseUrlThrows(input.anthropicBaseUrl)\n : undefined;\n\n // Validate agent provider if explicitly set\n let agentProvider: \"openai\" | \"azure-openai\" | \"anthropic\" | undefined =\n undefined;\n if (input.agentProvider) {\n const provider = input.agentProvider.toLowerCase();\n if (\n provider !== \"openai\" &&\n provider !== \"azure-openai\" &&\n provider !== \"anthropic\"\n ) {\n throw new Error(\n `Error: Invalid agent provider \"${input.agentProvider}\". Must be \"openai\", \"azure-openai\", or \"anthropic\".`,\n );\n }\n agentProvider = provider;\n }\n\n return {\n accessToken: input.accessToken,\n clientId: input.clientId || DEFAULT_SENTRY_CLIENT_ID,\n sentryHost,\n sentryProtocol,\n mcpUrl: input.mcpUrl,\n sentryDsn: input.sentryDsn,\n openaiBaseUrl: resolvedOpenAiBaseUrl,\n openaiModel: input.openaiModel,\n anthropicBaseUrl: resolvedAnthropicBaseUrl,\n anthropicModel: input.anthropicModel,\n agentProvider,\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;AAe5E,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;AACl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AO,iBAAiB,SAAS,GAAG,YAC1C,MAAM,cACP;AACD,MAAI,QAAQ,SAAS,EACnB,OAAM,IAAI,MAAM,oBAAoB,SAAS,mBAAmB;AAElE,OAAK,MAAM,SAAS,gBAClB,aAAY,OAAO,MAAM;AAE3B,MAAI,YAAY,SAAS,EACvB,OAAM,IAAI,MACR;CAGL;CAED,MAAM,wBAAwB,MAAM,gBAChC,8CAA4B,MAAM,cAAc;CAIpD,MAAM,2BAA2B,MAAM,mBACnC,8CAA4B,MAAM,iBAAiB;CAIvD,IAAIC;AAEJ,KAAI,MAAM,eAAe;EACvB,MAAM,WAAW,MAAM,cAAc,aAAa;AAClD,MACE,aAAa,YACb,aAAa,kBACb,aAAa,YAEb,OAAM,IAAI,OACP,iCAAiC,MAAM,cAAc;AAG1D,kBAAgB;CACjB;AAED,QAAO;EACL,aAAa,MAAM;EACnB,UAAU,MAAM,YAAYC;EAC5B;EACA;EACA,QAAQ,MAAM;EACd,WAAW,MAAM;EACjB,eAAe;EACf,aAAa,MAAM;EACnB,kBAAkB;EAClB,gBAAgB,MAAM;EACtB;EACA;EACA,kBAAkB,MAAM;EACxB,aAAa,MAAM;CACpB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_constants = require('./constants-
|
|
2
|
-
const require_types = require('./types-
|
|
3
|
-
const require_device_code_flow = require('./device-code-flow-
|
|
1
|
+
const require_constants = require('./constants-wVeitIuo.cjs');
|
|
2
|
+
const require_types = require('./types-DViCeKUc.cjs');
|
|
3
|
+
const require_device_code_flow = require('./device-code-flow-BMOB5yEt.cjs');
|
|
4
4
|
const require_token_cache = require('./token-cache-iqkTOca3.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/auth/resolve-token.ts
|
|
@@ -49,4 +49,4 @@ Object.defineProperty(exports, 'resolveAccessToken', {
|
|
|
49
49
|
return resolveAccessToken;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
//# sourceMappingURL=resolve-token-
|
|
52
|
+
//# sourceMappingURL=resolve-token-ZTTdPX3U.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-token-
|
|
1
|
+
{"version":3,"file":"resolve-token-ZTTdPX3U.cjs","names":["partial: PartiallyResolvedConfig","accessToken: string","OAUTH_HOST"],"sources":["../src/auth/resolve-token.ts"],"sourcesContent":["import type { PartiallyResolvedConfig, ResolvedConfig } from \"../cli/types\";\nimport { isSentryIo, OAUTH_HOST } from \"./constants\";\nimport { authenticate } from \"./device-code-flow\";\nimport { readCachedToken, writeCachedToken } from \"./token-cache\";\nimport { toCachedToken } from \"./types\";\n\nfunction withToken(\n partial: PartiallyResolvedConfig,\n accessToken: string,\n): ResolvedConfig {\n return { ...partial, accessToken };\n}\n\n/**\n * Resolves the access token for the session.\n *\n * If an access token is already provided, returns immediately.\n * If the host is sentry.io, attempts to use a cached token or\n * initiates the device code flow (only when stderr is a TTY).\n * For non-sentry.io hosts, throws an error requiring --access-token.\n */\nexport async function resolveAccessToken(\n partial: PartiallyResolvedConfig,\n): Promise<ResolvedConfig> {\n if (partial.accessToken) {\n return withToken(partial, partial.accessToken);\n }\n\n if (!isSentryIo(partial.sentryHost)) {\n throw new Error(\n \"Error: No access token was provided. Device code authentication is only supported for sentry.io.\\n\" +\n \"Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.\",\n );\n }\n\n const { clientId, sentryHost } = partial;\n\n // Try cached token first (works in both interactive and non-interactive contexts)\n try {\n const cached = await readCachedToken(sentryHost, clientId);\n if (cached) {\n process.stderr.write(\n `Using cached authentication for ${cached.user_email}\\n`,\n );\n return withToken(partial, cached.access_token);\n }\n } catch {\n // Cache read failure is non-fatal\n }\n\n // Device code flow requires a human to visit a URL and authorize.\n // In non-interactive contexts (CI, piped stdio), fail immediately\n // instead of hanging on the polling loop until expiry.\n if (!process.stderr.isTTY) {\n throw new Error(\n \"Error: No access token was provided.\\n\" +\n \"Run `sentry-mcp auth login` interactively first, or pass `--access-token` / `SENTRY_ACCESS_TOKEN`.\",\n );\n }\n\n const tokenResponse = await authenticate({ clientId, host: OAUTH_HOST });\n\n try {\n await writeCachedToken(toCachedToken(tokenResponse, sentryHost, clientId));\n } catch {\n process.stderr.write(\"Warning: Could not cache authentication token.\\n\");\n }\n\n return withToken(partial, tokenResponse.access_token);\n}\n"],"mappings":";;;;;;AAMA,SAAS,UACPA,SACAC,aACgB;AAChB,QAAO;EAAE,GAAG;EAAS;CAAa;AACnC;;;;;;;;;AAUD,eAAsB,mBACpBD,SACyB;AACzB,KAAI,QAAQ,YACV,QAAO,UAAU,SAAS,QAAQ,YAAY;AAGhD,MAAK,+BAAW,QAAQ,WAAW,CACjC,OAAM,IAAI,MACR;CAKJ,MAAM,EAAE,UAAU,YAAY,GAAG;AAGjC,KAAI;EACF,MAAM,SAAS,MAAM,oCAAgB,YAAY,SAAS;AAC1D,MAAI,QAAQ;AACV,WAAQ,OAAO,OACZ,kCAAkC,OAAO,WAAW,IACtD;AACD,UAAO,UAAU,SAAS,OAAO,aAAa;EAC/C;CACF,QAAO,CAEP;AAKD,MAAK,QAAQ,OAAO,MAClB,OAAM,IAAI,MACR;CAKJ,MAAM,gBAAgB,MAAM,sCAAa;EAAE;EAAU,MAAME;CAAY,EAAC;AAExE,KAAI;AACF,QAAM,qCAAiB,4BAAc,eAAe,YAAY,SAAS,CAAC;CAC3E,QAAO;AACN,UAAQ,OAAO,MAAM,mDAAmD;CACzE;AAED,QAAO,UAAU,SAAS,cAAc,aAAa;AACtD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OAUTH_HOST, isSentryHost } from "./constants-
|
|
2
|
-
import { toCachedToken } from "./types-
|
|
3
|
-
import { authenticate } from "./device-code-flow-
|
|
1
|
+
import { OAUTH_HOST, isSentryHost } from "./constants-DjY87Pdc.js";
|
|
2
|
+
import { toCachedToken } from "./types-C336ZSwF.js";
|
|
3
|
+
import { authenticate } from "./device-code-flow-BJxgQqnk.js";
|
|
4
4
|
import { readCachedToken, writeCachedToken } from "./token-cache-BTEUyVx2.js";
|
|
5
5
|
|
|
6
6
|
//#region src/auth/resolve-token.ts
|
|
@@ -44,4 +44,4 @@ async function resolveAccessToken(partial) {
|
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { resolveAccessToken };
|
|
47
|
-
//# sourceMappingURL=resolve-token-
|
|
47
|
+
//# sourceMappingURL=resolve-token-xrdqUeT7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-token-
|
|
1
|
+
{"version":3,"file":"resolve-token-xrdqUeT7.js","names":["partial: PartiallyResolvedConfig","accessToken: string"],"sources":["../src/auth/resolve-token.ts"],"sourcesContent":["import type { PartiallyResolvedConfig, ResolvedConfig } from \"../cli/types\";\nimport { isSentryIo, OAUTH_HOST } from \"./constants\";\nimport { authenticate } from \"./device-code-flow\";\nimport { readCachedToken, writeCachedToken } from \"./token-cache\";\nimport { toCachedToken } from \"./types\";\n\nfunction withToken(\n partial: PartiallyResolvedConfig,\n accessToken: string,\n): ResolvedConfig {\n return { ...partial, accessToken };\n}\n\n/**\n * Resolves the access token for the session.\n *\n * If an access token is already provided, returns immediately.\n * If the host is sentry.io, attempts to use a cached token or\n * initiates the device code flow (only when stderr is a TTY).\n * For non-sentry.io hosts, throws an error requiring --access-token.\n */\nexport async function resolveAccessToken(\n partial: PartiallyResolvedConfig,\n): Promise<ResolvedConfig> {\n if (partial.accessToken) {\n return withToken(partial, partial.accessToken);\n }\n\n if (!isSentryIo(partial.sentryHost)) {\n throw new Error(\n \"Error: No access token was provided. Device code authentication is only supported for sentry.io.\\n\" +\n \"Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.\",\n );\n }\n\n const { clientId, sentryHost } = partial;\n\n // Try cached token first (works in both interactive and non-interactive contexts)\n try {\n const cached = await readCachedToken(sentryHost, clientId);\n if (cached) {\n process.stderr.write(\n `Using cached authentication for ${cached.user_email}\\n`,\n );\n return withToken(partial, cached.access_token);\n }\n } catch {\n // Cache read failure is non-fatal\n }\n\n // Device code flow requires a human to visit a URL and authorize.\n // In non-interactive contexts (CI, piped stdio), fail immediately\n // instead of hanging on the polling loop until expiry.\n if (!process.stderr.isTTY) {\n throw new Error(\n \"Error: No access token was provided.\\n\" +\n \"Run `sentry-mcp auth login` interactively first, or pass `--access-token` / `SENTRY_ACCESS_TOKEN`.\",\n );\n }\n\n const tokenResponse = await authenticate({ clientId, host: OAUTH_HOST });\n\n try {\n await writeCachedToken(toCachedToken(tokenResponse, sentryHost, clientId));\n } catch {\n process.stderr.write(\"Warning: Could not cache authentication token.\\n\");\n }\n\n return withToken(partial, tokenResponse.access_token);\n}\n"],"mappings":";;;;;;AAMA,SAAS,UACPA,SACAC,aACgB;AAChB,QAAO;EAAE,GAAG;EAAS;CAAa;AACnC;;;;;;;;;AAUD,eAAsB,mBACpBD,SACyB;AACzB,KAAI,QAAQ,YACV,QAAO,UAAU,SAAS,QAAQ,YAAY;AAGhD,MAAK,aAAW,QAAQ,WAAW,CACjC,OAAM,IAAI,MACR;CAKJ,MAAM,EAAE,UAAU,YAAY,GAAG;AAGjC,KAAI;EACF,MAAM,SAAS,MAAM,gBAAgB,YAAY,SAAS;AAC1D,MAAI,QAAQ;AACV,WAAQ,OAAO,OACZ,kCAAkC,OAAO,WAAW,IACtD;AACD,UAAO,UAAU,SAAS,OAAO,aAAa;EAC/C;CACF,QAAO,CAEP;AAKD,MAAK,QAAQ,OAAO,MAClB,OAAM,IAAI,MACR;CAKJ,MAAM,gBAAgB,MAAM,aAAa;EAAE;EAAU,MAAM;CAAY,EAAC;AAExE,KAAI;AACF,QAAM,iBAAiB,cAAc,eAAe,YAAY,SAAS,CAAC;CAC3E,QAAO;AACN,UAAQ,OAAO,MAAM,mDAAmD;CACzE;AAED,QAAO,UAAU,SAAS,cAAc,aAAa;AACtD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-Cv9WC9bY.cjs');
|
|
2
|
-
const require_version = require('./version-
|
|
2
|
+
const require_version = require('./version-CG1gvrBK.cjs');
|
|
3
3
|
const __modelcontextprotocol_sdk_server_stdio_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/stdio.js"));
|
|
4
4
|
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
|
|
5
5
|
|
|
@@ -54,4 +54,4 @@ Object.defineProperty(exports, 'startStdio', {
|
|
|
54
54
|
return startStdio;
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
//# sourceMappingURL=stdio-
|
|
57
|
+
//# sourceMappingURL=stdio-CMTtwTjK.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio-
|
|
1
|
+
{"version":3,"file":"stdio-CMTtwTjK.cjs","names":["server: McpServer","context: ServerContext","LIB_VERSION","StdioServerTransport"],"sources":["../src/transports/stdio.ts"],"sourcesContent":["/**\n * Standard I/O Transport for MCP Server.\n *\n * Provides stdio-based communication for the Sentry MCP server, typically used\n * when the server runs as a subprocess communicating via stdin/stdout pipes.\n *\n * @example Basic Usage\n * ```typescript\n * import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\n * import { startStdio } from \"./transports/stdio.js\";\n *\n * const server = new Server();\n * const context = {\n * accessToken: process.env.SENTRY_TOKEN,\n * host: \"sentry.io\"\n * };\n *\n * await startStdio(server, context);\n * ```\n */\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as Sentry from \"@sentry/node\";\nimport { LIB_VERSION } from \"@sentry/mcp-core/version\";\nimport type { ServerContext } from \"@sentry/mcp-core/types\";\n\n/**\n * Starts the MCP server with stdio transport and telemetry.\n *\n * Connects the server using stdio transport for process-based communication.\n * Context is already captured in tool handler closures during buildServer().\n * All operations are wrapped in Sentry tracing for observability.\n *\n * @param server - Configured and instrumented MCP server instance (with context in closures)\n * @param context - Server context with authentication and configuration (for telemetry attributes)\n *\n * @example CLI Integration\n * ```typescript\n * import { buildServer } from \"./server.js\";\n * import { startStdio } from \"./transports/stdio.js\";\n *\n * const context = {\n * accessToken: userToken,\n * sentryHost: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"cursor-ide\",\n * constraints: {}\n * };\n *\n * const server = buildServer({ context }); // Context captured in closures\n * await startStdio(server, context);\n * ```\n */\nexport async function startStdio(server: McpServer, context: ServerContext) {\n await Sentry.startNewTrace(async () => {\n return await Sentry.startSpan(\n {\n name: \"mcp.server/stdio\",\n attributes: {\n \"mcp.transport\": \"stdio\",\n \"network.transport\": \"pipe\",\n \"service.version\": LIB_VERSION,\n },\n },\n async () => {\n // Context already captured in tool handler closures during buildServer()\n const transport = new StdioServerTransport();\n await server.connect(transport);\n },\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,WAAWA,QAAmBC,SAAwB;AAC1E,OAAM,cAAO,cAAc,YAAY;AACrC,SAAO,MAAM,cAAO,UAClB;GACE,MAAM;GACN,YAAY;IACV,iBAAiB;IACjB,qBAAqB;IACrB,mBAAmBC;GACpB;EACF,GACD,YAAY;GAEV,MAAM,YAAY,IAAIC;AACtB,SAAM,OAAO,QAAQ,UAAU;EAChC,EACF;CACF,EAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LIB_VERSION } from "./version-
|
|
1
|
+
import { LIB_VERSION } from "./version-C-VwoRFq.js";
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import * as Sentry from "@sentry/node";
|
|
4
4
|
|
|
@@ -48,4 +48,4 @@ async function startStdio(server, context) {
|
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
50
|
export { startStdio };
|
|
51
|
-
//# sourceMappingURL=stdio-
|
|
51
|
+
//# sourceMappingURL=stdio-CrPIATQh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio-
|
|
1
|
+
{"version":3,"file":"stdio-CrPIATQh.js","names":["server: McpServer","context: ServerContext"],"sources":["../src/transports/stdio.ts"],"sourcesContent":["/**\n * Standard I/O Transport for MCP Server.\n *\n * Provides stdio-based communication for the Sentry MCP server, typically used\n * when the server runs as a subprocess communicating via stdin/stdout pipes.\n *\n * @example Basic Usage\n * ```typescript\n * import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\n * import { startStdio } from \"./transports/stdio.js\";\n *\n * const server = new Server();\n * const context = {\n * accessToken: process.env.SENTRY_TOKEN,\n * host: \"sentry.io\"\n * };\n *\n * await startStdio(server, context);\n * ```\n */\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as Sentry from \"@sentry/node\";\nimport { LIB_VERSION } from \"@sentry/mcp-core/version\";\nimport type { ServerContext } from \"@sentry/mcp-core/types\";\n\n/**\n * Starts the MCP server with stdio transport and telemetry.\n *\n * Connects the server using stdio transport for process-based communication.\n * Context is already captured in tool handler closures during buildServer().\n * All operations are wrapped in Sentry tracing for observability.\n *\n * @param server - Configured and instrumented MCP server instance (with context in closures)\n * @param context - Server context with authentication and configuration (for telemetry attributes)\n *\n * @example CLI Integration\n * ```typescript\n * import { buildServer } from \"./server.js\";\n * import { startStdio } from \"./transports/stdio.js\";\n *\n * const context = {\n * accessToken: userToken,\n * sentryHost: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"cursor-ide\",\n * constraints: {}\n * };\n *\n * const server = buildServer({ context }); // Context captured in closures\n * await startStdio(server, context);\n * ```\n */\nexport async function startStdio(server: McpServer, context: ServerContext) {\n await Sentry.startNewTrace(async () => {\n return await Sentry.startSpan(\n {\n name: \"mcp.server/stdio\",\n attributes: {\n \"mcp.transport\": \"stdio\",\n \"network.transport\": \"pipe\",\n \"service.version\": LIB_VERSION,\n },\n },\n async () => {\n // Context already captured in tool handler closures during buildServer()\n const transport = new StdioServerTransport();\n await server.connect(transport);\n },\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,WAAWA,QAAmBC,SAAwB;AAC1E,OAAM,OAAO,cAAc,YAAY;AACrC,SAAO,MAAM,OAAO,UAClB;GACE,MAAM;GACN,YAAY;IACV,iBAAiB;IACjB,qBAAqB;IACrB,mBAAmB;GACpB;EACF,GACD,YAAY;GAEV,MAAM,YAAY,IAAI;AACtB,SAAM,OAAO,QAAQ,UAAU;EAChC,EACF;CACF,EAAC;AACH"}
|
package/dist/transports/stdio.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { SentryProtocol } from "@sentry/mcp-core/types";
|
|
1
2
|
import { Skill } from "@sentry/mcp-core/skills";
|
|
2
3
|
|
|
3
4
|
//#region src/cli/types.d.ts
|
|
4
5
|
type CliArgs = {
|
|
5
6
|
accessToken?: string;
|
|
6
7
|
host?: string;
|
|
8
|
+
insecureHttp?: boolean;
|
|
7
9
|
url?: string;
|
|
8
10
|
mcpUrl?: string;
|
|
9
11
|
sentryDsn?: string;
|
|
@@ -38,6 +40,7 @@ type EnvArgs = {
|
|
|
38
40
|
type MergedArgs = {
|
|
39
41
|
accessToken?: string;
|
|
40
42
|
host?: string;
|
|
43
|
+
insecureHttp?: boolean;
|
|
41
44
|
url?: string;
|
|
42
45
|
mcpUrl?: string;
|
|
43
46
|
sentryDsn?: string;
|
|
@@ -65,13 +68,14 @@ type PartiallyResolvedConfig = {
|
|
|
65
68
|
accessToken?: string;
|
|
66
69
|
clientId: string;
|
|
67
70
|
sentryHost: string;
|
|
71
|
+
sentryProtocol: SentryProtocol;
|
|
68
72
|
mcpUrl?: string;
|
|
69
73
|
sentryDsn?: string;
|
|
70
74
|
openaiBaseUrl?: string;
|
|
71
75
|
openaiModel?: string;
|
|
72
76
|
anthropicBaseUrl?: string;
|
|
73
77
|
anthropicModel?: string;
|
|
74
|
-
agentProvider?: "openai" | "anthropic";
|
|
78
|
+
agentProvider?: "openai" | "azure-openai" | "anthropic";
|
|
75
79
|
/** Skills granted for this session (always populated by finalize()) */
|
|
76
80
|
finalSkills: Set<Skill>;
|
|
77
81
|
organizationSlug?: string;
|
|
@@ -83,4 +87,4 @@ type ResolvedConfig = Omit<PartiallyResolvedConfig, "accessToken"> & {
|
|
|
83
87
|
//# sourceMappingURL=types.d.ts.map
|
|
84
88
|
//#endregion
|
|
85
89
|
export { CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig };
|
|
86
|
-
//# sourceMappingURL=types-
|
|
90
|
+
//# sourceMappingURL=types-BHd78Leq.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BHd78Leq.d.cts","names":[],"sources":["../src/cli/types.ts"],"sourcesContent":[],"mappings":";;;;KAGY,OAAA;;EAAA,IAAA,CAAA,EAAA,MAAO;EAuBP,YAAO,CAAA,EAAA,OAAA;EAcP,GAAA,CAAA,EAAA,MAAA;EA4BA,MAAA,CAAA,EAAA,MAAA;EAAuB,SAAA,CAAA,EAAA,MAAA;EAAA,aAIjB,CAAA,EAAA,MAAA;EAAc,WASb,CAAA,EAAA,MAAA;EAAK,gBAAT,CAAA,EAAA,MAAA;EAAG,cAAA,CAAA,EAAA,MAAA;EAKN,aAAA,CAAA,EAAA,MAAc;EAAA,MAAA,CAAA,EAAA,MAAA;EAAA,aAAQ,CAAA,EAAA,MAAA;EAAuB,KAA5B,CAAA,EAAA,OAAA;EAAI,YAAA,CAAA,EAAA,OAAA;;;;;;;KA5DrB,OAAA;;;;;;;;;;;;;KAcA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BA,uBAAA;;;;kBAIM;;;;;;;;;eASH,IAAI;;;;KAKP,cAAA,GAAiB,KAAK"}
|
|
@@ -53,17 +53,17 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
53
53
|
expires_in: z.ZodNumber;
|
|
54
54
|
expires_at: z.ZodString;
|
|
55
55
|
user: z.ZodObject<{
|
|
56
|
-
email: z.ZodString
|
|
56
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
57
|
id: z.ZodString;
|
|
58
58
|
name: z.ZodNullable<z.ZodString>;
|
|
59
59
|
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
email: string;
|
|
61
60
|
id: string;
|
|
62
61
|
name: string | null;
|
|
62
|
+
email?: string | null | undefined;
|
|
63
63
|
}, {
|
|
64
|
-
email: string;
|
|
65
64
|
id: string;
|
|
66
65
|
name: string | null;
|
|
66
|
+
email?: string | null | undefined;
|
|
67
67
|
}>;
|
|
68
68
|
scope: z.ZodString;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -73,9 +73,9 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
73
73
|
token_type: string;
|
|
74
74
|
expires_at: string;
|
|
75
75
|
user: {
|
|
76
|
-
email: string;
|
|
77
76
|
id: string;
|
|
78
77
|
name: string | null;
|
|
78
|
+
email?: string | null | undefined;
|
|
79
79
|
};
|
|
80
80
|
scope: string;
|
|
81
81
|
}, {
|
|
@@ -85,9 +85,9 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
85
85
|
token_type: string;
|
|
86
86
|
expires_at: string;
|
|
87
87
|
user: {
|
|
88
|
-
email: string;
|
|
89
88
|
id: string;
|
|
90
89
|
name: string | null;
|
|
90
|
+
email?: string | null | undefined;
|
|
91
91
|
};
|
|
92
92
|
scope: string;
|
|
93
93
|
}>;
|
|
@@ -104,8 +104,9 @@ type CachedToken = {
|
|
|
104
104
|
user_email: string;
|
|
105
105
|
scope: string;
|
|
106
106
|
};
|
|
107
|
+
declare function getTokenUserLabel(tokenResponse: TokenResponse): string;
|
|
107
108
|
declare function toCachedToken(tokenResponse: TokenResponse, sentryHost: string, clientId: string): CachedToken;
|
|
108
109
|
//# sourceMappingURL=types.d.ts.map
|
|
109
110
|
//#endregion
|
|
110
|
-
export { CachedToken, DeviceCodeErrorSchema, DeviceCodeResponse, DeviceCodeResponseSchema, TokenResponse, TokenResponseSchema, toCachedToken };
|
|
111
|
-
//# sourceMappingURL=types-
|
|
111
|
+
export { CachedToken, DeviceCodeErrorSchema, DeviceCodeResponse, DeviceCodeResponseSchema, TokenResponse, TokenResponseSchema, getTokenUserLabel, toCachedToken };
|
|
112
|
+
//# sourceMappingURL=types-BJpeKPWI.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BJpeKPWI.d.cts","names":[],"sources":["../src/auth/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;;AAOE,cAPW,wBAOX,EAPmC,CAAA,CAAA,SAOnC,CAAA;eAAA,CAAA,CAAA;;;;;;UAPmC,cAAA,EAAA;EAAA,WAAA,EAAA,MAAA;EASzB,SAAA,EAAA,MAAA;EAAkB,gBAAA,EAAA,MAAA;EAAA,yBAAkB,EAAA,MAAA;EAAwB,QAArC,EAAA,MAAA;EAAK,UAAA,EAAA,MAAA;AAKxC,CAAA,EAAA;EAGE,WAAA,EAAA,MAAA;EAAA,SAAA,EAAA,MAAA;;;;YAHgC,EAAA,MAAA;AAAA,CAAA,CAAA;AASrB,KAdD,kBAAA,GAAqB,CAAA,CAAE,KA0BjC,CAAA,OA1B8C,wBA0B9C,CAAA;;;;cArBW,uBAAqB,CAAA,CAAA;SAGhC,CAAA,CAAA;;;;;;;;;;;;;AAM8B,cAAnB,mBAAmB,EAAA,CAAA,CAAA,SAAA,CAAA;EAcpB,YAAA,EAFV,CAAA,CAAA,SAEuB;EAAA,aAAA,aAAA;EAAA,UAAkB,aAAA;EAAmB,UAAhC,aAAA;EAAK,UAAA,aAAA;EAKvB,IAAA,aAAW,CAAA;IAYP,KAAA,eAAiB,cAAgB,YAAa,CAAA,CAAA;IAM9C,EAAA,aAAa;IAAA,IAAA,eAAA,YAAA,CAAA;EAAA,CAAA,EACZ,OAAA,cAAA,EAAA;IAGd,EAAA,EAAA,MAAA;IAAW,IAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA3BF,aAAA,GAAgB,CAAA,CAAE,aAAa;;;;KAK/B,WAAA;;;;;;;;;iBAYI,iBAAA,gBAAiC;iBAMjC,aAAA,gBACC,sDAGd"}
|
|
@@ -31,12 +31,15 @@ const TokenResponseSchema = z.object({
|
|
|
31
31
|
expires_in: z.number(),
|
|
32
32
|
expires_at: z.string().datetime(),
|
|
33
33
|
user: z.object({
|
|
34
|
-
email: z.string().
|
|
34
|
+
email: z.string().nullable().optional(),
|
|
35
35
|
id: z.string(),
|
|
36
36
|
name: z.string().nullable()
|
|
37
37
|
}),
|
|
38
38
|
scope: z.string()
|
|
39
39
|
});
|
|
40
|
+
function getTokenUserLabel(tokenResponse) {
|
|
41
|
+
return tokenResponse.user.name ?? tokenResponse.user.email ?? tokenResponse.user.id;
|
|
42
|
+
}
|
|
40
43
|
function toCachedToken(tokenResponse, sentryHost, clientId) {
|
|
41
44
|
return {
|
|
42
45
|
access_token: tokenResponse.access_token,
|
|
@@ -44,11 +47,11 @@ function toCachedToken(tokenResponse, sentryHost, clientId) {
|
|
|
44
47
|
expires_at: tokenResponse.expires_at,
|
|
45
48
|
sentry_host: sentryHost,
|
|
46
49
|
client_id: clientId,
|
|
47
|
-
user_email: tokenResponse
|
|
50
|
+
user_email: getTokenUserLabel(tokenResponse),
|
|
48
51
|
scope: tokenResponse.scope
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
//#endregion
|
|
53
|
-
export { DeviceCodeErrorSchema, DeviceCodeResponseSchema, TokenResponseSchema, toCachedToken };
|
|
54
|
-
//# sourceMappingURL=types-
|
|
56
|
+
export { DeviceCodeErrorSchema, DeviceCodeResponseSchema, TokenResponseSchema, getTokenUserLabel, toCachedToken };
|
|
57
|
+
//# sourceMappingURL=types-C336ZSwF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-C336ZSwF.js","names":["tokenResponse: TokenResponse","sentryHost: string","clientId: string"],"sources":["../src/auth/types.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Response from Sentry's device code endpoint (POST /oauth/device/code/).\n * See: https://docs.sentry.io/api/auth/#device-authorization-flow\n */\nexport const DeviceCodeResponseSchema = z.object({\n device_code: z.string(),\n user_code: z.string(),\n verification_uri: z.string().url(),\n verification_uri_complete: z.string().url(),\n interval: z.number().int().positive(),\n expires_in: z.number().int().positive(),\n});\n\nexport type DeviceCodeResponse = z.infer<typeof DeviceCodeResponseSchema>;\n\n/**\n * Error response during device code token polling.\n */\nexport const DeviceCodeErrorSchema = z.object({\n error: z.string(),\n error_description: z.string().optional(),\n});\n\n/**\n * Successful token response from Sentry's token endpoint.\n * Mirrors the shape used by the cloudflare OAuth callback.\n */\nexport const TokenResponseSchema = z.object({\n access_token: z.string(),\n refresh_token: z.string(),\n token_type: z.string(),\n expires_in: z.number(),\n expires_at: z.string().datetime(),\n user: z.object({\n email: z.string().nullable().optional(),\n id: z.string(),\n name: z.string().nullable(),\n }),\n scope: z.string(),\n});\n\nexport type TokenResponse = z.infer<typeof TokenResponseSchema>;\n\n/**\n * Shape of a cached token entry stored on disk.\n */\nexport type CachedToken = {\n access_token: string;\n refresh_token: string;\n expires_at: string;\n sentry_host: string;\n client_id: string;\n // Historical name retained for cache compatibility; this stores a user label,\n // not necessarily an email address.\n user_email: string;\n scope: string;\n};\n\nexport function getTokenUserLabel(tokenResponse: TokenResponse): string {\n return (\n tokenResponse.user.name ?? tokenResponse.user.email ?? tokenResponse.user.id\n );\n}\n\nexport function toCachedToken(\n tokenResponse: TokenResponse,\n sentryHost: string,\n clientId: string,\n): CachedToken {\n return {\n access_token: tokenResponse.access_token,\n refresh_token: tokenResponse.refresh_token,\n expires_at: tokenResponse.expires_at,\n sentry_host: sentryHost,\n client_id: clientId,\n user_email: getTokenUserLabel(tokenResponse),\n scope: tokenResponse.scope,\n };\n}\n"],"mappings":";;;;;;;AAMA,MAAa,2BAA2B,EAAE,OAAO;CAC/C,aAAa,EAAE,QAAQ;CACvB,WAAW,EAAE,QAAQ;CACrB,kBAAkB,EAAE,QAAQ,CAAC,KAAK;CAClC,2BAA2B,EAAE,QAAQ,CAAC,KAAK;CAC3C,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;CACrC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;AACxC,EAAC;;;;AAOF,MAAa,wBAAwB,EAAE,OAAO;CAC5C,OAAO,EAAE,QAAQ;CACjB,mBAAmB,EAAE,QAAQ,CAAC,UAAU;AACzC,EAAC;;;;;AAMF,MAAa,sBAAsB,EAAE,OAAO;CAC1C,cAAc,EAAE,QAAQ;CACxB,eAAe,EAAE,QAAQ;CACzB,YAAY,EAAE,QAAQ;CACtB,YAAY,EAAE,QAAQ;CACtB,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,MAAM,EAAE,OAAO;EACb,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EACvC,IAAI,EAAE,QAAQ;EACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC5B,EAAC;CACF,OAAO,EAAE,QAAQ;AAClB,EAAC;AAmBF,SAAgB,kBAAkBA,eAAsC;AACtE,QACE,cAAc,KAAK,QAAQ,cAAc,KAAK,SAAS,cAAc,KAAK;AAE7E;AAED,SAAgB,cACdA,eACAC,YACAC,UACa;AACb,QAAO;EACL,cAAc,cAAc;EAC5B,eAAe,cAAc;EAC7B,YAAY,cAAc;EAC1B,aAAa;EACb,WAAW;EACX,YAAY,kBAAkB,cAAc;EAC5C,OAAO,cAAc;CACtB;AACF"}
|
|
@@ -53,17 +53,17 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
53
53
|
expires_in: z.ZodNumber;
|
|
54
54
|
expires_at: z.ZodString;
|
|
55
55
|
user: z.ZodObject<{
|
|
56
|
-
email: z.ZodString
|
|
56
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
57
|
id: z.ZodString;
|
|
58
58
|
name: z.ZodNullable<z.ZodString>;
|
|
59
59
|
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
email: string;
|
|
61
60
|
id: string;
|
|
62
61
|
name: string | null;
|
|
62
|
+
email?: string | null | undefined;
|
|
63
63
|
}, {
|
|
64
|
-
email: string;
|
|
65
64
|
id: string;
|
|
66
65
|
name: string | null;
|
|
66
|
+
email?: string | null | undefined;
|
|
67
67
|
}>;
|
|
68
68
|
scope: z.ZodString;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -73,9 +73,9 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
73
73
|
token_type: string;
|
|
74
74
|
expires_at: string;
|
|
75
75
|
user: {
|
|
76
|
-
email: string;
|
|
77
76
|
id: string;
|
|
78
77
|
name: string | null;
|
|
78
|
+
email?: string | null | undefined;
|
|
79
79
|
};
|
|
80
80
|
scope: string;
|
|
81
81
|
}, {
|
|
@@ -85,9 +85,9 @@ declare const TokenResponseSchema: z.ZodObject<{
|
|
|
85
85
|
token_type: string;
|
|
86
86
|
expires_at: string;
|
|
87
87
|
user: {
|
|
88
|
-
email: string;
|
|
89
88
|
id: string;
|
|
90
89
|
name: string | null;
|
|
90
|
+
email?: string | null | undefined;
|
|
91
91
|
};
|
|
92
92
|
scope: string;
|
|
93
93
|
}>;
|
|
@@ -104,8 +104,9 @@ type CachedToken = {
|
|
|
104
104
|
user_email: string;
|
|
105
105
|
scope: string;
|
|
106
106
|
};
|
|
107
|
+
declare function getTokenUserLabel(tokenResponse: TokenResponse): string;
|
|
107
108
|
declare function toCachedToken(tokenResponse: TokenResponse, sentryHost: string, clientId: string): CachedToken;
|
|
108
109
|
//# sourceMappingURL=types.d.ts.map
|
|
109
110
|
//#endregion
|
|
110
|
-
export { CachedToken, DeviceCodeErrorSchema, DeviceCodeResponse, DeviceCodeResponseSchema, TokenResponse, TokenResponseSchema, toCachedToken };
|
|
111
|
-
//# sourceMappingURL=types-
|
|
111
|
+
export { CachedToken, DeviceCodeErrorSchema, DeviceCodeResponse, DeviceCodeResponseSchema, TokenResponse, TokenResponseSchema, getTokenUserLabel, toCachedToken };
|
|
112
|
+
//# sourceMappingURL=types-DDkgkRP9.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DDkgkRP9.d.ts","names":[],"sources":["../src/auth/types.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;;AAOE,cAPW,wBAOX,EAPmC,CAAA,CAAA,SAOnC,CAAA;eAAA,CAAA,CAAA;;;;;;UAPmC,cAAA,EAAA;EAAA,WAAA,EAAA,MAAA;EASzB,SAAA,EAAA,MAAA;EAAkB,gBAAA,EAAA,MAAA;EAAA,yBAAkB,EAAA,MAAA;EAAwB,QAArC,EAAA,MAAA;EAAK,UAAA,EAAA,MAAA;AAKxC,CAAA,EAAA;EAGE,WAAA,EAAA,MAAA;EAAA,SAAA,EAAA,MAAA;;;;YAHgC,EAAA,MAAA;AAAA,CAAA,CAAA;AASrB,KAdD,kBAAA,GAAqB,CAAA,CAAE,KA0BjC,CAAA,OA1B8C,wBA0B9C,CAAA;;;;cArBW,uBAAqB,CAAA,CAAA;SAGhC,CAAA,CAAA;;;;;;;;;;;;;AAM8B,cAAnB,mBAAmB,EAAA,CAAA,CAAA,SAAA,CAAA;EAcpB,YAAA,EAFV,CAAA,CAAA,SAEuB;EAAA,aAAA,aAAA;EAAA,UAAkB,aAAA;EAAmB,UAAhC,aAAA;EAAK,UAAA,aAAA;EAKvB,IAAA,aAAW,CAAA;IAYP,KAAA,eAAiB,cAAgB,YAAa,CAAA,CAAA;IAM9C,EAAA,aAAa;IAAA,IAAA,eAAA,YAAA,CAAA;EAAA,CAAA,EACZ,OAAA,cAAA,EAAA;IAGd,EAAA,EAAA,MAAA;IAAW,IAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA3BF,aAAA,GAAgB,CAAA,CAAE,aAAa;;;;KAK/B,WAAA;;;;;;;;;iBAYI,iBAAA,gBAAiC;iBAMjC,aAAA,gBACC,sDAGd"}
|