@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,503 @@
1
+ import { mcpToolName, jsonResult, errorResult } from '../../chunk-H2OYWLOA.js';
2
+ import { z } from 'zod';
3
+
4
+ // src/modules/workspaces/operations.ts
5
+ var GET_WORKSPACE = `
6
+ query GetWorkspace($id: ID!) {
7
+ workspace(id: $id) {
8
+ id name slug description tenantId organizationId status createdAt updatedAt
9
+ }
10
+ }
11
+ `;
12
+ var CREATE_WORKSPACE = `
13
+ mutation CreateWorkspace($input: CreateWorkspaceInput!) {
14
+ createWorkspace(input: $input) {
15
+ id name slug status createdAt
16
+ }
17
+ }
18
+ `;
19
+ var UPDATE_WORKSPACE = `
20
+ mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
21
+ updateWorkspace(id: $id, input: $input) {
22
+ id name description status updatedAt
23
+ }
24
+ }
25
+ `;
26
+ var DELETE_WORKSPACE = `
27
+ mutation DeleteWorkspace($id: ID!) {
28
+ deleteWorkspace(id: $id)
29
+ }
30
+ `;
31
+ var LIST_WORKSPACE_MEMBERS = `
32
+ query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {
33
+ workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {
34
+ items { id userId email role status joinedAt }
35
+ total hasMore
36
+ }
37
+ }
38
+ `;
39
+ var ADD_WORKSPACE_MEMBER = `
40
+ mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {
41
+ addWorkspaceMember(input: $input) {
42
+ id userId role status
43
+ }
44
+ }
45
+ `;
46
+ var REMOVE_WORKSPACE_MEMBER = `
47
+ mutation RemoveWorkspaceMember($id: ID!) {
48
+ removeWorkspaceMember(id: $id)
49
+ }
50
+ `;
51
+ var UPDATE_WORKSPACE_MEMBER_ROLES = `
52
+ mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
53
+ updateWorkspaceMemberRoles(input: $input) {
54
+ id userId role
55
+ }
56
+ }
57
+ `;
58
+ var LIST_PROJECTS = `
59
+ query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {
60
+ projects(filter: $filter, pagination: $pagination) {
61
+ items { id name workspaceId status createdAt }
62
+ total hasMore
63
+ }
64
+ }
65
+ `;
66
+ var GET_PROJECT = `
67
+ query GetProject($id: ID!) {
68
+ project(id: $id) {
69
+ id name description workspaceId status createdAt updatedAt
70
+ }
71
+ }
72
+ `;
73
+ var CREATE_PROJECT = `
74
+ mutation CreateProject($input: CreateProjectInput!) {
75
+ createProject(input: $input) {
76
+ id name workspaceId status
77
+ }
78
+ }
79
+ `;
80
+ var ACCEPT_INVITATION = `
81
+ mutation AcceptInvitation($id: ID!) {
82
+ acceptInvitation(id: $id) {
83
+ id status workspaceId
84
+ }
85
+ }
86
+ `;
87
+ var WORKSPACE_ACTIVITY = `
88
+ query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
89
+ getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
90
+ id action actorId summary createdAt
91
+ }
92
+ }
93
+ `;
94
+
95
+ // src/modules/workspaces/tools.ts
96
+ var RoleEnum = z.enum(["MEMBER", "ADMIN", "OWNER"]);
97
+ function registerWorkspaceTools(server, ctx, track) {
98
+ server.registerTool(
99
+ track(mcpToolName(ctx.productName, "workspace_current")),
100
+ {
101
+ title: "Current Workspace",
102
+ description: "Inspect the workspace currently bound to this MCP session (workspace ID, organization ID, and whether a workspace token is held).",
103
+ inputSchema: {}
104
+ },
105
+ async () => {
106
+ try {
107
+ const auth = ctx.auth.read();
108
+ const wid = auth?.workspaceId ?? null;
109
+ if (!wid) {
110
+ return jsonResult({
111
+ workspaceId: null,
112
+ organizationId: null,
113
+ hasWorkspaceToken: false,
114
+ message: "No workspace selected. Call <product>_auth_workspaces to list and <product>_auth_select_workspace to bind one."
115
+ });
116
+ }
117
+ return jsonResult({
118
+ workspaceId: wid,
119
+ organizationId: auth?.organizationId ?? null,
120
+ hasWorkspaceToken: Boolean(auth?.workspaceToken)
121
+ });
122
+ } catch (error) {
123
+ ctx.logger.error("workspace_current failed", { error: String(error) });
124
+ return errorResult(
125
+ `Failed to read workspace context: ${error instanceof Error ? error.message : String(error)}`
126
+ );
127
+ }
128
+ }
129
+ );
130
+ server.registerTool(
131
+ track(mcpToolName(ctx.productName, "workspace_get")),
132
+ {
133
+ title: "Get Workspace",
134
+ description: "Get a workspace by its ID (global layer).",
135
+ inputSchema: { id: z.string().describe("Workspace ID") }
136
+ },
137
+ async ({ id }) => {
138
+ try {
139
+ const data = await ctx.gql.global.request(
140
+ GET_WORKSPACE,
141
+ { id }
142
+ );
143
+ if (!data.workspace) {
144
+ return errorResult(`Workspace ${id} not found`);
145
+ }
146
+ return jsonResult(data.workspace);
147
+ } catch (error) {
148
+ ctx.logger.error("workspace_get failed", { error: String(error) });
149
+ return errorResult(
150
+ `Failed to get workspace: ${error instanceof Error ? error.message : String(error)}`
151
+ );
152
+ }
153
+ }
154
+ );
155
+ server.registerTool(
156
+ track(mcpToolName(ctx.productName, "workspace_create")),
157
+ {
158
+ title: "Create Workspace",
159
+ description: "Create a workspace (global layer).",
160
+ inputSchema: {
161
+ name: z.string().describe("Workspace name"),
162
+ description: z.string().optional().describe("Workspace description"),
163
+ tenantId: z.string().optional().describe("Target tenant id"),
164
+ organizationId: z.string().optional().describe("Owning organization id"),
165
+ slug: z.string().optional().describe("URL-friendly slug")
166
+ }
167
+ },
168
+ async ({ name, description, tenantId, organizationId, slug }) => {
169
+ try {
170
+ const input = { name };
171
+ if (description !== void 0) input.description = description;
172
+ if (tenantId !== void 0) input.tenantId = tenantId;
173
+ if (organizationId !== void 0) input.organizationId = organizationId;
174
+ if (slug !== void 0) input.slug = slug;
175
+ const data = await ctx.gql.global.request(
176
+ CREATE_WORKSPACE,
177
+ { input }
178
+ );
179
+ return jsonResult(data.createWorkspace);
180
+ } catch (error) {
181
+ ctx.logger.error("workspace_create failed", { error: String(error) });
182
+ return errorResult(
183
+ `Failed to create workspace: ${error instanceof Error ? error.message : String(error)}`
184
+ );
185
+ }
186
+ }
187
+ );
188
+ server.registerTool(
189
+ track(mcpToolName(ctx.productName, "workspace_update")),
190
+ {
191
+ title: "Update Workspace",
192
+ description: "Update a workspace (global layer). At least one field must be provided.",
193
+ inputSchema: {
194
+ id: z.string().describe("Workspace ID"),
195
+ name: z.string().optional().describe("Updated name"),
196
+ description: z.string().optional().describe("Updated description"),
197
+ status: z.string().optional().describe("Updated status (will be uppercased)")
198
+ }
199
+ },
200
+ async ({ id, name, description, status }) => {
201
+ try {
202
+ const input = {};
203
+ if (name !== void 0) input.name = name;
204
+ if (description !== void 0) input.description = description;
205
+ if (status !== void 0) input.status = status.toUpperCase();
206
+ if (Object.keys(input).length === 0) {
207
+ return errorResult(
208
+ "No updates specified \u2014 provide at least one of name/description/status"
209
+ );
210
+ }
211
+ const data = await ctx.gql.global.request(
212
+ UPDATE_WORKSPACE,
213
+ { id, input }
214
+ );
215
+ return jsonResult(data.updateWorkspace);
216
+ } catch (error) {
217
+ ctx.logger.error("workspace_update failed", { error: String(error) });
218
+ return errorResult(
219
+ `Failed to update workspace: ${error instanceof Error ? error.message : String(error)}`
220
+ );
221
+ }
222
+ }
223
+ );
224
+ server.registerTool(
225
+ track(mcpToolName(ctx.productName, "workspace_delete")),
226
+ {
227
+ title: "Delete Workspace",
228
+ description: "Delete a workspace (workspace layer).",
229
+ inputSchema: { id: z.string().describe("Workspace ID") }
230
+ },
231
+ async ({ id }) => {
232
+ try {
233
+ const data = await ctx.gql.workspace.request(
234
+ DELETE_WORKSPACE,
235
+ { id }
236
+ );
237
+ return jsonResult({ deleted: data.deleteWorkspace, workspaceId: id });
238
+ } catch (error) {
239
+ ctx.logger.error("workspace_delete failed", { error: String(error) });
240
+ return errorResult(
241
+ `Failed to delete workspace: ${error instanceof Error ? error.message : String(error)}`
242
+ );
243
+ }
244
+ }
245
+ );
246
+ server.registerTool(
247
+ track(mcpToolName(ctx.productName, "workspace_members_list")),
248
+ {
249
+ title: "List Workspace Members",
250
+ description: "List members of a workspace.",
251
+ inputSchema: {
252
+ workspaceId: z.string().describe("Workspace ID"),
253
+ limit: z.number().optional().describe("Page size (default 100)"),
254
+ offset: z.number().optional().describe("Offset for pagination")
255
+ }
256
+ },
257
+ async ({ workspaceId, limit, offset }) => {
258
+ try {
259
+ const data = await ctx.gql.workspace.request(LIST_WORKSPACE_MEMBERS, {
260
+ workspaceId,
261
+ pagination: { limit: limit ?? 100, offset: offset ?? 0 }
262
+ });
263
+ return jsonResult(data.workspaceMembers);
264
+ } catch (error) {
265
+ ctx.logger.error("workspace_members_list failed", { error: String(error) });
266
+ return errorResult(
267
+ `Failed to list workspace members: ${error instanceof Error ? error.message : String(error)}`
268
+ );
269
+ }
270
+ }
271
+ );
272
+ server.registerTool(
273
+ track(mcpToolName(ctx.productName, "workspace_members_add")),
274
+ {
275
+ title: "Add Workspace Member",
276
+ description: "Add a member to a workspace.",
277
+ inputSchema: {
278
+ workspaceId: z.string().describe("Workspace ID"),
279
+ userId: z.string().describe("User ID to add"),
280
+ role: RoleEnum.optional().describe("Membership role (default MEMBER)")
281
+ }
282
+ },
283
+ async ({ workspaceId, userId, role }) => {
284
+ try {
285
+ const input = {
286
+ workspaceId,
287
+ userId,
288
+ role: role ?? "MEMBER"
289
+ };
290
+ const data = await ctx.gql.workspace.request(
291
+ ADD_WORKSPACE_MEMBER,
292
+ { input }
293
+ );
294
+ return jsonResult(data.addWorkspaceMember);
295
+ } catch (error) {
296
+ ctx.logger.error("workspace_members_add failed", { error: String(error) });
297
+ return errorResult(
298
+ `Failed to add workspace member: ${error instanceof Error ? error.message : String(error)}`
299
+ );
300
+ }
301
+ }
302
+ );
303
+ server.registerTool(
304
+ track(mcpToolName(ctx.productName, "workspace_members_remove")),
305
+ {
306
+ title: "Remove Workspace Member",
307
+ description: "Remove a member by membership id.",
308
+ inputSchema: { membershipId: z.string().describe("Membership ID to remove") }
309
+ },
310
+ async ({ membershipId }) => {
311
+ try {
312
+ const data = await ctx.gql.workspace.request(
313
+ REMOVE_WORKSPACE_MEMBER,
314
+ { id: membershipId }
315
+ );
316
+ return jsonResult({ removed: data.removeWorkspaceMember, membershipId });
317
+ } catch (error) {
318
+ ctx.logger.error("workspace_members_remove failed", { error: String(error) });
319
+ return errorResult(
320
+ `Failed to remove workspace member: ${error instanceof Error ? error.message : String(error)}`
321
+ );
322
+ }
323
+ }
324
+ );
325
+ server.registerTool(
326
+ track(mcpToolName(ctx.productName, "workspace_members_role")),
327
+ {
328
+ title: "Update Workspace Member Role",
329
+ description: "Update a workspace member role.",
330
+ inputSchema: {
331
+ workspaceId: z.string().describe("Workspace ID"),
332
+ userId: z.string().describe("User ID"),
333
+ role: RoleEnum.describe("New role")
334
+ }
335
+ },
336
+ async ({ workspaceId, userId, role }) => {
337
+ try {
338
+ const input = {
339
+ workspaceId,
340
+ userId,
341
+ roles: [role]
342
+ };
343
+ const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input });
344
+ return jsonResult(data.updateWorkspaceMemberRoles);
345
+ } catch (error) {
346
+ ctx.logger.error("workspace_members_role failed", { error: String(error) });
347
+ return errorResult(
348
+ `Failed to update workspace member role: ${error instanceof Error ? error.message : String(error)}`
349
+ );
350
+ }
351
+ }
352
+ );
353
+ server.registerTool(
354
+ track(mcpToolName(ctx.productName, "workspace_projects_list")),
355
+ {
356
+ title: "List Projects",
357
+ description: "List projects, optionally filtered by workspace.",
358
+ inputSchema: {
359
+ workspaceId: z.string().optional().describe("Filter by workspace ID"),
360
+ limit: z.number().optional().describe("Page size (default 100)"),
361
+ offset: z.number().optional().describe("Offset for pagination")
362
+ }
363
+ },
364
+ async ({ workspaceId, limit, offset }) => {
365
+ try {
366
+ const filter = {};
367
+ if (workspaceId !== void 0) filter.workspaceId = workspaceId;
368
+ const data = await ctx.gql.workspace.request(LIST_PROJECTS, {
369
+ filter: Object.keys(filter).length > 0 ? filter : void 0,
370
+ pagination: { limit: limit ?? 100, offset: offset ?? 0 }
371
+ });
372
+ return jsonResult(data.projects);
373
+ } catch (error) {
374
+ ctx.logger.error("workspace_projects_list failed", { error: String(error) });
375
+ return errorResult(
376
+ `Failed to list projects: ${error instanceof Error ? error.message : String(error)}`
377
+ );
378
+ }
379
+ }
380
+ );
381
+ server.registerTool(
382
+ track(mcpToolName(ctx.productName, "workspace_projects_get")),
383
+ {
384
+ title: "Get Project",
385
+ description: "Get a project by ID.",
386
+ inputSchema: { id: z.string().describe("Project ID") }
387
+ },
388
+ async ({ id }) => {
389
+ try {
390
+ const data = await ctx.gql.workspace.request(
391
+ GET_PROJECT,
392
+ { id }
393
+ );
394
+ if (!data.project) {
395
+ return errorResult(`Project ${id} not found`);
396
+ }
397
+ return jsonResult(data.project);
398
+ } catch (error) {
399
+ ctx.logger.error("workspace_projects_get failed", { error: String(error) });
400
+ return errorResult(
401
+ `Failed to get project: ${error instanceof Error ? error.message : String(error)}`
402
+ );
403
+ }
404
+ }
405
+ );
406
+ server.registerTool(
407
+ track(mcpToolName(ctx.productName, "workspace_projects_create")),
408
+ {
409
+ title: "Create Project",
410
+ description: "Create a project inside a workspace.",
411
+ inputSchema: {
412
+ workspaceId: z.string().describe("Workspace ID"),
413
+ name: z.string().describe("Project name"),
414
+ description: z.string().optional().describe("Project description")
415
+ }
416
+ },
417
+ async ({ workspaceId, name, description }) => {
418
+ try {
419
+ const input = { workspaceId, name };
420
+ if (description !== void 0) input.description = description;
421
+ const data = await ctx.gql.workspace.request(
422
+ CREATE_PROJECT,
423
+ { input }
424
+ );
425
+ return jsonResult(data.createProject);
426
+ } catch (error) {
427
+ ctx.logger.error("workspace_projects_create failed", { error: String(error) });
428
+ return errorResult(
429
+ `Failed to create project: ${error instanceof Error ? error.message : String(error)}`
430
+ );
431
+ }
432
+ }
433
+ );
434
+ server.registerTool(
435
+ track(mcpToolName(ctx.productName, "workspace_invite_accept")),
436
+ {
437
+ title: "Accept Workspace Invitation",
438
+ description: "Accept a workspace invitation by invitation ID.",
439
+ inputSchema: { invitationId: z.string().describe("Invitation ID") }
440
+ },
441
+ async ({ invitationId }) => {
442
+ try {
443
+ const data = await ctx.gql.workspace.request(ACCEPT_INVITATION, { id: invitationId });
444
+ return jsonResult(data.acceptInvitation);
445
+ } catch (error) {
446
+ ctx.logger.error("workspace_invite_accept failed", { error: String(error) });
447
+ return errorResult(
448
+ `Failed to accept invitation: ${error instanceof Error ? error.message : String(error)}`
449
+ );
450
+ }
451
+ }
452
+ );
453
+ server.registerTool(
454
+ track(mcpToolName(ctx.productName, "workspace_activity")),
455
+ {
456
+ title: "Workspace Activity Log",
457
+ description: "Workspace activity log (audit events) for a given workspace.",
458
+ inputSchema: {
459
+ workspaceId: z.string().describe("Workspace ID"),
460
+ limit: z.number().optional().describe("Page size (default 100)"),
461
+ offset: z.number().optional().describe("Offset for pagination")
462
+ }
463
+ },
464
+ async ({ workspaceId, limit, offset }) => {
465
+ try {
466
+ const data = await ctx.gql.workspace.request(WORKSPACE_ACTIVITY, {
467
+ workspaceId,
468
+ limit: limit ?? 100,
469
+ offset: offset ?? 0
470
+ });
471
+ return jsonResult(data.getWorkspaceActivities);
472
+ } catch (error) {
473
+ ctx.logger.error("workspace_activity failed", { error: String(error) });
474
+ return errorResult(
475
+ `Failed to fetch workspace activity: ${error instanceof Error ? error.message : String(error)}`
476
+ );
477
+ }
478
+ }
479
+ );
480
+ }
481
+
482
+ // src/modules/workspaces/index.ts
483
+ var workspacesModule = {
484
+ id: "workspaces",
485
+ version: "0.0.1",
486
+ displayName: "Workspaces",
487
+ dependsOn: ["auth"],
488
+ capabilities: { tools: {} },
489
+ register(server, ctx) {
490
+ const tools = [];
491
+ const track = (n) => {
492
+ tools.push(n);
493
+ return n;
494
+ };
495
+ registerWorkspaceTools(server, ctx, track);
496
+ return { tools, resources: [], prompts: [] };
497
+ }
498
+ };
499
+ var workspaces_default = workspacesModule;
500
+
501
+ export { workspaces_default as default };
502
+ //# sourceMappingURL=index.js.map
503
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/modules/workspaces/operations.ts","../../../src/modules/workspaces/tools.ts","../../../src/modules/workspaces/index.ts"],"names":[],"mappings":";;;;AAQO,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQtB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQzB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQzB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA,CAAA;AAMzB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS/B,IAAM,oBAAA,GAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQ7B,IAAM,uBAAA,GAA0B;AAAA;AAAA;AAAA;AAAA,CAAA;AAMhC,IAAM,6BAAA,GAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQtC,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAStB,IAAM,WAAA,GAAc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AAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,sBAAA,CAAuB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAEzC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,kBAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * Workspaces module GraphQL operations — full CRUD + members + projects +\n * activity + invitations.\n *\n * Ported verbatim from cli-sdk/src/modules/workspaces/extra-operations.ts\n * (the Phase 3 expansion of the Phase 2 thin context-only commands).\n */\n\nexport const GET_WORKSPACE = `\n query GetWorkspace($id: ID!) {\n workspace(id: $id) {\n id name slug description tenantId organizationId status createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_WORKSPACE = `\n mutation CreateWorkspace($input: CreateWorkspaceInput!) {\n createWorkspace(input: $input) {\n id name slug status createdAt\n }\n }\n`;\n\nexport const UPDATE_WORKSPACE = `\n mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {\n updateWorkspace(id: $id, input: $input) {\n id name description status updatedAt\n }\n }\n`;\n\nexport const DELETE_WORKSPACE = `\n mutation DeleteWorkspace($id: ID!) {\n deleteWorkspace(id: $id)\n }\n`;\n\nexport const LIST_WORKSPACE_MEMBERS = `\n query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {\n workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {\n items { id userId email role status joinedAt }\n total hasMore\n }\n }\n`;\n\nexport const ADD_WORKSPACE_MEMBER = `\n mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {\n addWorkspaceMember(input: $input) {\n id userId role status\n }\n }\n`;\n\nexport const REMOVE_WORKSPACE_MEMBER = `\n mutation RemoveWorkspaceMember($id: ID!) {\n removeWorkspaceMember(id: $id)\n }\n`;\n\nexport const UPDATE_WORKSPACE_MEMBER_ROLES = `\n mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {\n updateWorkspaceMemberRoles(input: $input) {\n id userId role\n }\n }\n`;\n\nexport const LIST_PROJECTS = `\n query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {\n projects(filter: $filter, pagination: $pagination) {\n items { id name workspaceId status createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_PROJECT = `\n query GetProject($id: ID!) {\n project(id: $id) {\n id name description workspaceId status createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_PROJECT = `\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id name workspaceId status\n }\n }\n`;\n\nexport const ACCEPT_INVITATION = `\n mutation AcceptInvitation($id: ID!) {\n acceptInvitation(id: $id) {\n id status workspaceId\n }\n }\n`;\n\nexport const WORKSPACE_ACTIVITY = `\n query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {\n getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {\n id action actorId summary createdAt\n }\n }\n`;\n","/**\n * Workspaces MCP tools — full CRUD + members + projects + activity + invitations.\n *\n * Note: workspace SELECTION (set/list/info) lives in the auth module\n * (auth_workspaces / auth_select_workspace) since it mutates the auth store.\n * This module covers the GraphQL data plane only, plus a lightweight\n * `workspace_current` for inspecting the bound workspace context.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport * as ops from './operations.js';\n\ninterface WorkspaceRow {\n id: string;\n name: string;\n slug?: string;\n status?: string;\n createdAt?: string;\n}\n\ninterface MemberRow {\n id: string;\n userId: string;\n email?: string;\n role?: string;\n status?: string;\n joinedAt?: string;\n}\n\ninterface ProjectRow {\n id: string;\n name: string;\n workspaceId: string;\n status?: string;\n createdAt?: string;\n}\n\nconst RoleEnum = z.enum(['MEMBER', 'ADMIN', 'OWNER']);\n\nexport function registerWorkspaceTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Current workspace context ───────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_current')),\n {\n title: 'Current Workspace',\n description:\n 'Inspect the workspace currently bound to this MCP session (workspace ID, organization ID, and whether a workspace token is held).',\n inputSchema: {},\n },\n async () => {\n try {\n const auth = ctx.auth.read();\n const wid = auth?.workspaceId ?? null;\n if (!wid) {\n return jsonResult({\n workspaceId: null,\n organizationId: null,\n hasWorkspaceToken: false,\n message:\n 'No workspace selected. Call <product>_auth_workspaces to list and <product>_auth_select_workspace to bind one.',\n });\n }\n return jsonResult({\n workspaceId: wid,\n organizationId: auth?.organizationId ?? null,\n hasWorkspaceToken: Boolean(auth?.workspaceToken),\n });\n } catch (error) {\n ctx.logger.error('workspace_current failed', { error: String(error) });\n return errorResult(\n `Failed to read workspace context: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── CRUD ────────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_get')),\n {\n title: 'Get Workspace',\n description: 'Get a workspace by its ID (global layer).',\n inputSchema: { id: z.string().describe('Workspace ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ workspace: WorkspaceRow | null }>(\n ops.GET_WORKSPACE,\n { id },\n );\n if (!data.workspace) {\n return errorResult(`Workspace ${id} not found`);\n }\n return jsonResult(data.workspace);\n } catch (error) {\n ctx.logger.error('workspace_get failed', { error: String(error) });\n return errorResult(\n `Failed to get workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_create')),\n {\n title: 'Create Workspace',\n description: 'Create a workspace (global layer).',\n inputSchema: {\n name: z.string().describe('Workspace name'),\n description: z.string().optional().describe('Workspace description'),\n tenantId: z.string().optional().describe('Target tenant id'),\n organizationId: z.string().optional().describe('Owning organization id'),\n slug: z.string().optional().describe('URL-friendly slug'),\n },\n },\n async ({ name, description, tenantId, organizationId, slug }) => {\n try {\n const input: Record<string, unknown> = { name };\n if (description !== undefined) input.description = description;\n if (tenantId !== undefined) input.tenantId = tenantId;\n if (organizationId !== undefined) input.organizationId = organizationId;\n if (slug !== undefined) input.slug = slug;\n\n const data = await ctx.gql.global.request<{ createWorkspace: WorkspaceRow }>(\n ops.CREATE_WORKSPACE,\n { input },\n );\n return jsonResult(data.createWorkspace);\n } catch (error) {\n ctx.logger.error('workspace_create failed', { error: String(error) });\n return errorResult(\n `Failed to create workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_update')),\n {\n title: 'Update Workspace',\n description: 'Update a workspace (global layer). At least one field must be provided.',\n inputSchema: {\n id: z.string().describe('Workspace ID'),\n name: z.string().optional().describe('Updated name'),\n description: z.string().optional().describe('Updated description'),\n status: z.string().optional().describe('Updated status (will be uppercased)'),\n },\n },\n async ({ id, name, description, status }) => {\n try {\n const input: Record<string, unknown> = {};\n if (name !== undefined) input.name = name;\n if (description !== undefined) input.description = description;\n if (status !== undefined) input.status = status.toUpperCase();\n if (Object.keys(input).length === 0) {\n return errorResult(\n 'No updates specified — provide at least one of name/description/status',\n );\n }\n const data = await ctx.gql.global.request<{ updateWorkspace: WorkspaceRow }>(\n ops.UPDATE_WORKSPACE,\n { id, input },\n );\n return jsonResult(data.updateWorkspace);\n } catch (error) {\n ctx.logger.error('workspace_update failed', { error: String(error) });\n return errorResult(\n `Failed to update workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_delete')),\n {\n title: 'Delete Workspace',\n description: 'Delete a workspace (workspace layer).',\n inputSchema: { id: z.string().describe('Workspace ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{ deleteWorkspace: boolean }>(\n ops.DELETE_WORKSPACE,\n { id },\n );\n return jsonResult({ deleted: data.deleteWorkspace, workspaceId: id });\n } catch (error) {\n ctx.logger.error('workspace_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete workspace: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Members ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_list')),\n {\n title: 'List Workspace Members',\n description: 'List members of a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n workspaceMembers: { items: MemberRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_WORKSPACE_MEMBERS, {\n workspaceId,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.workspaceMembers);\n } catch (error) {\n ctx.logger.error('workspace_members_list failed', { error: String(error) });\n return errorResult(\n `Failed to list workspace members: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_add')),\n {\n title: 'Add Workspace Member',\n description: 'Add a member to a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n userId: z.string().describe('User ID to add'),\n role: RoleEnum.optional().describe('Membership role (default MEMBER)'),\n },\n },\n async ({ workspaceId, userId, role }) => {\n try {\n const input: Record<string, unknown> = {\n workspaceId,\n userId,\n role: role ?? 'MEMBER',\n };\n const data = await ctx.gql.workspace.request<{ addWorkspaceMember: MemberRow }>(\n ops.ADD_WORKSPACE_MEMBER,\n { input },\n );\n return jsonResult(data.addWorkspaceMember);\n } catch (error) {\n ctx.logger.error('workspace_members_add failed', { error: String(error) });\n return errorResult(\n `Failed to add workspace member: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_remove')),\n {\n title: 'Remove Workspace Member',\n description: 'Remove a member by membership id.',\n inputSchema: { membershipId: z.string().describe('Membership ID to remove') },\n },\n async ({ membershipId }) => {\n try {\n const data = await ctx.gql.workspace.request<{ removeWorkspaceMember: boolean }>(\n ops.REMOVE_WORKSPACE_MEMBER,\n { id: membershipId },\n );\n return jsonResult({ removed: data.removeWorkspaceMember, membershipId });\n } catch (error) {\n ctx.logger.error('workspace_members_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove workspace member: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_role')),\n {\n title: 'Update Workspace Member Role',\n description: 'Update a workspace member role.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n userId: z.string().describe('User ID'),\n role: RoleEnum.describe('New role'),\n },\n },\n async ({ workspaceId, userId, role }) => {\n try {\n const input: Record<string, unknown> = {\n workspaceId,\n userId,\n roles: [role],\n };\n const data = await ctx.gql.workspace.request<{\n updateWorkspaceMemberRoles: { id: string; userId: string; role: string };\n }>(ops.UPDATE_WORKSPACE_MEMBER_ROLES, { input });\n return jsonResult(data.updateWorkspaceMemberRoles);\n } catch (error) {\n ctx.logger.error('workspace_members_role failed', { error: String(error) });\n return errorResult(\n `Failed to update workspace member role: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Projects ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_list')),\n {\n title: 'List Projects',\n description: 'List projects, optionally filtered by workspace.',\n inputSchema: {\n workspaceId: z.string().optional().describe('Filter by workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (workspaceId !== undefined) filter.workspaceId = workspaceId;\n\n const data = await ctx.gql.workspace.request<{\n projects: { items: ProjectRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_PROJECTS, {\n filter: Object.keys(filter).length > 0 ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.projects);\n } catch (error) {\n ctx.logger.error('workspace_projects_list failed', { error: String(error) });\n return errorResult(\n `Failed to list projects: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_get')),\n {\n title: 'Get Project',\n description: 'Get a project by ID.',\n inputSchema: { id: z.string().describe('Project ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{ project: ProjectRow | null }>(\n ops.GET_PROJECT,\n { id },\n );\n if (!data.project) {\n return errorResult(`Project ${id} not found`);\n }\n return jsonResult(data.project);\n } catch (error) {\n ctx.logger.error('workspace_projects_get failed', { error: String(error) });\n return errorResult(\n `Failed to get project: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_create')),\n {\n title: 'Create Project',\n description: 'Create a project inside a workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n name: z.string().describe('Project name'),\n description: z.string().optional().describe('Project description'),\n },\n },\n async ({ workspaceId, name, description }) => {\n try {\n const input: Record<string, unknown> = { workspaceId, name };\n if (description !== undefined) input.description = description;\n\n const data = await ctx.gql.workspace.request<{ createProject: ProjectRow }>(\n ops.CREATE_PROJECT,\n { input },\n );\n return jsonResult(data.createProject);\n } catch (error) {\n ctx.logger.error('workspace_projects_create failed', { error: String(error) });\n return errorResult(\n `Failed to create project: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Invitations ─────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_invite_accept')),\n {\n title: 'Accept Workspace Invitation',\n description: 'Accept a workspace invitation by invitation ID.',\n inputSchema: { invitationId: z.string().describe('Invitation ID') },\n },\n async ({ invitationId }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n acceptInvitation: { id: string; status: string; workspaceId: string };\n }>(ops.ACCEPT_INVITATION, { id: invitationId });\n return jsonResult(data.acceptInvitation);\n } catch (error) {\n ctx.logger.error('workspace_invite_accept failed', { error: String(error) });\n return errorResult(\n `Failed to accept invitation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Activity ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_activity')),\n {\n title: 'Workspace Activity Log',\n description: 'Workspace activity log (audit events) for a given workspace.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ workspaceId, limit, offset }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n getWorkspaceActivities: Array<Record<string, unknown>>;\n }>(ops.WORKSPACE_ACTIVITY, {\n workspaceId,\n limit: limit ?? 100,\n offset: offset ?? 0,\n });\n return jsonResult(data.getWorkspaceActivities);\n } catch (error) {\n ctx.logger.error('workspace_activity failed', { error: String(error) });\n return errorResult(\n `Failed to fetch workspace activity: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Workspaces module — full CRUD + members + projects + activity + invitations.\n *\n * Surface mirrors cli-sdk/src/modules/workspaces/extra-commands.ts.\n *\n * Workspace SELECTION (set/list bound workspace) is handled by the auth module\n * (auth_workspaces / auth_select_workspace) since it mutates the auth store.\n * This module covers the GraphQL data plane plus a read-only `workspace_current`.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerWorkspaceTools } from './tools.js';\n\nconst workspacesModule: McpModule = {\n id: 'workspaces',\n version: '0.0.1',\n displayName: 'Workspaces',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerWorkspaceTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default workspacesModule;\n"]}
@@ -0,0 +1,47 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { M as McpContext } from './context-1jV4NsLv.cjs';
3
+ import { c as McpModule, a as McpCapabilities, S as ServerManifest } from './module-DFQBZNK6.cjs';
4
+ import { ZodRawShape } from 'zod';
5
+
6
+ interface CreateMcpServerOptions {
7
+ name: string;
8
+ version: string;
9
+ extraCapabilities?: McpCapabilities;
10
+ }
11
+ interface McpServerHandle {
12
+ server: McpServer;
13
+ manifest: ServerManifest;
14
+ }
15
+ declare function createMcpServer(ctx: McpContext, modules: readonly McpModule[], opts: CreateMcpServerOptions): McpServerHandle;
16
+
17
+ interface ToolTextContent {
18
+ type: 'text';
19
+ text: string;
20
+ [k: string]: unknown;
21
+ }
22
+ interface ToolResult {
23
+ content: ToolTextContent[];
24
+ isError?: boolean;
25
+ structuredContent?: Record<string, unknown>;
26
+ [k: string]: unknown;
27
+ }
28
+ interface ToolMeta {
29
+ progressToken?: string | number;
30
+ }
31
+ declare function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult;
32
+ declare function textResult(text: string): ToolResult;
33
+ declare function errorResult(message: string, hint?: string): ToolResult;
34
+ interface ToolMetadata {
35
+ title: string;
36
+ description: string;
37
+ inputSchema?: ZodRawShape;
38
+ }
39
+ type ToolHandler<TArgs = Record<string, unknown>> = (args: TArgs, ctx: McpContext, meta: ToolMeta) => Promise<unknown>;
40
+ declare function registerTool<TArgs extends Record<string, unknown>>(server: McpServer, ctx: McpContext, name: string, metadata: ToolMetadata, handler: ToolHandler<TArgs>): void;
41
+
42
+ declare function mcpToolName(productName: string, ...parts: string[]): string;
43
+ declare function mcpResourceUri(productName: string, ...parts: string[]): string;
44
+ declare function mcpPromptName(productName: string, ...parts: string[]): string;
45
+ declare const TOOL_NAME_LIMIT = 63;
46
+
47
+ export { type CreateMcpServerOptions as C, type McpServerHandle as M, type ToolHandler as T, type ToolMeta as a, type ToolMetadata as b, type ToolResult as c, createMcpServer as d, errorResult as e, mcpResourceUri as f, mcpToolName as g, TOOL_NAME_LIMIT as h, type ToolTextContent as i, jsonResult as j, mcpPromptName as m, registerTool as r, textResult as t };
@@ -0,0 +1,47 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { M as McpContext } from './context-1jV4NsLv.js';
3
+ import { c as McpModule, a as McpCapabilities, S as ServerManifest } from './module-DBcfA-i3.js';
4
+ import { ZodRawShape } from 'zod';
5
+
6
+ interface CreateMcpServerOptions {
7
+ name: string;
8
+ version: string;
9
+ extraCapabilities?: McpCapabilities;
10
+ }
11
+ interface McpServerHandle {
12
+ server: McpServer;
13
+ manifest: ServerManifest;
14
+ }
15
+ declare function createMcpServer(ctx: McpContext, modules: readonly McpModule[], opts: CreateMcpServerOptions): McpServerHandle;
16
+
17
+ interface ToolTextContent {
18
+ type: 'text';
19
+ text: string;
20
+ [k: string]: unknown;
21
+ }
22
+ interface ToolResult {
23
+ content: ToolTextContent[];
24
+ isError?: boolean;
25
+ structuredContent?: Record<string, unknown>;
26
+ [k: string]: unknown;
27
+ }
28
+ interface ToolMeta {
29
+ progressToken?: string | number;
30
+ }
31
+ declare function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult;
32
+ declare function textResult(text: string): ToolResult;
33
+ declare function errorResult(message: string, hint?: string): ToolResult;
34
+ interface ToolMetadata {
35
+ title: string;
36
+ description: string;
37
+ inputSchema?: ZodRawShape;
38
+ }
39
+ type ToolHandler<TArgs = Record<string, unknown>> = (args: TArgs, ctx: McpContext, meta: ToolMeta) => Promise<unknown>;
40
+ declare function registerTool<TArgs extends Record<string, unknown>>(server: McpServer, ctx: McpContext, name: string, metadata: ToolMetadata, handler: ToolHandler<TArgs>): void;
41
+
42
+ declare function mcpToolName(productName: string, ...parts: string[]): string;
43
+ declare function mcpResourceUri(productName: string, ...parts: string[]): string;
44
+ declare function mcpPromptName(productName: string, ...parts: string[]): string;
45
+ declare const TOOL_NAME_LIMIT = 63;
46
+
47
+ export { type CreateMcpServerOptions as C, type McpServerHandle as M, type ToolHandler as T, type ToolMeta as a, type ToolMetadata as b, type ToolResult as c, createMcpServer as d, errorResult as e, mcpResourceUri as f, mcpToolName as g, TOOL_NAME_LIMIT as h, type ToolTextContent as i, jsonResult as j, mcpPromptName as m, registerTool as r, textResult as t };