@sentry/mcp-server 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/LICENSE.md +105 -0
  2. package/dist/api-client/client.cjs +5 -0
  3. package/dist/api-client/client.d.cts +5 -0
  4. package/dist/api-client/client.d.ts +5 -0
  5. package/dist/api-client/client.js +4 -0
  6. package/dist/api-client/client.test.cjs +34 -0
  7. package/dist/api-client/client.test.cjs.map +1 -0
  8. package/dist/api-client/client.test.d.cts +1 -0
  9. package/dist/api-client/client.test.d.ts +1 -0
  10. package/dist/api-client/client.test.js +33 -0
  11. package/dist/api-client/client.test.js.map +1 -0
  12. package/dist/api-client/index.cjs +35 -0
  13. package/dist/api-client/index.d.cts +6 -0
  14. package/dist/api-client/index.d.ts +6 -0
  15. package/dist/api-client/index.js +6 -0
  16. package/dist/api-client/schema.cjs +30 -0
  17. package/dist/api-client/schema.d.cts +3 -0
  18. package/dist/api-client/schema.d.ts +3 -0
  19. package/dist/api-client/schema.js +3 -0
  20. package/dist/api-client/types.cjs +1 -0
  21. package/dist/api-client/types.d.cts +4 -0
  22. package/dist/api-client/types.d.ts +4 -0
  23. package/dist/api-client/types.js +1 -0
  24. package/dist/api-client-9mzrj2HY.js +0 -0
  25. package/dist/api-client-CEBuz3Zu.cjs +0 -0
  26. package/dist/chunk-BtT13l48.cjs +40 -0
  27. package/dist/chunk-CsIcISPO.js +30 -0
  28. package/dist/client-BlG0jPGS.cjs +206 -0
  29. package/dist/client-BlG0jPGS.cjs.map +1 -0
  30. package/dist/client-D1XjYhij.js +194 -0
  31. package/dist/client-D1XjYhij.js.map +1 -0
  32. package/dist/client.d-B8RB2Poz.d.ts +108 -0
  33. package/dist/client.d-B8RB2Poz.d.ts.map +1 -0
  34. package/dist/client.d-CXQCEkJz.d.cts +108 -0
  35. package/dist/dist-B914BQU9.cjs +8043 -0
  36. package/dist/dist-B914BQU9.cjs.map +1 -0
  37. package/dist/dist-DJoL0rVQ.js +7899 -0
  38. package/dist/dist-DJoL0rVQ.js.map +1 -0
  39. package/dist/formatting-BTSvl7n7.cjs +41 -0
  40. package/dist/formatting-BTSvl7n7.cjs.map +1 -0
  41. package/dist/formatting-Bacfde0I.js +28 -0
  42. package/dist/formatting-Bacfde0I.js.map +1 -0
  43. package/dist/index.cjs +52 -0
  44. package/dist/index.cjs.map +1 -0
  45. package/dist/index.d-Cb-lHGvn.d.cts +1 -0
  46. package/dist/index.d-Db2MND9s.d.ts +1 -0
  47. package/dist/index.d.cts +1 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +50 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/internal/formatting.cjs +4 -0
  52. package/dist/internal/formatting.d.cts +13 -0
  53. package/dist/internal/formatting.d.ts +13 -0
  54. package/dist/internal/formatting.d.ts.map +1 -0
  55. package/dist/internal/formatting.js +3 -0
  56. package/dist/internal/issue-helpers.cjs +3 -0
  57. package/dist/internal/issue-helpers.d.cts +16 -0
  58. package/dist/internal/issue-helpers.d.ts +16 -0
  59. package/dist/internal/issue-helpers.d.ts.map +1 -0
  60. package/dist/internal/issue-helpers.js +3 -0
  61. package/dist/internal/issue-helpers.test.cjs +74 -0
  62. package/dist/internal/issue-helpers.test.cjs.map +1 -0
  63. package/dist/internal/issue-helpers.test.d.cts +1 -0
  64. package/dist/internal/issue-helpers.test.d.ts +1 -0
  65. package/dist/internal/issue-helpers.test.js +73 -0
  66. package/dist/internal/issue-helpers.test.js.map +1 -0
  67. package/dist/issue-helpers-C0kEdXOE.cjs +39 -0
  68. package/dist/issue-helpers-C0kEdXOE.cjs.map +1 -0
  69. package/dist/issue-helpers-DFde36Zu.js +32 -0
  70. package/dist/issue-helpers-DFde36Zu.js.map +1 -0
  71. package/dist/logging-BEMgC5SA.cjs +32 -0
  72. package/dist/logging-BEMgC5SA.cjs.map +1 -0
  73. package/dist/logging-Cxm8lQvg.js +25 -0
  74. package/dist/logging-Cxm8lQvg.js.map +1 -0
  75. package/dist/logging.cjs +3 -0
  76. package/dist/logging.d.cts +7 -0
  77. package/dist/logging.d.ts +7 -0
  78. package/dist/logging.d.ts.map +1 -0
  79. package/dist/logging.js +3 -0
  80. package/dist/magic-string.es-COkPNEcb.cjs +1017 -0
  81. package/dist/magic-string.es-COkPNEcb.cjs.map +1 -0
  82. package/dist/magic-string.es-qySpjS4V.js +1015 -0
  83. package/dist/magic-string.es-qySpjS4V.js.map +1 -0
  84. package/dist/promptDefinitions-CVB4IyVf.cjs +23 -0
  85. package/dist/promptDefinitions-CVB4IyVf.cjs.map +1 -0
  86. package/dist/promptDefinitions-CaRMCDPI.js +16 -0
  87. package/dist/promptDefinitions-CaRMCDPI.js.map +1 -0
  88. package/dist/promptDefinitions.cjs +4 -0
  89. package/dist/promptDefinitions.d-X_QALSRc.d.cts +15 -0
  90. package/dist/promptDefinitions.d-qzT7TH_Z.d.ts +15 -0
  91. package/dist/promptDefinitions.d-qzT7TH_Z.d.ts.map +1 -0
  92. package/dist/promptDefinitions.d.cts +3 -0
  93. package/dist/promptDefinitions.d.ts +3 -0
  94. package/dist/promptDefinitions.js +4 -0
  95. package/dist/prompts--QCiXmR2.cjs +26 -0
  96. package/dist/prompts--QCiXmR2.cjs.map +1 -0
  97. package/dist/prompts-Tz-qECa0.js +19 -0
  98. package/dist/prompts-Tz-qECa0.js.map +1 -0
  99. package/dist/prompts.cjs +3 -0
  100. package/dist/prompts.d.cts +19 -0
  101. package/dist/prompts.d.ts +19 -0
  102. package/dist/prompts.d.ts.map +1 -0
  103. package/dist/prompts.js +3 -0
  104. package/dist/resources-BAE7VVZZ.cjs +33 -0
  105. package/dist/resources-BAE7VVZZ.cjs.map +1 -0
  106. package/dist/resources-OM3EAnnj.js +26 -0
  107. package/dist/resources-OM3EAnnj.js.map +1 -0
  108. package/dist/resources.cjs +3 -0
  109. package/dist/resources.d.cts +15 -0
  110. package/dist/resources.d.ts +15 -0
  111. package/dist/resources.d.ts.map +1 -0
  112. package/dist/resources.js +3 -0
  113. package/dist/schema-BvloqMHW.cjs +57 -0
  114. package/dist/schema-BvloqMHW.cjs.map +1 -0
  115. package/dist/schema-Bvva80Pn.js +223 -0
  116. package/dist/schema-Bvva80Pn.js.map +1 -0
  117. package/dist/schema-CyHM0GZH.cjs +392 -0
  118. package/dist/schema-CyHM0GZH.cjs.map +1 -0
  119. package/dist/schema-k04PdSCK.js +14 -0
  120. package/dist/schema-k04PdSCK.js.map +1 -0
  121. package/dist/schema.cjs +9 -0
  122. package/dist/schema.d-BDStOeMD.d.cts +4978 -0
  123. package/dist/schema.d-Oa2HQQCX.d.ts +4978 -0
  124. package/dist/schema.d-Oa2HQQCX.d.ts.map +1 -0
  125. package/dist/schema.d.cts +14 -0
  126. package/dist/schema.d.ts +14 -0
  127. package/dist/schema.d.ts.map +1 -0
  128. package/dist/schema.js +3 -0
  129. package/dist/server-DY8wjV9H.cjs +110 -0
  130. package/dist/server-DY8wjV9H.cjs.map +1 -0
  131. package/dist/server-DuRPgdH4.js +103 -0
  132. package/dist/server-DuRPgdH4.js.map +1 -0
  133. package/dist/server.cjs +16 -0
  134. package/dist/server.d.cts +15 -0
  135. package/dist/server.d.ts +15 -0
  136. package/dist/server.d.ts.map +1 -0
  137. package/dist/server.js +16 -0
  138. package/dist/stdio-CSJMThag.cjs +23 -0
  139. package/dist/stdio-CSJMThag.cjs.map +1 -0
  140. package/dist/stdio-Ce5DHKZ4.js +16 -0
  141. package/dist/stdio-Ce5DHKZ4.js.map +1 -0
  142. package/dist/test-setup.cjs +18648 -0
  143. package/dist/test-setup.cjs.map +1 -0
  144. package/dist/test-setup.d.cts +1 -0
  145. package/dist/test-setup.d.ts +1 -0
  146. package/dist/test-setup.js +18647 -0
  147. package/dist/test-setup.js.map +1 -0
  148. package/dist/toolDefinitions-CMNKyt4H.js +400 -0
  149. package/dist/toolDefinitions-CMNKyt4H.js.map +1 -0
  150. package/dist/toolDefinitions-DS7wXdsP.cjs +407 -0
  151. package/dist/toolDefinitions-DS7wXdsP.cjs.map +1 -0
  152. package/dist/toolDefinitions.cjs +4 -0
  153. package/dist/toolDefinitions.d-CIXKiX81.d.cts +252 -0
  154. package/dist/toolDefinitions.d-DkYVHG7Y.d.ts +252 -0
  155. package/dist/toolDefinitions.d-DkYVHG7Y.d.ts.map +1 -0
  156. package/dist/toolDefinitions.d.cts +3 -0
  157. package/dist/toolDefinitions.d.ts +3 -0
  158. package/dist/toolDefinitions.js +4 -0
  159. package/dist/toolDefinitions.test.cjs +16 -0
  160. package/dist/toolDefinitions.test.cjs.map +1 -0
  161. package/dist/toolDefinitions.test.d.cts +1 -0
  162. package/dist/toolDefinitions.test.d.ts +1 -0
  163. package/dist/toolDefinitions.test.js +15 -0
  164. package/dist/toolDefinitions.test.js.map +1 -0
  165. package/dist/tools-BfTTqLNG.cjs +461 -0
  166. package/dist/tools-BfTTqLNG.cjs.map +1 -0
  167. package/dist/tools-qkapmf3p.js +455 -0
  168. package/dist/tools-qkapmf3p.js.map +1 -0
  169. package/dist/tools.cjs +10 -0
  170. package/dist/tools.d.cts +207 -0
  171. package/dist/tools.d.ts +207 -0
  172. package/dist/tools.d.ts.map +1 -0
  173. package/dist/tools.js +10 -0
  174. package/dist/tools.test.cjs +845 -0
  175. package/dist/tools.test.cjs.map +1 -0
  176. package/dist/tools.test.d.cts +1 -0
  177. package/dist/tools.test.d.ts +1 -0
  178. package/dist/tools.test.js +844 -0
  179. package/dist/tools.test.js.map +1 -0
  180. package/dist/transports/stdio.cjs +17 -0
  181. package/dist/transports/stdio.d.cts +11 -0
  182. package/dist/transports/stdio.d.ts +11 -0
  183. package/dist/transports/stdio.d.ts.map +1 -0
  184. package/dist/transports/stdio.js +17 -0
  185. package/dist/types-H-TSmRpm.js +0 -0
  186. package/dist/types-o3zWarRp.cjs +0 -0
  187. package/dist/types.cjs +0 -0
  188. package/dist/types.d-B8gSnrcY.d.cts +43 -0
  189. package/dist/types.d-BDS-6_Sj.d.cts +25 -0
  190. package/dist/types.d-Bfi1CpIf.d.ts +25 -0
  191. package/dist/types.d-Bfi1CpIf.d.ts.map +1 -0
  192. package/dist/types.d-Bj1fPi3b.d.ts +43 -0
  193. package/dist/types.d-Bj1fPi3b.d.ts.map +1 -0
  194. package/dist/types.d.cts +5 -0
  195. package/dist/types.d.ts +5 -0
  196. package/dist/types.js +0 -0
  197. package/dist/vi.ClIskdbk-BhK8y4UO.cjs +6294 -0
  198. package/dist/vi.ClIskdbk-BhK8y4UO.cjs.map +1 -0
  199. package/dist/vi.ClIskdbk-CiLaali_.js +6279 -0
  200. package/dist/vi.ClIskdbk-CiLaali_.js.map +1 -0
  201. package/package.json +77 -0
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/schema.d.ts
4
+ declare const ParamOrganizationSlug: z.ZodString;
5
+ declare const ParamTeamSlug: z.ZodString;
6
+ declare const ParamProjectSlug: z.ZodString;
7
+ declare const ParamIssueShortId: z.ZodString;
8
+ declare const ParamPlatform: z.ZodString;
9
+ declare const ParamTransaction: z.ZodString;
10
+ declare const ParamQuery: z.ZodString;
11
+
12
+ //#endregion
13
+ export { ParamIssueShortId, ParamOrganizationSlug, ParamPlatform, ParamProjectSlug, ParamQuery, ParamTeamSlug, ParamTransaction };
14
+ //# sourceMappingURL=schema.d.cts.map
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/schema.d.ts
4
+ declare const ParamOrganizationSlug: z.ZodString;
5
+ declare const ParamTeamSlug: z.ZodString;
6
+ declare const ParamProjectSlug: z.ZodString;
7
+ declare const ParamIssueShortId: z.ZodString;
8
+ declare const ParamPlatform: z.ZodString;
9
+ declare const ParamTransaction: z.ZodString;
10
+ declare const ParamQuery: z.ZodString;
11
+
12
+ //#endregion
13
+ export { ParamIssueShortId, ParamOrganizationSlug, ParamPlatform, ParamProjectSlug, ParamQuery, ParamTeamSlug, ParamTransaction };
14
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.d.ts"],"sourcesContent":["import { z } from \"zod\";\nexport declare const ParamOrganizationSlug: z.ZodString;\nexport declare const ParamTeamSlug: z.ZodString;\nexport declare const ParamProjectSlug: z.ZodString;\nexport declare const ParamIssueShortId: z.ZodString;\nexport declare const ParamPlatform: z.ZodString;\nexport declare const ParamTransaction: z.ZodString;\nexport declare const ParamQuery: z.ZodString;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;AACA,IAAW,wBAAqC,CAAC,GAAG,MAAG,EAAA,SAAA;AACvD,IAAW,gBAA6B,CAAC,GAAG,MAAG,EAAA,SAAA;AAC/C,IAAW,mBAAgC,CAAC,IAAI,MAAE,EAAA,SAAA;AAClD,IAAW,oBAAiC,CAAC,IAAI,MAAE,EAAA,SAAA;AACnD,IAAW,gBAA6B,CAAC,IAAI,MAAE,EAAA,SAAA;AAC/C,IAAW,mBAAgC,CAAC,IAAI,MAAE,EAAA,SAAA;AAClD,IAAW,aAA0B,CAAC,IAAI,MAAE,EAAA,SAAA"}
package/dist/schema.js ADDED
@@ -0,0 +1,3 @@
1
+ import { ParamIssueShortId, ParamOrganizationSlug, ParamPlatform, ParamProjectSlug, ParamQuery, ParamTeamSlug, ParamTransaction } from "./schema-k04PdSCK.js";
2
+
3
+ export { ParamIssueShortId, ParamOrganizationSlug, ParamPlatform, ParamProjectSlug, ParamQuery, ParamTeamSlug, ParamTransaction };
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ const require_chunk = require('./chunk-BtT13l48.cjs');
3
+ const require_client = require('./client-BlG0jPGS.cjs');
4
+ const require_logging = require('./logging-BEMgC5SA.cjs');
5
+ const require_tools = require('./tools-BfTTqLNG.cjs');
6
+ const require_toolDefinitions = require('./toolDefinitions-DS7wXdsP.cjs');
7
+ const require_resources = require('./resources-BAE7VVZZ.cjs');
8
+ const require_promptDefinitions = require('./promptDefinitions-CVB4IyVf.cjs');
9
+ const require_prompts = require('./prompts--QCiXmR2.cjs');
10
+ const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
11
+
12
+ //#region src/server.ts
13
+ function isApiError(error) {
14
+ return error instanceof require_client.ApiError || Object.hasOwn(error, "status");
15
+ }
16
+ async function logAndFormatError(error) {
17
+ const eventId = require_logging.logError(error);
18
+ if (isApiError(error)) {
19
+ const typedError = error;
20
+ return [
21
+ "**Error**",
22
+ `There was a ${typedError.status} error with the your request to the Sentry API.`,
23
+ `${typedError.message}`,
24
+ "If you believe this was a genuine error, please report the following to the user for the Sentry team:",
25
+ `**Event ID**: ${eventId}`
26
+ ].join("\n\n");
27
+ }
28
+ return [
29
+ "**Error**",
30
+ "It looks like there was a problem communicating with the Sentry API.",
31
+ "Please report the following to the user for the Sentry team:",
32
+ `**Event ID**: ${eventId}`,
33
+ process.env.NODE_ENV !== "production" ? error instanceof Error ? error.message : String(error) : ""
34
+ ].join("\n\n");
35
+ }
36
+ async function configureServer({ server, context, onToolComplete }) {
37
+ server.server.onerror = (error) => {
38
+ require_logging.logError(error);
39
+ };
40
+ for (const resource of require_resources.RESOURCES) server.resource(
41
+ resource.name,
42
+ resource.uri,
43
+ {
44
+ description: resource.description,
45
+ mimeType: resource.mimeType
46
+ },
47
+ // TODO: this doesnt support any error handling afaict via the spec
48
+ async (url) => {
49
+ return await (0, __sentry_core.startNewTrace)(async () => {
50
+ return await (0, __sentry_core.startSpan)({ name: `mcp.resource/${resource.name}` }, async () => {
51
+ if (context.userId) (0, __sentry_core.setUser)({ id: context.userId });
52
+ return resource.handler(url);
53
+ });
54
+ });
55
+ }
56
+ );
57
+ for (const prompt of require_promptDefinitions.PROMPT_DEFINITIONS) {
58
+ const handler = require_prompts.PROMPT_HANDLERS[prompt.name];
59
+ server.prompt(prompt.name, prompt.description, prompt.paramsSchema, async (...args) => {
60
+ try {
61
+ return await (0, __sentry_core.startNewTrace)(async () => {
62
+ return await (0, __sentry_core.startSpan)({ name: `mcp.prompt/${prompt.name}` }, async () => {
63
+ if (context.userId) (0, __sentry_core.setUser)({ id: context.userId });
64
+ return await handler(...args);
65
+ });
66
+ });
67
+ } finally {
68
+ onToolComplete?.();
69
+ }
70
+ });
71
+ }
72
+ for (const tool of require_toolDefinitions.TOOL_DEFINITIONS) {
73
+ const handler = require_tools.TOOL_HANDLERS[tool.name];
74
+ server.tool(tool.name, tool.description, tool.paramsSchema ? tool.paramsSchema : {}, async (...args) => {
75
+ try {
76
+ return await (0, __sentry_core.startNewTrace)(async () => {
77
+ return await (0, __sentry_core.startSpan)({ name: `mcp.tool/${tool.name}` }, async () => {
78
+ if (context.userId) (0, __sentry_core.setUser)({ id: context.userId });
79
+ try {
80
+ const output = await handler(context, ...args);
81
+ return { content: [{
82
+ type: "text",
83
+ text: output
84
+ }] };
85
+ } catch (error) {
86
+ return {
87
+ content: [{
88
+ type: "text",
89
+ text: await logAndFormatError(error)
90
+ }],
91
+ isError: true
92
+ };
93
+ }
94
+ });
95
+ });
96
+ } finally {
97
+ onToolComplete?.();
98
+ }
99
+ });
100
+ }
101
+ }
102
+
103
+ //#endregion
104
+ Object.defineProperty(exports, 'configureServer', {
105
+ enumerable: true,
106
+ get: function () {
107
+ return configureServer;
108
+ }
109
+ });
110
+ //# sourceMappingURL=server-DY8wjV9H.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-DY8wjV9H.cjs","names":["error: unknown","ApiError","RESOURCES","PROMPT_DEFINITIONS","PROMPT_HANDLERS","TOOL_DEFINITIONS","TOOL_HANDLERS"],"sources":["../src/server.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { TOOL_HANDLERS } from \"./tools\";\nimport { TOOL_DEFINITIONS } from \"./toolDefinitions\";\nimport type { ServerContext } from \"./types\";\nimport { 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\";\n\nfunction isApiError(error: unknown) {\n return error instanceof ApiError || Object.hasOwn(error as any, \"status\");\n}\n\nasync function logAndFormatError(error: unknown) {\n const eventId = logError(error);\n\n if (isApiError(error)) {\n const typedError = error as ApiError;\n return [\n \"**Error**\",\n `There was a ${typedError.status} error with the your request to the Sentry API.`,\n `${typedError.message}`,\n \"If you believe this was a genuine error, please report the following to the user for the Sentry team:\",\n `**Event ID**: ${eventId}`,\n ].join(\"\\n\\n\");\n }\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\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\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,\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n { name: `mcp.prompt/${prompt.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n return await handler(...args);\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 { name: `mcp.tool/${tool.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\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\n return {\n content: [\n {\n type: \"text\",\n text: output,\n },\n ],\n };\n } catch (error) {\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":";;;;;;;;;;;;AAWA,SAAS,WAAWA,OAAgB;AAClC,QAAO,iBAAiBC,2BAAY,OAAO,OAAO,OAAc,SAAS;AAC1E;AAED,eAAe,kBAAkBD,OAAgB;CAC/C,MAAM,UAAU,yBAAS,MAAM;AAE/B,KAAI,WAAW,MAAM,EAAE;EACrB,MAAM,aAAa;AACnB,SAAO;GACL;IACC,cAAc,WAAW,OAAO;IAChC,EAAE,WAAW,QAAQ;GACtB;IACC,gBAAgB,QAAQ;EAC1B,EAAC,KAAK,OAAO;CACf;AAED,QAAO;EACL;EACA;EACA;GACC,gBAAgB,QAAQ;EACzB,QAAQ,IAAI,aAAa,eACrB,iBAAiB,QACf,MAAM,UACN,OAAO,MAAM,GACf;CACL,EAAC,KAAK,OAAO;AACf;AAED,eAAsB,gBAAgB,EACpC,QACA,SACA,gBAC2E,EAAE;AAC7E,QAAO,OAAO,UAAU,CAAC,UAAU;AACjC,2BAAS,MAAM;CAChB;AAED,MAAK,MAAM,YAAYE,4BACrB,QAAO;EACL,SAAS;EACT,SAAS;EACT;GACE,aAAa,SAAS;GACtB,UAAU,SAAS;EACpB;;EAED,OAAO,QAAQ;AACb,UAAO,MAAM,iCAAc,YAAY;AACrC,WAAO,MAAM,6BACX,EAAE,OAAO,eAAe,SAAS,KAAK,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
+ import { ApiError } from "./client-D1XjYhij.js";
2
+ import { logError } from "./logging-Cxm8lQvg.js";
3
+ import { TOOL_HANDLERS } from "./tools-qkapmf3p.js";
4
+ import { TOOL_DEFINITIONS } from "./toolDefinitions-CMNKyt4H.js";
5
+ import { RESOURCES } from "./resources-OM3EAnnj.js";
6
+ import { PROMPT_DEFINITIONS } from "./promptDefinitions-CaRMCDPI.js";
7
+ import { PROMPT_HANDLERS } from "./prompts-Tz-qECa0.js";
8
+ import { setUser, startNewTrace, startSpan } from "@sentry/core";
9
+
10
+ //#region src/server.ts
11
+ function isApiError(error) {
12
+ return error instanceof ApiError || Object.hasOwn(error, "status");
13
+ }
14
+ async function logAndFormatError(error) {
15
+ const eventId = logError(error);
16
+ if (isApiError(error)) {
17
+ const typedError = error;
18
+ return [
19
+ "**Error**",
20
+ `There was a ${typedError.status} error with the your request to the Sentry API.`,
21
+ `${typedError.message}`,
22
+ "If you believe this was a genuine error, please report the following to the user for the Sentry team:",
23
+ `**Event ID**: ${eventId}`
24
+ ].join("\n\n");
25
+ }
26
+ return [
27
+ "**Error**",
28
+ "It looks like there was a problem communicating with the Sentry API.",
29
+ "Please report the following to the user for the Sentry team:",
30
+ `**Event ID**: ${eventId}`,
31
+ process.env.NODE_ENV !== "production" ? error instanceof Error ? error.message : String(error) : ""
32
+ ].join("\n\n");
33
+ }
34
+ async function configureServer({ server, context, onToolComplete }) {
35
+ server.server.onerror = (error) => {
36
+ logError(error);
37
+ };
38
+ for (const resource of RESOURCES) server.resource(
39
+ resource.name,
40
+ resource.uri,
41
+ {
42
+ description: resource.description,
43
+ mimeType: resource.mimeType
44
+ },
45
+ // TODO: this doesnt support any error handling afaict via the spec
46
+ async (url) => {
47
+ return await startNewTrace(async () => {
48
+ return await startSpan({ name: `mcp.resource/${resource.name}` }, async () => {
49
+ if (context.userId) setUser({ id: context.userId });
50
+ return resource.handler(url);
51
+ });
52
+ });
53
+ }
54
+ );
55
+ for (const prompt of PROMPT_DEFINITIONS) {
56
+ const handler = PROMPT_HANDLERS[prompt.name];
57
+ server.prompt(prompt.name, prompt.description, prompt.paramsSchema, async (...args) => {
58
+ try {
59
+ return await startNewTrace(async () => {
60
+ return await startSpan({ name: `mcp.prompt/${prompt.name}` }, async () => {
61
+ if (context.userId) setUser({ id: context.userId });
62
+ return await handler(...args);
63
+ });
64
+ });
65
+ } finally {
66
+ onToolComplete?.();
67
+ }
68
+ });
69
+ }
70
+ for (const tool of TOOL_DEFINITIONS) {
71
+ const handler = TOOL_HANDLERS[tool.name];
72
+ server.tool(tool.name, tool.description, tool.paramsSchema ? tool.paramsSchema : {}, async (...args) => {
73
+ try {
74
+ return await startNewTrace(async () => {
75
+ return await startSpan({ name: `mcp.tool/${tool.name}` }, async () => {
76
+ if (context.userId) setUser({ id: context.userId });
77
+ try {
78
+ const output = await handler(context, ...args);
79
+ return { content: [{
80
+ type: "text",
81
+ text: output
82
+ }] };
83
+ } catch (error) {
84
+ return {
85
+ content: [{
86
+ type: "text",
87
+ text: await logAndFormatError(error)
88
+ }],
89
+ isError: true
90
+ };
91
+ }
92
+ });
93
+ });
94
+ } finally {
95
+ onToolComplete?.();
96
+ }
97
+ });
98
+ }
99
+ }
100
+
101
+ //#endregion
102
+ export { configureServer };
103
+ //# sourceMappingURL=server-DuRPgdH4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-DuRPgdH4.js","names":["error: unknown"],"sources":["../src/server.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { TOOL_HANDLERS } from \"./tools\";\nimport { TOOL_DEFINITIONS } from \"./toolDefinitions\";\nimport type { ServerContext } from \"./types\";\nimport { 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\";\n\nfunction isApiError(error: unknown) {\n return error instanceof ApiError || Object.hasOwn(error as any, \"status\");\n}\n\nasync function logAndFormatError(error: unknown) {\n const eventId = logError(error);\n\n if (isApiError(error)) {\n const typedError = error as ApiError;\n return [\n \"**Error**\",\n `There was a ${typedError.status} error with the your request to the Sentry API.`,\n `${typedError.message}`,\n \"If you believe this was a genuine error, please report the following to the user for the Sentry team:\",\n `**Event ID**: ${eventId}`,\n ].join(\"\\n\\n\");\n }\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\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\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,\n async (...args) => {\n try {\n return await startNewTrace(async () => {\n return await startSpan(\n { name: `mcp.prompt/${prompt.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\n }\n\n // TODO(dcramer): I'm too dumb to figure this out\n // @ts-ignore\n return await handler(...args);\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 { name: `mcp.tool/${tool.name}` },\n async () => {\n if (context.userId) {\n setUser({\n id: context.userId,\n });\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\n return {\n content: [\n {\n type: \"text\",\n text: output,\n },\n ],\n };\n } catch (error) {\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":";;;;;;;;;;AAWA,SAAS,WAAWA,OAAgB;AAClC,QAAO,iBAAiB,YAAY,OAAO,OAAO,OAAc,SAAS;AAC1E;AAED,eAAe,kBAAkBA,OAAgB;CAC/C,MAAM,UAAU,SAAS,MAAM;AAE/B,KAAI,WAAW,MAAM,EAAE;EACrB,MAAM,aAAa;AACnB,SAAO;GACL;IACC,cAAc,WAAW,OAAO;IAChC,EAAE,WAAW,QAAQ;GACtB;IACC,gBAAgB,QAAQ;EAC1B,EAAC,KAAK,OAAO;CACf;AAED,QAAO;EACL;EACA;EACA;GACC,gBAAgB,QAAQ;EACzB,QAAQ,IAAI,aAAa,eACrB,iBAAiB,QACf,MAAM,UACN,OAAO,MAAM,GACf;CACL,EAAC,KAAK,OAAO;AACf;AAED,eAAsB,gBAAgB,EACpC,QACA,SACA,gBAC2E,EAAE;AAC7E,QAAO,OAAO,UAAU,CAAC,UAAU;AACjC,WAAS,MAAM;CAChB;AAED,MAAK,MAAM,YAAY,UACrB,QAAO;EACL,SAAS;EACT,SAAS;EACT;GACE,aAAa,SAAS;GACtB,UAAU,SAAS;EACpB;;EAED,OAAO,QAAQ;AACb,UAAO,MAAM,cAAc,YAAY;AACrC,WAAO,MAAM,UACX,EAAE,OAAO,eAAe,SAAS,KAAK,EAAG,GACzC,YAAY;AACV,SAAI,QAAQ,OACV,SAAQ,EACN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-o3zWarRp.cjs');
4
+ require('./api-client-CEBuz3Zu.cjs');
5
+ require('./formatting-BTSvl7n7.cjs');
6
+ require('./issue-helpers-C0kEdXOE.cjs');
7
+ require('./logging-BEMgC5SA.cjs');
8
+ require('./tools-BfTTqLNG.cjs');
9
+ require('./schema-BvloqMHW.cjs');
10
+ require('./toolDefinitions-DS7wXdsP.cjs');
11
+ require('./resources-BAE7VVZZ.cjs');
12
+ require('./promptDefinitions-CVB4IyVf.cjs');
13
+ require('./prompts--QCiXmR2.cjs');
14
+ const require_server = require('./server-DY8wjV9H.cjs');
15
+
16
+ exports.configureServer = require_server.configureServer
@@ -0,0 +1,15 @@
1
+ import "./promptDefinitions.d-X_QALSRc.cjs";
2
+ import "./toolDefinitions.d-CIXKiX81.cjs";
3
+ import { ServerContext } from "./types.d-B8gSnrcY.cjs";
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+
6
+ //#region src/server.d.ts
7
+ declare function configureServer({ server, context, onToolComplete, }: {
8
+ server: McpServer;
9
+ context: ServerContext;
10
+ onToolComplete?: () => void;
11
+ }): Promise<void>;
12
+
13
+ //#endregion
14
+ export { configureServer };
15
+ //# sourceMappingURL=server.d.cts.map
@@ -0,0 +1,15 @@
1
+ import "./promptDefinitions.d-qzT7TH_Z.js";
2
+ import "./toolDefinitions.d-DkYVHG7Y.js";
3
+ import { ServerContext } from "./types.d-Bj1fPi3b.js";
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+
6
+ //#region src/server.d.ts
7
+ declare function configureServer({ server, context, onToolComplete, }: {
8
+ server: McpServer;
9
+ context: ServerContext;
10
+ onToolComplete?: () => void;
11
+ }): Promise<void>;
12
+
13
+ //#endregion
14
+ export { configureServer };
15
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","names":[],"sources":["../src/server.d.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type { ServerContext } from \"./types\";\nexport declare function configureServer({ server, context, onToolComplete, }: {\n server: McpServer;\n context: ServerContext;\n onToolComplete?: () => void;\n}): Promise<void>;\n//# sourceMappingURL=server.d.ts.map"],"mappings":";;;;;;AAEA,IAAW,kBAAkB;CAAC;CAAI,MAAM;CAAW,MAAM;CAAe,MAAM;AAAA"}
package/dist/server.js ADDED
@@ -0,0 +1,16 @@
1
+ import "./schema-Bvva80Pn.js";
2
+ import "./client-D1XjYhij.js";
3
+ import "./types-H-TSmRpm.js";
4
+ import "./api-client-9mzrj2HY.js";
5
+ import "./formatting-Bacfde0I.js";
6
+ import "./issue-helpers-DFde36Zu.js";
7
+ import "./logging-Cxm8lQvg.js";
8
+ import "./tools-qkapmf3p.js";
9
+ import "./schema-k04PdSCK.js";
10
+ import "./toolDefinitions-CMNKyt4H.js";
11
+ import "./resources-OM3EAnnj.js";
12
+ import "./promptDefinitions-CaRMCDPI.js";
13
+ import "./prompts-Tz-qECa0.js";
14
+ import { configureServer } from "./server-DuRPgdH4.js";
15
+
16
+ export { configureServer };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ const require_chunk = require('./chunk-BtT13l48.cjs');
3
+ const require_server = require('./server-DY8wjV9H.cjs');
4
+ const __modelcontextprotocol_sdk_server_stdio_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/stdio.js"));
5
+
6
+ //#region src/transports/stdio.ts
7
+ async function startStdio(server, context) {
8
+ const transport = new __modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
9
+ await require_server.configureServer({
10
+ server,
11
+ context
12
+ });
13
+ await server.connect(transport);
14
+ }
15
+
16
+ //#endregion
17
+ Object.defineProperty(exports, 'startStdio', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return startStdio;
21
+ }
22
+ });
23
+ //# sourceMappingURL=stdio-CSJMThag.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio-CSJMThag.cjs","names":["server: McpServer","context: ServerContext","StdioServerTransport"],"sources":["../src/transports/stdio.ts"],"sourcesContent":["import { 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\";\n\nexport async function startStdio(server: McpServer, context: ServerContext) {\n const transport = new StdioServerTransport();\n await configureServer({ server, context });\n await server.connect(transport);\n}\n"],"mappings":";;;;;;AAKA,eAAsB,WAAWA,QAAmBC,SAAwB;CAC1E,MAAM,YAAY,IAAIC;AACtB,OAAM,+BAAgB;EAAE;EAAQ;CAAS,EAAC;AAC1C,OAAM,OAAO,QAAQ,UAAU;AAChC"}
@@ -0,0 +1,16 @@
1
+ import { configureServer } from "./server-DuRPgdH4.js";
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+
4
+ //#region src/transports/stdio.ts
5
+ async function startStdio(server, context) {
6
+ const transport = new StdioServerTransport();
7
+ await configureServer({
8
+ server,
9
+ context
10
+ });
11
+ await server.connect(transport);
12
+ }
13
+
14
+ //#endregion
15
+ export { startStdio };
16
+ //# sourceMappingURL=stdio-Ce5DHKZ4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio-Ce5DHKZ4.js","names":["server: McpServer","context: ServerContext"],"sources":["../src/transports/stdio.ts"],"sourcesContent":["import { 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\";\n\nexport async function startStdio(server: McpServer, context: ServerContext) {\n const transport = new StdioServerTransport();\n await configureServer({ server, context });\n await server.connect(transport);\n}\n"],"mappings":";;;;AAKA,eAAsB,WAAWA,QAAmBC,SAAwB;CAC1E,MAAM,YAAY,IAAI;AACtB,OAAM,gBAAgB;EAAE;EAAQ;CAAS,EAAC;AAC1C,OAAM,OAAO,QAAQ,UAAU;AAChC"}