@sentry/mcp-server 0.29.0 → 0.31.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 +9 -0
- package/dist/auth/constants.d.cts +31 -0
- package/dist/auth/constants.d.cts.map +1 -0
- package/dist/auth/constants.d.ts +31 -0
- package/dist/auth/constants.d.ts.map +1 -0
- package/dist/auth/constants.js +3 -0
- package/dist/auth/device-code-flow.cjs +10 -0
- package/dist/auth/device-code-flow.d.cts +34 -0
- package/dist/auth/device-code-flow.d.cts.map +1 -0
- package/dist/auth/device-code-flow.d.ts +34 -0
- package/dist/auth/device-code-flow.d.ts.map +1 -0
- package/dist/auth/device-code-flow.js +6 -0
- package/dist/auth/resolve-token.cjs +8 -0
- package/dist/auth/resolve-token.d.cts +17 -0
- package/dist/auth/resolve-token.d.cts.map +1 -0
- package/dist/auth/resolve-token.d.ts +17 -0
- package/dist/auth/resolve-token.d.ts.map +1 -0
- package/dist/auth/resolve-token.js +8 -0
- package/dist/auth/token-cache.cjs +5 -0
- package/dist/auth/token-cache.d.cts +11 -0
- package/dist/auth/token-cache.d.cts.map +1 -0
- package/dist/auth/token-cache.d.ts +11 -0
- package/dist/auth/token-cache.d.ts.map +1 -0
- package/dist/auth/token-cache.js +3 -0
- package/dist/auth/types.cjs +6 -0
- package/dist/auth/types.d.cts +2 -0
- package/dist/auth/types.d.ts +2 -0
- package/dist/auth/types.js +3 -0
- package/dist/auth-BIb4PBnL.js +79 -0
- package/dist/auth-BIb4PBnL.js.map +1 -0
- package/dist/auth-BK5LL8QY.cjs +90 -0
- package/dist/auth-BK5LL8QY.cjs.map +1 -0
- package/dist/{chunk-DoeelZqw.cjs → chunk-Cv9WC9bY.cjs} +7 -0
- package/dist/cli/commands/auth.cjs +11 -0
- package/dist/cli/commands/auth.d.cts +8 -0
- package/dist/cli/commands/auth.d.cts.map +1 -0
- package/dist/cli/commands/auth.d.ts +8 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +10 -0
- 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 +4 -2
- package/dist/cli/resolve.d.cts +10 -4
- package/dist/cli/resolve.d.cts.map +1 -1
- package/dist/cli/resolve.d.ts +10 -4
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +3 -2
- package/dist/cli/types.d.cts +2 -2
- package/dist/cli/types.d.ts +2 -2
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/{config-HqPAzoGg.js → config--FiEKpQR.js} +1 -1
- package/dist/{config-CEjP2CYO-DNCUeo0R.js → config-BYPjNBPX-7d8TAxBc.js} +3 -2
- package/dist/config-BYPjNBPX-7d8TAxBc.js.map +1 -0
- package/dist/{config-CEjP2CYO-CZKUamRu.cjs → config-BYPjNBPX-Bqwc8iZW.cjs} +3 -2
- package/dist/config-BYPjNBPX-Bqwc8iZW.cjs.map +1 -0
- package/dist/config-DU03TDiU.cjs +7 -0
- package/dist/{resolve-DpUhCbfh.js → constants-Ciwj7kb9.js} +30 -119
- package/dist/constants-Ciwj7kb9.js.map +1 -0
- package/dist/{resolve-DFUPLqHE.cjs → constants-DmV1Benp.cjs} +65 -130
- package/dist/constants-DmV1Benp.cjs.map +1 -0
- package/dist/device-code-flow-CpGZ3Eqv.cjs +154 -0
- package/dist/device-code-flow-CpGZ3Eqv.cjs.map +1 -0
- package/dist/device-code-flow-DmgeS5QN.js +124 -0
- package/dist/device-code-flow-DmgeS5QN.js.map +1 -0
- package/dist/index.cjs +24308 -16062
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25233 -17018
- package/dist/index.js.map +1 -1
- package/dist/{parse-CEJNfXug.js → parse-BC0czE2L.js} +7 -1
- package/dist/parse-BC0czE2L.js.map +1 -0
- package/dist/{parse-DFk2004x.cjs → parse-CBlXTQfk.cjs} +8 -2
- package/dist/parse-CBlXTQfk.cjs.map +1 -0
- package/dist/resolve-BfYJ9Cqy.cjs +168 -0
- package/dist/resolve-BfYJ9Cqy.cjs.map +1 -0
- package/dist/resolve-D0W2gbu8.js +133 -0
- package/dist/resolve-D0W2gbu8.js.map +1 -0
- package/dist/resolve-token-C2eTEtoo.cjs +52 -0
- package/dist/resolve-token-C2eTEtoo.cjs.map +1 -0
- package/dist/resolve-token-pfPBO9EK.js +47 -0
- package/dist/resolve-token-pfPBO9EK.js.map +1 -0
- package/dist/{stdio-CUTR3lwv.cjs → stdio-B08zZS4X.cjs} +4 -20
- package/dist/stdio-B08zZS4X.cjs.map +1 -0
- package/dist/{stdio-BG3LYhUm.js → stdio-CUhyR_jH.js} +3 -7
- package/dist/stdio-CUhyR_jH.js.map +1 -0
- package/dist/token-D7eiINbV.js +50 -0
- package/dist/token-D7eiINbV.js.map +1 -0
- package/dist/token-Dx4qrxlx.cjs +55 -0
- package/dist/token-Dx4qrxlx.cjs.map +1 -0
- package/dist/token-cache-BTEUyVx2.js +66 -0
- package/dist/token-cache-BTEUyVx2.js.map +1 -0
- package/dist/token-cache-iqkTOca3.cjs +84 -0
- package/dist/token-cache-iqkTOca3.cjs.map +1 -0
- package/dist/token-error-Df8A7mgb.js +77 -0
- package/dist/token-error-Df8A7mgb.js.map +1 -0
- package/dist/token-error-x_miDBP3.cjs +48 -0
- package/dist/token-error-x_miDBP3.cjs.map +1 -0
- package/dist/token-util-DtX1UM9f.js +4 -0
- package/dist/token-util-VkLmCUNV.js +357 -0
- package/dist/token-util-VkLmCUNV.js.map +1 -0
- package/dist/token-util-bEa_1v46.cjs +9 -0
- package/dist/token-util-oe0G9a-s.cjs +363 -0
- package/dist/token-util-oe0G9a-s.cjs.map +1 -0
- package/dist/transports/stdio.cjs +2 -1
- package/dist/transports/stdio.js +2 -1
- package/dist/types-BN426G4g.d.ts +111 -0
- package/dist/types-BN426G4g.d.ts.map +1 -0
- package/dist/types-C8FoyqMN.js +54 -0
- package/dist/types-C8FoyqMN.js.map +1 -0
- package/dist/{types-DWpWltcD.d.cts → types-CX4uOY82.d.ts} +19 -6
- package/dist/types-CX4uOY82.d.ts.map +1 -0
- package/dist/types-ClEPUb_D.d.cts +111 -0
- package/dist/types-ClEPUb_D.d.cts.map +1 -0
- package/dist/{types-rOTvxXQO.d.ts → types-rlmLVpNO.d.cts} +19 -6
- package/dist/types-rlmLVpNO.d.cts.map +1 -0
- package/dist/types-xUmfecYm.cjs +78 -0
- package/dist/types-xUmfecYm.cjs.map +1 -0
- package/dist/{usage-Bw3IN4iE.js → usage-DB-MGezA.js} +18 -5
- package/dist/usage-DB-MGezA.js.map +1 -0
- package/dist/{usage-BZayoeC1.cjs → usage-DRK6TiDr.cjs} +18 -5
- package/dist/usage-DRK6TiDr.cjs.map +1 -0
- package/dist/version-CYYpU4RZ.js +7 -0
- package/dist/version-CYYpU4RZ.js.map +1 -0
- package/dist/version-Ca7qUBih.cjs +19 -0
- package/dist/version-Ca7qUBih.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/config-CEjP2CYO-CZKUamRu.cjs.map +0 -1
- package/dist/config-CEjP2CYO-DNCUeo0R.js.map +0 -1
- package/dist/config-CwE3_vz4.cjs +0 -7
- package/dist/parse-CEJNfXug.js.map +0 -1
- package/dist/parse-DFk2004x.cjs.map +0 -1
- package/dist/resolve-DFUPLqHE.cjs.map +0 -1
- package/dist/resolve-DpUhCbfh.js.map +0 -1
- package/dist/stdio-BG3LYhUm.js.map +0 -1
- package/dist/stdio-CUTR3lwv.cjs.map +0 -1
- package/dist/types-DWpWltcD.d.cts.map +0 -1
- package/dist/types-rOTvxXQO.d.ts.map +0 -1
- package/dist/usage-BZayoeC1.cjs.map +0 -1
- package/dist/usage-Bw3IN4iE.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-B08zZS4X.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,11 +1,7 @@
|
|
|
1
|
+
import { LIB_VERSION } from "./version-CYYpU4RZ.js";
|
|
1
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
2
3
|
import * as Sentry from "@sentry/node";
|
|
3
4
|
|
|
4
|
-
//#region ../mcp-core/dist/version-B3cY5DeW.js
|
|
5
|
-
const LIB_VERSION = typeof process !== "undefined" && "0.29.0" || "0.0.0";
|
|
6
|
-
const USER_AGENT = `sentry-mcp/${LIB_VERSION} (https://mcp.sentry.dev)`;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
5
|
//#region src/transports/stdio.ts
|
|
10
6
|
/**
|
|
11
7
|
* Starts the MCP server with stdio transport and telemetry.
|
|
@@ -51,5 +47,5 @@ async function startStdio(server, context) {
|
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
//#endregion
|
|
54
|
-
export {
|
|
55
|
-
//# sourceMappingURL=stdio-
|
|
50
|
+
export { startStdio };
|
|
51
|
+
//# sourceMappingURL=stdio-CUhyR_jH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-CUhyR_jH.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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __commonJS, require_token_error } from "./token-error-Df8A7mgb.js";
|
|
2
|
+
import { require_token_util } from "./token-util-VkLmCUNV.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
|
|
5
|
+
var require_token = __commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"(exports, module) {
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var token_exports = {};
|
|
27
|
+
__export(token_exports, { refreshToken: () => refreshToken });
|
|
28
|
+
module.exports = __toCommonJS(token_exports);
|
|
29
|
+
var import_token_error = require_token_error();
|
|
30
|
+
var import_token_util = require_token_util();
|
|
31
|
+
async function refreshToken() {
|
|
32
|
+
const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
|
|
33
|
+
let maybeToken = (0, import_token_util.loadToken)(projectId);
|
|
34
|
+
if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
|
|
35
|
+
const authToken = await (0, import_token_util.getVercelCliToken)();
|
|
36
|
+
if (!authToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");
|
|
37
|
+
if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");
|
|
38
|
+
maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
|
|
39
|
+
if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
|
|
40
|
+
(0, import_token_util.saveToken)(maybeToken, projectId);
|
|
41
|
+
}
|
|
42
|
+
process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
} });
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export default require_token();
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=token-D7eiINbV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-D7eiINbV.js","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_exports = {};\n__export(token_exports, {\n refreshToken: () => refreshToken\n});\nmodule.exports = __toCommonJS(token_exports);\nvar import_token_error = require(\"./token-error\");\nvar import_token_util = require(\"./token-util\");\nasync function refreshToken() {\n const { projectId, teamId } = (0, import_token_util.findProjectInfo)();\n let maybeToken = (0, import_token_util.loadToken)(projectId);\n if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {\n const authToken = await (0, import_token_util.getVercelCliToken)();\n if (!authToken) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`\"\n );\n }\n if (!projectId) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Try re-linking your project with `vc link`\"\n );\n }\n maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);\n if (!maybeToken) {\n throw new import_token_error.VercelOidcTokenError(\"Failed to refresh OIDC token\");\n }\n (0, import_token_util.saveToken)(maybeToken, projectId);\n }\n process.env.VERCEL_OIDC_TOKEN = maybeToken.token;\n return;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n refreshToken\n});\n"],"x_google_ignoreList":[0],"mappings":";;;;;CACA,IAAI,YAAY,OAAO;CACvB,IAAI,mBAAmB,OAAO;CAC9B,IAAI,oBAAoB,OAAO;CAC/B,IAAI,eAAe,OAAO,UAAU;CACpC,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,MAAK,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAI,eAAe,CAAC,QAAQ,YAAY,UAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IAAI,gBAAgB,CAAE;AACtB,UAAS,eAAe,EACtB,cAAc,MAAM,aACrB,EAAC;AACF,QAAO,UAAU,aAAa,cAAc;CAC5C,IAAI;CACJ,IAAI;CACJ,eAAe,eAAe;EAC5B,MAAM,EAAE,WAAW,QAAQ,GAAG,CAAC,GAAG,kBAAkB,kBAAkB;EACtE,IAAI,aAAa,CAAC,GAAG,kBAAkB,WAAW,UAAU;AAC5D,OAAK,cAAc,CAAC,GAAG,kBAAkB,WAAW,CAAC,GAAG,kBAAkB,iBAAiB,WAAW,MAAM,CAAC,EAAE;GAC7G,MAAM,YAAY,MAAM,CAAC,GAAG,kBAAkB,oBAAoB;AAClE,QAAK,UACH,OAAM,IAAI,mBAAmB,qBAC3B;AAGJ,QAAK,UACH,OAAM,IAAI,mBAAmB,qBAC3B;AAGJ,gBAAa,MAAM,CAAC,GAAG,kBAAkB,oBAAoB,WAAW,WAAW,OAAO;AAC1F,QAAK,WACH,OAAM,IAAI,mBAAmB,qBAAqB;AAEpD,IAAC,GAAG,kBAAkB,WAAW,YAAY,UAAU;EACxD;AACD,UAAQ,IAAI,oBAAoB,WAAW;AAC3C;CACD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-Cv9WC9bY.cjs');
|
|
2
|
+
const require_token_error$1 = require('./token-error-x_miDBP3.cjs');
|
|
3
|
+
const require_token_util$1 = require('./token-util-oe0G9a-s.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
|
|
6
|
+
var require_token = require_chunk.__commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"(exports, module) {
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: () => from[key],
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var token_exports = {};
|
|
28
|
+
__export(token_exports, { refreshToken: () => refreshToken });
|
|
29
|
+
module.exports = __toCommonJS(token_exports);
|
|
30
|
+
var import_token_error = require_token_error$1.require_token_error();
|
|
31
|
+
var import_token_util = require_token_util$1.require_token_util();
|
|
32
|
+
async function refreshToken() {
|
|
33
|
+
const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
|
|
34
|
+
let maybeToken = (0, import_token_util.loadToken)(projectId);
|
|
35
|
+
if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
|
|
36
|
+
const authToken = await (0, import_token_util.getVercelCliToken)();
|
|
37
|
+
if (!authToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");
|
|
38
|
+
if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");
|
|
39
|
+
maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
|
|
40
|
+
if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
|
|
41
|
+
(0, import_token_util.saveToken)(maybeToken, projectId);
|
|
42
|
+
}
|
|
43
|
+
process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
} });
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
Object.defineProperty(exports, 'default', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return require_token();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=token-Dx4qrxlx.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-Dx4qrxlx.cjs","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_exports = {};\n__export(token_exports, {\n refreshToken: () => refreshToken\n});\nmodule.exports = __toCommonJS(token_exports);\nvar import_token_error = require(\"./token-error\");\nvar import_token_util = require(\"./token-util\");\nasync function refreshToken() {\n const { projectId, teamId } = (0, import_token_util.findProjectInfo)();\n let maybeToken = (0, import_token_util.loadToken)(projectId);\n if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {\n const authToken = await (0, import_token_util.getVercelCliToken)();\n if (!authToken) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`\"\n );\n }\n if (!projectId) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: Try re-linking your project with `vc link`\"\n );\n }\n maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);\n if (!maybeToken) {\n throw new import_token_error.VercelOidcTokenError(\"Failed to refresh OIDC token\");\n }\n (0, import_token_util.saveToken)(maybeToken, projectId);\n }\n process.env.VERCEL_OIDC_TOKEN = maybeToken.token;\n return;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n refreshToken\n});\n"],"x_google_ignoreList":[0],"mappings":";;;;;;CACA,IAAI,YAAY,OAAO;CACvB,IAAI,mBAAmB,OAAO;CAC9B,IAAI,oBAAoB,OAAO;CAC/B,IAAI,eAAe,OAAO,UAAU;CACpC,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,MAAK,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAI,eAAe,CAAC,QAAQ,YAAY,UAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IAAI,gBAAgB,CAAE;AACtB,UAAS,eAAe,EACtB,cAAc,MAAM,aACrB,EAAC;AACF,QAAO,UAAU,aAAa,cAAc;CAC5C,IAAI;CACJ,IAAI;CACJ,eAAe,eAAe;EAC5B,MAAM,EAAE,WAAW,QAAQ,GAAG,CAAC,GAAG,kBAAkB,kBAAkB;EACtE,IAAI,aAAa,CAAC,GAAG,kBAAkB,WAAW,UAAU;AAC5D,OAAK,cAAc,CAAC,GAAG,kBAAkB,WAAW,CAAC,GAAG,kBAAkB,iBAAiB,WAAW,MAAM,CAAC,EAAE;GAC7G,MAAM,YAAY,MAAM,CAAC,GAAG,kBAAkB,oBAAoB;AAClE,QAAK,UACH,OAAM,IAAI,mBAAmB,qBAC3B;AAGJ,QAAK,UACH,OAAM,IAAI,mBAAmB,qBAC3B;AAGJ,gBAAa,MAAM,CAAC,GAAG,kBAAkB,oBAAoB,WAAW,WAAW,OAAO;AAC1F,QAAK,WACH,OAAM,IAAI,mBAAmB,qBAAqB;AAEpD,IAAC,GAAG,kBAAkB,WAAW,YAAY,UAAU;EACxD;AACD,UAAQ,IAAI,oBAAoB,WAAW;AAC3C;CACD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
|
|
5
|
+
//#region src/auth/token-cache.ts
|
|
6
|
+
/** Safety window: treat tokens as expired 5 minutes before actual expiry. */
|
|
7
|
+
const EXPIRY_SAFETY_MS = 5 * 60 * 1e3;
|
|
8
|
+
function getCacheFilePath() {
|
|
9
|
+
if (process.env.SENTRY_MCP_AUTH_CACHE) return process.env.SENTRY_MCP_AUTH_CACHE;
|
|
10
|
+
return path.join(os.homedir(), ".sentry", "mcp.json");
|
|
11
|
+
}
|
|
12
|
+
function cacheKey(host, clientId) {
|
|
13
|
+
return `${host}:${clientId}`;
|
|
14
|
+
}
|
|
15
|
+
async function readCacheFile() {
|
|
16
|
+
try {
|
|
17
|
+
const raw = await fs.readFile(getCacheFilePath(), "utf-8");
|
|
18
|
+
return JSON.parse(raw);
|
|
19
|
+
} catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function writeCacheFile(data) {
|
|
24
|
+
const filePath = getCacheFilePath();
|
|
25
|
+
const dir = path.dirname(filePath);
|
|
26
|
+
await fs.mkdir(dir, {
|
|
27
|
+
recursive: true,
|
|
28
|
+
mode: 448
|
|
29
|
+
});
|
|
30
|
+
const tmpPath = `${filePath}.tmp.${process.pid}`;
|
|
31
|
+
await fs.writeFile(tmpPath, JSON.stringify(data, null, 2), {
|
|
32
|
+
encoding: "utf-8",
|
|
33
|
+
mode: 384
|
|
34
|
+
});
|
|
35
|
+
await fs.rename(tmpPath, filePath);
|
|
36
|
+
}
|
|
37
|
+
async function readCachedToken(host, clientId) {
|
|
38
|
+
const data = await readCacheFile();
|
|
39
|
+
const key = cacheKey(host, clientId);
|
|
40
|
+
const entry = data[key];
|
|
41
|
+
if (!entry) return null;
|
|
42
|
+
const expiresAt = new Date(entry.expires_at).getTime();
|
|
43
|
+
if (!Number.isFinite(expiresAt) || expiresAt - Date.now() <= EXPIRY_SAFETY_MS) {
|
|
44
|
+
delete data[key];
|
|
45
|
+
await writeCacheFile(data);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return entry;
|
|
49
|
+
}
|
|
50
|
+
async function writeCachedToken(token) {
|
|
51
|
+
const data = await readCacheFile();
|
|
52
|
+
data[cacheKey(token.sentry_host, token.client_id)] = token;
|
|
53
|
+
await writeCacheFile(data);
|
|
54
|
+
}
|
|
55
|
+
async function clearCachedToken(host, clientId) {
|
|
56
|
+
const data = await readCacheFile();
|
|
57
|
+
const key = cacheKey(host, clientId);
|
|
58
|
+
if (key in data) {
|
|
59
|
+
delete data[key];
|
|
60
|
+
await writeCacheFile(data);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { clearCachedToken, readCachedToken, writeCachedToken };
|
|
66
|
+
//# sourceMappingURL=token-cache-BTEUyVx2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-cache-BTEUyVx2.js","names":["host: string","clientId: string","data: CacheFile","token: CachedToken"],"sources":["../src/auth/token-cache.ts"],"sourcesContent":["/**\n * Persistent token cache for device code auth.\n * Tokens are stored at ~/.sentry/mcp.json, keyed by {host}:{clientId}.\n * See docs/stdio-auth.md for cache format and security details.\n */\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport type { CachedToken } from \"./types\";\n\n/** Safety window: treat tokens as expired 5 minutes before actual expiry. */\nconst EXPIRY_SAFETY_MS = 5 * 60 * 1000;\n\nfunction getCacheFilePath(): string {\n if (process.env.SENTRY_MCP_AUTH_CACHE) {\n return process.env.SENTRY_MCP_AUTH_CACHE;\n }\n return path.join(os.homedir(), \".sentry\", \"mcp.json\");\n}\n\nfunction cacheKey(host: string, clientId: string): string {\n return `${host}:${clientId}`;\n}\n\ntype CacheFile = Record<string, CachedToken>;\n\nasync function readCacheFile(): Promise<CacheFile> {\n try {\n const raw = await fs.readFile(getCacheFilePath(), \"utf-8\");\n return JSON.parse(raw) as CacheFile;\n } catch {\n return {};\n }\n}\n\nasync function writeCacheFile(data: CacheFile): Promise<void> {\n const filePath = getCacheFilePath();\n const dir = path.dirname(filePath);\n\n await fs.mkdir(dir, { recursive: true, mode: 0o700 });\n\n // Atomic write: write to temp file then rename\n const tmpPath = `${filePath}.tmp.${process.pid}`;\n await fs.writeFile(tmpPath, JSON.stringify(data, null, 2), {\n encoding: \"utf-8\",\n mode: 0o600,\n });\n await fs.rename(tmpPath, filePath);\n}\n\nexport async function readCachedToken(\n host: string,\n clientId: string,\n): Promise<CachedToken | null> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n const entry = data[key];\n if (!entry) return null;\n\n const expiresAt = new Date(entry.expires_at).getTime();\n if (\n !Number.isFinite(expiresAt) ||\n expiresAt - Date.now() <= EXPIRY_SAFETY_MS\n ) {\n delete data[key];\n await writeCacheFile(data);\n return null;\n }\n\n return entry;\n}\n\nexport async function writeCachedToken(token: CachedToken): Promise<void> {\n const data = await readCacheFile();\n data[cacheKey(token.sentry_host, token.client_id)] = token;\n await writeCacheFile(data);\n}\n\nexport async function clearCachedToken(\n host: string,\n clientId: string,\n): Promise<void> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n if (key in data) {\n delete data[key];\n await writeCacheFile(data);\n }\n}\n"],"mappings":";;;;;;AAWA,MAAM,mBAAmB,IAAI,KAAK;AAElC,SAAS,mBAA2B;AAClC,KAAI,QAAQ,IAAI,sBACd,QAAO,QAAQ,IAAI;AAErB,QAAO,KAAK,KAAK,GAAG,SAAS,EAAE,WAAW,WAAW;AACtD;AAED,SAAS,SAASA,MAAcC,UAA0B;AACxD,WAAU,KAAK,GAAG;AACnB;AAID,eAAe,gBAAoC;AACjD,KAAI;EACF,MAAM,MAAM,MAAM,GAAG,SAAS,kBAAkB,EAAE,QAAQ;AAC1D,SAAO,KAAK,MAAM,IAAI;CACvB,QAAO;AACN,SAAO,CAAE;CACV;AACF;AAED,eAAe,eAAeC,MAAgC;CAC5D,MAAM,WAAW,kBAAkB;CACnC,MAAM,MAAM,KAAK,QAAQ,SAAS;AAElC,OAAM,GAAG,MAAM,KAAK;EAAE,WAAW;EAAM,MAAM;CAAO,EAAC;CAGrD,MAAM,aAAa,SAAS,OAAO,QAAQ;AAC3C,OAAM,GAAG,UAAU,SAAS,KAAK,UAAU,MAAM,MAAM,EAAE,EAAE;EACzD,UAAU;EACV,MAAM;CACP,EAAC;AACF,OAAM,GAAG,OAAO,SAAS,SAAS;AACnC;AAED,eAAsB,gBACpBF,MACAC,UAC6B;CAC7B,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;CACpC,MAAM,QAAQ,KAAK;AACnB,MAAK,MAAO,QAAO;CAEnB,MAAM,YAAY,IAAI,KAAK,MAAM,YAAY,SAAS;AACtD,MACG,OAAO,SAAS,UAAU,IAC3B,YAAY,KAAK,KAAK,IAAI,kBAC1B;AACA,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;AAC1B,SAAO;CACR;AAED,QAAO;AACR;AAED,eAAsB,iBAAiBE,OAAmC;CACxE,MAAM,OAAO,MAAM,eAAe;AAClC,MAAK,SAAS,MAAM,aAAa,MAAM,UAAU,IAAI;AACrD,OAAM,eAAe,KAAK;AAC3B;AAED,eAAsB,iBACpBH,MACAC,UACe;CACf,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;AACpC,KAAI,OAAO,MAAM;AACf,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;CAC3B;AACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-Cv9WC9bY.cjs');
|
|
2
|
+
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
3
|
+
const node_path = require_chunk.__toESM(require("node:path"));
|
|
4
|
+
const node_os = require_chunk.__toESM(require("node:os"));
|
|
5
|
+
|
|
6
|
+
//#region src/auth/token-cache.ts
|
|
7
|
+
/** Safety window: treat tokens as expired 5 minutes before actual expiry. */
|
|
8
|
+
const EXPIRY_SAFETY_MS = 5 * 60 * 1e3;
|
|
9
|
+
function getCacheFilePath() {
|
|
10
|
+
if (process.env.SENTRY_MCP_AUTH_CACHE) return process.env.SENTRY_MCP_AUTH_CACHE;
|
|
11
|
+
return node_path.join(node_os.homedir(), ".sentry", "mcp.json");
|
|
12
|
+
}
|
|
13
|
+
function cacheKey(host, clientId) {
|
|
14
|
+
return `${host}:${clientId}`;
|
|
15
|
+
}
|
|
16
|
+
async function readCacheFile() {
|
|
17
|
+
try {
|
|
18
|
+
const raw = await node_fs_promises.readFile(getCacheFilePath(), "utf-8");
|
|
19
|
+
return JSON.parse(raw);
|
|
20
|
+
} catch {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function writeCacheFile(data) {
|
|
25
|
+
const filePath = getCacheFilePath();
|
|
26
|
+
const dir = node_path.dirname(filePath);
|
|
27
|
+
await node_fs_promises.mkdir(dir, {
|
|
28
|
+
recursive: true,
|
|
29
|
+
mode: 448
|
|
30
|
+
});
|
|
31
|
+
const tmpPath = `${filePath}.tmp.${process.pid}`;
|
|
32
|
+
await node_fs_promises.writeFile(tmpPath, JSON.stringify(data, null, 2), {
|
|
33
|
+
encoding: "utf-8",
|
|
34
|
+
mode: 384
|
|
35
|
+
});
|
|
36
|
+
await node_fs_promises.rename(tmpPath, filePath);
|
|
37
|
+
}
|
|
38
|
+
async function readCachedToken(host, clientId) {
|
|
39
|
+
const data = await readCacheFile();
|
|
40
|
+
const key = cacheKey(host, clientId);
|
|
41
|
+
const entry = data[key];
|
|
42
|
+
if (!entry) return null;
|
|
43
|
+
const expiresAt = new Date(entry.expires_at).getTime();
|
|
44
|
+
if (!Number.isFinite(expiresAt) || expiresAt - Date.now() <= EXPIRY_SAFETY_MS) {
|
|
45
|
+
delete data[key];
|
|
46
|
+
await writeCacheFile(data);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return entry;
|
|
50
|
+
}
|
|
51
|
+
async function writeCachedToken(token) {
|
|
52
|
+
const data = await readCacheFile();
|
|
53
|
+
data[cacheKey(token.sentry_host, token.client_id)] = token;
|
|
54
|
+
await writeCacheFile(data);
|
|
55
|
+
}
|
|
56
|
+
async function clearCachedToken(host, clientId) {
|
|
57
|
+
const data = await readCacheFile();
|
|
58
|
+
const key = cacheKey(host, clientId);
|
|
59
|
+
if (key in data) {
|
|
60
|
+
delete data[key];
|
|
61
|
+
await writeCacheFile(data);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
Object.defineProperty(exports, 'clearCachedToken', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return clearCachedToken;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, 'readCachedToken', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return readCachedToken;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, 'writeCachedToken', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return writeCachedToken;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=token-cache-iqkTOca3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-cache-iqkTOca3.cjs","names":["host: string","clientId: string","data: CacheFile","token: CachedToken"],"sources":["../src/auth/token-cache.ts"],"sourcesContent":["/**\n * Persistent token cache for device code auth.\n * Tokens are stored at ~/.sentry/mcp.json, keyed by {host}:{clientId}.\n * See docs/stdio-auth.md for cache format and security details.\n */\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport type { CachedToken } from \"./types\";\n\n/** Safety window: treat tokens as expired 5 minutes before actual expiry. */\nconst EXPIRY_SAFETY_MS = 5 * 60 * 1000;\n\nfunction getCacheFilePath(): string {\n if (process.env.SENTRY_MCP_AUTH_CACHE) {\n return process.env.SENTRY_MCP_AUTH_CACHE;\n }\n return path.join(os.homedir(), \".sentry\", \"mcp.json\");\n}\n\nfunction cacheKey(host: string, clientId: string): string {\n return `${host}:${clientId}`;\n}\n\ntype CacheFile = Record<string, CachedToken>;\n\nasync function readCacheFile(): Promise<CacheFile> {\n try {\n const raw = await fs.readFile(getCacheFilePath(), \"utf-8\");\n return JSON.parse(raw) as CacheFile;\n } catch {\n return {};\n }\n}\n\nasync function writeCacheFile(data: CacheFile): Promise<void> {\n const filePath = getCacheFilePath();\n const dir = path.dirname(filePath);\n\n await fs.mkdir(dir, { recursive: true, mode: 0o700 });\n\n // Atomic write: write to temp file then rename\n const tmpPath = `${filePath}.tmp.${process.pid}`;\n await fs.writeFile(tmpPath, JSON.stringify(data, null, 2), {\n encoding: \"utf-8\",\n mode: 0o600,\n });\n await fs.rename(tmpPath, filePath);\n}\n\nexport async function readCachedToken(\n host: string,\n clientId: string,\n): Promise<CachedToken | null> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n const entry = data[key];\n if (!entry) return null;\n\n const expiresAt = new Date(entry.expires_at).getTime();\n if (\n !Number.isFinite(expiresAt) ||\n expiresAt - Date.now() <= EXPIRY_SAFETY_MS\n ) {\n delete data[key];\n await writeCacheFile(data);\n return null;\n }\n\n return entry;\n}\n\nexport async function writeCachedToken(token: CachedToken): Promise<void> {\n const data = await readCacheFile();\n data[cacheKey(token.sentry_host, token.client_id)] = token;\n await writeCacheFile(data);\n}\n\nexport async function clearCachedToken(\n host: string,\n clientId: string,\n): Promise<void> {\n const data = await readCacheFile();\n const key = cacheKey(host, clientId);\n if (key in data) {\n delete data[key];\n await writeCacheFile(data);\n }\n}\n"],"mappings":";;;;;;;AAWA,MAAM,mBAAmB,IAAI,KAAK;AAElC,SAAS,mBAA2B;AAClC,KAAI,QAAQ,IAAI,sBACd,QAAO,QAAQ,IAAI;AAErB,QAAO,UAAK,KAAK,QAAG,SAAS,EAAE,WAAW,WAAW;AACtD;AAED,SAAS,SAASA,MAAcC,UAA0B;AACxD,WAAU,KAAK,GAAG;AACnB;AAID,eAAe,gBAAoC;AACjD,KAAI;EACF,MAAM,MAAM,MAAM,iBAAG,SAAS,kBAAkB,EAAE,QAAQ;AAC1D,SAAO,KAAK,MAAM,IAAI;CACvB,QAAO;AACN,SAAO,CAAE;CACV;AACF;AAED,eAAe,eAAeC,MAAgC;CAC5D,MAAM,WAAW,kBAAkB;CACnC,MAAM,MAAM,UAAK,QAAQ,SAAS;AAElC,OAAM,iBAAG,MAAM,KAAK;EAAE,WAAW;EAAM,MAAM;CAAO,EAAC;CAGrD,MAAM,aAAa,SAAS,OAAO,QAAQ;AAC3C,OAAM,iBAAG,UAAU,SAAS,KAAK,UAAU,MAAM,MAAM,EAAE,EAAE;EACzD,UAAU;EACV,MAAM;CACP,EAAC;AACF,OAAM,iBAAG,OAAO,SAAS,SAAS;AACnC;AAED,eAAsB,gBACpBF,MACAC,UAC6B;CAC7B,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;CACpC,MAAM,QAAQ,KAAK;AACnB,MAAK,MAAO,QAAO;CAEnB,MAAM,YAAY,IAAI,KAAK,MAAM,YAAY,SAAS;AACtD,MACG,OAAO,SAAS,UAAU,IAC3B,YAAY,KAAK,KAAK,IAAI,kBAC1B;AACA,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;AAC1B,SAAO;CACR;AAED,QAAO;AACR;AAED,eAAsB,iBAAiBE,OAAmC;CACxE,MAAM,OAAO,MAAM,eAAe;AAClC,MAAK,SAAS,MAAM,aAAa,MAAM,UAAU,IAAI;AACrD,OAAM,eAAe,KAAK;AAC3B;AAED,eAAsB,iBACpBH,MACAC,UACe;CACf,MAAM,OAAO,MAAM,eAAe;CAClC,MAAM,MAAM,SAAS,MAAM,SAAS;AACpC,KAAI,OAAO,MAAM;AACf,SAAO,KAAK;AACZ,QAAM,eAAe,KAAK;CAC3B;AACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp$1 = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames$1 = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJS = (cb, mod) => function() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames$1(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __export$1 = (target, all) => {
|
|
14
|
+
for (var name in all) __defProp$1(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
var __copyProps$1 = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
|
|
34
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js
|
|
38
|
+
var require_token_error = __commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
|
|
39
|
+
var __defProp = Object.defineProperty;
|
|
40
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
41
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
42
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
43
|
+
var __export = (target, all) => {
|
|
44
|
+
for (var name in all) __defProp(target, name, {
|
|
45
|
+
get: all[name],
|
|
46
|
+
enumerable: true
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __copyProps = (to, from, except, desc) => {
|
|
50
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
52
|
+
get: () => from[key],
|
|
53
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return to;
|
|
57
|
+
};
|
|
58
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
59
|
+
var token_error_exports = {};
|
|
60
|
+
__export(token_error_exports, { VercelOidcTokenError: () => VercelOidcTokenError });
|
|
61
|
+
module.exports = __toCommonJS(token_error_exports);
|
|
62
|
+
var VercelOidcTokenError = class extends Error {
|
|
63
|
+
constructor(message, cause) {
|
|
64
|
+
super(message);
|
|
65
|
+
this.name = "VercelOidcTokenError";
|
|
66
|
+
this.cause = cause;
|
|
67
|
+
}
|
|
68
|
+
toString() {
|
|
69
|
+
if (this.cause) return `${this.name}: ${this.message}: ${this.cause}`;
|
|
70
|
+
return `${this.name}: ${this.message}`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
} });
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { __commonJS, __export$1 as __export, __require, __toDynamicImportESM, __toESM, require_token_error };
|
|
77
|
+
//# sourceMappingURL=token-error-Df8A7mgb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-error-Df8A7mgb.js","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,IAAI,YAAY,OAAO;CACvB,IAAI,mBAAmB,OAAO;CAC9B,IAAI,oBAAoB,OAAO;CAC/B,IAAI,eAAe,OAAO,UAAU;CACpC,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,MAAK,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAI,eAAe,CAAC,QAAQ,YAAY,UAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IAAI,sBAAsB,CAAE;AAC5B,UAAS,qBAAqB,EAC5B,sBAAsB,MAAM,qBAC7B,EAAC;AACF,QAAO,UAAU,aAAa,oBAAoB;CAClD,IAAM,uBAAN,cAAmC,MAAM;EACvC,YAAY,SAAS,OAAO;AAC1B,SAAM,QAAQ;AACd,QAAK,OAAO;AACZ,QAAK,QAAQ;EACd;EACD,WAAW;AACT,OAAI,KAAK,MACP,WAAU,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK;AAEhD,aAAU,KAAK,KAAK,IAAI,KAAK;EAC9B;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-Cv9WC9bY.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js
|
|
4
|
+
var require_token_error = require_chunk.__commonJS({ "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var token_error_exports = {};
|
|
26
|
+
__export(token_error_exports, { VercelOidcTokenError: () => VercelOidcTokenError });
|
|
27
|
+
module.exports = __toCommonJS(token_error_exports);
|
|
28
|
+
var VercelOidcTokenError = class extends Error {
|
|
29
|
+
constructor(message, cause) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = "VercelOidcTokenError";
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
if (this.cause) return `${this.name}: ${this.message}: ${this.cause}`;
|
|
36
|
+
return `${this.name}: ${this.message}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
} });
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
Object.defineProperty(exports, 'require_token_error', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return require_token_error;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=token-error-x_miDBP3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-error-x_miDBP3.cjs","names":[],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token-error.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n"],"x_google_ignoreList":[0],"mappings":";;;;CACA,IAAI,YAAY,OAAO;CACvB,IAAI,mBAAmB,OAAO;CAC9B,IAAI,oBAAoB,OAAO;CAC/B,IAAI,eAAe,OAAO,UAAU;CACpC,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,WAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;EAAM,EAAC;CAChE;CACD,IAAI,cAAc,CAAC,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,eAAe,SAAS,mBAAmB,SAAS,YACtD;QAAK,IAAI,OAAO,kBAAkB,KAAK,CACrC,MAAK,aAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,WAAU,IAAI,KAAK;IAAE,KAAK,MAAM,KAAK;IAAM,cAAc,OAAO,iBAAiB,MAAM,IAAI,KAAK,KAAK;GAAY,EAAC;EAAC;AAEzH,SAAO;CACR;CACD,IAAI,eAAe,CAAC,QAAQ,YAAY,UAAU,CAAE,GAAE,cAAc,EAAE,OAAO,KAAM,EAAC,EAAE,IAAI;CAC1F,IAAI,sBAAsB,CAAE;AAC5B,UAAS,qBAAqB,EAC5B,sBAAsB,MAAM,qBAC7B,EAAC;AACF,QAAO,UAAU,aAAa,oBAAoB;CAClD,IAAM,uBAAN,cAAmC,MAAM;EACvC,YAAY,SAAS,OAAO;AAC1B,SAAM,QAAQ;AACd,QAAK,OAAO;AACZ,QAAK,QAAQ;EACd;EACD,WAAW;AACT,OAAI,KAAK,MACP,WAAU,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK;AAEhD,aAAU,KAAK,KAAK,IAAI,KAAK;EAC9B;CACF"}
|