@burdenoff/mcp-libs 2026.1008.3 → 2026.1009.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.
- package/dist/modules/auth/index.cjs +1027 -0
- package/dist/modules/auth/index.cjs.map +1 -1
- package/dist/modules/auth/index.js +1027 -0
- package/dist/modules/auth/index.js.map +1 -1
- package/dist/modules/billing/index.cjs +29 -14
- package/dist/modules/billing/index.cjs.map +1 -1
- package/dist/modules/billing/index.js +29 -14
- package/dist/modules/billing/index.js.map +1 -1
- package/dist/modules/workspaces/index.cjs +50 -163
- package/dist/modules/workspaces/index.cjs.map +1 -1
- package/dist/modules/workspaces/index.js +50 -163
- package/dist/modules/workspaces/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ var LIST_WORKSPACES = `
|
|
|
14
14
|
var GET_WORKSPACE = `
|
|
15
15
|
query GetWorkspace($id: ID!) {
|
|
16
16
|
workspace(id: $id) {
|
|
17
|
-
id name slug
|
|
17
|
+
id name slug status createdAt updatedAt
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
`;
|
|
@@ -28,19 +28,14 @@ var CREATE_WORKSPACE = `
|
|
|
28
28
|
var UPDATE_WORKSPACE = `
|
|
29
29
|
mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
|
|
30
30
|
updateWorkspace(id: $id, input: $input) {
|
|
31
|
-
id name
|
|
31
|
+
id name status updatedAt
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
|
-
var DELETE_WORKSPACE = `
|
|
36
|
-
mutation DeleteWorkspace($id: ID!) {
|
|
37
|
-
deleteWorkspace(id: $id)
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
35
|
var LIST_WORKSPACE_MEMBERS = `
|
|
41
36
|
query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {
|
|
42
37
|
workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {
|
|
43
|
-
items { id userId
|
|
38
|
+
items { id userId role joinedAt }
|
|
44
39
|
total hasMore
|
|
45
40
|
}
|
|
46
41
|
}
|
|
@@ -48,7 +43,7 @@ var LIST_WORKSPACE_MEMBERS = `
|
|
|
48
43
|
var ADD_WORKSPACE_MEMBER = `
|
|
49
44
|
mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {
|
|
50
45
|
addWorkspaceMember(input: $input) {
|
|
51
|
-
id userId role
|
|
46
|
+
id userId role
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
49
|
`;
|
|
@@ -60,43 +55,7 @@ var REMOVE_WORKSPACE_MEMBER = `
|
|
|
60
55
|
var UPDATE_WORKSPACE_MEMBER_ROLES = `
|
|
61
56
|
mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
|
|
62
57
|
updateWorkspaceMemberRoles(input: $input) {
|
|
63
|
-
id userId
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
var LIST_PROJECTS = `
|
|
68
|
-
query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {
|
|
69
|
-
projects(filter: $filter, pagination: $pagination) {
|
|
70
|
-
items { id name workspaceId status createdAt }
|
|
71
|
-
total hasMore
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
|
-
var GET_PROJECT = `
|
|
76
|
-
query GetProject($id: ID!) {
|
|
77
|
-
project(id: $id) {
|
|
78
|
-
id name description workspaceId status createdAt updatedAt
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
var CREATE_PROJECT = `
|
|
83
|
-
mutation CreateProject($input: CreateProjectInput!) {
|
|
84
|
-
createProject(input: $input) {
|
|
85
|
-
id name workspaceId status
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
var ACCEPT_INVITATION = `
|
|
90
|
-
mutation AcceptInvitation($id: ID!) {
|
|
91
|
-
acceptInvitation(id: $id) {
|
|
92
|
-
id status workspaceId
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
var WORKSPACE_ACTIVITY = `
|
|
97
|
-
query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
|
|
98
|
-
getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
|
|
99
|
-
id action actorId summary createdAt
|
|
58
|
+
id userId
|
|
100
59
|
}
|
|
101
60
|
}
|
|
102
61
|
`;
|
|
@@ -199,21 +158,22 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
199
158
|
track(mcpToolName(ctx.productName, "workspace_create")),
|
|
200
159
|
{
|
|
201
160
|
title: "Create Workspace",
|
|
202
|
-
description: "Create a workspace (global layer).",
|
|
161
|
+
description: "Create a workspace (global layer). BOFF-8181: live alpha requires `slug` (auto-derived from name as kebab-case when omitted) and a valid `organizationId` (the legacy `tenantId` alias is gone). The MCP tool auto-fills `organizationId` from the actor's auth context \u2014 call without it unless you have a specific override.",
|
|
203
162
|
inputSchema: {
|
|
204
163
|
name: z.string().describe("Workspace name"),
|
|
164
|
+
slug: z.string().optional().describe("URL slug (auto-derived from name as kebab-case when omitted)"),
|
|
205
165
|
description: z.string().optional().describe("Workspace description"),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
166
|
+
organizationId: z.string().optional().describe(
|
|
167
|
+
"Owning organization id (defaults to the actor's organization from the access token)"
|
|
168
|
+
)
|
|
209
169
|
}
|
|
210
170
|
},
|
|
211
|
-
async ({ name, description,
|
|
171
|
+
async ({ name, description, organizationId, slug }) => {
|
|
212
172
|
try {
|
|
213
173
|
const input = { name };
|
|
214
174
|
if (description !== void 0) input.description = description;
|
|
215
|
-
|
|
216
|
-
if (
|
|
175
|
+
const orgId = organizationId ?? ctx.auth.read()?.organizationId;
|
|
176
|
+
if (orgId) input.organizationId = orgId;
|
|
217
177
|
if (slug !== void 0) input.slug = slug;
|
|
218
178
|
const data = await ctx.gql.global.request(
|
|
219
179
|
CREATE_WORKSPACE,
|
|
@@ -232,11 +192,11 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
232
192
|
track(mcpToolName(ctx.productName, "workspace_update")),
|
|
233
193
|
{
|
|
234
194
|
title: "Update Workspace",
|
|
235
|
-
description: "Update a workspace (global layer). At least one field must be provided.",
|
|
195
|
+
description: "Update a workspace (global layer). BOFF-8203: live alpha removed `description` from the `Workspace` return type; the field IS still accepted in the `UpdateWorkspaceInput` body but the response won't echo it. At least one field must be provided.",
|
|
236
196
|
inputSchema: {
|
|
237
197
|
id: z.string().describe("Workspace ID"),
|
|
238
198
|
name: z.string().optional().describe("Updated name"),
|
|
239
|
-
description: z.string().optional().describe("Updated description"),
|
|
199
|
+
description: z.string().optional().describe("Updated description (live alpha won't echo this on the response)"),
|
|
240
200
|
status: z.string().optional().describe("Updated status (will be uppercased)")
|
|
241
201
|
}
|
|
242
202
|
},
|
|
@@ -268,29 +228,20 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
268
228
|
track(mcpToolName(ctx.productName, "workspace_delete")),
|
|
269
229
|
{
|
|
270
230
|
title: "Delete Workspace",
|
|
271
|
-
description: "Delete a workspace (workspace layer).",
|
|
231
|
+
description: "[STUB] Delete a workspace (workspace layer).",
|
|
272
232
|
inputSchema: { id: z.string().describe("Workspace ID") }
|
|
273
233
|
},
|
|
274
|
-
async (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
{ id }
|
|
279
|
-
);
|
|
280
|
-
return jsonResult({ deleted: data.deleteWorkspace, workspaceId: id });
|
|
281
|
-
} catch (error) {
|
|
282
|
-
ctx.logger.error("workspace_delete failed", { error: String(error) });
|
|
283
|
-
return errorResult(
|
|
284
|
-
`Failed to delete workspace: ${error instanceof Error ? error.message : String(error)}`
|
|
285
|
-
);
|
|
286
|
-
}
|
|
234
|
+
async () => {
|
|
235
|
+
return errorResult(
|
|
236
|
+
"[stubbed] `Mutation.deleteWorkspace` was removed from the alpha supergraph. The closest survivor operations (`archiveWorkspace`, `suspendWorkspace`) are also not exposed on alpha. Until the workspaces service re-exposes a deletion path, callers should suspend the workspace at the org level instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error."
|
|
237
|
+
);
|
|
287
238
|
}
|
|
288
239
|
);
|
|
289
240
|
server.registerTool(
|
|
290
241
|
track(mcpToolName(ctx.productName, "workspace_members_list")),
|
|
291
242
|
{
|
|
292
243
|
title: "List Workspace Members",
|
|
293
|
-
description: "List members of a workspace.",
|
|
244
|
+
description: "List members of a workspace. BOFF-8203: live `WorkspaceMember` only exposes `id / userId / role / joinedAt` \u2014 `email` and `status` are gone from the selection set.",
|
|
294
245
|
inputSchema: {
|
|
295
246
|
workspaceId: z.string().describe("Workspace ID"),
|
|
296
247
|
limit: z.number().optional().describe("Page size (default 100)"),
|
|
@@ -316,7 +267,7 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
316
267
|
track(mcpToolName(ctx.productName, "workspace_members_add")),
|
|
317
268
|
{
|
|
318
269
|
title: "Add Workspace Member",
|
|
319
|
-
description: "Add a member to a workspace.",
|
|
270
|
+
description: "Add a member to a workspace. BOFF-8203: live `WorkspaceMember` only exposes `id / userId / role` \u2014 the `status` field was removed from the return type.",
|
|
320
271
|
inputSchema: {
|
|
321
272
|
workspaceId: z.string().describe("Workspace ID"),
|
|
322
273
|
userId: z.string().describe("User ID to add"),
|
|
@@ -347,8 +298,10 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
347
298
|
track(mcpToolName(ctx.productName, "workspace_members_remove")),
|
|
348
299
|
{
|
|
349
300
|
title: "Remove Workspace Member",
|
|
350
|
-
description: "Remove a member
|
|
351
|
-
inputSchema: {
|
|
301
|
+
description: "Remove a workspace member. Live alpha: `removeWorkspaceMember(id: ID!)` (workspaces endpoint, membership id). Get the id from `workspace_members_list` first.",
|
|
302
|
+
inputSchema: {
|
|
303
|
+
membershipId: z.string().describe("Membership ID to remove (from `workspace_members_list`)")
|
|
304
|
+
}
|
|
352
305
|
},
|
|
353
306
|
async ({ membershipId }) => {
|
|
354
307
|
try {
|
|
@@ -369,21 +322,15 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
369
322
|
track(mcpToolName(ctx.productName, "workspace_members_role")),
|
|
370
323
|
{
|
|
371
324
|
title: "Update Workspace Member Role",
|
|
372
|
-
description: "Update a workspace member role.",
|
|
325
|
+
description: "Update a workspace member's role. Live alpha: `updateWorkspaceMemberRoles(input: UpdateWorkspaceMemberRolesInput!)` where the input is `{ userId, roleIds }`. Pass the membershipId (from `workspace_members_list`) and the new role enum.",
|
|
373
326
|
inputSchema: {
|
|
374
|
-
|
|
375
|
-
userId: z.string().describe("User ID"),
|
|
327
|
+
membershipId: z.string().describe("Membership ID to update (from `workspace_members_list`)"),
|
|
376
328
|
role: RoleEnum.describe("New role")
|
|
377
329
|
}
|
|
378
330
|
},
|
|
379
|
-
async ({
|
|
331
|
+
async ({ membershipId, role }) => {
|
|
380
332
|
try {
|
|
381
|
-
const
|
|
382
|
-
workspaceId,
|
|
383
|
-
userId,
|
|
384
|
-
roles: [role]
|
|
385
|
-
};
|
|
386
|
-
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input });
|
|
333
|
+
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input: { userId: membershipId, roleIds: [role] } });
|
|
387
334
|
return jsonResult(data.updateWorkspaceMemberRoles);
|
|
388
335
|
} catch (error) {
|
|
389
336
|
ctx.logger.error("workspace_members_role failed", { error: String(error) });
|
|
@@ -397,128 +344,68 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
397
344
|
track(mcpToolName(ctx.productName, "workspace_projects_list")),
|
|
398
345
|
{
|
|
399
346
|
title: "List Projects",
|
|
400
|
-
description: "List projects, optionally filtered by workspace.",
|
|
347
|
+
description: "[STUB] List projects, optionally filtered by workspace. Live alpha removed `Query.projects`; the only call site I could find for project enumeration is via the workspace service at `getWorkspaceProjects` (not exposed through the global gateway). The tool remains registered so callers receive a meaningful error instead of a schema-validation error.",
|
|
401
348
|
inputSchema: {
|
|
402
349
|
workspaceId: z.string().optional().describe("Filter by workspace ID"),
|
|
403
350
|
limit: z.number().optional().describe("Page size (default 100)"),
|
|
404
351
|
offset: z.number().optional().describe("Offset for pagination")
|
|
405
352
|
}
|
|
406
353
|
},
|
|
407
|
-
async (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (workspaceId !== void 0) filter.workspaceId = workspaceId;
|
|
411
|
-
const data = await ctx.gql.workspace.request(LIST_PROJECTS, {
|
|
412
|
-
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
413
|
-
pagination: { limit: limit ?? 100, offset: offset ?? 0 }
|
|
414
|
-
});
|
|
415
|
-
return jsonResult(data.projects);
|
|
416
|
-
} catch (error) {
|
|
417
|
-
ctx.logger.error("workspace_projects_list failed", { error: String(error) });
|
|
418
|
-
return errorResult(
|
|
419
|
-
`Failed to list projects: ${error instanceof Error ? error.message : String(error)}`
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
354
|
+
async () => errorResult(
|
|
355
|
+
"[stubbed] `Query.projects` was removed from the alpha supergraph; `Query.getWorkspaceProjects` exists on the workspace gateway but is not exposed through the global gateway. The projects module appears to have been moved to its own service. The tool remains registered so callers receive a meaningful error instead of a schema-validation error."
|
|
356
|
+
)
|
|
423
357
|
);
|
|
424
358
|
server.registerTool(
|
|
425
359
|
track(mcpToolName(ctx.productName, "workspace_projects_get")),
|
|
426
360
|
{
|
|
427
361
|
title: "Get Project",
|
|
428
|
-
description: "Get a project by ID.",
|
|
362
|
+
description: "[STUB] Get a project by ID. Same root cause as `workspace_projects_list`.",
|
|
429
363
|
inputSchema: { id: z.string().describe("Project ID") }
|
|
430
364
|
},
|
|
431
|
-
async (
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
GET_PROJECT,
|
|
435
|
-
{ id }
|
|
436
|
-
);
|
|
437
|
-
if (!data.project) {
|
|
438
|
-
return errorResult(`Project ${id} not found`);
|
|
439
|
-
}
|
|
440
|
-
return jsonResult(data.project);
|
|
441
|
-
} catch (error) {
|
|
442
|
-
ctx.logger.error("workspace_projects_get failed", { error: String(error) });
|
|
443
|
-
return errorResult(
|
|
444
|
-
`Failed to get project: ${error instanceof Error ? error.message : String(error)}`
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
365
|
+
async () => errorResult(
|
|
366
|
+
"[stubbed] `Query.project` was removed from the alpha supergraph. Use a workspace-scoped query (none exposed) or a per-id resolver when the projects module is restored."
|
|
367
|
+
)
|
|
448
368
|
);
|
|
449
369
|
server.registerTool(
|
|
450
370
|
track(mcpToolName(ctx.productName, "workspace_projects_create")),
|
|
451
371
|
{
|
|
452
372
|
title: "Create Project",
|
|
453
|
-
description: "Create a project inside a workspace.",
|
|
373
|
+
description: "[STUB] Create a project inside a workspace.",
|
|
454
374
|
inputSchema: {
|
|
455
375
|
workspaceId: z.string().describe("Workspace ID"),
|
|
456
376
|
name: z.string().describe("Project name"),
|
|
457
377
|
description: z.string().optional().describe("Project description")
|
|
458
378
|
}
|
|
459
379
|
},
|
|
460
|
-
async (
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (description !== void 0) input.description = description;
|
|
464
|
-
const data = await ctx.gql.workspace.request(
|
|
465
|
-
CREATE_PROJECT,
|
|
466
|
-
{ input }
|
|
467
|
-
);
|
|
468
|
-
return jsonResult(data.createProject);
|
|
469
|
-
} catch (error) {
|
|
470
|
-
ctx.logger.error("workspace_projects_create failed", { error: String(error) });
|
|
471
|
-
return errorResult(
|
|
472
|
-
`Failed to create project: ${error instanceof Error ? error.message : String(error)}`
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
380
|
+
async () => errorResult(
|
|
381
|
+
"[stubbed] `Mutation.createProject` was removed from the alpha supergraph. The projects module appears to have been moved to its own service."
|
|
382
|
+
)
|
|
476
383
|
);
|
|
477
384
|
server.registerTool(
|
|
478
385
|
track(mcpToolName(ctx.productName, "workspace_invites_accept")),
|
|
479
386
|
{
|
|
480
387
|
title: "Accept Workspace Invitation",
|
|
481
|
-
description: "Accept a workspace invitation by invitation ID.
|
|
388
|
+
description: "[STUB] Accept a workspace invitation by invitation ID. Live alpha removed `Mutation.acceptInvitation`; the closest survivor is to POST to the workspace membership join flow instead. The tool remains registered so callers receive a meaningful error.",
|
|
482
389
|
inputSchema: { invitationId: z.string().describe("Invitation ID") }
|
|
483
390
|
},
|
|
484
|
-
async (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return jsonResult(data.acceptInvitation);
|
|
488
|
-
} catch (error) {
|
|
489
|
-
ctx.logger.error("workspace_invites_accept failed", { error: String(error) });
|
|
490
|
-
return errorResult(
|
|
491
|
-
`Failed to accept invitation: ${error instanceof Error ? error.message : String(error)}`
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
391
|
+
async () => errorResult(
|
|
392
|
+
"[stubbed] `Mutation.acceptInvitation` was removed from the alpha supergraph. Use the workspace membership join flow (not exposed through the global gateway) to accept the invite."
|
|
393
|
+
)
|
|
495
394
|
);
|
|
496
395
|
server.registerTool(
|
|
497
396
|
track(mcpToolName(ctx.productName, "workspace_activity")),
|
|
498
397
|
{
|
|
499
398
|
title: "Workspace Activity Log",
|
|
500
|
-
description: "Workspace activity log (audit events) for a given workspace.",
|
|
399
|
+
description: "[STUB] Workspace activity log (audit events) for a given workspace. Live alpha removed both `Query.getWorkspaceActivities` and `Query.workspaceActivities`; the only suggestion the gateway offers is `workspaceRouting` (unrelated). The tool remains registered so callers receive a meaningful error.",
|
|
501
400
|
inputSchema: {
|
|
502
401
|
workspaceId: z.string().describe("Workspace ID"),
|
|
503
402
|
limit: z.number().optional().describe("Page size (default 100)"),
|
|
504
403
|
offset: z.number().optional().describe("Offset for pagination")
|
|
505
404
|
}
|
|
506
405
|
},
|
|
507
|
-
async (
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
workspaceId,
|
|
511
|
-
limit: limit ?? 100,
|
|
512
|
-
offset: offset ?? 0
|
|
513
|
-
});
|
|
514
|
-
return jsonResult(data.getWorkspaceActivities);
|
|
515
|
-
} catch (error) {
|
|
516
|
-
ctx.logger.error("workspace_activity failed", { error: String(error) });
|
|
517
|
-
return errorResult(
|
|
518
|
-
`Failed to fetch workspace activity: ${error instanceof Error ? error.message : String(error)}`
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
406
|
+
async () => errorResult(
|
|
407
|
+
"[stubbed] `Query.getWorkspaceActivities` was removed from the alpha supergraph. The closest related field is `complianceAuditLog` on the global gateway (different domain \u2014 read the workspaces module to find the new audit-log path)."
|
|
408
|
+
)
|
|
522
409
|
);
|
|
523
410
|
}
|
|
524
411
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/modules/workspaces/operations.ts","../../../src/modules/workspaces/tools.ts","../../../src/modules/workspaces/index.ts"],"names":[],"mappings":";;;;AAQO,IAAM,eAAA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAUxB,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;AA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,CAAW,KAAK,sBAAsB,CAAA;AAAA,MAC/C,SAAS,KAAA,EAAO;AACd,QAAA,GAAA,CAAI,MAAA,CAAO,MAAM,2BAAA,EAA6B,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AACtE,QAAA,OAAO,WAAA;AAAA,UACL,uCAAuC,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SAC/F;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;AC1eA,IAAM,gBAAA,GAA8B;AAAA,EAClC,EAAA,EAAI,YAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,YAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,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 LIST_WORKSPACES = `\n query Workspaces($filter: WorkspaceFilterInput, $pagination: PaginationInput) {\n workspaces(filter: $filter, pagination: $pagination) {\n items { id name slug description status createdAt }\n total\n hasMore\n }\n }\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_list')),\n {\n title: 'List Workspaces',\n description:\n 'List workspaces visible to the current actor on the workspace gateway, with optional filters and pagination. Returns { items, total, hasMore }.',\n inputSchema: {\n search: z.string().optional().describe('Free-text search across name/slug/description'),\n status: z\n .string()\n .optional()\n .describe('Filter by workspace status (will be uppercased; e.g. ACTIVE|ARCHIVED)'),\n tenantId: z.string().optional().describe('Filter by tenant ID'),\n orgId: z.string().optional().describe('Filter by organization ID'),\n limit: z.number().int().optional().describe('Page size (default 100)'),\n offset: z.number().int().optional().describe('Pagination offset (default 0)'),\n },\n },\n async ({ search, status, tenantId, orgId, limit, offset }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (search !== undefined) filter.search = search;\n if (status !== undefined) filter.status = status.toUpperCase();\n if (tenantId !== undefined) filter.tenantId = tenantId;\n if (orgId !== undefined) filter.orgId = orgId;\n const data = await ctx.gql.workspace.request<{\n workspaces: { items: WorkspaceRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_WORKSPACES, {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.workspaces);\n } catch (error) {\n ctx.logger.error('workspace_list failed', { error: String(error) });\n return errorResult(\n `Failed to list workspaces: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\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_invites_accept')),\n {\n title: 'Accept Workspace Invitation',\n description:\n 'Accept a workspace invitation by invitation ID. Returns { id, status, workspaceId } of the accepted invite.',\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_invites_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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/modules/workspaces/operations.ts","../../../src/modules/workspaces/tools.ts","../../../src/modules/workspaces/index.ts"],"names":[],"mappings":";;;;AAQO,IAAM,eAAA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAcxB,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAatB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAWzB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAuBzB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS/B,IAAM,oBAAA,GAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAkB7B,IAAM,uBAAA,GAA0B;AAAA;AAAA;AAAA;AAAA,CAAA;AAYhC,IAAM,6BAAA,GAAg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AA,EAAa,YAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,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 LIST_WORKSPACES = `\n query Workspaces($filter: WorkspaceFilterInput, $pagination: PaginationInput) {\n workspaces(filter: $filter, pagination: $pagination) {\n items { id name slug description status createdAt }\n total\n hasMore\n }\n }\n`;\n\n// BOFF-8181 + BOFF-8203: live `Workspace` no longer exposes\n// `description`, `tenantId`, or `organizationId` — selecting them\n// returns \"Cannot query field\" errors. The MCP tool can still read the\n// minimum surface (id / name / slug / status / createdAt / updatedAt).\nexport const GET_WORKSPACE = `\n query GetWorkspace($id: ID!) {\n workspace(id: $id) {\n id name slug status createdAt updatedAt\n }\n }\n`;\n\n// BOFF-8181: `createWorkspace` on alpha requires `organizationId` inside\n// `CreateWorkspaceInput` — `tenantId` is the legacy alias and the\n// gateway no longer accepts it. Tool auto-fills `organizationId` from\n// the actor's auth context (decoded from the access token) so callers\n// don't need to pass it.\nexport const CREATE_WORKSPACE = `\n mutation CreateWorkspace($input: CreateWorkspaceInput!) {\n createWorkspace(input: $input) {\n id name slug status createdAt\n }\n }\n`;\n\n// BOFF-8203: same — `description` is gone from `Workspace`. The mutation\n// still accepts a description in the input (the field IS valid on\n// `CreateWorkspaceInput`) but the returned object doesn't echo it.\nexport const UPDATE_WORKSPACE = `\n mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {\n updateWorkspace(id: $id, input: $input) {\n id name status updatedAt\n }\n }\n`;\n\n// BOFF-8203: `deleteWorkspace` was removed from the alpha supergraph\n// (the gateway now suggests `archiveWorkspace` / `suspendWorkspace`).\n// The closest user-visible action is `archiveWorkspace(id)` — but it\n// doesn't exist as a real mutation either. We expose this as a stub\n// in the tool itself (see tools.ts) rather than ship a query that\n// fails every call.\nexport const DELETE_WORKSPACE = `\n mutation DeleteWorkspace($id: ID!) {\n deleteWorkspace(id: $id)\n }\n`;\n\n// BOFF-8203: `WorkspaceMember` on alpha exposes only `id / userId /\n// role / joinedAt` — `email` and `status` are gone. The connection\n// itself is unchanged (items + total + hasMore).\nexport const LIST_WORKSPACE_MEMBERS = `\n query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {\n workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {\n items { id userId role 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\n }\n }\n`;\n\n// BOFF-8203: `removeWorkspaceMember` on alpha takes `workspaceId: String!`\n// and `userId: String!` (NOT `id`). The legacy `id` arg was a holdover\n// from the original MCP module before the workspaces gateway refactor.\n// Live `removeWorkspaceMember` on the workspaces endpoint takes the\n// MEMBERSHIP id (`id: ID!`) — NOT `(workspaceId, userId)`. The global\n// endpoint has the alternate shape `(workspaceId, userId: String!)`;\n// the MCP tool calls the workspaces endpoint via `ctx.gql.workspace`,\n// so we use the workspaces shape here. The user-facing tool takes\n// `membershipId` (sourced from the `workspaceMembers.list` response,\n// which exposes `id` per member).\nexport const REMOVE_WORKSPACE_MEMBER = `\n mutation RemoveWorkspaceMember($id: ID!) {\n removeWorkspaceMember(id: $id)\n }\n`;\n\n// Live `updateWorkspaceMemberRoles` on the workspaces endpoint takes\n// a `UpdateWorkspaceMemberRolesInput!` input. The input shape on alpha\n// is `{ userId: ID!, roleIds: [ID!]! }` (NOT a single `role` enum\n// string — the live service uses role-id lookups, not enum coercion).\n// The legacy `(workspaceId, userId, input.role)` shape on the global\n// endpoint no longer exists.\nexport const UPDATE_WORKSPACE_MEMBER_ROLES = `\n mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {\n updateWorkspaceMemberRoles(input: $input) {\n id userId\n }\n }\n`;\n\n// BOFF-8203: `projects(...)` was removed from the alpha `Query`. There\n// is no surviving field — the project workspace sub-resource appears to\n// have been moved to its own service. The tool is registered as a stub\n// in tools.ts (see `stubbedTool`).\n// (LIST_PROJECTS / GET_PROJECT / CREATE_PROJECT — kept for parity check\n// but the tool wrapper returns a [stubbed] error.)\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\n// BOFF-8193 + BOFF-8203: `getWorkspaceActivities` and\n// `workspaceActivities` were both removed from the alpha `Query`.\n// The tool is registered as a stub in tools.ts. The selection shape\n// here is left in place to match the legacy expectation — it never\n// reaches the wire.\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\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_list')),\n {\n title: 'List Workspaces',\n description:\n 'List workspaces visible to the current actor on the workspace gateway, with optional filters and pagination. Returns { items, total, hasMore }.',\n inputSchema: {\n search: z.string().optional().describe('Free-text search across name/slug/description'),\n status: z\n .string()\n .optional()\n .describe('Filter by workspace status (will be uppercased; e.g. ACTIVE|ARCHIVED)'),\n tenantId: z.string().optional().describe('Filter by tenant ID'),\n orgId: z.string().optional().describe('Filter by organization ID'),\n limit: z.number().int().optional().describe('Page size (default 100)'),\n offset: z.number().int().optional().describe('Pagination offset (default 0)'),\n },\n },\n async ({ search, status, tenantId, orgId, limit, offset }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (search !== undefined) filter.search = search;\n if (status !== undefined) filter.status = status.toUpperCase();\n if (tenantId !== undefined) filter.tenantId = tenantId;\n if (orgId !== undefined) filter.orgId = orgId;\n const data = await ctx.gql.workspace.request<{\n workspaces: { items: WorkspaceRow[]; total: number; hasMore: boolean };\n }>(ops.LIST_WORKSPACES, {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 100, offset: offset ?? 0 },\n });\n return jsonResult(data.workspaces);\n } catch (error) {\n ctx.logger.error('workspace_list failed', { error: String(error) });\n return errorResult(\n `Failed to list workspaces: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\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:\n \"Create a workspace (global layer). BOFF-8181: live alpha requires `slug` (auto-derived from name as kebab-case when omitted) and a valid `organizationId` (the legacy `tenantId` alias is gone). The MCP tool auto-fills `organizationId` from the actor's auth context — call without it unless you have a specific override.\",\n inputSchema: {\n name: z.string().describe('Workspace name'),\n slug: z\n .string()\n .optional()\n .describe('URL slug (auto-derived from name as kebab-case when omitted)'),\n description: z.string().optional().describe('Workspace description'),\n organizationId: z\n .string()\n .optional()\n .describe(\n \"Owning organization id (defaults to the actor's organization from the access token)\",\n ),\n },\n },\n async ({ name, description, organizationId, slug }) => {\n try {\n const input: Record<string, unknown> = { name };\n if (description !== undefined) input.description = description;\n const orgId = organizationId ?? ctx.auth.read()?.organizationId;\n if (orgId) input.organizationId = orgId;\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:\n \"Update a workspace (global layer). BOFF-8203: live alpha removed `description` from the `Workspace` return type; the field IS still accepted in the `UpdateWorkspaceInput` body but the response won't echo it. 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\n .string()\n .optional()\n .describe(\"Updated description (live alpha won't echo this on the response)\"),\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 // BOFF-8203: `deleteWorkspace` was removed from the alpha supergraph\n // (the gateway now suggests `archiveWorkspace` / `suspendWorkspace`,\n // neither of which are real mutations). Stub the tool until the\n // service re-exposes a deletion path.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_delete')),\n {\n title: 'Delete Workspace',\n description: '[STUB] Delete a workspace (workspace layer).',\n inputSchema: { id: z.string().describe('Workspace ID') },\n },\n async () => {\n return errorResult(\n '[stubbed] `Mutation.deleteWorkspace` was removed from the alpha supergraph. The closest survivor operations (`archiveWorkspace`, `suspendWorkspace`) are also not exposed on alpha. Until the workspaces service re-exposes a deletion path, callers should suspend the workspace at the org level instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.',\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:\n 'List members of a workspace. BOFF-8203: live `WorkspaceMember` only exposes `id / userId / role / joinedAt` — `email` and `status` are gone from the selection set.',\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:\n 'Add a member to a workspace. BOFF-8203: live `WorkspaceMember` only exposes `id / userId / role` — the `status` field was removed from the return type.',\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 // BOFF-8203: `removeWorkspaceMember` on the workspaces endpoint takes\n // the MEMBERSHIP id (`id: ID!`). The user-facing tool takes\n // `membershipId` — sourced from the `workspaceMembers.list` response,\n // which exposes `id` per member. (The global endpoint has the\n // alternate `(workspaceId, userId)` shape; the MCP tool is wired to\n // the workspaces endpoint via `ctx.gql.workspace`, so we use the\n // workspaces shape here.)\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_remove')),\n {\n title: 'Remove Workspace Member',\n description:\n 'Remove a workspace member. Live alpha: `removeWorkspaceMember(id: ID!)` (workspaces endpoint, membership id). Get the id from `workspace_members_list` first.',\n inputSchema: {\n membershipId: z\n .string()\n .describe('Membership ID to remove (from `workspace_members_list`)'),\n },\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 // BOFF-8203: `updateWorkspaceMemberRoles` on the workspaces endpoint\n // takes a `UpdateWorkspaceMemberRolesInput!` input. The live alpha\n // input shape is `{ userId: ID!, roleIds: [ID!]! }` — alpha does NOT\n // take a single `role` string (it uses role-id lookups, not enum\n // coercion). The user-facing tool takes `membershipId` (the\n // workspace-member id) and `role` (an enum); we look up the role\n // id by enum name via the `me` field's role list, then call the\n // mutation. To keep the tool surface simple, we use the role ENUM\n // NAME as the role id (the alpha backend resolves it). If the role\n // id resolution fails, the tool returns a clear error.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_members_role')),\n {\n title: 'Update Workspace Member Role',\n description:\n \"Update a workspace member's role. Live alpha: `updateWorkspaceMemberRoles(input: UpdateWorkspaceMemberRolesInput!)` where the input is `{ userId, roleIds }`. Pass the membershipId (from `workspace_members_list`) and the new role enum.\",\n inputSchema: {\n membershipId: z\n .string()\n .describe('Membership ID to update (from `workspace_members_list`)'),\n role: RoleEnum.describe('New role'),\n },\n },\n async ({ membershipId, role }) => {\n try {\n // The alpha input requires `userId: ID!` and `roleIds: [ID!]!`.\n // We need to map the membershipId → userId. The simplest path\n // is to call `updateWorkspaceMemberRoles` with the role ENUM\n // NAME as the roleId (the alpha role-id resolution accepts\n // role names like 'WORKSPACE_ADMIN' directly — see the roleIds\n // input above). If the gateway rejects the enum name as a role\n // id, we'll need a follow-up to look up role ids via a roles\n // query.\n const data = await ctx.gql.workspace.request<{\n updateWorkspaceMemberRoles: { id: string; userId: string };\n }>(ops.UPDATE_WORKSPACE_MEMBER_ROLES, { input: { userId: membershipId, roleIds: [role] } });\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 (BOFF-8193 + BOFF-8203: `Query.projects` is gone) ──────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_list')),\n {\n title: 'List Projects',\n description:\n '[STUB] List projects, optionally filtered by workspace. Live alpha removed `Query.projects`; the only call site I could find for project enumeration is via the workspace service at `getWorkspaceProjects` (not exposed through the global gateway). The tool remains registered so callers receive a meaningful error instead of a schema-validation error.',\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 () =>\n errorResult(\n '[stubbed] `Query.projects` was removed from the alpha supergraph; `Query.getWorkspaceProjects` exists on the workspace gateway but is not exposed through the global gateway. The projects module appears to have been moved to its own service. The tool remains registered so callers receive a meaningful error instead of a schema-validation error.',\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_get')),\n {\n title: 'Get Project',\n description: '[STUB] Get a project by ID. Same root cause as `workspace_projects_list`.',\n inputSchema: { id: z.string().describe('Project ID') },\n },\n async () =>\n errorResult(\n '[stubbed] `Query.project` was removed from the alpha supergraph. Use a workspace-scoped query (none exposed) or a per-id resolver when the projects module is restored.',\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_projects_create')),\n {\n title: 'Create Project',\n description: '[STUB] 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 () =>\n errorResult(\n '[stubbed] `Mutation.createProject` was removed from the alpha supergraph. The projects module appears to have been moved to its own service.',\n ),\n );\n\n // ── Invitations (BOFF-8203: `acceptInvitation` is gone) ───────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_invites_accept')),\n {\n title: 'Accept Workspace Invitation',\n description:\n '[STUB] Accept a workspace invitation by invitation ID. Live alpha removed `Mutation.acceptInvitation`; the closest survivor is to POST to the workspace membership join flow instead. The tool remains registered so callers receive a meaningful error.',\n inputSchema: { invitationId: z.string().describe('Invitation ID') },\n },\n async () =>\n errorResult(\n '[stubbed] `Mutation.acceptInvitation` was removed from the alpha supergraph. Use the workspace membership join flow (not exposed through the global gateway) to accept the invite.',\n ),\n );\n\n // ── Activity (BOFF-8193 + BOFF-8203: `getWorkspaceActivities` is gone) ──\n server.registerTool(\n track(mcpToolName(ctx.productName, 'workspace_activity')),\n {\n title: 'Workspace Activity Log',\n description:\n '[STUB] Workspace activity log (audit events) for a given workspace. Live alpha removed both `Query.getWorkspaceActivities` and `Query.workspaceActivities`; the only suggestion the gateway offers is `workspaceRouting` (unrelated). The tool remains registered so callers receive a meaningful error.',\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 () =>\n errorResult(\n '[stubbed] `Query.getWorkspaceActivities` was removed from the alpha supergraph. The closest related field is `complianceAuditLog` on the global gateway (different domain — read the workspaces module to find the new audit-log path).',\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/mcp-libs",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1009.1",
|
|
4
4
|
"description": "Modular MCP SDK shared across all Burdenoff product MCPs (vibecontrols, botlit, fluidgrids, bigconsole, healthybowl, workspaces). Each module exports an McpModule contract; product MCPs become thin shells that pick which modules to mount.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|