@burdenoff/mcp-libs 2026.511.1

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 (174) hide show
  1. package/README.md +76 -0
  2. package/dist/chunk-4GBVJ4OY.js +847 -0
  3. package/dist/chunk-4GBVJ4OY.js.map +1 -0
  4. package/dist/chunk-H2OYWLOA.js +919 -0
  5. package/dist/chunk-H2OYWLOA.js.map +1 -0
  6. package/dist/chunk-JFEQYSWM.js +174 -0
  7. package/dist/chunk-JFEQYSWM.js.map +1 -0
  8. package/dist/chunk-WWFVD7BO.js +273 -0
  9. package/dist/chunk-WWFVD7BO.js.map +1 -0
  10. package/dist/context-1jV4NsLv.d.cts +138 -0
  11. package/dist/context-1jV4NsLv.d.ts +138 -0
  12. package/dist/core/index.cjs +953 -0
  13. package/dist/core/index.cjs.map +1 -0
  14. package/dist/core/index.d.cts +59 -0
  15. package/dist/core/index.d.ts +59 -0
  16. package/dist/core/index.js +3 -0
  17. package/dist/core/index.js.map +1 -0
  18. package/dist/http-BP4c721D.d.cts +22 -0
  19. package/dist/http-DXTeCD5r.d.ts +22 -0
  20. package/dist/index.cjs +1013 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +7 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.js +4 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/module-DBcfA-i3.d.ts +67 -0
  27. package/dist/module-DFQBZNK6.d.cts +67 -0
  28. package/dist/modules/auth/index.cjs +533 -0
  29. package/dist/modules/auth/index.cjs.map +1 -0
  30. package/dist/modules/auth/index.d.cts +51 -0
  31. package/dist/modules/auth/index.d.ts +51 -0
  32. package/dist/modules/auth/index.js +159 -0
  33. package/dist/modules/auth/index.js.map +1 -0
  34. package/dist/modules/billing/index.cjs +655 -0
  35. package/dist/modules/billing/index.cjs.map +1 -0
  36. package/dist/modules/billing/index.d.cts +8 -0
  37. package/dist/modules/billing/index.d.ts +8 -0
  38. package/dist/modules/billing/index.js +606 -0
  39. package/dist/modules/billing/index.js.map +1 -0
  40. package/dist/modules/channels/index.cjs +443 -0
  41. package/dist/modules/channels/index.cjs.map +1 -0
  42. package/dist/modules/channels/index.d.cts +8 -0
  43. package/dist/modules/channels/index.d.ts +8 -0
  44. package/dist/modules/channels/index.js +394 -0
  45. package/dist/modules/channels/index.js.map +1 -0
  46. package/dist/modules/conversations/index.cjs +288 -0
  47. package/dist/modules/conversations/index.cjs.map +1 -0
  48. package/dist/modules/conversations/index.d.cts +8 -0
  49. package/dist/modules/conversations/index.d.ts +8 -0
  50. package/dist/modules/conversations/index.js +239 -0
  51. package/dist/modules/conversations/index.js.map +1 -0
  52. package/dist/modules/devportal/index.cjs +796 -0
  53. package/dist/modules/devportal/index.cjs.map +1 -0
  54. package/dist/modules/devportal/index.d.cts +8 -0
  55. package/dist/modules/devportal/index.d.ts +8 -0
  56. package/dist/modules/devportal/index.js +747 -0
  57. package/dist/modules/devportal/index.js.map +1 -0
  58. package/dist/modules/export/index.cjs +333 -0
  59. package/dist/modules/export/index.cjs.map +1 -0
  60. package/dist/modules/export/index.d.cts +8 -0
  61. package/dist/modules/export/index.d.ts +8 -0
  62. package/dist/modules/export/index.js +284 -0
  63. package/dist/modules/export/index.js.map +1 -0
  64. package/dist/modules/files/index.cjs +278 -0
  65. package/dist/modules/files/index.cjs.map +1 -0
  66. package/dist/modules/files/index.d.cts +8 -0
  67. package/dist/modules/files/index.d.ts +8 -0
  68. package/dist/modules/files/index.js +229 -0
  69. package/dist/modules/files/index.js.map +1 -0
  70. package/dist/modules/groups/index.cjs +451 -0
  71. package/dist/modules/groups/index.cjs.map +1 -0
  72. package/dist/modules/groups/index.d.cts +8 -0
  73. package/dist/modules/groups/index.d.ts +8 -0
  74. package/dist/modules/groups/index.js +402 -0
  75. package/dist/modules/groups/index.js.map +1 -0
  76. package/dist/modules/health/index.cjs +159 -0
  77. package/dist/modules/health/index.cjs.map +1 -0
  78. package/dist/modules/health/index.d.cts +8 -0
  79. package/dist/modules/health/index.d.ts +8 -0
  80. package/dist/modules/health/index.js +36 -0
  81. package/dist/modules/health/index.js.map +1 -0
  82. package/dist/modules/integrations/index.cjs +316 -0
  83. package/dist/modules/integrations/index.cjs.map +1 -0
  84. package/dist/modules/integrations/index.d.cts +8 -0
  85. package/dist/modules/integrations/index.d.ts +8 -0
  86. package/dist/modules/integrations/index.js +267 -0
  87. package/dist/modules/integrations/index.js.map +1 -0
  88. package/dist/modules/notifications/index.cjs +222 -0
  89. package/dist/modules/notifications/index.cjs.map +1 -0
  90. package/dist/modules/notifications/index.d.cts +8 -0
  91. package/dist/modules/notifications/index.d.ts +8 -0
  92. package/dist/modules/notifications/index.js +173 -0
  93. package/dist/modules/notifications/index.js.map +1 -0
  94. package/dist/modules/organizations/index.cjs +267 -0
  95. package/dist/modules/organizations/index.cjs.map +1 -0
  96. package/dist/modules/organizations/index.d.cts +8 -0
  97. package/dist/modules/organizations/index.d.ts +8 -0
  98. package/dist/modules/organizations/index.js +218 -0
  99. package/dist/modules/organizations/index.js.map +1 -0
  100. package/dist/modules/products/index.cjs +736 -0
  101. package/dist/modules/products/index.cjs.map +1 -0
  102. package/dist/modules/products/index.d.cts +8 -0
  103. package/dist/modules/products/index.d.ts +8 -0
  104. package/dist/modules/products/index.js +687 -0
  105. package/dist/modules/products/index.js.map +1 -0
  106. package/dist/modules/rbac/index.cjs +378 -0
  107. package/dist/modules/rbac/index.cjs.map +1 -0
  108. package/dist/modules/rbac/index.d.cts +8 -0
  109. package/dist/modules/rbac/index.d.ts +8 -0
  110. package/dist/modules/rbac/index.js +329 -0
  111. package/dist/modules/rbac/index.js.map +1 -0
  112. package/dist/modules/sandbox/index.cjs +318 -0
  113. package/dist/modules/sandbox/index.cjs.map +1 -0
  114. package/dist/modules/sandbox/index.d.cts +8 -0
  115. package/dist/modules/sandbox/index.d.ts +8 -0
  116. package/dist/modules/sandbox/index.js +225 -0
  117. package/dist/modules/sandbox/index.js.map +1 -0
  118. package/dist/modules/scheduler/index.cjs +267 -0
  119. package/dist/modules/scheduler/index.cjs.map +1 -0
  120. package/dist/modules/scheduler/index.d.cts +8 -0
  121. package/dist/modules/scheduler/index.d.ts +8 -0
  122. package/dist/modules/scheduler/index.js +218 -0
  123. package/dist/modules/scheduler/index.js.map +1 -0
  124. package/dist/modules/security/index.cjs +529 -0
  125. package/dist/modules/security/index.cjs.map +1 -0
  126. package/dist/modules/security/index.d.cts +8 -0
  127. package/dist/modules/security/index.d.ts +8 -0
  128. package/dist/modules/security/index.js +480 -0
  129. package/dist/modules/security/index.js.map +1 -0
  130. package/dist/modules/store/index.cjs +450 -0
  131. package/dist/modules/store/index.cjs.map +1 -0
  132. package/dist/modules/store/index.d.cts +8 -0
  133. package/dist/modules/store/index.d.ts +8 -0
  134. package/dist/modules/store/index.js +401 -0
  135. package/dist/modules/store/index.js.map +1 -0
  136. package/dist/modules/support/index.cjs +285 -0
  137. package/dist/modules/support/index.cjs.map +1 -0
  138. package/dist/modules/support/index.d.cts +8 -0
  139. package/dist/modules/support/index.d.ts +8 -0
  140. package/dist/modules/support/index.js +236 -0
  141. package/dist/modules/support/index.js.map +1 -0
  142. package/dist/modules/tags/index.cjs +421 -0
  143. package/dist/modules/tags/index.cjs.map +1 -0
  144. package/dist/modules/tags/index.d.cts +8 -0
  145. package/dist/modules/tags/index.d.ts +8 -0
  146. package/dist/modules/tags/index.js +372 -0
  147. package/dist/modules/tags/index.js.map +1 -0
  148. package/dist/modules/tours/index.cjs +225 -0
  149. package/dist/modules/tours/index.cjs.map +1 -0
  150. package/dist/modules/tours/index.d.cts +8 -0
  151. package/dist/modules/tours/index.d.ts +8 -0
  152. package/dist/modules/tours/index.js +176 -0
  153. package/dist/modules/tours/index.js.map +1 -0
  154. package/dist/modules/vibecontrols/index.cjs +5551 -0
  155. package/dist/modules/vibecontrols/index.cjs.map +1 -0
  156. package/dist/modules/vibecontrols/index.d.cts +8 -0
  157. package/dist/modules/vibecontrols/index.d.ts +8 -0
  158. package/dist/modules/vibecontrols/index.js +4380 -0
  159. package/dist/modules/vibecontrols/index.js.map +1 -0
  160. package/dist/modules/workspaces/index.cjs +552 -0
  161. package/dist/modules/workspaces/index.cjs.map +1 -0
  162. package/dist/modules/workspaces/index.d.cts +8 -0
  163. package/dist/modules/workspaces/index.d.ts +8 -0
  164. package/dist/modules/workspaces/index.js +503 -0
  165. package/dist/modules/workspaces/index.js.map +1 -0
  166. package/dist/tool-name-CQf_IqAj.d.cts +47 -0
  167. package/dist/tool-name-DlnrBsZ6.d.ts +47 -0
  168. package/dist/transports/index.cjs +183 -0
  169. package/dist/transports/index.cjs.map +1 -0
  170. package/dist/transports/index.d.cts +13 -0
  171. package/dist/transports/index.d.ts +13 -0
  172. package/dist/transports/index.js +3 -0
  173. package/dist/transports/index.js.map +1 -0
  174. package/package.json +125 -0
