@burdenoff/mcp-libs 2026.522.1 → 2026.523.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{chunk-4GBVJ4OY.js → chunk-N2CZNPYC.js} +31 -3
  2. package/dist/chunk-N2CZNPYC.js.map +1 -0
  3. package/dist/modules/auth/index.cjs +317 -0
  4. package/dist/modules/auth/index.cjs.map +1 -1
  5. package/dist/modules/auth/index.js +289 -1
  6. package/dist/modules/auth/index.js.map +1 -1
  7. package/dist/modules/channels/index.cjs +47 -0
  8. package/dist/modules/channels/index.cjs.map +1 -1
  9. package/dist/modules/channels/index.js +47 -0
  10. package/dist/modules/channels/index.js.map +1 -1
  11. package/dist/modules/conversations/index.cjs +181 -0
  12. package/dist/modules/conversations/index.cjs.map +1 -1
  13. package/dist/modules/conversations/index.js +181 -0
  14. package/dist/modules/conversations/index.js.map +1 -1
  15. package/dist/modules/devportal/index.cjs +281 -0
  16. package/dist/modules/devportal/index.cjs.map +1 -1
  17. package/dist/modules/devportal/index.js +281 -0
  18. package/dist/modules/devportal/index.js.map +1 -1
  19. package/dist/modules/files/index.cjs +244 -2
  20. package/dist/modules/files/index.cjs.map +1 -1
  21. package/dist/modules/files/index.js +244 -2
  22. package/dist/modules/files/index.js.map +1 -1
  23. package/dist/modules/organizations/index.cjs +211 -0
  24. package/dist/modules/organizations/index.cjs.map +1 -1
  25. package/dist/modules/organizations/index.js +211 -0
  26. package/dist/modules/organizations/index.js.map +1 -1
  27. package/dist/modules/products/index.cjs +131 -0
  28. package/dist/modules/products/index.cjs.map +1 -1
  29. package/dist/modules/products/index.js +131 -0
  30. package/dist/modules/products/index.js.map +1 -1
  31. package/dist/modules/rbac/index.cjs +114 -0
  32. package/dist/modules/rbac/index.cjs.map +1 -1
  33. package/dist/modules/rbac/index.js +114 -0
  34. package/dist/modules/rbac/index.js.map +1 -1
  35. package/dist/modules/sandbox/index.cjs.map +1 -1
  36. package/dist/modules/sandbox/index.js +1 -1
  37. package/dist/modules/scheduler/index.cjs +124 -0
  38. package/dist/modules/scheduler/index.cjs.map +1 -1
  39. package/dist/modules/scheduler/index.js +124 -0
  40. package/dist/modules/scheduler/index.js.map +1 -1
  41. package/dist/modules/security/index.cjs +51 -0
  42. package/dist/modules/security/index.cjs.map +1 -1
  43. package/dist/modules/security/index.js +51 -0
  44. package/dist/modules/security/index.js.map +1 -1
  45. package/dist/modules/store/index.cjs +102 -0
  46. package/dist/modules/store/index.cjs.map +1 -1
  47. package/dist/modules/store/index.js +102 -0
  48. package/dist/modules/store/index.js.map +1 -1
  49. package/dist/modules/tours/index.cjs +43 -0
  50. package/dist/modules/tours/index.cjs.map +1 -1
  51. package/dist/modules/tours/index.js +43 -0
  52. package/dist/modules/tours/index.js.map +1 -1
  53. package/dist/modules/vibecontrols/index.cjs +197 -0
  54. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  55. package/dist/modules/vibecontrols/index.js +170 -1
  56. package/dist/modules/vibecontrols/index.js.map +1 -1
  57. package/dist/modules/workspaces/index.cjs +46 -3
  58. package/dist/modules/workspaces/index.cjs.map +1 -1
  59. package/dist/modules/workspaces/index.js +46 -3
  60. package/dist/modules/workspaces/index.js.map +1 -1
  61. package/package.json +4 -3
  62. package/dist/chunk-4GBVJ4OY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/modules/conversations/operations.ts","../../../src/modules/conversations/tools.ts","../../../src/modules/conversations/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS3B,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AASzB,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQ5B,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA,CAAA;AAM5B,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AAW,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,0BAAA,CAA2B,MAAA,EAAQ,KAAK,KAAK,CAAA;AAE7C,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,qBAAA,GAAQ","file":"index.js","sourcesContent":["export const LIST_CONVERSATIONS = `\n query ListConversations($filter: ConversationFilterInput, $first: Int, $after: String) {\n conversations(filter: $filter, first: $first, after: $after) {\n edges { node { id title type description createdAt updatedAt unreadCount } }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nexport const GET_CONVERSATION = `\n query GetConversation($id: ID!) {\n conversation(id: $id) {\n id title type description avatarUrl settings\n createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_CONVERSATION = `\n mutation CreateConversation($input: CreateConversationInput!) {\n createConversation(input: $input) {\n conversation { id title type }\n }\n }\n`;\n\nexport const DELETE_CONVERSATION = `\n mutation DeleteConversation($id: ID!) {\n deleteConversation(id: $id) { success }\n }\n`;\n\nexport const UPDATE_CONVERSATION = `\n mutation UpdateConversation($input: UpdateConversationInput!) {\n updateConversation(input: $input) {\n conversation { id title description }\n }\n }\n`;\n\nexport const SEND_MESSAGE = `\n mutation SendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n message { id content type createdAt }\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n LIST_CONVERSATIONS,\n GET_CONVERSATION,\n CREATE_CONVERSATION,\n UPDATE_CONVERSATION,\n DELETE_CONVERSATION,\n SEND_MESSAGE,\n} from './operations.js';\n\nconst ConversationTypeEnum = z.enum(['DIRECT', 'GROUP', 'CHANNEL']);\n\ninterface ConversationNode {\n id: string;\n title?: string;\n type?: string;\n description?: string | null;\n createdAt?: string;\n updatedAt?: string;\n unreadCount?: number;\n}\n\nexport function registerConversationsTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_list')),\n {\n title: 'List Conversations',\n description: 'List threaded conversations with optional type filter and cursor pagination.',\n inputSchema: {\n type: ConversationTypeEnum.optional().describe('Filter by conversation type'),\n first: z.number().optional().describe('Page size (default 50)'),\n after: z.string().optional().describe('Cursor returned by a previous page'),\n },\n },\n async ({ type, first, after }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (type !== undefined) filter.type = type;\n\n const data = await ctx.gql.workspace.request<{\n conversations: {\n edges: Array<{ node: ConversationNode }>;\n pageInfo: { hasNextPage: boolean; endCursor?: string };\n };\n }>(LIST_CONVERSATIONS, {\n filter: Object.keys(filter).length > 0 ? filter : undefined,\n first,\n after,\n });\n return jsonResult({\n items: data.conversations.edges.map((e) => e.node),\n pageInfo: data.conversations.pageInfo,\n });\n } catch (error) {\n ctx.logger.error('conversations_list failed', { error });\n return errorResult(\n `Failed to list conversations: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_get')),\n {\n title: 'Get Conversation',\n description: 'Get a single conversation by ID.',\n inputSchema: {\n id: z.string().describe('Conversation ID'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n conversation: ConversationNode | null;\n }>(GET_CONVERSATION, { id });\n if (!data.conversation) {\n return errorResult(`Conversation ${id} not found`);\n }\n return jsonResult(data.conversation);\n } catch (error) {\n ctx.logger.error('conversations_get failed', { error });\n return errorResult(\n `Failed to get conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_create')),\n {\n title: 'Create Conversation',\n description: 'Create a new threaded conversation.',\n inputSchema: {\n title: z.string().describe('Conversation title'),\n description: z.string().optional().describe('Conversation description'),\n type: ConversationTypeEnum.optional().describe('Conversation type (default: GROUP)'),\n participantIds: z.array(z.string()).optional().describe('Participant user IDs'),\n },\n },\n async ({ title, description, type, participantIds }) => {\n try {\n const input: Record<string, unknown> = {\n title,\n type: type ?? 'GROUP',\n };\n if (description !== undefined) input.description = description;\n if (participantIds !== undefined) input.participantIds = participantIds;\n\n const data = await ctx.gql.workspace.request<{\n createConversation: { conversation: ConversationNode };\n }>(CREATE_CONVERSATION, { input });\n return jsonResult(data.createConversation.conversation);\n } catch (error) {\n ctx.logger.error('conversations_create failed', { error });\n return errorResult(\n `Failed to create conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_update')),\n {\n title: 'Update Conversation',\n description: 'Update title and/or description of a conversation.',\n inputSchema: {\n id: z.string().describe('Conversation ID'),\n title: z.string().optional().describe('New title'),\n description: z.string().optional().describe('New description'),\n },\n },\n async ({ id, title, description }) => {\n try {\n const input: Record<string, unknown> = { id };\n if (title !== undefined) input.title = title;\n if (description !== undefined) input.description = description;\n if (Object.keys(input).length === 1) {\n return errorResult('No updates specified');\n }\n const data = await ctx.gql.workspace.request<{\n updateConversation: { conversation: ConversationNode };\n }>(UPDATE_CONVERSATION, { input });\n return jsonResult(data.updateConversation.conversation);\n } catch (error) {\n ctx.logger.error('conversations_update failed', { error });\n return errorResult(\n `Failed to update conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_delete')),\n {\n title: 'Delete Conversation',\n description: 'Delete a conversation by ID.',\n inputSchema: {\n id: z.string().describe('Conversation ID to delete'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n deleteConversation: { success: boolean };\n }>(DELETE_CONVERSATION, { id });\n return jsonResult({ deleted: data.deleteConversation.success, conversationId: id });\n } catch (error) {\n ctx.logger.error('conversations_delete failed', { error });\n return errorResult(\n `Failed to delete conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_send_message')),\n {\n title: 'Send Message',\n description: 'Send a text message to a conversation. Optionally reply to a parent message.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n content: z.string().describe('Message content'),\n parentMessageId: z.string().optional().describe('Parent message ID (for replies)'),\n },\n },\n async ({ conversationId, content, parentMessageId }) => {\n try {\n const input: Record<string, unknown> = {\n conversationId,\n content,\n type: 'TEXT',\n };\n if (parentMessageId !== undefined) input.parentMessageId = parentMessageId;\n\n const data = await ctx.gql.workspace.request<{\n sendMessage: {\n message: { id: string; content: string; type?: string; createdAt?: string };\n };\n }>(SEND_MESSAGE, { input });\n return jsonResult(data.sendMessage.message);\n } catch (error) {\n ctx.logger.error('conversations_send_message failed', { error });\n return errorResult(\n `Failed to send message: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Conversations module — threaded conversations + messages\n * (<product>_conversations_{list,get,create,update,delete,send_message}).\n *\n * Backend: ~/products/wspace/conversations/wspace-conversations-svc/.\n * Ported from cli-sdk/src/modules/conversations/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerConversationsTools } from './tools.js';\n\nconst conversationsModule: McpModule = {\n id: 'conversations',\n version: '0.0.1',\n displayName: 'Conversations',\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 registerConversationsTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default conversationsModule;\n"]}
1
+ {"version":3,"sources":["../../../src/modules/conversations/operations.ts","../../../src/modules/conversations/tools.ts","../../../src/modules/conversations/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS3B,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AASzB,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQ5B,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA,CAAA;AAM5B,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQ5B,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQrB,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAYtB,IAAM,yBAAA,GAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AASlC,IAAM,4BAAA,GAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;;;ACtD5C,IAAM,uBAAuB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,SAAS,CAAC,CAAA;AAClE,IAAM,wBAAwB,CAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,OAAO,CAAC,CAAA;AA4B1D,SAAS,0BAAA,CACd,MAAA,EACA,GAAA,EACA,KAAA,EACM;AACN,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,oBAAoB,CAAC,CAAA;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AAa,eAAA;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,0BAAA,CAA2B,MAAA,EAAQ,KAAK,KAAK,CAAA;AAE7C,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,qBAAA,GAAQ","file":"index.js","sourcesContent":["export const LIST_CONVERSATIONS = `\n query ListConversations($filter: ConversationFilterInput, $first: Int, $after: String) {\n conversations(filter: $filter, first: $first, after: $after) {\n edges { node { id title type description createdAt updatedAt unreadCount } }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nexport const GET_CONVERSATION = `\n query GetConversation($id: ID!) {\n conversation(id: $id) {\n id title type description avatarUrl settings\n createdAt updatedAt\n }\n }\n`;\n\nexport const CREATE_CONVERSATION = `\n mutation CreateConversation($input: CreateConversationInput!) {\n createConversation(input: $input) {\n conversation { id title type }\n }\n }\n`;\n\nexport const DELETE_CONVERSATION = `\n mutation DeleteConversation($id: ID!) {\n deleteConversation(id: $id) { success }\n }\n`;\n\nexport const UPDATE_CONVERSATION = `\n mutation UpdateConversation($input: UpdateConversationInput!) {\n updateConversation(input: $input) {\n conversation { id title description }\n }\n }\n`;\n\nexport const SEND_MESSAGE = `\n mutation SendMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n message { id content type createdAt }\n }\n }\n`;\n\nexport const LIST_MESSAGES = `\n query Messages($conversationId: ID!, $filter: MessageFilter, $first: Int, $after: String) {\n messages(conversationId: $conversationId, filter: $filter, first: $first, after: $after) {\n edges {\n cursor\n node { id conversationId senderId content type metadata createdAt updatedAt }\n }\n pageInfo { hasNextPage endCursor }\n }\n }\n`;\n\nexport const GET_CONVERSATION_SETTINGS = `\n query ConversationSettings($id: ID!) {\n conversation(id: $id) {\n id\n settings\n }\n }\n`;\n\nexport const UPDATE_CONVERSATION_SETTINGS = `\n mutation UpdateConversationSettings($input: UpdateConversationInput!) {\n updateConversation(input: $input) {\n conversation { id settings }\n success\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n LIST_CONVERSATIONS,\n GET_CONVERSATION,\n CREATE_CONVERSATION,\n UPDATE_CONVERSATION,\n DELETE_CONVERSATION,\n SEND_MESSAGE,\n LIST_MESSAGES,\n GET_CONVERSATION_SETTINGS,\n UPDATE_CONVERSATION_SETTINGS,\n} from './operations.js';\n\nconst ConversationTypeEnum = z.enum(['DIRECT', 'GROUP', 'CHANNEL']);\nconst NotificationLevelEnum = z.enum(['ALL', 'MENTIONS', 'MUTED']);\n\ninterface ConversationNode {\n id: string;\n title?: string;\n type?: string;\n description?: string | null;\n createdAt?: string;\n updatedAt?: string;\n unreadCount?: number;\n}\n\ninterface MessageNode {\n id: string;\n conversationId?: string;\n senderId?: string;\n content?: string;\n type?: string;\n createdAt?: string;\n updatedAt?: string;\n metadata?: Record<string, unknown> | null;\n}\n\ninterface ConversationSettingsShape {\n id?: string;\n settings?: Record<string, unknown> | null;\n}\n\nexport function registerConversationsTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_list')),\n {\n title: 'List Conversations',\n description: 'List threaded conversations with optional type filter and cursor pagination.',\n inputSchema: {\n type: ConversationTypeEnum.optional().describe('Filter by conversation type'),\n first: z.number().optional().describe('Page size (default 50)'),\n after: z.string().optional().describe('Cursor returned by a previous page'),\n },\n },\n async ({ type, first, after }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (type !== undefined) filter.type = type;\n\n const data = await ctx.gql.workspace.request<{\n conversations: {\n edges: Array<{ node: ConversationNode }>;\n pageInfo: { hasNextPage: boolean; endCursor?: string };\n };\n }>(LIST_CONVERSATIONS, {\n filter: Object.keys(filter).length > 0 ? filter : undefined,\n first,\n after,\n });\n return jsonResult({\n items: data.conversations.edges.map((e) => e.node),\n pageInfo: data.conversations.pageInfo,\n });\n } catch (error) {\n ctx.logger.error('conversations_list failed', { error });\n return errorResult(\n `Failed to list conversations: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_get')),\n {\n title: 'Get Conversation',\n description: 'Get a single conversation by ID.',\n inputSchema: {\n id: z.string().describe('Conversation ID'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n conversation: ConversationNode | null;\n }>(GET_CONVERSATION, { id });\n if (!data.conversation) {\n return errorResult(`Conversation ${id} not found`);\n }\n return jsonResult(data.conversation);\n } catch (error) {\n ctx.logger.error('conversations_get failed', { error });\n return errorResult(\n `Failed to get conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_create')),\n {\n title: 'Create Conversation',\n description: 'Create a new threaded conversation.',\n inputSchema: {\n title: z.string().describe('Conversation title'),\n description: z.string().optional().describe('Conversation description'),\n type: ConversationTypeEnum.optional().describe('Conversation type (default: GROUP)'),\n participantIds: z.array(z.string()).optional().describe('Participant user IDs'),\n },\n },\n async ({ title, description, type, participantIds }) => {\n try {\n const input: Record<string, unknown> = {\n title,\n type: type ?? 'GROUP',\n };\n if (description !== undefined) input.description = description;\n if (participantIds !== undefined) input.participantIds = participantIds;\n\n const data = await ctx.gql.workspace.request<{\n createConversation: { conversation: ConversationNode };\n }>(CREATE_CONVERSATION, { input });\n return jsonResult(data.createConversation.conversation);\n } catch (error) {\n ctx.logger.error('conversations_create failed', { error });\n return errorResult(\n `Failed to create conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_update')),\n {\n title: 'Update Conversation',\n description: 'Update title and/or description of a conversation.',\n inputSchema: {\n id: z.string().describe('Conversation ID'),\n title: z.string().optional().describe('New title'),\n description: z.string().optional().describe('New description'),\n },\n },\n async ({ id, title, description }) => {\n try {\n const input: Record<string, unknown> = { id };\n if (title !== undefined) input.title = title;\n if (description !== undefined) input.description = description;\n if (Object.keys(input).length === 1) {\n return errorResult('No updates specified');\n }\n const data = await ctx.gql.workspace.request<{\n updateConversation: { conversation: ConversationNode };\n }>(UPDATE_CONVERSATION, { input });\n return jsonResult(data.updateConversation.conversation);\n } catch (error) {\n ctx.logger.error('conversations_update failed', { error });\n return errorResult(\n `Failed to update conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_delete')),\n {\n title: 'Delete Conversation',\n description: 'Delete a conversation by ID.',\n inputSchema: {\n id: z.string().describe('Conversation ID to delete'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n deleteConversation: { success: boolean };\n }>(DELETE_CONVERSATION, { id });\n return jsonResult({ deleted: data.deleteConversation.success, conversationId: id });\n } catch (error) {\n ctx.logger.error('conversations_delete failed', { error });\n return errorResult(\n `Failed to delete conversation: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_send_message')),\n {\n title: 'Send Message',\n description: 'Send a text message to a conversation. Optionally reply to a parent message.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n content: z.string().describe('Message content'),\n parentMessageId: z.string().optional().describe('Parent message ID (for replies)'),\n },\n },\n async ({ conversationId, content, parentMessageId }) => {\n try {\n const input: Record<string, unknown> = {\n conversationId,\n content,\n type: 'TEXT',\n };\n if (parentMessageId !== undefined) input.parentMessageId = parentMessageId;\n\n const data = await ctx.gql.workspace.request<{\n sendMessage: {\n message: { id: string; content: string; type?: string; createdAt?: string };\n };\n }>(SEND_MESSAGE, { input });\n return jsonResult(data.sendMessage.message);\n } catch (error) {\n ctx.logger.error('conversations_send_message failed', { error });\n return errorResult(\n `Failed to send message: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Messages ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_messages_list')),\n {\n title: 'List Conversation Messages',\n description:\n 'List messages in a conversation with cursor pagination. Returns { items, pageInfo }.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n first: z.number().optional().describe('Page size (default 50)'),\n after: z.string().optional().describe('Cursor returned by a previous page'),\n },\n },\n async ({ conversationId, first, after }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n messages: {\n edges: Array<{ cursor: string; node: MessageNode }>;\n pageInfo: { hasNextPage: boolean; endCursor?: string };\n };\n }>(LIST_MESSAGES, { conversationId, first, after });\n return jsonResult({\n items: data.messages.edges.map((e) => e.node),\n pageInfo: data.messages.pageInfo,\n });\n } catch (error) {\n ctx.logger.error('conversations_messages_list failed', { error });\n return errorResult(\n `Failed to list messages: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_messages_send')),\n {\n title: 'Send Conversation Message',\n description:\n 'Send a message to a conversation under the nested messages.send surface. Returns the created Message.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n content: z.string().describe('Message content'),\n parentMessageId: z.string().optional().describe('Parent message ID (for thread replies)'),\n type: z.string().optional().describe('Message type (default TEXT, will be uppercased)'),\n },\n },\n async ({ conversationId, content, parentMessageId, type }) => {\n try {\n const input: Record<string, unknown> = {\n conversationId,\n content,\n type: (type ?? 'TEXT').toUpperCase(),\n };\n if (parentMessageId !== undefined) input.parentMessageId = parentMessageId;\n const data = await ctx.gql.workspace.request<{\n sendMessage: { message: MessageNode };\n }>(SEND_MESSAGE, { input });\n return jsonResult(data.sendMessage.message);\n } catch (error) {\n ctx.logger.error('conversations_messages_send failed', { error });\n return errorResult(\n `Failed to send message: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Settings ────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_settings_get')),\n {\n title: 'Get Conversation Settings',\n description:\n 'Fetch the settings JSON for a conversation. Returns { id, settings }; settings is null if the conversation has no overrides.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n },\n },\n async ({ conversationId }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n conversation: ConversationSettingsShape | null;\n }>(GET_CONVERSATION_SETTINGS, { id: conversationId });\n if (!data.conversation) {\n return errorResult(`Conversation ${conversationId} not found`);\n }\n return jsonResult({\n id: data.conversation.id,\n settings: data.conversation.settings ?? null,\n });\n } catch (error) {\n ctx.logger.error('conversations_settings_get failed', { error });\n return errorResult(\n `Failed to get conversation settings: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'conversations_settings_set')),\n {\n title: 'Update Conversation Settings',\n description:\n 'Update the settings (notification level, retention, moderation, etc.) for a conversation. At least one setting field must be provided. Returns the updated conversation { id, settings }.',\n inputSchema: {\n conversationId: z.string().describe('Conversation ID'),\n allowAnonymous: z.boolean().optional().describe('Whether anonymous users can post'),\n allowGuests: z.boolean().optional().describe('Whether guests can join'),\n allowMessageDeletion: z\n .boolean()\n .optional()\n .describe('Whether members can delete messages'),\n allowMessageEditing: z.boolean().optional().describe('Whether members can edit messages'),\n defaultNotificationLevel: NotificationLevelEnum.optional().describe(\n 'Default notification level for new members (ALL/MENTIONS/MUTED)',\n ),\n messageRetentionDays: z\n .number()\n .int()\n .optional()\n .describe('Auto-delete messages older than N days (null = keep forever)'),\n moderationEnabled: z.boolean().optional().describe('Enable auto-moderation'),\n reactionsEnabled: z.boolean().optional().describe('Enable emoji reactions'),\n threadsEnabled: z.boolean().optional().describe('Enable threaded replies'),\n slowModeSeconds: z\n .number()\n .int()\n .optional()\n .describe('Seconds between consecutive messages per user (0 = off)'),\n },\n },\n async ({\n conversationId,\n allowAnonymous,\n allowGuests,\n allowMessageDeletion,\n allowMessageEditing,\n defaultNotificationLevel,\n messageRetentionDays,\n moderationEnabled,\n reactionsEnabled,\n threadsEnabled,\n slowModeSeconds,\n }) => {\n try {\n const settings: Record<string, unknown> = {};\n if (allowAnonymous !== undefined) settings.allowAnonymous = allowAnonymous;\n if (allowGuests !== undefined) settings.allowGuests = allowGuests;\n if (allowMessageDeletion !== undefined)\n settings.allowMessageDeletion = allowMessageDeletion;\n if (allowMessageEditing !== undefined) settings.allowMessageEditing = allowMessageEditing;\n if (defaultNotificationLevel !== undefined)\n settings.defaultNotificationLevel = defaultNotificationLevel;\n if (messageRetentionDays !== undefined)\n settings.messageRetentionDays = messageRetentionDays;\n if (moderationEnabled !== undefined) settings.moderationEnabled = moderationEnabled;\n if (reactionsEnabled !== undefined) settings.reactionsEnabled = reactionsEnabled;\n if (threadsEnabled !== undefined) settings.threadsEnabled = threadsEnabled;\n if (slowModeSeconds !== undefined) settings.slowModeSeconds = slowModeSeconds;\n\n if (Object.keys(settings).length === 0) {\n return errorResult(\n 'No settings specified — provide at least one settings field to update',\n );\n }\n\n const data = await ctx.gql.workspace.request<{\n updateConversation: { conversation: ConversationSettingsShape | null; success: boolean };\n }>(UPDATE_CONVERSATION_SETTINGS, {\n input: { id: conversationId, settings },\n });\n return jsonResult({\n success: data.updateConversation.success,\n id: data.updateConversation.conversation?.id ?? conversationId,\n settings: data.updateConversation.conversation?.settings ?? null,\n });\n } catch (error) {\n ctx.logger.error('conversations_settings_set failed', { error });\n return errorResult(\n `Failed to update conversation settings: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Conversations module — threaded conversations + messages\n * (<product>_conversations_{list,get,create,update,delete,send_message}).\n *\n * Backend: ~/products/wspace/conversations/wspace-conversations-svc/.\n * Ported from cli-sdk/src/modules/conversations/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerConversationsTools } from './tools.js';\n\nconst conversationsModule: McpModule = {\n id: 'conversations',\n version: '0.0.1',\n displayName: 'Conversations',\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 registerConversationsTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default conversationsModule;\n"]}
@@ -202,8 +202,66 @@ var REJECT_APPLICATION = `
202
202
  }
203
203
  }
204
204
  `;
205
+ var LIST_API_KEYS = `
206
+ query ApiKeys($applicationId: ID!) {
207
+ apiKeys(applicationId: $applicationId) {
208
+ id applicationId name prefix scopes lastUsedAt isActive createdAt
209
+ }
210
+ }
211
+ `;
212
+ var CREATE_API_KEY = `
213
+ mutation CreateApiKey($input: CreateApiKeyInput!) {
214
+ createApiKey(input: $input) {
215
+ id applicationId name prefix token scopes isActive createdAt
216
+ }
217
+ }
218
+ `;
219
+ var REVOKE_API_KEY = `
220
+ mutation RevokeApiKey($id: ID!) {
221
+ revokeApiKey(id: $id) { success }
222
+ }
223
+ `;
224
+ var LIST_OAUTH_CLIENTS = `
225
+ query OAuthClients($applicationId: ID!) {
226
+ oauthClients(applicationId: $applicationId) {
227
+ id applicationId clientId name redirectUris grantTypes isActive createdAt
228
+ }
229
+ }
230
+ `;
231
+ var CREATE_OAUTH_CLIENT = `
232
+ mutation CreateOAuthClient($input: CreateOAuthClientInput!) {
233
+ createOAuthClient(input: $input) {
234
+ id applicationId clientId clientSecret name redirectUris grantTypes isActive createdAt
235
+ }
236
+ }
237
+ `;
238
+ var DELETE_OAUTH_CLIENT = `
239
+ mutation DeleteOAuthClient($id: ID!) {
240
+ deleteOAuthClient(id: $id) { success }
241
+ }
242
+ `;
243
+ var LIST_DELEGATIONS = `
244
+ query Delegations($applicationId: ID, $workspaceId: ID) {
245
+ delegations(applicationId: $applicationId, workspaceId: $workspaceId) {
246
+ id applicationId workspaceId scopes status expiresAt createdAt
247
+ }
248
+ }
249
+ `;
250
+ var CREATE_DELEGATION = `
251
+ mutation CreateDelegation($input: CreateDelegationInput!) {
252
+ createDelegation(input: $input) {
253
+ id applicationId workspaceId scopes status expiresAt
254
+ }
255
+ }
256
+ `;
257
+ var REVOKE_DELEGATION = `
258
+ mutation RevokeDelegation($id: ID!) {
259
+ revokeDelegation(id: $id) { success }
260
+ }
261
+ `;
205
262
 
206
263
  // src/modules/devportal/tools.ts
264
+ var OAuthGrantTypeEnum = zod.z.enum(["AUTHORIZATION_CODE", "CLIENT_CREDENTIALS", "REFRESH_TOKEN", "PASSWORD", "IMPLICIT"]).describe("OAuth 2.0 grant type");
207
265
  function registerDevportalTools(server, ctx, track) {
208
266
  server.registerTool(
209
267
  track(mcpToolName(ctx.productName, "devportal_orgs_list")),
@@ -770,6 +828,229 @@ function registerDevportalTools(server, ctx, track) {
770
828
  }
771
829
  }
772
830
  );
831
+ server.registerTool(
832
+ track(mcpToolName(ctx.productName, "devportal_api_keys_list")),
833
+ {
834
+ title: "List API Keys",
835
+ description: "List API keys issued for a devportal application. Returns an array of key metadata (no secret material).",
836
+ inputSchema: {
837
+ applicationId: zod.z.string().describe("Application ID that owns the API keys")
838
+ }
839
+ },
840
+ async ({ applicationId }) => {
841
+ try {
842
+ const data = await ctx.gql.global.request(LIST_API_KEYS, {
843
+ applicationId
844
+ });
845
+ return jsonResult(data.apiKeys);
846
+ } catch (error) {
847
+ ctx.logger.error("devportal_api_keys_list failed", { error: String(error) });
848
+ return errorResult(
849
+ `Failed to list API keys: ${error instanceof Error ? error.message : String(error)}`
850
+ );
851
+ }
852
+ }
853
+ );
854
+ server.registerTool(
855
+ track(mcpToolName(ctx.productName, "devportal_api_keys_create")),
856
+ {
857
+ title: "Create API Key",
858
+ description: "Mint a new API key for an application. Returns the full key including the one-time-visible `token` \u2014 surface it once and never persist server-side after handoff.",
859
+ inputSchema: {
860
+ applicationId: zod.z.string().describe("Application ID that will own the key"),
861
+ name: zod.z.string().min(1).describe("Human-readable name for the key (audit/UI label)"),
862
+ scopes: zod.z.array(zod.z.string()).optional().describe("Scope identifiers granted to the key (omit for default scopes)"),
863
+ expiresAt: zod.z.string().optional().describe("ISO 8601 expiry timestamp (omit for non-expiring key)")
864
+ }
865
+ },
866
+ async ({ applicationId, name, scopes, expiresAt }) => {
867
+ try {
868
+ const input = { applicationId, name };
869
+ if (scopes !== void 0) input.scopes = scopes;
870
+ if (expiresAt !== void 0) input.expiresAt = expiresAt;
871
+ const data = await ctx.gql.global.request(
872
+ CREATE_API_KEY,
873
+ { input }
874
+ );
875
+ return jsonResult(data.createApiKey);
876
+ } catch (error) {
877
+ ctx.logger.error("devportal_api_keys_create failed", { error: String(error) });
878
+ return errorResult(
879
+ `Failed to create API key: ${error instanceof Error ? error.message : String(error)}`
880
+ );
881
+ }
882
+ }
883
+ );
884
+ server.registerTool(
885
+ track(mcpToolName(ctx.productName, "devportal_api_keys_revoke")),
886
+ {
887
+ title: "Revoke API Key",
888
+ description: "Revoke an API key by ID. Revocation is irreversible. Returns `{ status, message, apiKeyId }`.",
889
+ inputSchema: { id: zod.z.string().describe("API key ID to revoke") }
890
+ },
891
+ async ({ id }) => {
892
+ try {
893
+ await ctx.gql.global.request(REVOKE_API_KEY, { id });
894
+ return jsonResult({ status: "success", message: "API key revoked", apiKeyId: id });
895
+ } catch (error) {
896
+ ctx.logger.error("devportal_api_keys_revoke failed", { error: String(error) });
897
+ return errorResult(
898
+ `Failed to revoke API key: ${error instanceof Error ? error.message : String(error)}`
899
+ );
900
+ }
901
+ }
902
+ );
903
+ server.registerTool(
904
+ track(mcpToolName(ctx.productName, "devportal_oauth_list")),
905
+ {
906
+ title: "List OAuth Clients",
907
+ description: "List OAuth 2.0 clients registered for a devportal application.",
908
+ inputSchema: {
909
+ applicationId: zod.z.string().describe("Application ID that owns the OAuth clients")
910
+ }
911
+ },
912
+ async ({ applicationId }) => {
913
+ try {
914
+ const data = await ctx.gql.global.request(
915
+ LIST_OAUTH_CLIENTS,
916
+ { applicationId }
917
+ );
918
+ return jsonResult(data.oauthClients);
919
+ } catch (error) {
920
+ ctx.logger.error("devportal_oauth_list failed", { error: String(error) });
921
+ return errorResult(
922
+ `Failed to list OAuth clients: ${error instanceof Error ? error.message : String(error)}`
923
+ );
924
+ }
925
+ }
926
+ );
927
+ server.registerTool(
928
+ track(mcpToolName(ctx.productName, "devportal_oauth_create")),
929
+ {
930
+ title: "Create OAuth Client",
931
+ description: "Register a new OAuth 2.0 client for an application. Returns the client including the one-time-visible `clientSecret`.",
932
+ inputSchema: {
933
+ applicationId: zod.z.string().describe("Application ID that will own the client"),
934
+ name: zod.z.string().min(1).describe("Human-readable client name"),
935
+ redirectUris: zod.z.array(zod.z.string()).optional().describe("Allowed redirect URIs for authorization-code flows"),
936
+ grantTypes: zod.z.array(OAuthGrantTypeEnum).optional().describe("OAuth grant types the client is allowed to use")
937
+ }
938
+ },
939
+ async ({ applicationId, name, redirectUris, grantTypes }) => {
940
+ try {
941
+ const input = { applicationId, name };
942
+ if (redirectUris !== void 0) input.redirectUris = redirectUris;
943
+ if (grantTypes !== void 0) input.grantTypes = grantTypes;
944
+ const data = await ctx.gql.global.request(
945
+ CREATE_OAUTH_CLIENT,
946
+ { input }
947
+ );
948
+ return jsonResult(data.createOAuthClient);
949
+ } catch (error) {
950
+ ctx.logger.error("devportal_oauth_create failed", { error: String(error) });
951
+ return errorResult(
952
+ `Failed to create OAuth client: ${error instanceof Error ? error.message : String(error)}`
953
+ );
954
+ }
955
+ }
956
+ );
957
+ server.registerTool(
958
+ track(mcpToolName(ctx.productName, "devportal_oauth_delete")),
959
+ {
960
+ title: "Delete OAuth Client",
961
+ description: "Delete an OAuth 2.0 client by ID. Returns `{ status, message, oauthClientId }`.",
962
+ inputSchema: { id: zod.z.string().describe("OAuth client ID") }
963
+ },
964
+ async ({ id }) => {
965
+ try {
966
+ await ctx.gql.global.request(DELETE_OAUTH_CLIENT, { id });
967
+ return jsonResult({
968
+ status: "success",
969
+ message: "OAuth client deleted",
970
+ oauthClientId: id
971
+ });
972
+ } catch (error) {
973
+ ctx.logger.error("devportal_oauth_delete failed", { error: String(error) });
974
+ return errorResult(
975
+ `Failed to delete OAuth client: ${error instanceof Error ? error.message : String(error)}`
976
+ );
977
+ }
978
+ }
979
+ );
980
+ server.registerTool(
981
+ track(mcpToolName(ctx.productName, "devportal_delegations_list")),
982
+ {
983
+ title: "List Delegations",
984
+ description: "List workspace delegations issued to applications. Filter by application or workspace.",
985
+ inputSchema: {
986
+ applicationId: zod.z.string().optional().describe("Filter by application ID"),
987
+ workspaceId: zod.z.string().optional().describe("Filter by workspace ID")
988
+ }
989
+ },
990
+ async ({ applicationId, workspaceId }) => {
991
+ try {
992
+ const data = await ctx.gql.global.request(
993
+ LIST_DELEGATIONS,
994
+ { applicationId, workspaceId }
995
+ );
996
+ return jsonResult(data.delegations);
997
+ } catch (error) {
998
+ ctx.logger.error("devportal_delegations_list failed", { error: String(error) });
999
+ return errorResult(
1000
+ `Failed to list delegations: ${error instanceof Error ? error.message : String(error)}`
1001
+ );
1002
+ }
1003
+ }
1004
+ );
1005
+ server.registerTool(
1006
+ track(mcpToolName(ctx.productName, "devportal_delegations_create")),
1007
+ {
1008
+ title: "Create Delegation",
1009
+ description: "Grant a workspace delegation to an application with the given scopes. Returns the persisted delegation.",
1010
+ inputSchema: {
1011
+ applicationId: zod.z.string().describe("Application ID receiving the delegation"),
1012
+ workspaceId: zod.z.string().describe("Workspace ID granting the delegation"),
1013
+ scopes: zod.z.array(zod.z.string()).optional().describe("Scope identifiers granted to the application (omit for default scope set)"),
1014
+ expiresAt: zod.z.string().optional().describe("ISO 8601 expiry timestamp (omit for non-expiring delegation)")
1015
+ }
1016
+ },
1017
+ async ({ applicationId, workspaceId, scopes, expiresAt }) => {
1018
+ try {
1019
+ const input = { applicationId, workspaceId };
1020
+ if (scopes !== void 0) input.scopes = scopes;
1021
+ if (expiresAt !== void 0) input.expiresAt = expiresAt;
1022
+ const data = await ctx.gql.global.request(
1023
+ CREATE_DELEGATION,
1024
+ { input }
1025
+ );
1026
+ return jsonResult(data.createDelegation);
1027
+ } catch (error) {
1028
+ ctx.logger.error("devportal_delegations_create failed", { error: String(error) });
1029
+ return errorResult(
1030
+ `Failed to create delegation: ${error instanceof Error ? error.message : String(error)}`
1031
+ );
1032
+ }
1033
+ }
1034
+ );
1035
+ server.registerTool(
1036
+ track(mcpToolName(ctx.productName, "devportal_delegations_revoke")),
1037
+ {
1038
+ title: "Revoke Delegation",
1039
+ description: "Revoke a workspace delegation by ID. Returns `{ status, message, delegationId }`.",
1040
+ inputSchema: { id: zod.z.string().describe("Delegation ID to revoke") }
1041
+ },
1042
+ async ({ id }) => {
1043
+ try {
1044
+ await ctx.gql.global.request(REVOKE_DELEGATION, { id });
1045
+ return jsonResult({ status: "success", message: "Delegation revoked", delegationId: id });
1046
+ } catch (error) {
1047
+ ctx.logger.error("devportal_delegations_revoke failed", { error: String(error) });
1048
+ return errorResult(
1049
+ `Failed to revoke delegation: ${error instanceof Error ? error.message : String(error)}`
1050
+ );
1051
+ }
1052
+ }
1053
+ );
773
1054
  }
774
1055
 
775
1056
  // src/modules/devportal/index.ts