@burdenoff/mcp-libs 2026.1008.4 → 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.
|
@@ -97,14 +97,14 @@ var ADD_WORKSPACE_MEMBER = `
|
|
|
97
97
|
}
|
|
98
98
|
`;
|
|
99
99
|
var REMOVE_WORKSPACE_MEMBER = `
|
|
100
|
-
mutation RemoveWorkspaceMember($
|
|
101
|
-
removeWorkspaceMember(
|
|
100
|
+
mutation RemoveWorkspaceMember($id: ID!) {
|
|
101
|
+
removeWorkspaceMember(id: $id)
|
|
102
102
|
}
|
|
103
103
|
`;
|
|
104
104
|
var UPDATE_WORKSPACE_MEMBER_ROLES = `
|
|
105
|
-
mutation UpdateWorkspaceMemberRoles($
|
|
106
|
-
|
|
107
|
-
id userId
|
|
105
|
+
mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
|
|
106
|
+
updateWorkspaceMemberRoles(input: $input) {
|
|
107
|
+
id userId
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
`;
|
|
@@ -347,19 +347,18 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
347
347
|
track(mcpToolName(ctx.productName, "workspace_members_remove")),
|
|
348
348
|
{
|
|
349
349
|
title: "Remove Workspace Member",
|
|
350
|
-
description: "Remove a workspace member. Live alpha: `removeWorkspaceMember(
|
|
350
|
+
description: "Remove a workspace member. Live alpha: `removeWorkspaceMember(id: ID!)` (workspaces endpoint, membership id). Get the id from `workspace_members_list` first.",
|
|
351
351
|
inputSchema: {
|
|
352
|
-
|
|
353
|
-
userId: zod.z.string().describe("User ID to remove from the workspace")
|
|
352
|
+
membershipId: zod.z.string().describe("Membership ID to remove (from `workspace_members_list`)")
|
|
354
353
|
}
|
|
355
354
|
},
|
|
356
|
-
async ({
|
|
355
|
+
async ({ membershipId }) => {
|
|
357
356
|
try {
|
|
358
357
|
const data = await ctx.gql.workspace.request(
|
|
359
358
|
REMOVE_WORKSPACE_MEMBER,
|
|
360
|
-
{
|
|
359
|
+
{ id: membershipId }
|
|
361
360
|
);
|
|
362
|
-
return jsonResult({ removed: data.removeWorkspaceMember,
|
|
361
|
+
return jsonResult({ removed: data.removeWorkspaceMember, membershipId });
|
|
363
362
|
} catch (error) {
|
|
364
363
|
ctx.logger.error("workspace_members_remove failed", { error: String(error) });
|
|
365
364
|
return errorResult(
|
|
@@ -372,17 +371,16 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
372
371
|
track(mcpToolName(ctx.productName, "workspace_members_role")),
|
|
373
372
|
{
|
|
374
373
|
title: "Update Workspace Member Role",
|
|
375
|
-
description: "Update a workspace member role. Live alpha: `
|
|
374
|
+
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.",
|
|
376
375
|
inputSchema: {
|
|
377
|
-
|
|
378
|
-
userId: zod.z.string().describe("User ID"),
|
|
376
|
+
membershipId: zod.z.string().describe("Membership ID to update (from `workspace_members_list`)"),
|
|
379
377
|
role: RoleEnum.describe("New role")
|
|
380
378
|
}
|
|
381
379
|
},
|
|
382
|
-
async ({
|
|
380
|
+
async ({ membershipId, role }) => {
|
|
383
381
|
try {
|
|
384
|
-
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, {
|
|
385
|
-
return jsonResult(data.
|
|
382
|
+
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input: { userId: membershipId, roleIds: [role] } });
|
|
383
|
+
return jsonResult(data.updateWorkspaceMemberRoles);
|
|
386
384
|
} catch (error) {
|
|
387
385
|
ctx.logger.error("workspace_members_role failed", { error: String(error) });
|
|
388
386
|
return errorResult(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src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AAQ,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.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()`.\n */\nconst DESTRUCTIVE_NAME_SEGMENT = /(?:^|_)delete(?:_|$)/i;\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\nimport type { ToolAnnotations } from './tool-governance.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n /**\n * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n { _meta?: { progressToken?: string | number } } | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\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.\nexport const REMOVE_WORKSPACE_MEMBER = `\n mutation RemoveWorkspaceMember($workspaceId: String!, $userId: String!) {\n removeWorkspaceMember(workspaceId: $workspaceId, userId: $userId)\n }\n`;\n\n// BOFF-8203: `updateWorkspaceMemberRoles` was a leftover alias from the\n// old contract. The live mutation is `updateWorkspaceMember` and takes\n// `(workspaceId, userId, input: UpdateWorkspaceMemberInput!)`. The\n// `id` arg + `UpdateWorkspaceMemberRolesInput` type no longer exist.\nexport const UPDATE_WORKSPACE_MEMBER_ROLES = `\n mutation UpdateWorkspaceMemberRoles($workspaceId: String!, $userId: String!, $input: UpdateWorkspaceMemberInput!) {\n updateWorkspaceMember(workspaceId: $workspaceId, userId: $userId, input: $input) {\n id userId role\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 alpha takes\n // `(workspaceId: String!, userId: String!)` — NOT a `membershipId`\n // or `id`. The legacy `memberships(id)` lookup is gone; the new mutation\n // scopes by `(workspaceId, userId)` directly. The MCP tool accepts\n // those two IDs and forwards them.\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(workspaceId, userId)` returns Boolean. The legacy `memberships(id)` path was removed.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID the member belongs to'),\n userId: z.string().describe('User ID to remove from the workspace'),\n },\n },\n async ({ workspaceId, userId }) => {\n try {\n const data = await ctx.gql.workspace.request<{ removeWorkspaceMember: boolean }>(\n ops.REMOVE_WORKSPACE_MEMBER,\n { workspaceId, userId },\n );\n return jsonResult({ removed: data.removeWorkspaceMember, workspaceId, userId });\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` was a legacy alias for\n // `updateWorkspaceMember` on the live alpha mutation. The new op\n // takes `(workspaceId, userId, input: UpdateWorkspaceMemberInput!)`\n // and the input shape holds the `role` field directly (NOT a `roles`\n // array).\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 role. Live alpha: `updateWorkspaceMember(workspaceId, userId, input)` where `input.role` is the new role. The legacy `updateWorkspaceMemberRoles` mutation and the `roles: [role]` array shape are gone.',\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 data = await ctx.gql.workspace.request<{\n updateWorkspaceMember: { id: string; userId: string; role: string };\n }>(ops.UPDATE_WORKSPACE_MEMBER_ROLES, { workspaceId, userId, input: { role } });\n return jsonResult(data.updateWorkspaceMember);\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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/workspaces/operations.ts","../../../src/modules/workspaces/tools.ts","../../../src/modules/workspaces/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,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,GACJ;AAGA,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,oBAAoB,CAAC,CAAA;AAAA,IACxD;AAAA,MACE,KAAA,EAAO,wBAAA;AAAA,MACP,WAAA,EACE,0SAAA;AAAA,MACF,WAAA,EAAa;AAAA,QACX,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,SAAS,cAAc,CAAA;AAAA,QAC/C,OAAOA,KAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,yBAAyB,CAAA;AAAA,QAC/D,QAAQA,KAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,uBAAuB;AAAA;AAChE,KACF;AAAA,IACA,YACE,WAAA;AAAA,MACE;AAAA;AACF,GACJ;AACF;;;ACzcA,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.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()`.\n */\nconst DESTRUCTIVE_NAME_SEGMENT = /(?:^|_)delete(?:_|$)/i;\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\nimport type { ToolAnnotations } from './tool-governance.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n /**\n * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n { _meta?: { progressToken?: string | number } } | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\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"]}
|
|
@@ -48,14 +48,14 @@ var ADD_WORKSPACE_MEMBER = `
|
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
50
|
var REMOVE_WORKSPACE_MEMBER = `
|
|
51
|
-
mutation RemoveWorkspaceMember($
|
|
52
|
-
removeWorkspaceMember(
|
|
51
|
+
mutation RemoveWorkspaceMember($id: ID!) {
|
|
52
|
+
removeWorkspaceMember(id: $id)
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
var UPDATE_WORKSPACE_MEMBER_ROLES = `
|
|
56
|
-
mutation UpdateWorkspaceMemberRoles($
|
|
57
|
-
|
|
58
|
-
id userId
|
|
56
|
+
mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
|
|
57
|
+
updateWorkspaceMemberRoles(input: $input) {
|
|
58
|
+
id userId
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
`;
|
|
@@ -298,19 +298,18 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
298
298
|
track(mcpToolName(ctx.productName, "workspace_members_remove")),
|
|
299
299
|
{
|
|
300
300
|
title: "Remove Workspace Member",
|
|
301
|
-
description: "Remove a workspace member. Live alpha: `removeWorkspaceMember(
|
|
301
|
+
description: "Remove a workspace member. Live alpha: `removeWorkspaceMember(id: ID!)` (workspaces endpoint, membership id). Get the id from `workspace_members_list` first.",
|
|
302
302
|
inputSchema: {
|
|
303
|
-
|
|
304
|
-
userId: z.string().describe("User ID to remove from the workspace")
|
|
303
|
+
membershipId: z.string().describe("Membership ID to remove (from `workspace_members_list`)")
|
|
305
304
|
}
|
|
306
305
|
},
|
|
307
|
-
async ({
|
|
306
|
+
async ({ membershipId }) => {
|
|
308
307
|
try {
|
|
309
308
|
const data = await ctx.gql.workspace.request(
|
|
310
309
|
REMOVE_WORKSPACE_MEMBER,
|
|
311
|
-
{
|
|
310
|
+
{ id: membershipId }
|
|
312
311
|
);
|
|
313
|
-
return jsonResult({ removed: data.removeWorkspaceMember,
|
|
312
|
+
return jsonResult({ removed: data.removeWorkspaceMember, membershipId });
|
|
314
313
|
} catch (error) {
|
|
315
314
|
ctx.logger.error("workspace_members_remove failed", { error: String(error) });
|
|
316
315
|
return errorResult(
|
|
@@ -323,17 +322,16 @@ function registerWorkspaceTools(server, ctx, track) {
|
|
|
323
322
|
track(mcpToolName(ctx.productName, "workspace_members_role")),
|
|
324
323
|
{
|
|
325
324
|
title: "Update Workspace Member Role",
|
|
326
|
-
description: "Update a workspace member role. Live alpha: `
|
|
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.",
|
|
327
326
|
inputSchema: {
|
|
328
|
-
|
|
329
|
-
userId: z.string().describe("User ID"),
|
|
327
|
+
membershipId: z.string().describe("Membership ID to update (from `workspace_members_list`)"),
|
|
330
328
|
role: RoleEnum.describe("New role")
|
|
331
329
|
}
|
|
332
330
|
},
|
|
333
|
-
async ({
|
|
331
|
+
async ({ membershipId, role }) => {
|
|
334
332
|
try {
|
|
335
|
-
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, {
|
|
336
|
-
return jsonResult(data.
|
|
333
|
+
const data = await ctx.gql.workspace.request(UPDATE_WORKSPACE_MEMBER_ROLES, { input: { userId: membershipId, roleIds: [role] } });
|
|
334
|
+
return jsonResult(data.updateWorkspaceMemberRoles);
|
|
337
335
|
} catch (error) {
|
|
338
336
|
ctx.logger.error("workspace_members_role failed", { error: String(error) });
|
|
339
337
|
return errorResult(
|
|
@@ -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;AAcxB,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;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,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,oBAAoB,CAAC,CAAA;AAAA,IACxD;AAAA,MACE,KAAA,EAAO,wBAAA;AAAA,MACP,WAAA,EACE,0SAAA;AAAA,MACF,WAAA,EAAa;AAAA,QACX,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,cAAc,CAAA;AAAA,QAC/C,OAAO,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,yBAAyB,CAAA;AAAA,QAC/D,QAAQ,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,uBAAuB;AAAA;AAChE,KACF;AAAA,IACA,YACE,WAAA;AAAA,MACE;AAAA;AACF,GACJ;AACF;;;ACxbA,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\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.\nexport const REMOVE_WORKSPACE_MEMBER = `\n mutation RemoveWorkspaceMember($workspaceId: String!, $userId: String!) {\n removeWorkspaceMember(workspaceId: $workspaceId, userId: $userId)\n }\n`;\n\n// BOFF-8203: `updateWorkspaceMemberRoles` was a leftover alias from the\n// old contract. The live mutation is `updateWorkspaceMember` and takes\n// `(workspaceId, userId, input: UpdateWorkspaceMemberInput!)`. The\n// `id` arg + `UpdateWorkspaceMemberRolesInput` type no longer exist.\nexport const UPDATE_WORKSPACE_MEMBER_ROLES = `\n mutation UpdateWorkspaceMemberRoles($workspaceId: String!, $userId: String!, $input: UpdateWorkspaceMemberInput!) {\n updateWorkspaceMember(workspaceId: $workspaceId, userId: $userId, input: $input) {\n id userId role\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 alpha takes\n // `(workspaceId: String!, userId: String!)` — NOT a `membershipId`\n // or `id`. The legacy `memberships(id)` lookup is gone; the new mutation\n // scopes by `(workspaceId, userId)` directly. The MCP tool accepts\n // those two IDs and forwards them.\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(workspaceId, userId)` returns Boolean. The legacy `memberships(id)` path was removed.',\n inputSchema: {\n workspaceId: z.string().describe('Workspace ID the member belongs to'),\n userId: z.string().describe('User ID to remove from the workspace'),\n },\n },\n async ({ workspaceId, userId }) => {\n try {\n const data = await ctx.gql.workspace.request<{ removeWorkspaceMember: boolean }>(\n ops.REMOVE_WORKSPACE_MEMBER,\n { workspaceId, userId },\n );\n return jsonResult({ removed: data.removeWorkspaceMember, workspaceId, userId });\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` was a legacy alias for\n // `updateWorkspaceMember` on the live alpha mutation. The new op\n // takes `(workspaceId, userId, input: UpdateWorkspaceMemberInput!)`\n // and the input shape holds the `role` field directly (NOT a `roles`\n // array).\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 role. Live alpha: `updateWorkspaceMember(workspaceId, userId, input)` where `input.role` is the new role. The legacy `updateWorkspaceMemberRoles` mutation and the `roles: [role]` array shape are gone.',\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 data = await ctx.gql.workspace.request<{\n updateWorkspaceMember: { id: string; userId: string; role: string };\n }>(ops.UPDATE_WORKSPACE_MEMBER_ROLES, { workspaceId, userId, input: { role } });\n return jsonResult(data.updateWorkspaceMember);\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"]}
|
|
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,GAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;;;AC7E7C,IAAM,WAAW,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC,CAAA;AAE7C,SAAS,sBAAA,CACd,MAAA,EACA,GAAA,EACA,KAAA,EACM;AAEN,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,mBAAmB,CAAC,CAAA;AAAA,IACvD;AAAA,MACE,KAAA,EAAO,mBAAA;AAAA,MACP,WAAA,EACE,mIAAA;AAAA,MACF,aAAa;AAAC,KAChB;AAAA,IACA,YAAY;AACV,MAAA,IAAI;AACF,QAAA,MAAM,IAAA,GAAO,GAAA,CAAI,IAAA,CAAK,IAAA,EAAK;AAC3B,QAAA,MAAM,GAAA,GAAM,MAAM,WAAA,IAAe,IAAA;AACjC,QAAA,IAAI,CAAC,GAAA,EAAK;AACR,UAAA,OAAO,UAAA,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ACJ;AAGA,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,oBAAoB,CAAC,CAAA;AAAA,IACxD;AAAA,MACE,KAAA,EAAO,wBAAA;AAAA,MACP,WAAA,EACE,0SAAA;AAAA,MACF,WAAA,EAAa;AAAA,QACX,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,cAAc,CAAA;AAAA,QAC/C,OAAO,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,yBAAyB,CAAA;AAAA,QAC/D,QAAQ,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,uBAAuB;AAAA;AAChE,KACF;AAAA,IACA,YACE,WAAA;AAAA,MACE;AAAA;AACF,GACJ;AACF;;;ACzcA,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\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",
|