@@ -0,0 +1,796 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+ require('graphql-request');
5
+ require('cross-fetch');
6
+ require('@modelcontextprotocol/sdk/server/mcp.js');
7
+ require('@modelcontextprotocol/sdk/types.js');
8
+
9
+ // src/modules/devportal/tools.ts
10
+
11
+ // src/core/errors.ts
12
+ var McpInternalError = class extends Error {
13
+ cause;
14
+ constructor(message, cause) {
15
+ super(message);
16
+ this.name = "McpInternalError";
17
+ this.cause = cause;
18
+ }
19
+ };
20
+
21
+ // src/core/result.ts
22
+ function jsonResult(data, structured) {
23
+ const result = {
24
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
25
+ };
26
+ return result;
27
+ }
28
+ function errorResult(message, hint) {
29
+ const text = hint ? `${message}
30
+
31
+ Hint: ${hint}` : message;
32
+ return { content: [{ type: "text", text }], isError: true };
33
+ }
34
+
35
+ // src/core/tool-name.ts
36
+ var MAX_TOOL_NAME_LENGTH = 63;
37
+ function assertSafeName(name, kind) {
38
+ if (name.length > MAX_TOOL_NAME_LENGTH) {
39
+ throw new McpInternalError(
40
+ `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`
41
+ );
42
+ }
43
+ return name;
44
+ }
45
+ function mcpToolName(productName, ...parts) {
46
+ if (!productName) {
47
+ throw new McpInternalError("mcpToolName: productName is required");
48
+ }
49
+ const name = [productName, ...parts].filter(Boolean).join("_");
50
+ return assertSafeName(name);
51
+ }
52
+
53
+ // src/modules/devportal/operations.ts
54
+ var LIST_ORGANIZATIONS = `
55
+ query ListOrganizations($limit: Int, $offset: Int) {
56
+ organizations(limit: $limit, offset: $offset) {
57
+ edges { node { id name slug status } }
58
+ totalCount pageInfo { hasNextPage }
59
+ }
60
+ }
61
+ `;
62
+ var GET_ORGANIZATION = `
63
+ query GetOrganization($id: ID!) {
64
+ organization(id: $id) {
65
+ id name description status
66
+ }
67
+ }
68
+ `;
69
+ var CREATE_ORGANIZATION = `
70
+ mutation CreateOrganization($input: CreateOrganizationInput!) {
71
+ createOrganization(input: $input) {
72
+ id name slug status
73
+ }
74
+ }
75
+ `;
76
+ var UPDATE_ORGANIZATION = `
77
+ mutation UpdateOrganization($id: ID!, $input: UpdateOrganizationInput!) {
78
+ updateOrganization(id: $id, input: $input) {
79
+ id name updatedAt
80
+ }
81
+ }
82
+ `;
83
+ var DELETE_ORGANIZATION = `
84
+ mutation DeleteOrganization($id: ID!) {
85
+ deleteOrganization(id: $id) { success }
86
+ }
87
+ `;
88
+ var LIST_APPLICATIONS = `
89
+ query ListApplications($organizationId: ID, $status: String, $limit: Int) {
90
+ applications(organizationId: $organizationId, status: $status, limit: $limit) {
91
+ edges { node { id name status installCount averageRating } }
92
+ totalCount
93
+ }
94
+ }
95
+ `;
96
+ var GET_APPLICATION = `
97
+ query GetApplication($id: ID!) {
98
+ application(id: $id) {
99
+ id name status reviewStatus publishedAt installCount
100
+ }
101
+ }
102
+ `;
103
+ var CREATE_APPLICATION = `
104
+ mutation CreateApplication($input: CreateApplicationInput!) {
105
+ createApplication(input: $input) {
106
+ id name status appId
107
+ }
108
+ }
109
+ `;
110
+ var UPDATE_APPLICATION = `
111
+ mutation UpdateApplication($id: ID!, $input: UpdateApplicationInput!) {
112
+ updateApplication(id: $id, input: $input) {
113
+ id description updatedAt
114
+ }
115
+ }
116
+ `;
117
+ var SUBMIT_APPLICATION_FOR_REVIEW = `
118
+ mutation SubmitApplicationForReview($id: ID!, $notes: String) {
119
+ submitApplicationForReview(id: $id, notes: $notes) {
120
+ id status reviewStatus submittedAt
121
+ }
122
+ }
123
+ `;
124
+ var PUBLISH_APPLICATION = `
125
+ mutation PublishApplication($id: ID!) {
126
+ publishApplication(id: $id) {
127
+ id status publishedAt
128
+ }
129
+ }
130
+ `;
131
+ var DELETE_APPLICATION = `
132
+ mutation DeleteApplication($id: ID!) {
133
+ deleteApplication(id: $id) { success }
134
+ }
135
+ `;
136
+ var APPLICATION_VERSIONS = `
137
+ query ApplicationVersions($applicationId: ID!) {
138
+ applicationVersions(applicationId: $applicationId) {
139
+ id version status isLatest isStable releaseNotes
140
+ }
141
+ }
142
+ `;
143
+ var CREATE_APPLICATION_VERSION = `
144
+ mutation CreateApplicationVersion($applicationId: ID!, $input: CreateApplicationVersionInput!) {
145
+ createApplicationVersion(applicationId: $applicationId, input: $input) {
146
+ id version status publishedAt
147
+ }
148
+ }
149
+ `;
150
+ var LIST_WEBHOOKS = `
151
+ query ListDevportalWebhooks($applicationId: ID!) {
152
+ webhooks(applicationId: $applicationId) {
153
+ id name url events isActive status failureCount
154
+ }
155
+ }
156
+ `;
157
+ var CREATE_WEBHOOK = `
158
+ mutation CreateDevportalWebhook($input: CreateWebhookInput!) {
159
+ createWebhook(input: $input) {
160
+ id name url status
161
+ }
162
+ }
163
+ `;
164
+ var DELETE_WEBHOOK = `
165
+ mutation DeleteDevportalWebhook($id: ID!) {
166
+ deleteWebhook(id: $id) { success }
167
+ }
168
+ `;
169
+ var APPLICATION_ANALYTICS = `
170
+ query ApplicationAnalytics($applicationId: ID!, $period: String!, $startDate: DateTime, $endDate: DateTime) {
171
+ applicationAnalytics(applicationId: $applicationId, period: $period, startDate: $startDate, endDate: $endDate) {
172
+ date period activeUsers apiCalls avgResponseTime sessions
173
+ }
174
+ }
175
+ `;
176
+ var ORGANIZATION_REVENUE = `
177
+ query OrganizationRevenue($organizationId: ID!, $period: String!) {
178
+ organizationRevenue(organizationId: $organizationId, period: $period) {
179
+ totalEarnings currency netEarnings
180
+ }
181
+ }
182
+ `;
183
+ var ADMIN_REVIEWS = `
184
+ query AdminReviews($status: String) {
185
+ adminReviews(status: $status) {
186
+ edges { node { id applicationId reviewStatus reviewNotes } }
187
+ totalCount
188
+ }
189
+ }
190
+ `;
191
+ var APPROVE_APPLICATION = `
192
+ mutation ApproveApplication($id: ID!, $notes: String) {
193
+ approveApplication(id: $id, notes: $notes) {
194
+ id status reviewStatus publishedAt
195
+ }
196
+ }
197
+ `;
198
+ var REJECT_APPLICATION = `
199
+ mutation RejectApplication($id: ID!, $notes: String!) {
200
+ rejectApplication(id: $id, notes: $notes) {
201
+ id status reviewStatus reviewNotes
202
+ }
203
+ }
204
+ `;
205
+
206
+ // src/modules/devportal/tools.ts
207
+ function registerDevportalTools(server, ctx, track) {
208
+ server.registerTool(
209
+ track(mcpToolName(ctx.productName, "devportal_orgs_list")),
210
+ {
211
+ title: "List Devportal Organizations",
212
+ description: "List publisher organizations.",
213
+ inputSchema: {
214
+ limit: zod.z.number().optional().describe("Page size (default 50)"),
215
+ offset: zod.z.number().optional().describe("Skip results")
216
+ }
217
+ },
218
+ async ({ limit, offset }) => {
219
+ try {
220
+ const data = await ctx.gql.global.request(LIST_ORGANIZATIONS, { limit: limit ?? 50, offset: offset ?? 0 });
221
+ return jsonResult({
222
+ items: data.organizations.edges.map((e) => e.node),
223
+ totalCount: data.organizations.totalCount
224
+ });
225
+ } catch (error) {
226
+ ctx.logger.error("devportal_orgs_list failed", { error: String(error) });
227
+ return errorResult(
228
+ `Failed to list organizations: ${error instanceof Error ? error.message : String(error)}`
229
+ );
230
+ }
231
+ }
232
+ );
233
+ server.registerTool(
234
+ track(mcpToolName(ctx.productName, "devportal_orgs_get")),
235
+ {
236
+ title: "Get Devportal Organization",
237
+ description: "Get a publisher organization by ID.",
238
+ inputSchema: { id: zod.z.string().describe("Organization ID") }
239
+ },
240
+ async ({ id }) => {
241
+ try {
242
+ const data = await ctx.gql.global.request(
243
+ GET_ORGANIZATION,
244
+ { id }
245
+ );
246
+ if (!data.organization) return errorResult(`Organization ${id} not found`);
247
+ return jsonResult(data.organization);
248
+ } catch (error) {
249
+ ctx.logger.error("devportal_orgs_get failed", { error: String(error) });
250
+ return errorResult(
251
+ `Failed to get organization: ${error instanceof Error ? error.message : String(error)}`
252
+ );
253
+ }
254
+ }
255
+ );
256
+ server.registerTool(
257
+ track(mcpToolName(ctx.productName, "devportal_orgs_create")),
258
+ {
259
+ title: "Create Publisher Organization",
260
+ description: "Create a publisher organization.",
261
+ inputSchema: {
262
+ name: zod.z.string().describe("Organization name"),
263
+ description: zod.z.string().optional(),
264
+ tier: zod.z.string().optional().describe("INDIVIDUAL|ORGANIZATION|ENTERPRISE (default ORGANIZATION)")
265
+ }
266
+ },
267
+ async ({ name, description, tier }) => {
268
+ try {
269
+ const input = {
270
+ name,
271
+ tier: (tier ?? "ORGANIZATION").toUpperCase()
272
+ };
273
+ if (description !== void 0) input.description = description;
274
+ const data = await ctx.gql.global.request(
275
+ CREATE_ORGANIZATION,
276
+ { input }
277
+ );
278
+ return jsonResult(data.createOrganization);
279
+ } catch (error) {
280
+ ctx.logger.error("devportal_orgs_create failed", { error: String(error) });
281
+ return errorResult(
282
+ `Failed to create organization: ${error instanceof Error ? error.message : String(error)}`
283
+ );
284
+ }
285
+ }
286
+ );
287
+ server.registerTool(
288
+ track(mcpToolName(ctx.productName, "devportal_orgs_update")),
289
+ {
290
+ title: "Update Publisher Organization",
291
+ description: "Update a publisher organization.",
292
+ inputSchema: {
293
+ id: zod.z.string().describe("Organization ID"),
294
+ name: zod.z.string().optional(),
295
+ description: zod.z.string().optional()
296
+ }
297
+ },
298
+ async ({ id, name, description }) => {
299
+ try {
300
+ const input = {};
301
+ if (name !== void 0) input.name = name;
302
+ if (description !== void 0) input.description = description;
303
+ if (!Object.keys(input).length) return errorResult("No updates specified");
304
+ const data = await ctx.gql.global.request(
305
+ UPDATE_ORGANIZATION,
306
+ { id, input }
307
+ );
308
+ return jsonResult(data.updateOrganization);
309
+ } catch (error) {
310
+ ctx.logger.error("devportal_orgs_update failed", { error: String(error) });
311
+ return errorResult(
312
+ `Failed to update organization: ${error instanceof Error ? error.message : String(error)}`
313
+ );
314
+ }
315
+ }
316
+ );
317
+ server.registerTool(
318
+ track(mcpToolName(ctx.productName, "devportal_orgs_delete")),
319
+ {
320
+ title: "Delete Publisher Organization",
321
+ description: "Delete a publisher organization.",
322
+ inputSchema: { id: zod.z.string().describe("Organization ID") }
323
+ },
324
+ async ({ id }) => {
325
+ try {
326
+ await ctx.gql.global.request(DELETE_ORGANIZATION, { id });
327
+ return jsonResult({ status: "success", message: "Organization deleted", orgId: id });
328
+ } catch (error) {
329
+ ctx.logger.error("devportal_orgs_delete failed", { error: String(error) });
330
+ return errorResult(
331
+ `Failed to delete organization: ${error instanceof Error ? error.message : String(error)}`
332
+ );
333
+ }
334
+ }
335
+ );
336
+ server.registerTool(
337
+ track(mcpToolName(ctx.productName, "devportal_apps_list")),
338
+ {
339
+ title: "List Devportal Applications",
340
+ description: "List devportal applications.",
341
+ inputSchema: {
342
+ organizationId: zod.z.string().optional(),
343
+ status: zod.z.string().optional().describe("DRAFT|REVIEW|PUBLISHED|ARCHIVED"),
344
+ limit: zod.z.number().optional().describe("Page size (default 50)")
345
+ }
346
+ },
347
+ async ({ organizationId, status, limit }) => {
348
+ try {
349
+ const data = await ctx.gql.global.request(LIST_APPLICATIONS, {
350
+ organizationId,
351
+ status: status ? status.toUpperCase() : void 0,
352
+ limit: limit ?? 50
353
+ });
354
+ return jsonResult({
355
+ items: data.applications.edges.map((e) => e.node),
356
+ totalCount: data.applications.totalCount
357
+ });
358
+ } catch (error) {
359
+ ctx.logger.error("devportal_apps_list failed", { error: String(error) });
360
+ return errorResult(
361
+ `Failed to list applications: ${error instanceof Error ? error.message : String(error)}`
362
+ );
363
+ }
364
+ }
365
+ );
366
+ server.registerTool(
367
+ track(mcpToolName(ctx.productName, "devportal_apps_get")),
368
+ {
369
+ title: "Get Devportal Application",
370
+ description: "Get a devportal application by ID.",
371
+ inputSchema: { id: zod.z.string().describe("Application ID") }
372
+ },
373
+ async ({ id }) => {
374
+ try {
375
+ const data = await ctx.gql.global.request(
376
+ GET_APPLICATION,
377
+ { id }
378
+ );
379
+ if (!data.application) return errorResult(`Application ${id} not found`);
380
+ return jsonResult(data.application);
381
+ } catch (error) {
382
+ ctx.logger.error("devportal_apps_get failed", { error: String(error) });
383
+ return errorResult(
384
+ `Failed to get application: ${error instanceof Error ? error.message : String(error)}`
385
+ );
386
+ }
387
+ }
388
+ );
389
+ server.registerTool(
390
+ track(mcpToolName(ctx.productName, "devportal_apps_create")),
391
+ {
392
+ title: "Create Devportal Application",
393
+ description: "Create a devportal application.",
394
+ inputSchema: {
395
+ name: zod.z.string().describe("Application name"),
396
+ organizationId: zod.z.string().describe("Owning organization ID"),
397
+ appType: zod.z.string().optional().describe("API_INTEGRATION|WEB_APP|MOBILE_APP (default API_INTEGRATION)"),
398
+ description: zod.z.string().optional()
399
+ }
400
+ },
401
+ async ({ name, organizationId, appType, description }) => {
402
+ try {
403
+ const input = {
404
+ name,
405
+ organizationId,
406
+ appType: (appType ?? "API_INTEGRATION").toUpperCase()
407
+ };
408
+ if (description !== void 0) input.description = description;
409
+ const data = await ctx.gql.global.request(CREATE_APPLICATION, { input });
410
+ return jsonResult(data.createApplication);
411
+ } catch (error) {
412
+ ctx.logger.error("devportal_apps_create failed", { error: String(error) });
413
+ return errorResult(
414
+ `Failed to create application: ${error instanceof Error ? error.message : String(error)}`
415
+ );
416
+ }
417
+ }
418
+ );
419
+ server.registerTool(
420
+ track(mcpToolName(ctx.productName, "devportal_apps_update")),
421
+ {
422
+ title: "Update Devportal Application",
423
+ description: "Update a devportal application.",
424
+ inputSchema: {
425
+ id: zod.z.string().describe("Application ID"),
426
+ description: zod.z.string().optional(),
427
+ pricingType: zod.z.string().optional().describe("FREE|PAID_ONETIME|SUBSCRIPTION"),
428
+ documentationUrl: zod.z.string().optional()
429
+ }
430
+ },
431
+ async ({ id, description, pricingType, documentationUrl }) => {
432
+ try {
433
+ const input = {};
434
+ if (description !== void 0) input.description = description;
435
+ if (pricingType !== void 0) input.pricingType = pricingType.toUpperCase();
436
+ if (documentationUrl !== void 0) input.documentationUrl = documentationUrl;
437
+ if (!Object.keys(input).length) return errorResult("No updates specified");
438
+ const data = await ctx.gql.global.request(
439
+ UPDATE_APPLICATION,
440
+ { id, input }
441
+ );
442
+ return jsonResult(data.updateApplication);
443
+ } catch (error) {
444
+ ctx.logger.error("devportal_apps_update failed", { error: String(error) });
445
+ return errorResult(
446
+ `Failed to update application: ${error instanceof Error ? error.message : String(error)}`
447
+ );
448
+ }
449
+ }
450
+ );
451
+ server.registerTool(
452
+ track(mcpToolName(ctx.productName, "devportal_apps_submit_review")),
453
+ {
454
+ title: "Submit Application For Review",
455
+ description: "Submit an application for admin review.",
456
+ inputSchema: {
457
+ id: zod.z.string().describe("Application ID"),
458
+ notes: zod.z.string().optional().describe("Optional submission notes")
459
+ }
460
+ },
461
+ async ({ id, notes }) => {
462
+ try {
463
+ const data = await ctx.gql.global.request(
464
+ SUBMIT_APPLICATION_FOR_REVIEW,
465
+ { id, notes }
466
+ );
467
+ return jsonResult(data.submitApplicationForReview);
468
+ } catch (error) {
469
+ ctx.logger.error("devportal_apps_submit_review failed", { error: String(error) });
470
+ return errorResult(
471
+ `Failed to submit for review: ${error instanceof Error ? error.message : String(error)}`
472
+ );
473
+ }
474
+ }
475
+ );
476
+ server.registerTool(
477
+ track(mcpToolName(ctx.productName, "devportal_apps_publish")),
478
+ {
479
+ title: "Publish Application",
480
+ description: "Publish an approved application. Note: in the legacy CLI this opened a browser; here it just calls the publish mutation directly.",
481
+ inputSchema: { id: zod.z.string().describe("Application ID") }
482
+ },
483
+ async ({ id }) => {
484
+ try {
485
+ const data = await ctx.gql.global.request(
486
+ PUBLISH_APPLICATION,
487
+ { id }
488
+ );
489
+ return jsonResult(data.publishApplication);
490
+ } catch (error) {
491
+ ctx.logger.error("devportal_apps_publish failed", { error: String(error) });
492
+ return errorResult(
493
+ `Failed to publish application: ${error instanceof Error ? error.message : String(error)}`
494
+ );
495
+ }
496
+ }
497
+ );
498
+ server.registerTool(
499
+ track(mcpToolName(ctx.productName, "devportal_apps_delete")),
500
+ {
501
+ title: "Delete Devportal Application",
502
+ description: "Delete a devportal application.",
503
+ inputSchema: { id: zod.z.string().describe("Application ID") }
504
+ },
505
+ async ({ id }) => {
506
+ try {
507
+ await ctx.gql.global.request(DELETE_APPLICATION, { id });
508
+ return jsonResult({ status: "success", message: "Application deleted", appId: id });
509
+ } catch (error) {
510
+ ctx.logger.error("devportal_apps_delete failed", { error: String(error) });
511
+ return errorResult(
512
+ `Failed to delete application: ${error instanceof Error ? error.message : String(error)}`
513
+ );
514
+ }
515
+ }
516
+ );
517
+ server.registerTool(
518
+ track(mcpToolName(ctx.productName, "devportal_apps_versions_list")),
519
+ {
520
+ title: "List Application Versions",
521
+ description: "List versions for an application.",
522
+ inputSchema: { applicationId: zod.z.string().describe("Application ID") }
523
+ },
524
+ async ({ applicationId }) => {
525
+ try {
526
+ const data = await ctx.gql.global.request(
527
+ APPLICATION_VERSIONS,
528
+ { applicationId }
529
+ );
530
+ return jsonResult(data.applicationVersions);
531
+ } catch (error) {
532
+ ctx.logger.error("devportal_apps_versions_list failed", { error: String(error) });
533
+ return errorResult(
534
+ `Failed to list versions: ${error instanceof Error ? error.message : String(error)}`
535
+ );
536
+ }
537
+ }
538
+ );
539
+ server.registerTool(
540
+ track(mcpToolName(ctx.productName, "devportal_apps_versions_create")),
541
+ {
542
+ title: "Create Application Version",
543
+ description: "Create a new version for an application.",
544
+ inputSchema: {
545
+ applicationId: zod.z.string().describe("Application ID"),
546
+ version: zod.z.string().describe('Version string (e.g. "1.2.0")'),
547
+ releaseNotes: zod.z.string().optional(),
548
+ packageUrl: zod.z.string().optional()
549
+ }
550
+ },
551
+ async ({ applicationId, version, releaseNotes, packageUrl }) => {
552
+ try {
553
+ const input = { version };
554
+ if (releaseNotes !== void 0) input.releaseNotes = releaseNotes;
555
+ if (packageUrl !== void 0) input.packageUrl = packageUrl;
556
+ const data = await ctx.gql.global.request(
557
+ CREATE_APPLICATION_VERSION,
558
+ { applicationId, input }
559
+ );
560
+ return jsonResult(data.createApplicationVersion);
561
+ } catch (error) {
562
+ ctx.logger.error("devportal_apps_versions_create failed", { error: String(error) });
563
+ return errorResult(
564
+ `Failed to create version: ${error instanceof Error ? error.message : String(error)}`
565
+ );
566
+ }
567
+ }
568
+ );
569
+ server.registerTool(
570
+ track(mcpToolName(ctx.productName, "devportal_apps_webhooks_list")),
571
+ {
572
+ title: "List Application Webhooks",
573
+ description: "List webhooks attached to an application.",
574
+ inputSchema: { applicationId: zod.z.string().describe("Application ID") }
575
+ },
576
+ async ({ applicationId }) => {
577
+ try {
578
+ const data = await ctx.gql.global.request(LIST_WEBHOOKS, {
579
+ applicationId
580
+ });
581
+ return jsonResult(data.webhooks);
582
+ } catch (error) {
583
+ ctx.logger.error("devportal_apps_webhooks_list failed", { error: String(error) });
584
+ return errorResult(
585
+ `Failed to list webhooks: ${error instanceof Error ? error.message : String(error)}`
586
+ );
587
+ }
588
+ }
589
+ );
590
+ server.registerTool(
591
+ track(mcpToolName(ctx.productName, "devportal_apps_webhooks_add")),
592
+ {
593
+ title: "Add Application Webhook",
594
+ description: "Add a webhook to an application.",
595
+ inputSchema: {
596
+ applicationId: zod.z.string().describe("Application ID"),
597
+ name: zod.z.string().describe("Webhook name"),
598
+ url: zod.z.string().describe("Delivery URL"),
599
+ events: zod.z.array(zod.z.string()).describe("Event names"),
600
+ maxRetries: zod.z.number().optional().describe("Default 5")
601
+ }
602
+ },
603
+ async ({ applicationId, name, url, events, maxRetries }) => {
604
+ try {
605
+ const input = {
606
+ applicationId,
607
+ name,
608
+ url,
609
+ events,
610
+ retryEnabled: true,
611
+ maxRetries: maxRetries ?? 5
612
+ };
613
+ const data = await ctx.gql.global.request(
614
+ CREATE_WEBHOOK,
615
+ { input }
616
+ );
617
+ return jsonResult(data.createWebhook);
618
+ } catch (error) {
619
+ ctx.logger.error("devportal_apps_webhooks_add failed", { error: String(error) });
620
+ return errorResult(
621
+ `Failed to create webhook: ${error instanceof Error ? error.message : String(error)}`
622
+ );
623
+ }
624
+ }
625
+ );
626
+ server.registerTool(
627
+ track(mcpToolName(ctx.productName, "devportal_apps_webhooks_remove")),
628
+ {
629
+ title: "Remove Application Webhook",
630
+ description: "Remove a webhook by ID.",
631
+ inputSchema: { id: zod.z.string().describe("Webhook ID") }
632
+ },
633
+ async ({ id }) => {
634
+ try {
635
+ await ctx.gql.global.request(DELETE_WEBHOOK, { id });
636
+ return jsonResult({ status: "success", message: "Webhook removed", webhookId: id });
637
+ } catch (error) {
638
+ ctx.logger.error("devportal_apps_webhooks_remove failed", { error: String(error) });
639
+ return errorResult(
640
+ `Failed to remove webhook: ${error instanceof Error ? error.message : String(error)}`
641
+ );
642
+ }
643
+ }
644
+ );
645
+ server.registerTool(
646
+ track(mcpToolName(ctx.productName, "devportal_apps_analytics")),
647
+ {
648
+ title: "Application Analytics",
649
+ description: "Get analytics for an application over a period.",
650
+ inputSchema: {
651
+ applicationId: zod.z.string().describe("Application ID"),
652
+ period: zod.z.string().optional().describe("LAST_7_DAYS|LAST_30_DAYS|CUSTOM (default LAST_30_DAYS)"),
653
+ startDate: zod.z.string().optional().describe("ISO 8601 (required when period=CUSTOM)"),
654
+ endDate: zod.z.string().optional().describe("ISO 8601")
655
+ }
656
+ },
657
+ async ({ applicationId, period, startDate, endDate }) => {
658
+ try {
659
+ const data = await ctx.gql.global.request(APPLICATION_ANALYTICS, {
660
+ applicationId,
661
+ period: (period ?? "LAST_30_DAYS").toUpperCase(),
662
+ startDate,
663
+ endDate
664
+ });
665
+ return jsonResult(data.applicationAnalytics);
666
+ } catch (error) {
667
+ ctx.logger.error("devportal_apps_analytics failed", { error: String(error) });
668
+ return errorResult(
669
+ `Failed to fetch analytics: ${error instanceof Error ? error.message : String(error)}`
670
+ );
671
+ }
672
+ }
673
+ );
674
+ server.registerTool(
675
+ track(mcpToolName(ctx.productName, "devportal_revenue")),
676
+ {
677
+ title: "Organization Revenue",
678
+ description: "Get revenue summary for an organization.",
679
+ inputSchema: {
680
+ organizationId: zod.z.string().describe("Organization ID"),
681
+ period: zod.z.string().optional().describe("LAST_7_DAYS|LAST_30_DAYS|YTD (default LAST_30_DAYS)")
682
+ }
683
+ },
684
+ async ({ organizationId, period }) => {
685
+ try {
686
+ const data = await ctx.gql.global.request(ORGANIZATION_REVENUE, {
687
+ organizationId,
688
+ period: (period ?? "LAST_30_DAYS").toUpperCase()
689
+ });
690
+ return jsonResult(data.organizationRevenue);
691
+ } catch (error) {
692
+ ctx.logger.error("devportal_revenue failed", { error: String(error) });
693
+ return errorResult(
694
+ `Failed to fetch revenue: ${error instanceof Error ? error.message : String(error)}`
695
+ );
696
+ }
697
+ }
698
+ );
699
+ server.registerTool(
700
+ track(mcpToolName(ctx.productName, "devportal_admin_reviews_list")),
701
+ {
702
+ title: "List Admin Application Reviews",
703
+ description: "List applications in the admin review queue.",
704
+ inputSchema: {
705
+ status: zod.z.string().optional().describe("PENDING|APPROVED|REJECTED (default PENDING)")
706
+ }
707
+ },
708
+ async ({ status }) => {
709
+ try {
710
+ const data = await ctx.gql.global.request(ADMIN_REVIEWS, { status: (status ?? "PENDING").toUpperCase() });
711
+ return jsonResult({
712
+ items: data.adminReviews.edges.map((e) => e.node),
713
+ totalCount: data.adminReviews.totalCount
714
+ });
715
+ } catch (error) {
716
+ ctx.logger.error("devportal_admin_reviews_list failed", { error: String(error) });
717
+ return errorResult(
718
+ `Failed to list reviews: ${error instanceof Error ? error.message : String(error)}`
719
+ );
720
+ }
721
+ }
722
+ );
723
+ server.registerTool(
724
+ track(mcpToolName(ctx.productName, "devportal_admin_reviews_approve")),
725
+ {
726
+ title: "Approve Application",
727
+ description: "Approve a pending application.",
728
+ inputSchema: {
729
+ id: zod.z.string().describe("Application ID"),
730
+ notes: zod.z.string().optional()
731
+ }
732
+ },
733
+ async ({ id, notes }) => {
734
+ try {
735
+ const data = await ctx.gql.global.request(
736
+ APPROVE_APPLICATION,
737
+ { id, notes }
738
+ );
739
+ return jsonResult(data.approveApplication);
740
+ } catch (error) {
741
+ ctx.logger.error("devportal_admin_reviews_approve failed", { error: String(error) });
742
+ return errorResult(
743
+ `Failed to approve application: ${error instanceof Error ? error.message : String(error)}`
744
+ );
745
+ }
746
+ }
747
+ );
748
+ server.registerTool(
749
+ track(mcpToolName(ctx.productName, "devportal_admin_reviews_reject")),
750
+ {
751
+ title: "Reject Application",
752
+ description: "Reject a pending application.",
753
+ inputSchema: {
754
+ id: zod.z.string().describe("Application ID"),
755
+ notes: zod.z.string().describe("Reason for rejection (required)")
756
+ }
757
+ },
758
+ async ({ id, notes }) => {
759
+ try {
760
+ const data = await ctx.gql.global.request(
761
+ REJECT_APPLICATION,
762
+ { id, notes }
763
+ );
764
+ return jsonResult(data.rejectApplication);
765
+ } catch (error) {
766
+ ctx.logger.error("devportal_admin_reviews_reject failed", { error: String(error) });
767
+ return errorResult(
768
+ `Failed to reject application: ${error instanceof Error ? error.message : String(error)}`
769
+ );
770
+ }
771
+ }
772
+ );
773
+ }
774
+
775
+ // src/modules/devportal/index.ts
776
+ var devportalModule = {
777
+ id: "devportal",
778
+ version: "0.0.1",
779
+ displayName: "Developer Portal",
780
+ dependsOn: ["auth"],
781
+ capabilities: { tools: {} },
782
+ register(server, ctx) {
783
+ const tools = [];
784
+ const track = (n) => {
785
+ tools.push(n);
786
+ return n;
787
+ };
788
+ registerDevportalTools(server, ctx, track);
789
+ return { tools, resources: [], prompts: [] };
790
+ }
791
+ };
792
+ var devportal_default = devportalModule;
793
+
794
+ module.exports = devportal_default;
795
+ //# sourceMappingURL=index.cjs.map
796
+ //# sourceMappingURL=index.cjs.map