@sentry/mcp-server 0.10.0 → 0.12.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/api-client/client.cjs +4 -4
- package/dist/api-client/client.d.cts +3 -3
- package/dist/api-client/client.d.ts +3 -3
- package/dist/api-client/client.js +2 -2
- package/dist/api-client/client.test.cjs +8 -9
- package/dist/api-client/client.test.cjs.map +1 -1
- package/dist/api-client/client.test.js +4 -4
- package/dist/api-client/index.cjs +41 -38
- package/dist/api-client/index.d.cts +4 -4
- package/dist/api-client/index.d.ts +4 -4
- package/dist/api-client/index.js +5 -5
- package/dist/api-client/schema.cjs +36 -33
- package/dist/api-client/schema.d.cts +2 -2
- package/dist/api-client/schema.d.ts +2 -2
- package/dist/api-client/schema.js +2 -2
- package/dist/api-client/types.cjs +1 -1
- package/dist/api-client/types.d.cts +3 -3
- package/dist/api-client/types.d.ts +3 -3
- package/dist/api-client/types.js +1 -1
- package/dist/{chunk-CsIcISPO.js → chunk-BLXvPPr8.js} +1 -1
- package/dist/{chunk-BtT13l48.cjs → chunk-DWy1uDak.cjs} +0 -1
- package/dist/client-4jq_wVgn.d.ts +522 -0
- package/dist/client-4jq_wVgn.d.ts.map +1 -0
- package/dist/client-B7vZ6JMk.cjs +572 -0
- package/dist/client-B7vZ6JMk.cjs.map +1 -0
- package/dist/client-CAoHZbyK.js +561 -0
- package/dist/client-CAoHZbyK.js.map +1 -0
- package/dist/client-DkY0ifZf.d.cts +522 -0
- package/dist/client-DkY0ifZf.d.cts.map +1 -0
- package/dist/{dist-wiyJYfAH.cjs → dist-BlIWGSIM.cjs} +318 -164
- package/dist/dist-BlIWGSIM.cjs.map +1 -0
- package/dist/{dist-BKh-M1A1.js → dist-DDpQABxe.js} +318 -163
- package/dist/dist-DDpQABxe.js.map +1 -0
- package/dist/errors-B9fwS-aP.cjs +21 -0
- package/dist/errors-B9fwS-aP.cjs.map +1 -0
- package/dist/errors-BJSrT6Ou.js +15 -0
- package/dist/errors-BJSrT6Ou.js.map +1 -0
- package/dist/errors.cjs +3 -0
- package/dist/errors.d.cts +12 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +3 -0
- package/dist/errors.test.cjs +24 -0
- package/dist/errors.test.cjs.map +1 -0
- package/dist/errors.test.d.cts +1 -0
- package/dist/errors.test.d.ts +1 -0
- package/dist/errors.test.js +24 -0
- package/dist/errors.test.js.map +1 -0
- package/dist/{formatting-ggD6YRYR.js → formatting-BaARL2gT.js} +1 -1
- package/dist/formatting-BaARL2gT.js.map +1 -0
- package/dist/{formatting-B0SJqiqX.cjs → formatting-C2kN0ok6.cjs} +1 -2
- package/dist/formatting-C2kN0ok6.cjs.map +1 -0
- package/dist/index.cjs +19 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/formatting.cjs +4 -4
- package/dist/internal/formatting.d.cts +5 -5
- package/dist/internal/formatting.d.cts.map +1 -1
- package/dist/internal/formatting.d.ts +5 -5
- package/dist/internal/formatting.d.ts.map +1 -1
- package/dist/internal/formatting.js +1 -1
- package/dist/internal/issue-helpers.cjs +4 -4
- package/dist/internal/issue-helpers.d.cts +10 -2
- package/dist/internal/issue-helpers.d.cts.map +1 -1
- package/dist/internal/issue-helpers.d.ts +10 -2
- package/dist/internal/issue-helpers.d.ts.map +1 -1
- package/dist/internal/issue-helpers.js +1 -1
- package/dist/internal/issue-helpers.test.cjs +21 -25
- package/dist/internal/issue-helpers.test.cjs.map +1 -1
- package/dist/internal/issue-helpers.test.js +5 -8
- package/dist/internal/issue-helpers.test.js.map +1 -1
- package/dist/{issue-helpers-CyoHu5j4.js → issue-helpers-BMVLc3mR.js} +16 -2
- package/dist/issue-helpers-BMVLc3mR.js.map +1 -0
- package/dist/{issue-helpers-DbsECZFq.cjs → issue-helpers-D712fGT2.cjs} +16 -3
- package/dist/issue-helpers-D712fGT2.cjs.map +1 -0
- package/dist/{logging-BEMgC5SA.cjs → logging-ByvSjT6V.cjs} +2 -3
- package/dist/logging-ByvSjT6V.cjs.map +1 -0
- package/dist/{logging-Cxm8lQvg.js → logging-CXLD0FFB.js} +1 -1
- package/dist/logging-CXLD0FFB.js.map +1 -0
- package/dist/logging.cjs +2 -2
- package/dist/logging.d.cts +31 -3
- package/dist/logging.d.cts.map +1 -1
- package/dist/logging.d.ts +31 -3
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +1 -1
- package/dist/{magic-string.es-m-ldRjOa.cjs → magic-string.es-CybcVAw7.cjs} +2 -3
- package/dist/{magic-string.es-m-ldRjOa.cjs.map → magic-string.es-CybcVAw7.cjs.map} +1 -1
- package/dist/{promptDefinitions-pHRpPOpJ.cjs → promptDefinitions-BTLIBcGt.cjs} +10 -4
- package/dist/promptDefinitions-BTLIBcGt.cjs.map +1 -0
- package/dist/{promptDefinitions-tpKruPny.d.ts → promptDefinitions-CF2VWdQ6.d.cts} +12 -4
- package/dist/promptDefinitions-CF2VWdQ6.d.cts.map +1 -0
- package/dist/{promptDefinitions-BR7PxWcH.d.cts → promptDefinitions-D5FSQckL.d.ts} +11 -3
- package/dist/promptDefinitions-D5FSQckL.d.ts.map +1 -0
- package/dist/{promptDefinitions-DBNOeSg-.js → promptDefinitions-D8yow1m0.js} +9 -2
- package/dist/promptDefinitions-D8yow1m0.js.map +1 -0
- package/dist/promptDefinitions.cjs +3 -3
- package/dist/promptDefinitions.d.cts +1 -1
- package/dist/promptDefinitions.d.ts +1 -1
- package/dist/promptDefinitions.js +2 -2
- package/dist/{prompts-nfFU-zY-.cjs → prompts-CDbQrutV.cjs} +3 -3
- package/dist/prompts-CDbQrutV.cjs.map +1 -0
- package/dist/{prompts-DgWOD2rU.js → prompts-Dt3A8Qfl.js} +4 -2
- package/dist/prompts-Dt3A8Qfl.js.map +1 -0
- package/dist/prompts.cjs +3 -2
- package/dist/prompts.d.cts +4 -5
- package/dist/prompts.d.cts.map +1 -1
- package/dist/prompts.d.ts +4 -5
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +2 -1
- package/dist/{resources-OM3EAnnj.js → resources-Bol20Xuo.js} +13 -1
- package/dist/resources-Bol20Xuo.js.map +1 -0
- package/dist/{resources-BAE7VVZZ.cjs → resources-DNyoutxH.cjs} +13 -2
- package/dist/resources-DNyoutxH.cjs.map +1 -0
- package/dist/resources.cjs +2 -2
- package/dist/resources.d.cts +9 -1
- package/dist/resources.d.cts.map +1 -1
- package/dist/resources.d.ts +9 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +1 -1
- package/dist/{schema-B7A-FyIi.d.ts → schema-BJv7kREf.d.cts} +215 -68
- package/dist/schema-BJv7kREf.d.cts.map +1 -0
- package/dist/{schema-jk88gqOu.cjs → schema-BTfISwFu.cjs} +30 -4
- package/dist/schema-BTfISwFu.cjs.map +1 -0
- package/dist/{schema-PvgLrC1b.d.cts → schema-BnxGHL_i.d.ts} +215 -68
- package/dist/schema-BnxGHL_i.d.ts.map +1 -0
- package/dist/{schema-3VLYcf4D.cjs → schema-BsvGMALe.cjs} +59 -8
- package/dist/schema-BsvGMALe.cjs.map +1 -0
- package/dist/{schema-Dltbjui7.js → schema-C_hp0BR7.js} +41 -7
- package/dist/schema-C_hp0BR7.js.map +1 -0
- package/dist/schema-Dv6aLZgz.js +32 -0
- package/dist/schema-Dv6aLZgz.js.map +1 -0
- package/dist/schema.cjs +13 -11
- package/dist/schema.d.cts +14 -5
- package/dist/schema.d.cts.map +1 -1
- package/dist/schema.d.ts +14 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/{server-yb4PkNyo.js → server-C7cHq_pc.js} +82 -27
- package/dist/server-C7cHq_pc.js.map +1 -0
- package/dist/{server-VwFSUPQn.cjs → server-DeutbO8v.cjs} +83 -29
- package/dist/server-DeutbO8v.cjs.map +1 -0
- package/dist/server.cjs +16 -15
- package/dist/server.d.cts +24 -6
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +24 -6
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +15 -14
- package/dist/stdio-B73CCTly.cjs +47 -0
- package/dist/stdio-B73CCTly.cjs.map +1 -0
- package/dist/stdio-ZQLC-i5Q.js +41 -0
- package/dist/stdio-ZQLC-i5Q.js.map +1 -0
- package/dist/test-setup.cjs +653 -438
- package/dist/test-setup.cjs.map +1 -1
- package/dist/test-setup.js +653 -438
- package/dist/test-setup.js.map +1 -1
- package/dist/{toolDefinitions-B94CNDbt.d.cts → toolDefinitions-BOMF-zIC.d.ts} +148 -18
- package/dist/toolDefinitions-BOMF-zIC.d.ts.map +1 -0
- package/dist/{toolDefinitions-DIhvw3vk.cjs → toolDefinitions-CUegGcWU.cjs} +128 -7
- package/dist/toolDefinitions-CUegGcWU.cjs.map +1 -0
- package/dist/{toolDefinitions-Bb_1ejkl.js → toolDefinitions-DFAxp3nr.js} +127 -5
- package/dist/toolDefinitions-DFAxp3nr.js.map +1 -0
- package/dist/{toolDefinitions-q_1-70fG.d.ts → toolDefinitions-Ipvr4Acw.d.cts} +149 -19
- package/dist/toolDefinitions-Ipvr4Acw.d.cts.map +1 -0
- package/dist/toolDefinitions.cjs +3 -3
- package/dist/toolDefinitions.d.cts +1 -1
- package/dist/toolDefinitions.d.ts +1 -1
- package/dist/toolDefinitions.js +2 -2
- package/dist/toolDefinitions.test.cjs +3 -4
- package/dist/toolDefinitions.test.cjs.map +1 -1
- package/dist/toolDefinitions.test.js +3 -3
- package/dist/{tools-CMFpMPpD.js → tools-DpiQwSTY.js} +156 -13
- package/dist/tools-DpiQwSTY.js.map +1 -0
- package/dist/{tools-BdkmyaZo.cjs → tools-DyOqlsCW.cjs} +157 -15
- package/dist/tools-DyOqlsCW.cjs.map +1 -0
- package/dist/tools.cjs +10 -9
- package/dist/tools.d.cts +121 -8
- package/dist/tools.d.cts.map +1 -1
- package/dist/tools.d.ts +121 -8
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +9 -8
- package/dist/tools.test.cjs +330 -35
- package/dist/tools.test.cjs.map +1 -1
- package/dist/tools.test.js +311 -15
- package/dist/tools.test.js.map +1 -1
- package/dist/transports/stdio.cjs +17 -16
- package/dist/transports/stdio.d.cts +27 -6
- package/dist/transports/stdio.d.cts.map +1 -1
- package/dist/transports/stdio.d.ts +27 -6
- package/dist/transports/stdio.d.ts.map +1 -1
- package/dist/transports/stdio.js +16 -15
- package/dist/{types-jftb-CP9.d.ts → types-D5TPcOfv.d.ts} +4 -4
- package/dist/types-D5TPcOfv.d.ts.map +1 -0
- package/dist/{types-OeoNXRm-.d.cts → types-DRF2IoP_.d.cts} +4 -4
- package/dist/types-DRF2IoP_.d.cts.map +1 -0
- package/dist/{types-B03G337q.d.cts → types-Daq2fm0E.d.ts} +7 -5
- package/dist/types-Daq2fm0E.d.ts.map +1 -0
- package/dist/{types-CN4NEway.d.ts → types-NIQW7KyF.d.cts} +7 -5
- package/dist/types-NIQW7KyF.d.cts.map +1 -0
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/{version-CDnh7DyW.cjs → version-BNmubeQI.cjs} +2 -3
- package/dist/{version-CDnh7DyW.cjs.map → version-BNmubeQI.cjs.map} +1 -1
- package/dist/version-CRto5Sn_.js +6 -0
- package/dist/{version-TjO7fHpC.js.map → version-CRto5Sn_.js.map} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.d.cts +1 -2
- package/dist/version.d.cts.map +1 -1
- package/dist/version.d.ts +1 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/{vi.ClIskdbk-De9q3829.js → vi.bdSIJ99Y-BfJr7I2s.js} +241 -171
- package/dist/vi.bdSIJ99Y-BfJr7I2s.js.map +1 -0
- package/dist/{vi.ClIskdbk-Bs263gvI.cjs → vi.bdSIJ99Y-Dft_B_Ta.cjs} +243 -182
- package/dist/vi.bdSIJ99Y-Dft_B_Ta.cjs.map +1 -0
- package/package.json +8 -8
- package/dist/client-B4Ux5Zdg.cjs +0 -227
- package/dist/client-B4Ux5Zdg.cjs.map +0 -1
- package/dist/client-Bz_PNC8o.js +0 -215
- package/dist/client-Bz_PNC8o.js.map +0 -1
- package/dist/client-J6VSRmQS.d.ts +0 -177
- package/dist/client-J6VSRmQS.d.ts.map +0 -1
- package/dist/client-tE6FD__9.d.cts +0 -177
- package/dist/client-tE6FD__9.d.cts.map +0 -1
- package/dist/dist-BKh-M1A1.js.map +0 -1
- package/dist/dist-wiyJYfAH.cjs.map +0 -1
- package/dist/formatting-B0SJqiqX.cjs.map +0 -1
- package/dist/formatting-ggD6YRYR.js.map +0 -1
- package/dist/issue-helpers-CyoHu5j4.js.map +0 -1
- package/dist/issue-helpers-DbsECZFq.cjs.map +0 -1
- package/dist/logging-BEMgC5SA.cjs.map +0 -1
- package/dist/logging-Cxm8lQvg.js.map +0 -1
- package/dist/promptDefinitions-BR7PxWcH.d.cts.map +0 -1
- package/dist/promptDefinitions-DBNOeSg-.js.map +0 -1
- package/dist/promptDefinitions-pHRpPOpJ.cjs.map +0 -1
- package/dist/promptDefinitions-tpKruPny.d.ts.map +0 -1
- package/dist/prompts-DgWOD2rU.js.map +0 -1
- package/dist/prompts-nfFU-zY-.cjs.map +0 -1
- package/dist/resources-BAE7VVZZ.cjs.map +0 -1
- package/dist/resources-OM3EAnnj.js.map +0 -1
- package/dist/schema-3VLYcf4D.cjs.map +0 -1
- package/dist/schema-B7A-FyIi.d.ts.map +0 -1
- package/dist/schema-BKa41TQ4.js +0 -17
- package/dist/schema-BKa41TQ4.js.map +0 -1
- package/dist/schema-Dltbjui7.js.map +0 -1
- package/dist/schema-PvgLrC1b.d.cts.map +0 -1
- package/dist/schema-jk88gqOu.cjs.map +0 -1
- package/dist/server-VwFSUPQn.cjs.map +0 -1
- package/dist/server-yb4PkNyo.js.map +0 -1
- package/dist/stdio-65sYKLOk.cjs +0 -26
- package/dist/stdio-65sYKLOk.cjs.map +0 -1
- package/dist/stdio-DkU2-spy.js +0 -19
- package/dist/stdio-DkU2-spy.js.map +0 -1
- package/dist/toolDefinitions-B94CNDbt.d.cts.map +0 -1
- package/dist/toolDefinitions-Bb_1ejkl.js.map +0 -1
- package/dist/toolDefinitions-DIhvw3vk.cjs.map +0 -1
- package/dist/toolDefinitions-q_1-70fG.d.ts.map +0 -1
- package/dist/tools-BdkmyaZo.cjs.map +0 -1
- package/dist/tools-CMFpMPpD.js.map +0 -1
- package/dist/types-B03G337q.d.cts.map +0 -1
- package/dist/types-CN4NEway.d.ts.map +0 -1
- package/dist/types-OeoNXRm-.d.cts.map +0 -1
- package/dist/types-jftb-CP9.d.ts.map +0 -1
- package/dist/version-TjO7fHpC.js +0 -6
- package/dist/vi.ClIskdbk-Bs263gvI.cjs.map +0 -1
- package/dist/vi.ClIskdbk-De9q3829.js.map +0 -1
- /package/dist/{api-client-9mzrj2HY.js → api-client-CL1WDkw9.cjs} +0 -0
- /package/dist/{api-client-CEBuz3Zu.cjs → api-client-CNv_hbPO.js} +0 -0
- /package/dist/{types-H-TSmRpm.js → types-6zHoEWAx.js} +0 -0
- /package/dist/{types-o3zWarRp.cjs → types-MYBaygjr.cjs} +0 -0
|
@@ -1,17 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { UserInputError } from "./errors-BJSrT6Ou.js";
|
|
2
|
+
import { ApiError } from "./client-CAoHZbyK.js";
|
|
3
|
+
import { logError } from "./logging-CXLD0FFB.js";
|
|
4
|
+
import { TOOL_HANDLERS } from "./tools-DpiQwSTY.js";
|
|
5
|
+
import { TOOL_DEFINITIONS } from "./toolDefinitions-DFAxp3nr.js";
|
|
6
|
+
import { RESOURCES } from "./resources-Bol20Xuo.js";
|
|
7
|
+
import { PROMPT_DEFINITIONS } from "./promptDefinitions-D8yow1m0.js";
|
|
8
|
+
import { PROMPT_HANDLERS } from "./prompts-Dt3A8Qfl.js";
|
|
8
9
|
import { setTag, setUser, startNewTrace, startSpan } from "@sentry/core";
|
|
9
10
|
|
|
10
11
|
//#region src/server.ts
|
|
12
|
+
/**
|
|
13
|
+
* Type guard to identify Sentry API errors.
|
|
14
|
+
*/
|
|
11
15
|
function isApiError(error) {
|
|
12
16
|
return error instanceof ApiError || Object.hasOwn(error, "status");
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Type guard to identify user input validation errors.
|
|
20
|
+
*/
|
|
21
|
+
function isUserInputError(error) {
|
|
22
|
+
return error instanceof UserInputError;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Formats errors for LLM consumption with appropriate telemetry handling.
|
|
26
|
+
*
|
|
27
|
+
* **Error Types:**
|
|
28
|
+
* - User Input Errors: Clear guidance without telemetry
|
|
29
|
+
* - API Errors: Enhanced messaging with HTTP status context
|
|
30
|
+
* - System Errors: Full telemetry capture with event IDs
|
|
31
|
+
*
|
|
32
|
+
* @example User Input Error Response
|
|
33
|
+
* ```markdown
|
|
34
|
+
* **Input Error**
|
|
35
|
+
*
|
|
36
|
+
* It looks like there was a problem with the input you provided.
|
|
37
|
+
* Organization slug is required. Please provide an organizationSlug parameter.
|
|
38
|
+
* You may be able to resolve the issue by addressing the concern and trying again.
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
14
41
|
async function logAndFormatError(error) {
|
|
42
|
+
if (isUserInputError(error)) {
|
|
43
|
+
const typedError = error;
|
|
44
|
+
return [
|
|
45
|
+
"**Input Error**",
|
|
46
|
+
"It looks like there was a problem with the input you provided.",
|
|
47
|
+
typedError.message,
|
|
48
|
+
`You may be able to resolve the issue by addressing the concern and trying again.`
|
|
49
|
+
].join("\n\n");
|
|
50
|
+
}
|
|
15
51
|
if (isApiError(error)) {
|
|
16
52
|
const typedError = error;
|
|
17
53
|
return [
|
|
@@ -31,36 +67,55 @@ async function logAndFormatError(error) {
|
|
|
31
67
|
].join("\n\n");
|
|
32
68
|
}
|
|
33
69
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
70
|
+
* Extracts MCP request parameters for OpenTelemetry attributes.
|
|
71
|
+
*
|
|
72
|
+
* @example Parameter Transformation
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const input = { organizationSlug: "my-org", query: "is:unresolved" };
|
|
75
|
+
* const output = extractMcpParameters(input);
|
|
76
|
+
* // { "mcp.param.organizationSlug": "\"my-org\"", "mcp.param.query": "\"is:unresolved\"" }
|
|
77
|
+
* ```
|
|
36
78
|
*/
|
|
37
79
|
function extractMcpParameters(args) {
|
|
38
80
|
return Object.fromEntries(Object.entries(args).map(([key, value]) => {
|
|
39
81
|
return [`mcp.param.${key}`, JSON.stringify(value)];
|
|
40
82
|
}));
|
|
41
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Configures an MCP server with all tools, prompts, resources, and telemetry.
|
|
86
|
+
*
|
|
87
|
+
* Transforms a bare MCP server instance into a fully-featured Sentry integration
|
|
88
|
+
* with comprehensive observability, error handling, and handler registration.
|
|
89
|
+
*
|
|
90
|
+
* @example Basic Configuration
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const server = new McpServer();
|
|
93
|
+
* const context = {
|
|
94
|
+
* accessToken: process.env.SENTRY_TOKEN,
|
|
95
|
+
* host: "sentry.io",
|
|
96
|
+
* userId: "user-123",
|
|
97
|
+
* clientId: "cursor-ide"
|
|
98
|
+
* };
|
|
99
|
+
*
|
|
100
|
+
* await configureServer({ server, context });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
42
103
|
async function configureServer({ server, context, onToolComplete }) {
|
|
43
104
|
server.server.onerror = (error) => {
|
|
44
105
|
logError(error);
|
|
45
106
|
};
|
|
46
|
-
for (const resource of RESOURCES) server.resource(
|
|
47
|
-
resource.
|
|
48
|
-
resource.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return await startNewTrace(async () => {
|
|
56
|
-
return await startSpan({ name: `mcp.resource/${resource.name}` }, async () => {
|
|
57
|
-
if (context.userId) setUser({ id: context.userId });
|
|
58
|
-
if (context.clientId) setTag("client.id", context.clientId);
|
|
59
|
-
return resource.handler(url);
|
|
60
|
-
});
|
|
107
|
+
for (const resource of RESOURCES) server.resource(resource.name, resource.uri, {
|
|
108
|
+
description: resource.description,
|
|
109
|
+
mimeType: resource.mimeType
|
|
110
|
+
}, async (url) => {
|
|
111
|
+
return await startNewTrace(async () => {
|
|
112
|
+
return await startSpan({ name: `mcp.resource/${resource.name}` }, async () => {
|
|
113
|
+
if (context.userId) setUser({ id: context.userId });
|
|
114
|
+
if (context.clientId) setTag("client.id", context.clientId);
|
|
115
|
+
return resource.handler(url);
|
|
61
116
|
});
|
|
62
|
-
}
|
|
63
|
-
);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
64
119
|
for (const prompt of PROMPT_DEFINITIONS) {
|
|
65
120
|
const handler = PROMPT_HANDLERS[prompt.name];
|
|
66
121
|
server.prompt(prompt.name, prompt.description, prompt.paramsSchema ? prompt.paramsSchema : {}, async (...args) => {
|
|
@@ -132,4 +187,4 @@ async function configureServer({ server, context, onToolComplete }) {
|
|
|
132
187
|
|
|
133
188
|
//#endregion
|
|
134
189
|
export { configureServer };
|
|
135
|
-
//# sourceMappingURL=server-
|
|
190
|
+
//# sourceMappingURL=server-C7cHq_pc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-C7cHq_pc.js","names":["error: unknown","args: Record<string, any>"],"sources":["../src/server.ts"],"sourcesContent":["/**\n * MCP Server Configuration and Request Handling Infrastructure.\n *\n * This module orchestrates tool execution, prompt handling, resource management,\n * and telemetry collection in a unified server interface for LLMs.\n *\n * **Configuration Example:**\n * ```typescript\n * const server = new McpServer();\n * const context: ServerContext = {\n * accessToken: \"your-sentry-token\",\n * host: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"mcp-client\"\n * };\n *\n * await configureServer({ server, context });\n * ```\n */\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { TOOL_HANDLERS } from \"./tools\";\nimport { TOOL_DEFINITIONS } from \"./toolDefinitions\";\nimport type { ServerContext } from \"./types\";\nimport { setTag, setUser, startNewTrace, startSpan } from \"@sentry/core\";\nimport { logError } from \"./logging\";\nimport { RESOURCES } from \"./resources\";\nimport { PROMPT_DEFINITIONS } from \"./promptDefinitions\";\nimport { PROMPT_HANDLERS } from \"./prompts\";\nimport { ApiError } from \"./api-client\";\nimport { UserInputError } from \"./errors\";\n\n/**\n * Type guard to identify Sentry API errors.\n */\nfunction isApiError(error: unknown) {\n return error instanceof ApiError || Object.hasOwn(error as any, \"status\");\n}\n\n/**\n * Type guard to identify user input validation errors.\n */\nfunction isUserInputError(error: unknown) {\n return error instanceof UserInputError;\n}\n\n/**\n * Formats errors for LLM consumption with appropriate telemetry handling.\n *\n * **Error Types:**\n * - User Input Errors: Clear guidance without telemetry\n * - API Errors: Enhanced messaging with HTTP status context\n * - System Errors: Full telemetry capture with event IDs\n *\n * @example User Input Error Response\n * ```markdown\n * **Input Error**\n *\n * It looks like there was a problem with the input you provided.\n * Organization slug is required. Please provide an organizationSlug parameter.\n * You may be able to resolve the issue by addressing the concern and trying again.\n * ```\n */\nasync function logAndFormatError(error: unknown) {\n if (isUserInputError(error)) {\n const typedError = error as UserInputError;\n return [\n \"**Input Error**\",\n \"It looks like there was a problem with the input you provided.\",\n typedError.message,\n `You may be able to resolve the issue by addressing the concern and trying again.`,\n ].join(\"\\n\\n\");\n }\n\n if (isApiError(error)) {\n const typedError = error as ApiError;\n return [\n \"**Error**\",\n `There was an HTTP ${typedError.status} error with the your request to the Sentry API.`,\n `${typedError.message}`,\n `You may be able to resolve the issue by addressing the concern and trying again.`,\n ].join(\"\\n\\n\");\n }\n\n const eventId = logError(error);\n\n return [\n \"**Error**\",\n \"It looks like there was a problem communicating with the Sentry API.\",\n \"Please report the following to the user for the Sentry team:\",\n `**Event ID**: ${eventId}`,\n process.env.NODE_ENV !== \"production\"\n ? error instanceof Error\n ? error.message\n : String(error)\n : \"\",\n ].join(\"\\n\\n\");\n}\n\n/**\n * Extracts MCP request parameters for OpenTelemetry attributes.\n *\n * @example Parameter Transformation\n * ```typescript\n * const input = { organizationSlug: \"my-org\", query: \"is:unresolved\" };\n * const output = extractMcpParameters(input);\n * // { \"mcp.param.organizationSlug\": \"\\\"my-org\\\"\", \"mcp.param.query\": \"\\\"is:unresolved\\\"\" }\n * ```\n */\nfunction extractMcpParameters(args: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(args).map(([key, value]) => {\n return [`mcp.param.${key}`, JSON.stringify(value)];\n }),\n );\n}\n\n/**\n * Configures an MCP server with all tools, prompts, resources, and telemetry.\n *\n * Transforms a bare MCP server instance into a fully-featured Sentry integration\n * with comprehensive observability, error handling, and handler registration.\n *\n * @example Basic Configuration\n * ```typescript\n * const server = new McpServer();\n * const context = {\n * accessToken: process.env.SENTRY_TOKEN,\n * host: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"cursor-ide\"\n * };\n *\n * await configureServer({ server, context });\n * ```\n */\nexport async function configureServer({\n server,\n context,\n onToolComplete,\n}: { server: McpServer; context: ServerContext; onToolComplete?: () => void }) {\n server.server.onerror = (error) => {\n logError(error);\n };\n\n for (const resource of RESOURCES) {\n server.resource(\n resource.name,\n resource.uri,\n {\n description: resource.description,\n mimeType: resource.mimeType,\n },\n // TODO: this doesnt support any error handling afaict via the spec\n async (url) => {\n return await startNewTrace(async () => {\n return await startSpan(\n { name: `mcp.resource/${resource.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n\n return resource.handler(url);\n },\n );\n });\n },\n );\n }\n\n for (const prompt of PROMPT_DEFINITIONS) {\n const handler = PROMPT_HANDLERS[prompt.name];\n\n server.prompt(\n prompt.name,\n prompt.description,\n prompt.paramsSchema ? prompt.paramsSchema : {},\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n {\n name: `mcp.prompt/${prompt.name}`,\n attributes: extractMcpParameters(args),\n },\n async (span) => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n try {\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n const output = await handler(context, ...args);\n span.setStatus({\n code: 1, // ok\n });\n return {\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text: output,\n },\n },\n ],\n };\n } catch (error) {\n span.setStatus({\n code: 2, // error\n });\n throw error;\n }\n },\n );\n });\n } finally {\n onToolComplete?.();\n }\n },\n );\n }\n\n for (const tool of TOOL_DEFINITIONS) {\n const handler = TOOL_HANDLERS[tool.name];\n\n server.tool(\n tool.name as string,\n tool.description,\n tool.paramsSchema ? tool.paramsSchema : {},\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n {\n name: `mcp.tool/${tool.name}`,\n attributes: extractMcpParameters(args),\n },\n async (span) => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n\n try {\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n const output = await handler(context, ...args);\n span.setStatus({\n code: 1, // ok\n });\n return {\n content: [\n {\n type: \"text\",\n text: output,\n },\n ],\n };\n } catch (error) {\n span.setStatus({\n code: 2, // error\n });\n return {\n content: [\n {\n type: \"text\",\n text: await logAndFormatError(error),\n },\n ],\n isError: true,\n };\n }\n },\n );\n });\n } finally {\n onToolComplete?.();\n }\n },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAkCA,SAAS,WAAWA,OAAgB;AAClC,QAAO,iBAAiB,YAAY,OAAO,OAAO,OAAc,SAAS;AAC1E;;;;AAKD,SAAS,iBAAiBA,OAAgB;AACxC,QAAO,iBAAiB;AACzB;;;;;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b,MAAM,EACP,EAAC;AACF,cAAO,EACL,SAAS,CACP;QACE,MAAM;QACN,MAAM;OACP,CACF,EACF;MACF,SAAQ,OAAO;AACd,YAAK,UAAU,EACb,MAAM,EACP,EAAC;AACF,cAAO;QACL,SAAS,CACP;SACE,MAAM;SACN,MAAM,MAAM,kBAAkB,MAAM;QACrC,CACF;QACD,SAAS;OACV;MACF;KACF,EACF;IACF,EAAC;GACH,UAAS;AACR,sBAAkB;GACnB;EACF,EACF;CACF;AACF"}
|
|
@@ -1,19 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const require_client = require('./client-
|
|
4
|
-
const require_logging = require('./logging-
|
|
5
|
-
const require_tools = require('./tools-
|
|
6
|
-
const require_toolDefinitions = require('./toolDefinitions-
|
|
7
|
-
const require_resources = require('./resources-
|
|
8
|
-
const require_promptDefinitions = require('./promptDefinitions-
|
|
9
|
-
const require_prompts = require('./prompts-
|
|
1
|
+
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
+
const require_errors = require('./errors-B9fwS-aP.cjs');
|
|
3
|
+
const require_client = require('./client-B7vZ6JMk.cjs');
|
|
4
|
+
const require_logging = require('./logging-ByvSjT6V.cjs');
|
|
5
|
+
const require_tools = require('./tools-DyOqlsCW.cjs');
|
|
6
|
+
const require_toolDefinitions = require('./toolDefinitions-CUegGcWU.cjs');
|
|
7
|
+
const require_resources = require('./resources-DNyoutxH.cjs');
|
|
8
|
+
const require_promptDefinitions = require('./promptDefinitions-BTLIBcGt.cjs');
|
|
9
|
+
const require_prompts = require('./prompts-CDbQrutV.cjs');
|
|
10
10
|
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
11
11
|
|
|
12
12
|
//#region src/server.ts
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to identify Sentry API errors.
|
|
15
|
+
*/
|
|
13
16
|
function isApiError(error) {
|
|
14
17
|
return error instanceof require_client.ApiError || Object.hasOwn(error, "status");
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard to identify user input validation errors.
|
|
21
|
+
*/
|
|
22
|
+
function isUserInputError(error) {
|
|
23
|
+
return error instanceof require_errors.UserInputError;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Formats errors for LLM consumption with appropriate telemetry handling.
|
|
27
|
+
*
|
|
28
|
+
* **Error Types:**
|
|
29
|
+
* - User Input Errors: Clear guidance without telemetry
|
|
30
|
+
* - API Errors: Enhanced messaging with HTTP status context
|
|
31
|
+
* - System Errors: Full telemetry capture with event IDs
|
|
32
|
+
*
|
|
33
|
+
* @example User Input Error Response
|
|
34
|
+
* ```markdown
|
|
35
|
+
* **Input Error**
|
|
36
|
+
*
|
|
37
|
+
* It looks like there was a problem with the input you provided.
|
|
38
|
+
* Organization slug is required. Please provide an organizationSlug parameter.
|
|
39
|
+
* You may be able to resolve the issue by addressing the concern and trying again.
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
16
42
|
async function logAndFormatError(error) {
|
|
43
|
+
if (isUserInputError(error)) {
|
|
44
|
+
const typedError = error;
|
|
45
|
+
return [
|
|
46
|
+
"**Input Error**",
|
|
47
|
+
"It looks like there was a problem with the input you provided.",
|
|
48
|
+
typedError.message,
|
|
49
|
+
`You may be able to resolve the issue by addressing the concern and trying again.`
|
|
50
|
+
].join("\n\n");
|
|
51
|
+
}
|
|
17
52
|
if (isApiError(error)) {
|
|
18
53
|
const typedError = error;
|
|
19
54
|
return [
|
|
@@ -33,36 +68,55 @@ async function logAndFormatError(error) {
|
|
|
33
68
|
].join("\n\n");
|
|
34
69
|
}
|
|
35
70
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
71
|
+
* Extracts MCP request parameters for OpenTelemetry attributes.
|
|
72
|
+
*
|
|
73
|
+
* @example Parameter Transformation
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const input = { organizationSlug: "my-org", query: "is:unresolved" };
|
|
76
|
+
* const output = extractMcpParameters(input);
|
|
77
|
+
* // { "mcp.param.organizationSlug": "\"my-org\"", "mcp.param.query": "\"is:unresolved\"" }
|
|
78
|
+
* ```
|
|
38
79
|
*/
|
|
39
80
|
function extractMcpParameters(args) {
|
|
40
81
|
return Object.fromEntries(Object.entries(args).map(([key, value]) => {
|
|
41
82
|
return [`mcp.param.${key}`, JSON.stringify(value)];
|
|
42
83
|
}));
|
|
43
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Configures an MCP server with all tools, prompts, resources, and telemetry.
|
|
87
|
+
*
|
|
88
|
+
* Transforms a bare MCP server instance into a fully-featured Sentry integration
|
|
89
|
+
* with comprehensive observability, error handling, and handler registration.
|
|
90
|
+
*
|
|
91
|
+
* @example Basic Configuration
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const server = new McpServer();
|
|
94
|
+
* const context = {
|
|
95
|
+
* accessToken: process.env.SENTRY_TOKEN,
|
|
96
|
+
* host: "sentry.io",
|
|
97
|
+
* userId: "user-123",
|
|
98
|
+
* clientId: "cursor-ide"
|
|
99
|
+
* };
|
|
100
|
+
*
|
|
101
|
+
* await configureServer({ server, context });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
44
104
|
async function configureServer({ server, context, onToolComplete }) {
|
|
45
105
|
server.server.onerror = (error) => {
|
|
46
106
|
require_logging.logError(error);
|
|
47
107
|
};
|
|
48
|
-
for (const resource of require_resources.RESOURCES) server.resource(
|
|
49
|
-
resource.
|
|
50
|
-
resource.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return await (0, __sentry_core.startNewTrace)(async () => {
|
|
58
|
-
return await (0, __sentry_core.startSpan)({ name: `mcp.resource/${resource.name}` }, async () => {
|
|
59
|
-
if (context.userId) (0, __sentry_core.setUser)({ id: context.userId });
|
|
60
|
-
if (context.clientId) (0, __sentry_core.setTag)("client.id", context.clientId);
|
|
61
|
-
return resource.handler(url);
|
|
62
|
-
});
|
|
108
|
+
for (const resource of require_resources.RESOURCES) server.resource(resource.name, resource.uri, {
|
|
109
|
+
description: resource.description,
|
|
110
|
+
mimeType: resource.mimeType
|
|
111
|
+
}, async (url) => {
|
|
112
|
+
return await (0, __sentry_core.startNewTrace)(async () => {
|
|
113
|
+
return await (0, __sentry_core.startSpan)({ name: `mcp.resource/${resource.name}` }, async () => {
|
|
114
|
+
if (context.userId) (0, __sentry_core.setUser)({ id: context.userId });
|
|
115
|
+
if (context.clientId) (0, __sentry_core.setTag)("client.id", context.clientId);
|
|
116
|
+
return resource.handler(url);
|
|
63
117
|
});
|
|
64
|
-
}
|
|
65
|
-
);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
66
120
|
for (const prompt of require_promptDefinitions.PROMPT_DEFINITIONS) {
|
|
67
121
|
const handler = require_prompts.PROMPT_HANDLERS[prompt.name];
|
|
68
122
|
server.prompt(prompt.name, prompt.description, prompt.paramsSchema ? prompt.paramsSchema : {}, async (...args) => {
|
|
@@ -139,4 +193,4 @@ Object.defineProperty(exports, 'configureServer', {
|
|
|
139
193
|
return configureServer;
|
|
140
194
|
}
|
|
141
195
|
});
|
|
142
|
-
//# sourceMappingURL=server-
|
|
196
|
+
//# sourceMappingURL=server-DeutbO8v.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-DeutbO8v.cjs","names":["error: unknown","ApiError","UserInputError","args: Record<string, any>","RESOURCES","PROMPT_DEFINITIONS","PROMPT_HANDLERS","TOOL_DEFINITIONS","TOOL_HANDLERS"],"sources":["../src/server.ts"],"sourcesContent":["/**\n * MCP Server Configuration and Request Handling Infrastructure.\n *\n * This module orchestrates tool execution, prompt handling, resource management,\n * and telemetry collection in a unified server interface for LLMs.\n *\n * **Configuration Example:**\n * ```typescript\n * const server = new McpServer();\n * const context: ServerContext = {\n * accessToken: \"your-sentry-token\",\n * host: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"mcp-client\"\n * };\n *\n * await configureServer({ server, context });\n * ```\n */\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { TOOL_HANDLERS } from \"./tools\";\nimport { TOOL_DEFINITIONS } from \"./toolDefinitions\";\nimport type { ServerContext } from \"./types\";\nimport { setTag, setUser, startNewTrace, startSpan } from \"@sentry/core\";\nimport { logError } from \"./logging\";\nimport { RESOURCES } from \"./resources\";\nimport { PROMPT_DEFINITIONS } from \"./promptDefinitions\";\nimport { PROMPT_HANDLERS } from \"./prompts\";\nimport { ApiError } from \"./api-client\";\nimport { UserInputError } from \"./errors\";\n\n/**\n * Type guard to identify Sentry API errors.\n */\nfunction isApiError(error: unknown) {\n return error instanceof ApiError || Object.hasOwn(error as any, \"status\");\n}\n\n/**\n * Type guard to identify user input validation errors.\n */\nfunction isUserInputError(error: unknown) {\n return error instanceof UserInputError;\n}\n\n/**\n * Formats errors for LLM consumption with appropriate telemetry handling.\n *\n * **Error Types:**\n * - User Input Errors: Clear guidance without telemetry\n * - API Errors: Enhanced messaging with HTTP status context\n * - System Errors: Full telemetry capture with event IDs\n *\n * @example User Input Error Response\n * ```markdown\n * **Input Error**\n *\n * It looks like there was a problem with the input you provided.\n * Organization slug is required. Please provide an organizationSlug parameter.\n * You may be able to resolve the issue by addressing the concern and trying again.\n * ```\n */\nasync function logAndFormatError(error: unknown) {\n if (isUserInputError(error)) {\n const typedError = error as UserInputError;\n return [\n \"**Input Error**\",\n \"It looks like there was a problem with the input you provided.\",\n typedError.message,\n `You may be able to resolve the issue by addressing the concern and trying again.`,\n ].join(\"\\n\\n\");\n }\n\n if (isApiError(error)) {\n const typedError = error as ApiError;\n return [\n \"**Error**\",\n `There was an HTTP ${typedError.status} error with the your request to the Sentry API.`,\n `${typedError.message}`,\n `You may be able to resolve the issue by addressing the concern and trying again.`,\n ].join(\"\\n\\n\");\n }\n\n const eventId = logError(error);\n\n return [\n \"**Error**\",\n \"It looks like there was a problem communicating with the Sentry API.\",\n \"Please report the following to the user for the Sentry team:\",\n `**Event ID**: ${eventId}`,\n process.env.NODE_ENV !== \"production\"\n ? error instanceof Error\n ? error.message\n : String(error)\n : \"\",\n ].join(\"\\n\\n\");\n}\n\n/**\n * Extracts MCP request parameters for OpenTelemetry attributes.\n *\n * @example Parameter Transformation\n * ```typescript\n * const input = { organizationSlug: \"my-org\", query: \"is:unresolved\" };\n * const output = extractMcpParameters(input);\n * // { \"mcp.param.organizationSlug\": \"\\\"my-org\\\"\", \"mcp.param.query\": \"\\\"is:unresolved\\\"\" }\n * ```\n */\nfunction extractMcpParameters(args: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(args).map(([key, value]) => {\n return [`mcp.param.${key}`, JSON.stringify(value)];\n }),\n );\n}\n\n/**\n * Configures an MCP server with all tools, prompts, resources, and telemetry.\n *\n * Transforms a bare MCP server instance into a fully-featured Sentry integration\n * with comprehensive observability, error handling, and handler registration.\n *\n * @example Basic Configuration\n * ```typescript\n * const server = new McpServer();\n * const context = {\n * accessToken: process.env.SENTRY_TOKEN,\n * host: \"sentry.io\",\n * userId: \"user-123\",\n * clientId: \"cursor-ide\"\n * };\n *\n * await configureServer({ server, context });\n * ```\n */\nexport async function configureServer({\n server,\n context,\n onToolComplete,\n}: { server: McpServer; context: ServerContext; onToolComplete?: () => void }) {\n server.server.onerror = (error) => {\n logError(error);\n };\n\n for (const resource of RESOURCES) {\n server.resource(\n resource.name,\n resource.uri,\n {\n description: resource.description,\n mimeType: resource.mimeType,\n },\n // TODO: this doesnt support any error handling afaict via the spec\n async (url) => {\n return await startNewTrace(async () => {\n return await startSpan(\n { name: `mcp.resource/${resource.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n\n return resource.handler(url);\n },\n );\n });\n },\n );\n }\n\n for (const prompt of PROMPT_DEFINITIONS) {\n const handler = PROMPT_HANDLERS[prompt.name];\n\n server.prompt(\n prompt.name,\n prompt.description,\n prompt.paramsSchema ? prompt.paramsSchema : {},\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n {\n name: `mcp.prompt/${prompt.name}`,\n attributes: extractMcpParameters(args),\n },\n async (span) => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n try {\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n const output = await handler(context, ...args);\n span.setStatus({\n code: 1, // ok\n });\n return {\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text: output,\n },\n },\n ],\n };\n } catch (error) {\n span.setStatus({\n code: 2, // error\n });\n throw error;\n }\n },\n );\n });\n } finally {\n onToolComplete?.();\n }\n },\n );\n }\n\n for (const tool of TOOL_DEFINITIONS) {\n const handler = TOOL_HANDLERS[tool.name];\n\n server.tool(\n tool.name as string,\n tool.description,\n tool.paramsSchema ? tool.paramsSchema : {},\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n {\n name: `mcp.tool/${tool.name}`,\n attributes: extractMcpParameters(args),\n },\n async (span) => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n if (context.clientId) {\n setTag(\"client.id\", context.clientId);\n }\n\n try {\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n const output = await handler(context, ...args);\n span.setStatus({\n code: 1, // ok\n });\n return {\n content: [\n {\n type: \"text\",\n text: output,\n },\n ],\n };\n } catch (error) {\n span.setStatus({\n code: 2, // error\n });\n return {\n content: [\n {\n type: \"text\",\n text: await logAndFormatError(error),\n },\n ],\n isError: true,\n };\n }\n },\n );\n });\n } finally {\n onToolComplete?.();\n }\n },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,SAAS,WAAWA,OAAgB;AAClC,QAAO,iBAAiBC,2BAAY,OAAO,OAAO,OAAc,SAAS;AAC1E;;;;AAKD,SAAS,iBAAiBD,OAAgB;AACxC,QAAO,iBAAiBE;AACzB;;;;;;;;;;;;;;;;;;AAmBD,eAAe,kBAAkBF,OAA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;AACF,cAAO,EACL,SAAS,CACP;QACE,MAAM;QACN,MAAM;OACP,CACF,EACF;MACF,SAAQ,OAAO;AACd,YAAK,UAAU,EACb,MAAM,EACP,EAAC;AACF,cAAO;QACL,SAAS,CACP;SACE,MAAM;SACN,MAAM,MAAM,kBAAkB,MAAM;QACrC,CACF;QACD,SAAS;OACV;MACF;KACF,EACF;IACF,EAAC;GACH,UAAS;AACR,sBAAkB;GACnB;EACF,EACF;CACF;AACF"}
|
package/dist/server.cjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
require('./
|
|
2
|
-
require('./
|
|
3
|
-
require('./
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
6
|
-
require('./
|
|
7
|
-
require('./
|
|
8
|
-
require('./
|
|
9
|
-
require('./
|
|
10
|
-
require('./
|
|
11
|
-
require('./
|
|
12
|
-
require('./
|
|
13
|
-
require('./
|
|
14
|
-
|
|
1
|
+
require('./errors-B9fwS-aP.cjs');
|
|
2
|
+
require('./schema-BsvGMALe.cjs');
|
|
3
|
+
require('./client-B7vZ6JMk.cjs');
|
|
4
|
+
require('./types-MYBaygjr.cjs');
|
|
5
|
+
require('./api-client-CL1WDkw9.cjs');
|
|
6
|
+
require('./formatting-C2kN0ok6.cjs');
|
|
7
|
+
require('./issue-helpers-D712fGT2.cjs');
|
|
8
|
+
require('./logging-ByvSjT6V.cjs');
|
|
9
|
+
require('./tools-DyOqlsCW.cjs');
|
|
10
|
+
require('./schema-BTfISwFu.cjs');
|
|
11
|
+
require('./toolDefinitions-CUegGcWU.cjs');
|
|
12
|
+
require('./resources-DNyoutxH.cjs');
|
|
13
|
+
require('./promptDefinitions-BTLIBcGt.cjs');
|
|
14
|
+
require('./prompts-CDbQrutV.cjs');
|
|
15
|
+
const require_server = require('./server-DeutbO8v.cjs');
|
|
15
16
|
|
|
16
|
-
exports.configureServer = require_server.configureServer
|
|
17
|
+
exports.configureServer = require_server.configureServer;
|
package/dist/server.d.cts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import "./promptDefinitions-
|
|
2
|
-
import "./toolDefinitions-
|
|
3
|
-
import { ServerContext } from "./types-
|
|
1
|
+
import "./promptDefinitions-CF2VWdQ6.cjs";
|
|
2
|
+
import "./toolDefinitions-Ipvr4Acw.cjs";
|
|
3
|
+
import { ServerContext } from "./types-DRF2IoP_.cjs";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
|
|
6
6
|
//#region src/server.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Configures an MCP server with all tools, prompts, resources, and telemetry.
|
|
10
|
+
*
|
|
11
|
+
* Transforms a bare MCP server instance into a fully-featured Sentry integration
|
|
12
|
+
* with comprehensive observability, error handling, and handler registration.
|
|
13
|
+
*
|
|
14
|
+
* @example Basic Configuration
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const server = new McpServer();
|
|
17
|
+
* const context = {
|
|
18
|
+
* accessToken: process.env.SENTRY_TOKEN,
|
|
19
|
+
* host: "sentry.io",
|
|
20
|
+
* userId: "user-123",
|
|
21
|
+
* clientId: "cursor-ide"
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* await configureServer({ server, context });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
7
27
|
declare function configureServer({
|
|
8
28
|
server,
|
|
9
29
|
context,
|
|
@@ -13,9 +33,7 @@ declare function configureServer({
|
|
|
13
33
|
context: ServerContext;
|
|
14
34
|
onToolComplete?: () => void;
|
|
15
35
|
}): Promise<void>;
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
36
|
//# sourceMappingURL=server.d.ts.map
|
|
19
|
-
|
|
37
|
+
//#endregion
|
|
20
38
|
export { configureServer };
|
|
21
39
|
//# sourceMappingURL=server.d.cts.map
|
package/dist/server.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.cts","names":[],"sources":["../src/server.ts"],"sourcesContent":
|
|
1
|
+
{"version":3,"file":"server.d.cts","names":[],"sources":["../src/server.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBAuIsB,eAAA;;;;;UAIT;WAAoB;;IAA4C"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import "./promptDefinitions-
|
|
2
|
-
import "./toolDefinitions-
|
|
3
|
-
import { ServerContext } from "./types-
|
|
1
|
+
import "./promptDefinitions-D5FSQckL.js";
|
|
2
|
+
import "./toolDefinitions-BOMF-zIC.js";
|
|
3
|
+
import { ServerContext } from "./types-D5TPcOfv.js";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
|
|
6
6
|
//#region src/server.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Configures an MCP server with all tools, prompts, resources, and telemetry.
|
|
10
|
+
*
|
|
11
|
+
* Transforms a bare MCP server instance into a fully-featured Sentry integration
|
|
12
|
+
* with comprehensive observability, error handling, and handler registration.
|
|
13
|
+
*
|
|
14
|
+
* @example Basic Configuration
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const server = new McpServer();
|
|
17
|
+
* const context = {
|
|
18
|
+
* accessToken: process.env.SENTRY_TOKEN,
|
|
19
|
+
* host: "sentry.io",
|
|
20
|
+
* userId: "user-123",
|
|
21
|
+
* clientId: "cursor-ide"
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* await configureServer({ server, context });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
7
27
|
declare function configureServer({
|
|
8
28
|
server,
|
|
9
29
|
context,
|
|
@@ -13,9 +33,7 @@ declare function configureServer({
|
|
|
13
33
|
context: ServerContext;
|
|
14
34
|
onToolComplete?: () => void;
|
|
15
35
|
}): Promise<void>;
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
36
|
//# sourceMappingURL=server.d.ts.map
|
|
19
|
-
|
|
37
|
+
//#endregion
|
|
20
38
|
export { configureServer };
|
|
21
39
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","names":[],"sources":["../src/server.ts"],"sourcesContent":
|
|
1
|
+
{"version":3,"file":"server.d.ts","names":[],"sources":["../src/server.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBAuIsB,eAAA;;;;;UAIT;WAAoB;;IAA4C"}
|
package/dist/server.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
13
|
-
import "./
|
|
14
|
-
import
|
|
1
|
+
import "./errors-BJSrT6Ou.js";
|
|
2
|
+
import "./schema-C_hp0BR7.js";
|
|
3
|
+
import "./client-CAoHZbyK.js";
|
|
4
|
+
import "./types-6zHoEWAx.js";
|
|
5
|
+
import "./api-client-CNv_hbPO.js";
|
|
6
|
+
import "./formatting-BaARL2gT.js";
|
|
7
|
+
import "./issue-helpers-BMVLc3mR.js";
|
|
8
|
+
import "./logging-CXLD0FFB.js";
|
|
9
|
+
import "./tools-DpiQwSTY.js";
|
|
10
|
+
import "./schema-Dv6aLZgz.js";
|
|
11
|
+
import "./toolDefinitions-DFAxp3nr.js";
|
|
12
|
+
import "./resources-Bol20Xuo.js";
|
|
13
|
+
import "./promptDefinitions-D8yow1m0.js";
|
|
14
|
+
import "./prompts-Dt3A8Qfl.js";
|
|
15
|
+
import { configureServer } from "./server-C7cHq_pc.js";
|
|
15
16
|
|
|
16
17
|
export { configureServer };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
+
const require_server = require('./server-DeutbO8v.cjs');
|
|
3
|
+
const __modelcontextprotocol_sdk_server_stdio_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/stdio.js"));
|
|
4
|
+
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
|
|
5
|
+
|
|
6
|
+
//#region src/transports/stdio.ts
|
|
7
|
+
/**
|
|
8
|
+
* Starts the MCP server with stdio transport and telemetry.
|
|
9
|
+
*
|
|
10
|
+
* Configures the server with all tools, prompts, and resources, then connects
|
|
11
|
+
* using stdio transport for process-based communication. All operations are
|
|
12
|
+
* wrapped in Sentry tracing for observability.
|
|
13
|
+
*
|
|
14
|
+
* @param server - MCP server instance to configure and start
|
|
15
|
+
* @param context - Server context with authentication and configuration
|
|
16
|
+
*
|
|
17
|
+
* @example CLI Integration
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // In a CLI tool or IDE extension:
|
|
20
|
+
* const server = new McpServer();
|
|
21
|
+
* await startStdio(server, {
|
|
22
|
+
* accessToken: userToken,
|
|
23
|
+
* host: userHost,
|
|
24
|
+
* userId: "user-123",
|
|
25
|
+
* clientId: "cursor-ide"
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
async function startStdio(server, context) {
|
|
30
|
+
await __sentry_node.startNewTrace(async () => {
|
|
31
|
+
const transport = new __modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
|
|
32
|
+
await require_server.configureServer({
|
|
33
|
+
server,
|
|
34
|
+
context
|
|
35
|
+
});
|
|
36
|
+
await server.connect(transport);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
Object.defineProperty(exports, 'startStdio', {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return startStdio;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=stdio-B73CCTly.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-B73CCTly.cjs","names":["server: McpServer","context: ServerContext","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 { configureServer } from \"../server\";\nimport type { ServerContext } from \"../types\";\nimport * as Sentry from \"@sentry/node\";\n\n/**\n * Starts the MCP server with stdio transport and telemetry.\n *\n * Configures the server with all tools, prompts, and resources, then connects\n * using stdio transport for process-based communication. All operations are\n * wrapped in Sentry tracing for observability.\n *\n * @param server - MCP server instance to configure and start\n * @param context - Server context with authentication and configuration\n *\n * @example CLI Integration\n * ```typescript\n * // In a CLI tool or IDE extension:\n * const server = new McpServer();\n * await startStdio(server, {\n * accessToken: userToken,\n * host: userHost,\n * userId: \"user-123\",\n * clientId: \"cursor-ide\"\n * });\n * ```\n */\nexport async function startStdio(server: McpServer, context: ServerContext) {\n await Sentry.startNewTrace(async () => {\n const transport = new StdioServerTransport();\n await configureServer({ server, context });\n await server.connect(transport);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAsB,WAAWA,QAAmBC,SAAwB;AAC1E,OAAM,cAAO,cAAc,YAAY;EACrC,MAAM,YAAY,IAAIC;AACtB,QAAM,+BAAgB;GAAE;GAAQ;EAAS,EAAC;AAC1C,QAAM,OAAO,QAAQ,UAAU;CAChC,EAAC;AACH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { configureServer } from "./server-C7cHq_pc.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import * as Sentry from "@sentry/node";
|
|
4
|
+
|
|
5
|
+
//#region src/transports/stdio.ts
|
|
6
|
+
/**
|
|
7
|
+
* Starts the MCP server with stdio transport and telemetry.
|
|
8
|
+
*
|
|
9
|
+
* Configures the server with all tools, prompts, and resources, then connects
|
|
10
|
+
* using stdio transport for process-based communication. All operations are
|
|
11
|
+
* wrapped in Sentry tracing for observability.
|
|
12
|
+
*
|
|
13
|
+
* @param server - MCP server instance to configure and start
|
|
14
|
+
* @param context - Server context with authentication and configuration
|
|
15
|
+
*
|
|
16
|
+
* @example CLI Integration
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // In a CLI tool or IDE extension:
|
|
19
|
+
* const server = new McpServer();
|
|
20
|
+
* await startStdio(server, {
|
|
21
|
+
* accessToken: userToken,
|
|
22
|
+
* host: userHost,
|
|
23
|
+
* userId: "user-123",
|
|
24
|
+
* clientId: "cursor-ide"
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
async function startStdio(server, context) {
|
|
29
|
+
await Sentry.startNewTrace(async () => {
|
|
30
|
+
const transport = new StdioServerTransport();
|
|
31
|
+
await configureServer({
|
|
32
|
+
server,
|
|
33
|
+
context
|
|
34
|
+
});
|
|
35
|
+
await server.connect(transport);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { startStdio };
|
|
41
|
+
//# sourceMappingURL=stdio-ZQLC-i5Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-ZQLC-i5Q.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 { configureServer } from \"../server\";\nimport type { ServerContext } from \"../types\";\nimport * as Sentry from \"@sentry/node\";\n\n/**\n * Starts the MCP server with stdio transport and telemetry.\n *\n * Configures the server with all tools, prompts, and resources, then connects\n * using stdio transport for process-based communication. All operations are\n * wrapped in Sentry tracing for observability.\n *\n * @param server - MCP server instance to configure and start\n * @param context - Server context with authentication and configuration\n *\n * @example CLI Integration\n * ```typescript\n * // In a CLI tool or IDE extension:\n * const server = new McpServer();\n * await startStdio(server, {\n * accessToken: userToken,\n * host: userHost,\n * userId: \"user-123\",\n * clientId: \"cursor-ide\"\n * });\n * ```\n */\nexport async function startStdio(server: McpServer, context: ServerContext) {\n await Sentry.startNewTrace(async () => {\n const transport = new StdioServerTransport();\n await configureServer({ server, context });\n await server.connect(transport);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAsB,WAAWA,QAAmBC,SAAwB;AAC1E,OAAM,OAAO,cAAc,YAAY;EACrC,MAAM,YAAY,IAAI;AACtB,QAAM,gBAAgB;GAAE;GAAQ;EAAS,EAAC;AAC1C,QAAM,OAAO,QAAQ,UAAU;CAChC,EAAC;AACH"}
|