@mcp-z/mcp-outlook 2.2.2 → 2.2.3

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 (90) hide show
  1. package/dist/cjs/constants.js.map +1 -1
  2. package/dist/cjs/email/composition/outlook-message-builder.js.map +1 -1
  3. package/dist/cjs/email/messages/messages.js.map +1 -1
  4. package/dist/cjs/email/parsing/header-parsing.js.map +1 -1
  5. package/dist/cjs/email/parsing/message-extraction.js.map +1 -1
  6. package/dist/cjs/email/parsing/message-mapping.js.map +1 -1
  7. package/dist/cjs/email/querying/client-filter.js.map +1 -1
  8. package/dist/cjs/email/querying/execute-query.js.map +1 -1
  9. package/dist/cjs/email/querying/pagination-token.js.map +1 -1
  10. package/dist/cjs/email/querying/query-builder.js.map +1 -1
  11. package/dist/cjs/email/querying/search-execution.js.map +1 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/lib/create-store.js.map +1 -1
  14. package/dist/cjs/lib/messages-to-row.js.map +1 -1
  15. package/dist/cjs/lib/outlook/index.js.map +1 -1
  16. package/dist/cjs/lib/outlook/types.js.map +1 -1
  17. package/dist/cjs/mcp/index.js.map +1 -1
  18. package/dist/cjs/mcp/prompts/draft-email.js.map +1 -1
  19. package/dist/cjs/mcp/prompts/index.js.map +1 -1
  20. package/dist/cjs/mcp/prompts/query-syntax.js.map +1 -1
  21. package/dist/cjs/mcp/resources/email.js.map +1 -1
  22. package/dist/cjs/mcp/resources/index.js.map +1 -1
  23. package/dist/cjs/mcp/tools/categories-list.js.map +1 -1
  24. package/dist/cjs/mcp/tools/index.js.map +1 -1
  25. package/dist/cjs/mcp/tools/label-add.js.map +1 -1
  26. package/dist/cjs/mcp/tools/label-delete.js.map +1 -1
  27. package/dist/cjs/mcp/tools/labels-list.js.map +1 -1
  28. package/dist/cjs/mcp/tools/message-get.js.map +1 -1
  29. package/dist/cjs/mcp/tools/message-mark-read.js.map +1 -1
  30. package/dist/cjs/mcp/tools/message-move-to-trash.js.map +1 -1
  31. package/dist/cjs/mcp/tools/message-respond.js.map +1 -1
  32. package/dist/cjs/mcp/tools/message-search.js.map +1 -1
  33. package/dist/cjs/mcp/tools/message-send.js.map +1 -1
  34. package/dist/cjs/mcp/tools/messages-export-csv.js.map +1 -1
  35. package/dist/cjs/schemas/index.js.map +1 -1
  36. package/dist/cjs/schemas/outlook-query-schema.js.map +1 -1
  37. package/dist/cjs/schemas/outlook-validation.js.map +1 -1
  38. package/dist/cjs/setup/config.js.map +1 -1
  39. package/dist/cjs/setup/http.js.map +1 -1
  40. package/dist/cjs/setup/index.js.map +1 -1
  41. package/dist/cjs/setup/oauth-microsoft.js.map +1 -1
  42. package/dist/cjs/setup/runtime.js.map +1 -1
  43. package/dist/cjs/setup/stdio.js.map +1 -1
  44. package/dist/cjs/setup/version-help.js.map +1 -1
  45. package/dist/esm/constants.js.map +1 -1
  46. package/dist/esm/email/composition/outlook-message-builder.js.map +1 -1
  47. package/dist/esm/email/messages/messages.js.map +1 -1
  48. package/dist/esm/email/parsing/header-parsing.js.map +1 -1
  49. package/dist/esm/email/parsing/message-extraction.js.map +1 -1
  50. package/dist/esm/email/parsing/message-mapping.js.map +1 -1
  51. package/dist/esm/email/querying/client-filter.js.map +1 -1
  52. package/dist/esm/email/querying/execute-query.js.map +1 -1
  53. package/dist/esm/email/querying/pagination-token.js.map +1 -1
  54. package/dist/esm/email/querying/query-builder.js.map +1 -1
  55. package/dist/esm/email/querying/search-execution.js.map +1 -1
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/esm/lib/create-store.js.map +1 -1
  58. package/dist/esm/lib/messages-to-row.js.map +1 -1
  59. package/dist/esm/lib/outlook/index.js.map +1 -1
  60. package/dist/esm/lib/outlook/types.js.map +1 -1
  61. package/dist/esm/mcp/index.js.map +1 -1
  62. package/dist/esm/mcp/prompts/draft-email.js.map +1 -1
  63. package/dist/esm/mcp/prompts/index.js.map +1 -1
  64. package/dist/esm/mcp/prompts/query-syntax.js.map +1 -1
  65. package/dist/esm/mcp/resources/email.js.map +1 -1
  66. package/dist/esm/mcp/resources/index.js.map +1 -1
  67. package/dist/esm/mcp/tools/categories-list.js.map +1 -1
  68. package/dist/esm/mcp/tools/index.js.map +1 -1
  69. package/dist/esm/mcp/tools/label-add.js.map +1 -1
  70. package/dist/esm/mcp/tools/label-delete.js.map +1 -1
  71. package/dist/esm/mcp/tools/labels-list.js.map +1 -1
  72. package/dist/esm/mcp/tools/message-get.js.map +1 -1
  73. package/dist/esm/mcp/tools/message-mark-read.js.map +1 -1
  74. package/dist/esm/mcp/tools/message-move-to-trash.js.map +1 -1
  75. package/dist/esm/mcp/tools/message-respond.js.map +1 -1
  76. package/dist/esm/mcp/tools/message-search.js.map +1 -1
  77. package/dist/esm/mcp/tools/message-send.js.map +1 -1
  78. package/dist/esm/mcp/tools/messages-export-csv.js.map +1 -1
  79. package/dist/esm/schemas/index.js.map +1 -1
  80. package/dist/esm/schemas/outlook-query-schema.js.map +1 -1
  81. package/dist/esm/schemas/outlook-validation.js.map +1 -1
  82. package/dist/esm/setup/config.js.map +1 -1
  83. package/dist/esm/setup/http.js.map +1 -1
  84. package/dist/esm/setup/index.js.map +1 -1
  85. package/dist/esm/setup/oauth-microsoft.js.map +1 -1
  86. package/dist/esm/setup/runtime.js.map +1 -1
  87. package/dist/esm/setup/stdio.js.map +1 -1
  88. package/dist/esm/setup/version-help.js.map +1 -1
  89. package/dist/esm/types.js.map +1 -1
  90. package/package.json +6 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/mcp/tools/message-search.ts"],"sourcesContent":["import { EMAIL_COMMON_PATTERNS, EMAIL_FIELD_DESCRIPTIONS, EMAIL_FIELDS, EmailContentTypeSchema, type EmailDetail, EmailDetailSchema, ExcludeThreadHistorySchema, extractCurrentMessageFromHtml, extractCurrentMessageFromHtmlToText } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, createFieldsSchema, createPaginationSchema, createShapeSchema, filterFields, ProtocolError, ProtocolErrorCode, parseFields, type ToolModule, toColumnarFormat } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport type * as MicrosoftGraph from '@microsoft/microsoft-graph-types';\nimport { z } from 'zod';\nimport { needsBody } from '../../email/querying/client-filter.ts';\nimport { executeQuery as executeOutlookQuery } from '../../email/querying/execute-query.ts';\nimport { OutlookQueryParameterSchema, parseOutlookQueryParameter } from '../../schemas/outlook-query-schema.ts';\n\nconst inputSchema = z.object({\n query: OutlookQueryParameterSchema.optional().describe('Structured query object or JSON string for filtering messages. Use query-syntax prompt for reference and kqlQuery for KQL syntax.'),\n fields: createFieldsSchema({\n availableFields: EMAIL_FIELDS,\n fieldDescriptions: EMAIL_FIELD_DESCRIPTIONS,\n commonPatterns: EMAIL_COMMON_PATTERNS,\n resourceName: 'email message',\n }),\n ...createPaginationSchema({\n defaultPageSize: 50,\n maxPageSize: 500,\n provider: 'outlook',\n }).shape,\n shape: createShapeSchema(),\n contentType: EmailContentTypeSchema,\n excludeThreadHistory: ExcludeThreadHistorySchema,\n});\n\n// Success branch schemas for different shapes\nconst successObjectsBranchSchema = z.object({\n type: z.literal('success'),\n shape: z.literal('objects'),\n items: z.array(EmailDetailSchema).describe('Matching email messages'),\n nextPageToken: z.string().optional().describe('Token for fetching next page of results'),\n});\n\nconst successArraysBranchSchema = z.object({\n type: z.literal('success'),\n shape: z.literal('arrays'),\n columns: z.array(z.string()).describe('Column names in canonical order'),\n rows: z.array(z.array(z.unknown())).describe('Row data matching column order'),\n nextPageToken: z.string().optional().describe('Token for fetching next page of results'),\n});\n\n// Output schema with auth_required support\n// Using z.union instead of discriminatedUnion since we have two success branches with different shapes\nconst outputSchema = z.union([successObjectsBranchSchema, successArraysBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Search Outlook messages using structured query objects with flexible field selection.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ query, pageSize = 50, pageToken, fields, shape = 'arrays', contentType, excludeThreadHistory }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n\n try {\n const parsedQuery = parseOutlookQueryParameter(query);\n const requestedFields = parseFields(fields, EMAIL_FIELDS);\n const needsBodyContent = needsBody(parsedQuery);\n const includeBody = requestedFields === 'all' || requestedFields.has('body') || needsBodyContent;\n\n logger.info('outlook.search called with', {\n query: parsedQuery,\n pageSize,\n pageToken: pageToken ? '[provided]' : undefined,\n fields: fields || 'all',\n includeBody,\n });\n\n const graph = Client.initWithMiddleware({\n authProvider: extra.authContext.auth,\n });\n const started = Date.now();\n const exec = await executeOutlookQuery(\n graph,\n parsedQuery,\n {\n logger,\n pageSize,\n ...(pageToken ? { pageToken } : {}),\n includeBody,\n limit: pageSize,\n },\n (m: unknown) => {\n const message = m as MicrosoftGraph.Message;\n const to = Array.isArray(message?.toRecipients)\n ? message.toRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const cc = Array.isArray(message?.ccRecipients)\n ? message.ccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const bcc = Array.isArray(message?.bccRecipients)\n ? message.bccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const fromAddr = message?.from?.emailAddress?.address ?? null;\n const fromName = message?.from?.emailAddress?.name ?? null;\n // Process body based on contentType and excludeThreadHistory options\n let bodyContent: string | undefined;\n if (includeBody && message?.body?.content) {\n const isHtml = message.body.contentType?.toLowerCase() === 'html';\n bodyContent = message.body.content;\n\n if (isHtml && excludeThreadHistory) {\n bodyContent = extractCurrentMessageFromHtml(bodyContent);\n }\n\n if (isHtml && contentType === 'text') {\n bodyContent = excludeThreadHistory ? extractCurrentMessageFromHtmlToText(bodyContent) : extractCurrentMessageFromHtmlToText(message.body.content);\n }\n }\n\n const mapped: Partial<EmailDetail> = {\n id: message?.id ?? undefined,\n subject: message?.subject ?? undefined,\n from: fromAddr ?? undefined,\n fromName: fromName ?? undefined,\n to,\n cc,\n bcc,\n date: message?.receivedDateTime ?? undefined,\n snippet: message?.bodyPreview ?? undefined,\n ...(bodyContent && { body: bodyContent, bodyContentType: contentType }),\n };\n return mapped;\n }\n );\n const durationMs = Date.now() - started;\n\n const filteredItems = exec.items.map((item) => filterFields(item, requestedFields));\n logger.info('outlook.message.search returning', {\n query,\n pageSize,\n itemsLength: filteredItems.length,\n fields: fields || 'all',\n });\n logger.info('outlook.message.search metrics', {\n durationMs,\n metadata: exec.metadata,\n });\n\n // Type-safe metadata access\n const metadataObj = exec.metadata as { nextPageToken?: string } | undefined;\n\n // Build result based on shape\n const result: Output =\n shape === 'arrays'\n ? {\n type: 'success' as const,\n shape: 'arrays' as const,\n ...toColumnarFormat(filteredItems, requestedFields, EMAIL_FIELDS),\n ...(metadataObj?.nextPageToken && { nextPageToken: metadataObj.nextPageToken }),\n }\n : {\n type: 'success' as const,\n shape: 'objects' as const,\n items: filteredItems,\n ...(metadataObj?.nextPageToken && { nextPageToken: metadataObj.nextPageToken }),\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.message.search error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error searching messages: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'message-search',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","inputSchema","z","object","query","OutlookQueryParameterSchema","optional","describe","fields","createFieldsSchema","availableFields","EMAIL_FIELDS","fieldDescriptions","EMAIL_FIELD_DESCRIPTIONS","commonPatterns","EMAIL_COMMON_PATTERNS","resourceName","createPaginationSchema","defaultPageSize","maxPageSize","provider","shape","createShapeSchema","contentType","EmailContentTypeSchema","excludeThreadHistory","ExcludeThreadHistorySchema","successObjectsBranchSchema","type","literal","items","array","EmailDetailSchema","nextPageToken","string","successArraysBranchSchema","columns","rows","unknown","outputSchema","union","config","description","result","handler","extra","pageSize","pageToken","logger","parsedQuery","requestedFields","needsBodyContent","includeBody","graph","started","exec","durationMs","filteredItems","metadataObj","error","message","parseOutlookQueryParameter","parseFields","needsBody","has","info","undefined","Client","initWithMiddleware","authProvider","authContext","auth","Date","now","executeOutlookQuery","limit","m","to","Array","isArray","toRecipients","map","r","emailAddress","address","filter","Boolean","join","cc","ccRecipients","bcc","bccRecipients","fromAddr","from","fromName","name","bodyContent","body","content","isHtml","toLowerCase","extractCurrentMessageFromHtml","extractCurrentMessageFromHtmlToText","mapped","id","subject","date","receivedDateTime","snippet","bodyPreview","bodyContentType","item","filterFields","itemsLength","length","metadata","toColumnarFormat","text","JSON","stringify","structuredContent","Error","String","ProtocolError","ProtocolErrorCode","InternalError","stack"],"mappings":";;;;+BAsMA;;;eAAwBA;;;qBAtMmN;8BAEnN;sBAI2K;oCAC5K;mBAEL;8BACQ;8BAC0B;oCACoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AARxE,IAAM,AAAEC,2BAA6BC,uBAAO,CAApCD;AAUR,IAAME,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC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ACtBzD,cAAcH,KAAK4D,QAAQ;oBAEjC,8BAA8B;oBACxBxE,SACJtB,UAAU,WACN;wBACEO,MAAM;wBACNP,OAAO;uBACJ+F,IAAAA,wBAAgB,EAAC3D,eAAeP,iBAAiBvC,mBAAY,GAC5D+C,CAAAA,wBAAAA,kCAAAA,YAAazB,aAAa,KAAI;wBAAEA,eAAeyB,YAAYzB,aAAa;oBAAC,KAE/E;wBACEL,MAAM;wBACNP,OAAO;wBACPS,OAAO2B;uBACHC,CAAAA,wBAAAA,kCAAAA,YAAazB,aAAa,KAAI;wBAAEA,eAAeyB,YAAYzB,aAAa;oBAAC;oBAGrF;;wBAAO;4BACLiE,OAAO;gCACL;oCACEtE,MAAM;oCACNyF,MAAMC,KAAKC,SAAS,CAAC5E;gCACvB;;4BAEF6E,mBAAmB;gCAAE7E,QAAAA;4BAAO;wBAC9B;;;oBACOgB;oBACDC,UAAUD,AAAK,YAALA,OAAiB8D,SAAQ9D,MAAMC,OAAO,GAAG8D,OAAO/D;oBAChEX,OAAOW,KAAK,CAAC,gCAAgC;wBAAEA,OAAOC;oBAAQ;oBAE9D,MAAM,IAAI+D,qBAAa,CAACC,yBAAiB,CAACC,aAAa,EAAE,AAAC,6BAAoC,OAARjE,UAAW;wBAC/FkE,OAAOnE,AAAK,YAALA,OAAiB8D,SAAQ9D,MAAMmE,KAAK,GAAG5D;oBAChD;;;;;;;IAEJ;;AAEe,SAASpE;IACtB,OAAO;QACLiG,MAAM;QACNtD,QAAAA;QACAG,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/mcp/tools/message-search.ts"],"sourcesContent":["import { EMAIL_COMMON_PATTERNS, EMAIL_FIELD_DESCRIPTIONS, EMAIL_FIELDS, EmailContentTypeSchema, type EmailDetail, EmailDetailSchema, ExcludeThreadHistorySchema, extractCurrentMessageFromHtml, extractCurrentMessageFromHtmlToText } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, createFieldsSchema, createPaginationSchema, createShapeSchema, filterFields, ProtocolError, ProtocolErrorCode, parseFields, type ToolModule, toColumnarFormat } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport type * as MicrosoftGraph from '@microsoft/microsoft-graph-types';\nimport { z } from 'zod';\nimport { needsBody } from '../../email/querying/client-filter.ts';\nimport { executeQuery as executeOutlookQuery } from '../../email/querying/execute-query.ts';\nimport { OutlookQueryParameterSchema, parseOutlookQueryParameter } from '../../schemas/outlook-query-schema.ts';\n\nconst inputSchema = z.object({\n query: OutlookQueryParameterSchema.optional().describe('Structured query object or JSON string for filtering messages. Use query-syntax prompt for reference and kqlQuery for KQL syntax.'),\n fields: createFieldsSchema({\n availableFields: EMAIL_FIELDS,\n fieldDescriptions: EMAIL_FIELD_DESCRIPTIONS,\n commonPatterns: EMAIL_COMMON_PATTERNS,\n resourceName: 'email message',\n }),\n ...createPaginationSchema({\n defaultPageSize: 50,\n maxPageSize: 500,\n provider: 'outlook',\n }).shape,\n shape: createShapeSchema(),\n contentType: EmailContentTypeSchema,\n excludeThreadHistory: ExcludeThreadHistorySchema,\n});\n\n// Success branch schemas for different shapes\nconst successObjectsBranchSchema = z.object({\n type: z.literal('success'),\n shape: z.literal('objects'),\n items: z.array(EmailDetailSchema).describe('Matching email messages'),\n nextPageToken: z.string().optional().describe('Token for fetching next page of results'),\n});\n\nconst successArraysBranchSchema = z.object({\n type: z.literal('success'),\n shape: z.literal('arrays'),\n columns: z.array(z.string()).describe('Column names in canonical order'),\n rows: z.array(z.array(z.unknown())).describe('Row data matching column order'),\n nextPageToken: z.string().optional().describe('Token for fetching next page of results'),\n});\n\n// Output schema with auth_required support\n// Using z.union instead of discriminatedUnion since we have two success branches with different shapes\nconst outputSchema = z.union([successObjectsBranchSchema, successArraysBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Search Outlook messages using structured query objects with flexible field selection.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ query, pageSize = 50, pageToken, fields, shape = 'arrays', contentType, excludeThreadHistory }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n\n try {\n const parsedQuery = parseOutlookQueryParameter(query);\n const requestedFields = parseFields(fields, EMAIL_FIELDS);\n const needsBodyContent = needsBody(parsedQuery);\n const includeBody = requestedFields === 'all' || requestedFields.has('body') || needsBodyContent;\n\n logger.info('outlook.search called with', {\n query: parsedQuery,\n pageSize,\n pageToken: pageToken ? '[provided]' : undefined,\n fields: fields || 'all',\n includeBody,\n });\n\n const graph = Client.initWithMiddleware({\n authProvider: extra.authContext.auth,\n });\n const started = Date.now();\n const exec = await executeOutlookQuery(\n graph,\n parsedQuery,\n {\n logger,\n pageSize,\n ...(pageToken ? { pageToken } : {}),\n includeBody,\n limit: pageSize,\n },\n (m: unknown) => {\n const message = m as MicrosoftGraph.Message;\n const to = Array.isArray(message?.toRecipients)\n ? message.toRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const cc = Array.isArray(message?.ccRecipients)\n ? message.ccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const bcc = Array.isArray(message?.bccRecipients)\n ? message.bccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address)\n .filter(Boolean)\n .join(', ')\n : undefined;\n const fromAddr = message?.from?.emailAddress?.address ?? null;\n const fromName = message?.from?.emailAddress?.name ?? null;\n // Process body based on contentType and excludeThreadHistory options\n let bodyContent: string | undefined;\n if (includeBody && message?.body?.content) {\n const isHtml = message.body.contentType?.toLowerCase() === 'html';\n bodyContent = message.body.content;\n\n if (isHtml && excludeThreadHistory) {\n bodyContent = extractCurrentMessageFromHtml(bodyContent);\n }\n\n if (isHtml && contentType === 'text') {\n bodyContent = excludeThreadHistory ? extractCurrentMessageFromHtmlToText(bodyContent) : extractCurrentMessageFromHtmlToText(message.body.content);\n }\n }\n\n const mapped: Partial<EmailDetail> = {\n id: message?.id ?? undefined,\n subject: message?.subject ?? undefined,\n from: fromAddr ?? undefined,\n fromName: fromName ?? undefined,\n to,\n cc,\n bcc,\n date: message?.receivedDateTime ?? undefined,\n snippet: message?.bodyPreview ?? undefined,\n ...(bodyContent && { body: bodyContent, bodyContentType: contentType }),\n };\n return mapped;\n }\n );\n const durationMs = Date.now() - started;\n\n const filteredItems = exec.items.map((item) => filterFields(item, requestedFields));\n logger.info('outlook.message.search returning', {\n query,\n pageSize,\n itemsLength: filteredItems.length,\n fields: fields || 'all',\n });\n logger.info('outlook.message.search metrics', {\n durationMs,\n metadata: exec.metadata,\n });\n\n // Type-safe metadata access\n const metadataObj = exec.metadata as { nextPageToken?: string } | undefined;\n\n // Build result based on shape\n const result: Output =\n shape === 'arrays'\n ? {\n type: 'success' as const,\n shape: 'arrays' as const,\n ...toColumnarFormat(filteredItems, requestedFields, EMAIL_FIELDS),\n ...(metadataObj?.nextPageToken && { nextPageToken: metadataObj.nextPageToken }),\n }\n : {\n type: 'success' as const,\n shape: 'objects' as const,\n items: filteredItems,\n ...(metadataObj?.nextPageToken && { nextPageToken: metadataObj.nextPageToken }),\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.message.search error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error searching messages: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'message-search',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","inputSchema","z","object","query","OutlookQueryParameterSchema","optional","describe","fields","createFieldsSchema","availableFields","EMAIL_FIELDS","fieldDescriptions","EMAIL_FIELD_DESCRIPTIONS","commonPatterns","EMAIL_COMMON_PATTERNS","resourceName","createPaginationSchema","defaultPageSize","maxPageSize","provider","shape","createShapeSchema","contentType","EmailContentTypeSchema","excludeThreadHistory","ExcludeThreadHistorySchema","successObjectsBranchSchema","type","literal","items","array","EmailDetailSchema","nextPageToken","string","successArraysBranchSchema","columns","rows","unknown","outputSchema","union","config","description","result","handler","extra","pageSize","pageToken","logger","parsedQuery","requestedFields","needsBodyContent","includeBody","graph","started","exec","durationMs","filteredItems","metadataObj","error","message","parseOutlookQueryParameter","parseFields","needsBody","has","info","undefined","Client","initWithMiddleware","authProvider","authContext","auth","Date","now","executeOutlookQuery","limit","m","to","Array","isArray","toRecipients","map","r","emailAddress","address","filter","Boolean","join","cc","ccRecipients","bcc","bccRecipients","fromAddr","from","fromName","name","bodyContent","body","content","isHtml","toLowerCase","extractCurrentMessageFromHtml","extractCurrentMessageFromHtmlToText","mapped","id","subject","date","receivedDateTime","snippet","bodyPreview","bodyContentType","item","filterFields","itemsLength","length","metadata","toColumnarFormat","text","JSON","stringify","structuredContent","Error","String","ProtocolError","ProtocolErrorCode","InternalError","stack"],"mappings":";;;;+BAsMA;;;eAAwBA;;;qBAtMmN;8BAEnN;sBAI2K;oCAC5K;mBAEL;8BACQ;8BAC0B;oCACoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AARxE,IAAM,AAAEC,2BAA6BC,uBAAO,CAApCD;AAUR,IAAME,cAAcC,MAAC,CAACC,MAAM,CAAC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AA4B;oBACtBzD,cAAcH,KAAK4D,QAAQ;oBAEjC,8BAA8B;oBACxBxE,SACJtB,UAAU,WACN;wBACEO,MAAM;wBACNP,OAAO;uBACJ+F,IAAAA,wBAAgB,EAAC3D,eAAeP,iBAAiBvC,mBAAY,GAC5D+C,CAAAA,wBAAAA,kCAAAA,YAAazB,aAAa,KAAI;wBAAEA,eAAeyB,YAAYzB,aAAa;oBAAC,KAE/E;wBACEL,MAAM;wBACNP,OAAO;wBACPS,OAAO2B;uBACHC,CAAAA,wBAAAA,kCAAAA,YAAazB,aAAa,KAAI;wBAAEA,eAAeyB,YAAYzB,aAAa;oBAAC;oBAGrF;;wBAAO;4BACLiE,OAAO;gCACL;oCACEtE,MAAM;oCACNyF,MAAMC,KAAKC,SAAS,CAAC5E;gCACvB;;4BAEF6E,mBAAmB;gCAAE7E,QAAAA;4BAAO;wBAC9B;;;oBACOgB;oBACDC,UAAUD,AAAK,YAALA,OAAiB8D,SAAQ9D,MAAMC,OAAO,GAAG8D,OAAO/D;oBAChEX,OAAOW,KAAK,CAAC,gCAAgC;wBAAEA,OAAOC;oBAAQ;oBAE9D,MAAM,IAAI+D,qBAAa,CAACC,yBAAiB,CAACC,aAAa,EAAE,AAAC,6BAAoC,OAARjE,UAAW;wBAC/FkE,OAAOnE,AAAK,YAALA,OAAiB8D,SAAQ9D,MAAMmE,KAAK,GAAG5D;oBAChD;;;;;;;IAEJ;;AAEe,SAASpE;IACtB,OAAO;QACLiG,MAAM;QACNtD,QAAAA;QACAG,SAAAA;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/mcp/tools/message-send.ts"],"sourcesContent":["import { ComposeContentTypeSchema, createEmailRecipientsSchema, createMessageResultSchema } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { type CallToolResult, ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport { z } from 'zod';\nimport { buildOutlookMessage } from '../../email/composition/outlook-message-builder.ts';\n\nconst MessageResultSchema = createMessageResultSchema('outlook');\n\nconst inputSchema = z.object({\n to: createEmailRecipientsSchema('to', true),\n cc: createEmailRecipientsSchema('cc', false),\n bcc: createEmailRecipientsSchema('bcc', false),\n subject: z.string().describe('Email subject line').default(''),\n body: z.string().trim().min(1).describe('Email body content (plain text or HTML)'),\n contentType: ComposeContentTypeSchema,\n});\n\n// Success branch schema\nconst successBranchSchema = MessageResultSchema.extend({\n type: z.literal('success'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Send an email message through Outlook',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ to, cc, bcc, subject, body, contentType }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n\n try {\n const graph = Client.initWithMiddleware({ authProvider: extra.authContext.auth });\n\n // Use composition module to build the message\n const toArray = to\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n const ccArray = cc\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n const bccArray = bcc\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n\n const message = buildOutlookMessage({\n to: toArray,\n cc: ccArray && ccArray.length > 0 ? ccArray : undefined,\n bcc: bccArray && bccArray.length > 0 ? bccArray : undefined,\n subject: subject ?? '',\n body,\n contentType: contentType === 'html' ? 'HTML' : 'Text',\n });\n\n // Use draft-send pattern to get message ID\n // 1. Create draft message\n const draft = await graph.api('/me/messages').post(message);\n const messageId = draft.id;\n\n if (!messageId) {\n logger.error('outlook.message.send draft creation failed - no ID returned');\n throw new ProtocolError(ProtocolErrorCode.InternalError, 'Failed to create draft message');\n }\n\n // 2. Send the draft\n await graph.api(`/me/messages/${messageId}/send`).post({});\n logger.info('Outlook: sent mail successfully', { messageId });\n\n const toCount = message.toRecipients?.length ?? 0;\n const ccCount = message.ccRecipients?.length ?? 0;\n const bccCount = message.bccRecipients?.length ?? 0;\n\n logger.info('outlook.message.send success', { toCount, ccCount, bccCount, subject: subject ?? '', messageId });\n\n const totalRecipients = toCount + ccCount + bccCount;\n const result: Output = {\n type: 'success' as const,\n id: messageId,\n sentAt: new Date().toISOString(),\n recipientCount: totalRecipients,\n webLink: 'https://outlook.live.com/mail/0/sentitems',\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.message.send error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error sending message: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'message-send',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","MessageResultSchema","createMessageResultSchema","inputSchema","z","object","to","createEmailRecipientsSchema","cc","bcc","subject","string","describe","default","body","trim","min","contentType","ComposeContentTypeSchema","successBranchSchema","extend","type","literal","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","message","graph","toArray","ccArray","bccArray","draft","messageId","toCount","ccCount","bccCount","totalRecipients","error","Client","initWithMiddleware","authProvider","authContext","auth","split","map","addr","filter","buildOutlookMessage","length","undefined","api","post","id","ProtocolError","ProtocolErrorCode","InternalError","info","toRecipients","ccRecipients","bccRecipients","sentAt","Date","toISOString","recipientCount","webLink","content","text","JSON","stringify","structuredContent","Error","String","stack","name"],"mappings":";;;;+BAuHA;;;eAAwBA;;;qBAvHyE;8BAE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/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/mcp/tools/message-send.ts"],"sourcesContent":["import { ComposeContentTypeSchema, createEmailRecipientsSchema, createMessageResultSchema } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { type CallToolResult, ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport { z } from 'zod';\nimport { buildOutlookMessage } from '../../email/composition/outlook-message-builder.ts';\n\nconst MessageResultSchema = createMessageResultSchema('outlook');\n\nconst inputSchema = z.object({\n to: createEmailRecipientsSchema('to', true),\n cc: createEmailRecipientsSchema('cc', false),\n bcc: createEmailRecipientsSchema('bcc', false),\n subject: z.string().describe('Email subject line').default(''),\n body: z.string().trim().min(1).describe('Email body content (plain text or HTML)'),\n contentType: ComposeContentTypeSchema,\n});\n\n// Success branch schema\nconst successBranchSchema = MessageResultSchema.extend({\n type: z.literal('success'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Send an email message through Outlook',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ to, cc, bcc, subject, body, contentType }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n\n try {\n const graph = Client.initWithMiddleware({ authProvider: extra.authContext.auth });\n\n // Use composition module to build the message\n const toArray = to\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n const ccArray = cc\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n const bccArray = bcc\n ?.split(',')\n .map((addr) => addr.trim())\n .filter((addr) => addr);\n\n const message = buildOutlookMessage({\n to: toArray,\n cc: ccArray && ccArray.length > 0 ? ccArray : undefined,\n bcc: bccArray && bccArray.length > 0 ? bccArray : undefined,\n subject: subject ?? '',\n body,\n contentType: contentType === 'html' ? 'HTML' : 'Text',\n });\n\n // Use draft-send pattern to get message ID\n // 1. Create draft message\n const draft = await graph.api('/me/messages').post(message);\n const messageId = draft.id;\n\n if (!messageId) {\n logger.error('outlook.message.send draft creation failed - no ID returned');\n throw new ProtocolError(ProtocolErrorCode.InternalError, 'Failed to create draft message');\n }\n\n // 2. Send the draft\n await graph.api(`/me/messages/${messageId}/send`).post({});\n logger.info('Outlook: sent mail successfully', { messageId });\n\n const toCount = message.toRecipients?.length ?? 0;\n const ccCount = message.ccRecipients?.length ?? 0;\n const bccCount = message.bccRecipients?.length ?? 0;\n\n logger.info('outlook.message.send success', { toCount, ccCount, bccCount, subject: subject ?? '', messageId });\n\n const totalRecipients = toCount + ccCount + bccCount;\n const result: Output = {\n type: 'success' as const,\n id: messageId,\n sentAt: new Date().toISOString(),\n recipientCount: totalRecipients,\n webLink: 'https://outlook.live.com/mail/0/sentitems',\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.message.send error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error sending message: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'message-send',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","MessageResultSchema","createMessageResultSchema","inputSchema","z","object","to","createEmailRecipientsSchema","cc","bcc","subject","string","describe","default","body","trim","min","contentType","ComposeContentTypeSchema","successBranchSchema","extend","type","literal","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","message","graph","toArray","ccArray","bccArray","draft","messageId","toCount","ccCount","bccCount","totalRecipients","error","Client","initWithMiddleware","authProvider","authContext","auth","split","map","addr","filter","buildOutlookMessage","length","undefined","api","post","id","ProtocolError","ProtocolErrorCode","InternalError","info","toRecipients","ccRecipients","bccRecipients","sentAt","Date","toISOString","recipientCount","webLink","content","text","JSON","stringify","structuredContent","Error","String","stack","name"],"mappings":";;;;+BAuHA;;;eAAwBA;;;qBAvHyE;8BAEzE;sBAK8C;oCAC/C;mBACL;uCACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANpC,IAAM,AAAEC,2BAA6BC,uBAAO,CAApCD;AAQR,IAAME,sBAAsBC,IAAAA,gCAAyB,EAAC;AAEtD,IAAMC,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,IAAIC,IAAAA,kCAA2B,EAAC,MAAM;IACtCC,IAAID,IAAAA,kCAA2B,EAAC,MAAM;IACtCE,KAAKF,IAAAA,kCAA2B,EAAC,OAAO;IACxCG,SAASN,MAAC,CAACO,MAAM,GAAGC,QAAQ,CAAC,sBAAsBC,OAAO,CAAC;IAC3DC,MAAMV,MAAC,CAACO,MAAM,GAAGI,IAAI,GAAGC,GAAG,CAAC,GAAGJ,QAAQ,CAAC;IACxCK,aAAaC,+BAAwB;AACvC;AAEA,wBAAwB;AACxB,IAAMC,sBAAsBlB,oBAAoBmB,MAAM,CAAC;IACrDC,MAAMjB,MAAC,CAACkB,OAAO,CAAC;AAClB;AAEA,2CAA2C;AAC3C,IAAMC,eAAenB,MAAC,CAACoB,kBAAkB,CAAC,QAAQ;IAACL;IAAqBpB;CAAyB;AAEjG,IAAM0B,SAAS;IACbC,aAAa;IACbvB,aAAaA;IACboB,cAAcnB,MAAC,CAACC,MAAM,CAAC;QACrBsB,QAAQJ;IACV;AACF;AAKA,SAAeK;wCAAQ,KAAkD,EAAEC,KAA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,aAAa,EAAE,AAAC,0BAAiC,OAAR7B,WAAW;wBAC5F8C,OAAOnC,AAAK,YAALA,OAAiBiC,SAAQjC,MAAMmC,KAAK,GAAGvB;oBAChD;;;;;;;IAEJ;;AAEe,SAASxD;IACtB,OAAO;QACLgF,MAAM;QACNrD,QAAAA;QACAG,SAAAA;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/mcp/tools/messages-export-csv.ts"],"sourcesContent":["/** Outlook message CSV export tool - streams results to file without loading all data into context */\n\nimport { EmailContentTypeSchema, ExcludeThreadHistorySchema, extractCurrentMessageFromHtml, extractCurrentMessageFromHtmlToText } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, getFileUri, ProtocolError, ProtocolErrorCode, reserveFile, type ToolModule } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport type * as MicrosoftGraph from '@microsoft/microsoft-graph-types';\nimport { stringify } from 'csv-stringify/sync';\nimport { createWriteStream } from 'fs';\nimport { unlink } from 'fs/promises';\nimport { z } from 'zod';\nimport { executeQuery as executeOutlookQuery } from '../../email/querying/execute-query.ts';\nimport { OutlookQueryParameterSchema, parseOutlookQueryParameter } from '../../schemas/outlook-query-schema.ts';\nimport type { StorageExtra } from '../../types.ts';\n\nconst DEFAULT_PAGE_SIZE = 50;\nconst DEFAULT_MAX_ITEMS = 10000;\nconst MAX_EXPORT_ITEMS = 50000;\n\nconst ExportResultSchema = z.object({\n uri: z.string().describe('File URI (file:// or http://)'),\n filename: z.string().describe('Stored filename'),\n rowCount: z.number().describe('Number of messages exported'),\n truncated: z.boolean().describe('Whether export was truncated at maxItems'),\n});\n\nconst inputSchema = z.object({\n query: OutlookQueryParameterSchema.optional().describe('Structured query object or JSON string for filtering messages. Use query-syntax prompt for reference and kqlQuery for KQL syntax.'),\n maxItems: z.number().int().positive().max(MAX_EXPORT_ITEMS).default(DEFAULT_MAX_ITEMS).describe(`Maximum messages to export (default: ${DEFAULT_MAX_ITEMS}, max: ${MAX_EXPORT_ITEMS})`),\n filename: z.string().trim().min(1).default('outlook-messages.csv').describe('Output filename (default: outlook-messages.csv)'),\n contentType: EmailContentTypeSchema,\n excludeThreadHistory: ExcludeThreadHistorySchema,\n});\n\n// Success branch schema\nconst successBranchSchema = ExportResultSchema.extend({\n type: z.literal('success'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Export Outlook messages to CSV with streaming pagination. Returns file URI. Use query-syntax prompt for query reference.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\n/**\n * Handler for outlook-messages-export-csv tool\n *\n * CRITICAL: Streaming implementation per user requirements\n * - Generate UUID upfront\n * - Write CSV header immediately\n * - Append rows as batches arrive\n * - Delete partial file on error\n * - NO RETRIES (fail fast on error)\n */\nasync function handler({ query, maxItems, filename, contentType, excludeThreadHistory }: Input, extra: EnrichedExtra & StorageExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n const { storageContext } = extra;\n const { transport, resourceStoreUri, baseUrl } = storageContext;\n\n // Reserve file location for streaming write (creates directory, generates ID, formats filename)\n const reservation = await reserveFile(filename, {\n resourceStoreUri,\n });\n const { storedName, fullPath } = reservation;\n\n logger.info('outlook.messages.export-csv starting streaming export', { path: fullPath, maxItems });\n\n try {\n const parsedQuery = parseOutlookQueryParameter(query);\n\n logger.info('outlook.messages.export-csv called', {\n query: parsedQuery,\n maxItems,\n filename,\n accountId: extra.authContext.accountId,\n });\n\n const graph = Client.initWithMiddleware({ authProvider: extra.authContext.auth });\n\n // Create CSV headers (all email fields)\n const csvHeaders = ['id', 'threadId', 'from', 'to', 'cc', 'bcc', 'subject', 'date', 'snippet', 'body', 'provider', 'labels'];\n\n // Create write stream and write headers immediately\n const writeStream = createWriteStream(fullPath, { encoding: 'utf-8' });\n const headerLine = stringify([csvHeaders], { header: false, quoted: true, quote: '\"', escape: '\"' });\n writeStream.write(headerLine);\n\n // Internal pagination loop - append to CSV with each batch\n // NO RETRIES: If any error occurs, fail the whole operation and clean up\n let totalRows = 0;\n let nextPageToken: string | undefined;\n const started = Date.now();\n\n while (totalRows < maxItems) {\n const remainingItems = maxItems - totalRows;\n const pageSize = Math.min(remainingItems, DEFAULT_PAGE_SIZE);\n\n const exec: {\n items: Array<{\n id: string;\n threadId?: string;\n from: string;\n to: string;\n cc: string;\n bcc: string;\n subject: string;\n date: string;\n snippet: string;\n body: string;\n provider: string;\n labels: string;\n }>;\n metadata?: { nextPageToken?: string };\n } = await executeOutlookQuery(\n graph,\n parsedQuery,\n {\n logger,\n pageSize,\n ...(nextPageToken !== undefined && { pageToken: nextPageToken }),\n includeBody: true, // Always include body for CSV export\n limit: pageSize,\n },\n (m: unknown) => {\n const message = m as MicrosoftGraph.Message;\n const to = Array.isArray(message?.toRecipients)\n ? message.toRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const cc = Array.isArray(message?.ccRecipients)\n ? message.ccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const bcc = Array.isArray(message?.bccRecipients)\n ? message.bccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const fromAddr = message?.from?.emailAddress?.address ?? (message?.from as { address?: string })?.address ?? '';\n const categories = Array.isArray(message?.categories) ? message.categories.join(';') : '';\n\n // Process body based on contentType and excludeThreadHistory options\n let body = message?.body?.content ?? '';\n const isHtml = message?.body?.contentType?.toLowerCase() === 'html';\n\n if (isHtml && excludeThreadHistory) {\n body = extractCurrentMessageFromHtml(body);\n }\n\n if (isHtml && contentType === 'text') {\n body = excludeThreadHistory ? extractCurrentMessageFromHtmlToText(body) : extractCurrentMessageFromHtmlToText(message?.body?.content ?? '');\n }\n\n return {\n id: String(message?.id ?? ''),\n threadId: message?.conversationId ? String(message.conversationId) : '',\n from: fromAddr,\n to,\n cc,\n bcc,\n subject: message?.subject ?? '',\n date: message?.receivedDateTime ?? '',\n snippet: message?.bodyPreview ?? '',\n body,\n provider: 'outlook' as const,\n labels: categories,\n };\n }\n );\n\n const csvRows = exec.items.map((item) => {\n return [item.id, item.threadId, item.from, item.to, item.cc, item.bcc, item.subject, item.date, item.snippet, item.body, item.provider, item.labels];\n });\n\n // Append rows to CSV file immediately\n if (csvRows.length > 0) {\n const rowsContent = stringify(csvRows, { header: false, quoted: true, quote: '\"', escape: '\"' });\n writeStream.write(rowsContent);\n }\n\n totalRows += exec.items.length;\n nextPageToken = exec.metadata?.nextPageToken;\n\n logger.info('outlook.messages.export-csv batch written', {\n batchSize: exec.items.length,\n totalRows,\n hasMore: Boolean(nextPageToken),\n });\n\n // Exit if no more results or reached maxItems\n if (!nextPageToken || exec.items.length === 0) {\n break;\n }\n }\n\n // Close write stream\n await new Promise<void>((resolve, reject) => {\n writeStream.end(() => resolve());\n writeStream.on('error', reject);\n });\n\n const durationMs = Date.now() - started;\n const truncated = totalRows >= maxItems && Boolean(nextPageToken);\n\n logger.info('outlook.messages.export-csv completed', {\n rowCount: totalRows,\n truncated,\n durationMs,\n filename: storedName,\n });\n\n // Generate URI based on transport type (stdio: file://, HTTP: http://)\n const uri = getFileUri(storedName, transport, {\n resourceStoreUri,\n ...(baseUrl && { baseUrl }),\n endpoint: '/files',\n });\n\n const result: Output = {\n type: 'success' as const,\n uri,\n filename: storedName,\n rowCount: totalRows,\n truncated,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n // CRITICAL: Clean up partial CSV file on error\n try {\n await unlink(fullPath);\n logger.debug('Cleaned up partial CSV file after error', { path: fullPath });\n } catch (_cleanupError) {\n logger.debug('Could not clean up CSV file (may not exist)', { path: fullPath });\n }\n\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.messages.export-csv error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error exporting messages to CSV: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'messages-export-csv',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","DEFAULT_PAGE_SIZE","DEFAULT_MAX_ITEMS","MAX_EXPORT_ITEMS","ExportResultSchema","z","object","uri","string","describe","filename","rowCount","number","truncated","boolean","inputSchema","query","OutlookQueryParameterSchema","optional","maxItems","int","positive","max","default","trim","min","contentType","EmailContentTypeSchema","excludeThreadHistory","ExcludeThreadHistorySchema","successBranchSchema","extend","type","literal","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","storageContext","transport","resourceStoreUri","baseUrl","reservation","storedName","fullPath","parsedQuery","graph","csvHeaders","writeStream","headerLine","totalRows","nextPageToken","started","exec","remainingItems","pageSize","csvRows","rowsContent","durationMs","error","_cleanupError","message","reserveFile","info","path","parseOutlookQueryParameter","accountId","authContext","Client","initWithMiddleware","authProvider","auth","createWriteStream","encoding","stringify","header","quoted","quote","escape","write","Date","now","Math","executeOutlookQuery","undefined","pageToken","includeBody","limit","m","to","Array","isArray","toRecipients","map","r","emailAddress","address","filter","Boolean","join","cc","ccRecipients","bcc","bccRecipients","fromAddr","from","categories","body","content","isHtml","toLowerCase","extractCurrentMessageFromHtml","extractCurrentMessageFromHtmlToText","id","String","threadId","conversationId","subject","date","receivedDateTime","snippet","bodyPreview","provider","labels","items","item","length","metadata","batchSize","hasMore","Promise","resolve","reject","end","on","getFileUri","endpoint","text","JSON","structuredContent","unlink","debug","Error","ProtocolError","ProtocolErrorCode","InternalError","stack","name"],"mappings":"AAAA,oGAAoG;;;;+BA+QpG;;;eAAwBA;;;qBA7Q+G;8BAE/G;sBAIwF;oCACzF;oBAEG;kBACQ;wBACX;mBACL;8BACkC;oCACoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVxE,IAAM,AAAEC,2BAA6BC,uBAAO,CAApCD;AAaR,IAAME,oBAAoB;AAC1B,IAAMC,oBAAoB;AAC1B,IAAMC,mBAAmB;AAEzB,IAAMC,qBAAqBC,MAAC,CAACC,MAAM,CAAC;IAClCC,KAAKF,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IACzBC,UAAUL,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IAC9BE,UAAUN,MAAC,CAACO,MAAM,GAAGH,QAAQ,CAAC;IAC9BI,WAAWR,MAAC,CAACS,OAAO,GAAGL,QAAQ,CAAC;AAClC;AAEA,IAAMM,cAAcV,MAAC,CAACC,MAAM,CAAC;IAC3BU,OAAOC,iDAA2B,CAACC,QAAQ,GAAGT,QAAQ,CAAC;IACvDU,UAAUd,MAAC,CAACO,MAAM,GAAGQ,GAAG,GAAGC,QAAQ,GAAGC,GAAG,CAACnB,kBAAkBoB,OAAO,CAACrB,mBAAmBO,QAAQ,CAAC,AAAC,wCAAkEN,OAA3BD,mBAAkB,WAA0B,OAAjBC,kBAAiB;IACpLO,UAAUL,MAAC,CAACG,MAAM,GAAGgB,IAAI,GAAGC,GAAG,CAAC,GAAGF,OAAO,CAAC,wBAAwBd,QAAQ,CAAC;IAC5EiB,aAAaC,6BAAsB;IAC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S,CAACxC;gCACvB;;4BAEFyG,mBAAmB;gCAAEzG,QAAAA;4BAAO;wBAC9B;;;oBACOyB;;;;;;;;;oBAGL;;wBAAMiF,IAAAA,gBAAM,EAAChG;;;oBAAb;oBACAP,OAAOwG,KAAK,CAAC,2CAA2C;wBAAE7E,MAAMpB;oBAAS;;;;;;oBAClEgB;oBACPvB,OAAOwG,KAAK,CAAC,+CAA+C;wBAAE7E,MAAMpB;oBAAS;;;;;;oBAGzEiB,UAAUF,AAAK,YAALA,OAAiBmF,SAAQnF,MAAME,OAAO,GAAGqD,OAAOvD;oBAChEtB,OAAOsB,KAAK,CAAC,qCAAqC;wBAAEA,OAAOE;oBAAQ;oBAEnE,MAAM,IAAIkF,qBAAa,CAACC,yBAAiB,CAACC,aAAa,EAAE,AAAC,oCAA2C,OAARpF,UAAW;wBACtGqF,OAAOvF,AAAK,YAALA,OAAiBmF,SAAQnF,MAAMuF,KAAK,GAAG9D;oBAChD;;;;;;;IAEJ;;AAEe,SAAS1F;IACtB,OAAO;QACLyJ,MAAM;QACNnH,QAAAA;QACAG,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/mcp/tools/messages-export-csv.ts"],"sourcesContent":["/** Outlook message CSV export tool - streams results to file without loading all data into context */\n\nimport { EmailContentTypeSchema, ExcludeThreadHistorySchema, extractCurrentMessageFromHtml, extractCurrentMessageFromHtmlToText } from '@mcp-z/email';\nimport type { EnrichedExtra } from '@mcp-z/oauth-microsoft';\nimport { schemas } from '@mcp-z/oauth-microsoft';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport { type CallToolResult, getFileUri, ProtocolError, ProtocolErrorCode, reserveFile, type ToolModule } from '@mcp-z/server';\nimport { Client } from '@microsoft/microsoft-graph-client';\nimport type * as MicrosoftGraph from '@microsoft/microsoft-graph-types';\nimport { stringify } from 'csv-stringify/sync';\nimport { createWriteStream } from 'fs';\nimport { unlink } from 'fs/promises';\nimport { z } from 'zod';\nimport { executeQuery as executeOutlookQuery } from '../../email/querying/execute-query.ts';\nimport { OutlookQueryParameterSchema, parseOutlookQueryParameter } from '../../schemas/outlook-query-schema.ts';\nimport type { StorageExtra } from '../../types.ts';\n\nconst DEFAULT_PAGE_SIZE = 50;\nconst DEFAULT_MAX_ITEMS = 10000;\nconst MAX_EXPORT_ITEMS = 50000;\n\nconst ExportResultSchema = z.object({\n uri: z.string().describe('File URI (file:// or http://)'),\n filename: z.string().describe('Stored filename'),\n rowCount: z.number().describe('Number of messages exported'),\n truncated: z.boolean().describe('Whether export was truncated at maxItems'),\n});\n\nconst inputSchema = z.object({\n query: OutlookQueryParameterSchema.optional().describe('Structured query object or JSON string for filtering messages. Use query-syntax prompt for reference and kqlQuery for KQL syntax.'),\n maxItems: z.number().int().positive().max(MAX_EXPORT_ITEMS).default(DEFAULT_MAX_ITEMS).describe(`Maximum messages to export (default: ${DEFAULT_MAX_ITEMS}, max: ${MAX_EXPORT_ITEMS})`),\n filename: z.string().trim().min(1).default('outlook-messages.csv').describe('Output filename (default: outlook-messages.csv)'),\n contentType: EmailContentTypeSchema,\n excludeThreadHistory: ExcludeThreadHistorySchema,\n});\n\n// Success branch schema\nconst successBranchSchema = ExportResultSchema.extend({\n type: z.literal('success'),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Export Outlook messages to CSV with streaming pagination. Returns file URI. Use query-syntax prompt for query reference.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\n/**\n * Handler for outlook-messages-export-csv tool\n *\n * CRITICAL: Streaming implementation per user requirements\n * - Generate UUID upfront\n * - Write CSV header immediately\n * - Append rows as batches arrive\n * - Delete partial file on error\n * - NO RETRIES (fail fast on error)\n */\nasync function handler({ query, maxItems, filename, contentType, excludeThreadHistory }: Input, extra: EnrichedExtra & StorageExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n const { storageContext } = extra;\n const { transport, resourceStoreUri, baseUrl } = storageContext;\n\n // Reserve file location for streaming write (creates directory, generates ID, formats filename)\n const reservation = await reserveFile(filename, {\n resourceStoreUri,\n });\n const { storedName, fullPath } = reservation;\n\n logger.info('outlook.messages.export-csv starting streaming export', { path: fullPath, maxItems });\n\n try {\n const parsedQuery = parseOutlookQueryParameter(query);\n\n logger.info('outlook.messages.export-csv called', {\n query: parsedQuery,\n maxItems,\n filename,\n accountId: extra.authContext.accountId,\n });\n\n const graph = Client.initWithMiddleware({ authProvider: extra.authContext.auth });\n\n // Create CSV headers (all email fields)\n const csvHeaders = ['id', 'threadId', 'from', 'to', 'cc', 'bcc', 'subject', 'date', 'snippet', 'body', 'provider', 'labels'];\n\n // Create write stream and write headers immediately\n const writeStream = createWriteStream(fullPath, { encoding: 'utf-8' });\n const headerLine = stringify([csvHeaders], { header: false, quoted: true, quote: '\"', escape: '\"' });\n writeStream.write(headerLine);\n\n // Internal pagination loop - append to CSV with each batch\n // NO RETRIES: If any error occurs, fail the whole operation and clean up\n let totalRows = 0;\n let nextPageToken: string | undefined;\n const started = Date.now();\n\n while (totalRows < maxItems) {\n const remainingItems = maxItems - totalRows;\n const pageSize = Math.min(remainingItems, DEFAULT_PAGE_SIZE);\n\n const exec: {\n items: Array<{\n id: string;\n threadId?: string;\n from: string;\n to: string;\n cc: string;\n bcc: string;\n subject: string;\n date: string;\n snippet: string;\n body: string;\n provider: string;\n labels: string;\n }>;\n metadata?: { nextPageToken?: string };\n } = await executeOutlookQuery(\n graph,\n parsedQuery,\n {\n logger,\n pageSize,\n ...(nextPageToken !== undefined && { pageToken: nextPageToken }),\n includeBody: true, // Always include body for CSV export\n limit: pageSize,\n },\n (m: unknown) => {\n const message = m as MicrosoftGraph.Message;\n const to = Array.isArray(message?.toRecipients)\n ? message.toRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const cc = Array.isArray(message?.ccRecipients)\n ? message.ccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const bcc = Array.isArray(message?.bccRecipients)\n ? message.bccRecipients\n .map((r: MicrosoftGraph.Recipient) => r?.emailAddress?.address ?? (r as { address?: string })?.address)\n .filter(Boolean)\n .join(', ')\n : '';\n const fromAddr = message?.from?.emailAddress?.address ?? (message?.from as { address?: string })?.address ?? '';\n const categories = Array.isArray(message?.categories) ? message.categories.join(';') : '';\n\n // Process body based on contentType and excludeThreadHistory options\n let body = message?.body?.content ?? '';\n const isHtml = message?.body?.contentType?.toLowerCase() === 'html';\n\n if (isHtml && excludeThreadHistory) {\n body = extractCurrentMessageFromHtml(body);\n }\n\n if (isHtml && contentType === 'text') {\n body = excludeThreadHistory ? extractCurrentMessageFromHtmlToText(body) : extractCurrentMessageFromHtmlToText(message?.body?.content ?? '');\n }\n\n return {\n id: String(message?.id ?? ''),\n threadId: message?.conversationId ? String(message.conversationId) : '',\n from: fromAddr,\n to,\n cc,\n bcc,\n subject: message?.subject ?? '',\n date: message?.receivedDateTime ?? '',\n snippet: message?.bodyPreview ?? '',\n body,\n provider: 'outlook' as const,\n labels: categories,\n };\n }\n );\n\n const csvRows = exec.items.map((item) => {\n return [item.id, item.threadId, item.from, item.to, item.cc, item.bcc, item.subject, item.date, item.snippet, item.body, item.provider, item.labels];\n });\n\n // Append rows to CSV file immediately\n if (csvRows.length > 0) {\n const rowsContent = stringify(csvRows, { header: false, quoted: true, quote: '\"', escape: '\"' });\n writeStream.write(rowsContent);\n }\n\n totalRows += exec.items.length;\n nextPageToken = exec.metadata?.nextPageToken;\n\n logger.info('outlook.messages.export-csv batch written', {\n batchSize: exec.items.length,\n totalRows,\n hasMore: Boolean(nextPageToken),\n });\n\n // Exit if no more results or reached maxItems\n if (!nextPageToken || exec.items.length === 0) {\n break;\n }\n }\n\n // Close write stream\n await new Promise<void>((resolve, reject) => {\n writeStream.end(() => resolve());\n writeStream.on('error', reject);\n });\n\n const durationMs = Date.now() - started;\n const truncated = totalRows >= maxItems && Boolean(nextPageToken);\n\n logger.info('outlook.messages.export-csv completed', {\n rowCount: totalRows,\n truncated,\n durationMs,\n filename: storedName,\n });\n\n // Generate URI based on transport type (stdio: file://, HTTP: http://)\n const uri = getFileUri(storedName, transport, {\n resourceStoreUri,\n ...(baseUrl && { baseUrl }),\n endpoint: '/files',\n });\n\n const result: Output = {\n type: 'success' as const,\n uri,\n filename: storedName,\n rowCount: totalRows,\n truncated,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n // CRITICAL: Clean up partial CSV file on error\n try {\n await unlink(fullPath);\n logger.debug('Cleaned up partial CSV file after error', { path: fullPath });\n } catch (_cleanupError) {\n logger.debug('Could not clean up CSV file (may not exist)', { path: fullPath });\n }\n\n const message = error instanceof Error ? error.message : String(error);\n logger.error('outlook.messages.export-csv error', { error: message });\n\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error exporting messages to CSV: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'messages-export-csv',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","DEFAULT_PAGE_SIZE","DEFAULT_MAX_ITEMS","MAX_EXPORT_ITEMS","ExportResultSchema","z","object","uri","string","describe","filename","rowCount","number","truncated","boolean","inputSchema","query","OutlookQueryParameterSchema","optional","maxItems","int","positive","max","default","trim","min","contentType","EmailContentTypeSchema","excludeThreadHistory","ExcludeThreadHistorySchema","successBranchSchema","extend","type","literal","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","storageContext","transport","resourceStoreUri","baseUrl","reservation","storedName","fullPath","parsedQuery","graph","csvHeaders","writeStream","headerLine","totalRows","nextPageToken","started","exec","remainingItems","pageSize","csvRows","rowsContent","durationMs","error","_cleanupError","message","reserveFile","info","path","parseOutlookQueryParameter","accountId","authContext","Client","initWithMiddleware","authProvider","auth","createWriteStream","encoding","stringify","header","quoted","quote","escape","write","Date","now","Math","executeOutlookQuery","undefined","pageToken","includeBody","limit","m","to","Array","isArray","toRecipients","map","r","emailAddress","address","filter","Boolean","join","cc","ccRecipients","bcc","bccRecipients","fromAddr","from","categories","body","content","isHtml","toLowerCase","extractCurrentMessageFromHtml","extractCurrentMessageFromHtmlToText","id","String","threadId","conversationId","subject","date","receivedDateTime","snippet","bodyPreview","provider","labels","items","item","length","metadata","batchSize","hasMore","Promise","resolve","reject","end","on","getFileUri","endpoint","text","JSON","structuredContent","unlink","debug","Error","ProtocolError","ProtocolErrorCode","InternalError","stack","name"],"mappings":"AAAA,oGAAoG;;;;+BA+QpG;;;eAAwBA;;;qBA7Q+G;8BAE/G;sBAIwF;oCACzF;oBAEG;kBACQ;wBACX;mBACL;8BACkC;oCACoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVxE,IAAM,AAAEC,2BAA6BC,uBAAO,CAApCD;AAaR,IAAME,oBAAoB;AAC1B,IAAMC,oBAAoB;AAC1B,IAAMC,mBAAmB;AAEzB,IAAMC,qBAAqBC,MAAC,CAACC,MAAM,CAAC;IAClCC,KAAKF,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IACzBC,UAAUL,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IAC9BE,UAAUN,MAAC,CAACO,MAAM,GAAGH,QAAQ,CAAC;IAC9BI,WAAWR,MAAC,CAACS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],"sourcesContent":["export * from './outlook-query-schema.ts';\nexport * from './outlook-validation.ts';\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/schemas/index.ts"],"sourcesContent":["export * from './outlook-query-schema.ts';\nexport * from './outlook-validation.ts';\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/schemas/outlook-query-schema.ts"],"sourcesContent":["import { type BaseEmailQueryFields, baseEmailQueryFields, type FieldOperator, FieldOperatorSchema } from '@mcp-z/email';\nimport { z } from 'zod';\n\n/**\n * Outlook system category values.\n * These are the built-in category types that Outlook recognizes.\n * Note: This is distinct from OutlookCategory (user-created category objects with id/displayName/color).\n */\nexport type OutlookSystemCategory = 'work' | 'personal' | 'family' | 'travel' | 'important' | 'urgent';\n\n/** Zod schema for validating OutlookSystemCategory values */\nexport const OutlookSystemCategorySchema = z.enum(['work', 'personal', 'family', 'travel', 'important', 'urgent']);\n\n/**\n * Outlook-specific query schema with recursive operators and Outlook features.\n *\n * Includes Microsoft Graph/Outlook-specific features:\n * - exactPhrase: Strict exact phrase matching via KQL $search parameter\n * - categories: Outlook system categories (work, personal, family, travel, important, urgent)\n * - label: User-created Outlook categories (case-sensitive, discovered via outlook-categories-list)\n * - importance: Message importance level (high, normal, low)\n * - kqlQuery: Escape hatch for advanced KQL (Keyword Query Language) syntax\n *\n * Plus all base fields from baseEmailQueryFields:\n * - Email addresses: from, to, cc, bcc (support string or field operators)\n * - Content: subject, body, text\n * - Flags: hasAttachment, isRead\n * - Date range: date { $gte, $lt }\n * - Logical operators: $and, $or, $not (recursive)\n *\n * Note: Cast through unknown to work around Zod's lazy schema type inference issue\n * with exactOptionalPropertyTypes. The runtime schema is correct; this cast ensures\n * TypeScript sees the strict OutlookQuery type everywhere the schema is used.\n */\nexport const OutlookQuerySchema = z.lazy(() =>\n z\n .object({\n // Logical operators for combining conditions (recursive)\n $and: z.array(OutlookQuerySchema).optional().describe('Array of conditions that must ALL match'),\n $or: z.array(OutlookQuerySchema).optional().describe('Array of conditions where ANY must match'),\n $not: OutlookQuerySchema.optional().describe('Nested condition that must NOT match'),\n\n // Spread base email query fields (from, to, subject, body, etc.)\n ...baseEmailQueryFields,\n\n // Outlook-specific features\n\n // Exact phrase matching - KQL strict search with double quotes\n exactPhrase: z.string().min(1).optional().describe('Exact phrase matching - words must appear together in exact order (strict matching). Outlook uses KQL.'),\n\n // Outlook system categories with field operator support\n categories: z\n .union([\n OutlookSystemCategorySchema,\n z\n .object({\n $any: z.array(OutlookSystemCategorySchema).optional(),\n $all: z.array(OutlookSystemCategorySchema).optional(),\n $none: z.array(OutlookSystemCategorySchema).optional(),\n })\n .strict(),\n ])\n .optional()\n .describe('Filter by Outlook system categories (work, personal, family, travel, important, urgent)'),\n\n // User-created categories\n label: z\n .union([z.string().min(1), FieldOperatorSchema])\n .optional()\n .describe('Filter by user-created categories (case-sensitive). Use outlook-categories-list to see available categories'),\n\n // Message importance level - Outlook-specific property\n importance: z.enum(['high', 'normal', 'low']).optional().describe('Filter by message importance level (high, normal, low)'),\n\n // Raw KQL query string - escape hatch for advanced syntax\n kqlQuery: z.string().min(1).optional().describe('Raw KQL (Keyword Query Language) syntax for advanced use cases. Bypasses schema validation - use sparingly.'),\n })\n .strict()\n) as unknown as z.ZodType<OutlookQuery>;\n\nconst OutlookQueryStringSchema = z\n .string()\n .min(1)\n .transform((value, ctx) => {\n try {\n return parseOutlookQueryString(value);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Invalid query input';\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message,\n });\n return z.NEVER;\n }\n });\n\nexport const OutlookQueryParameterSchema = z.union([OutlookQuerySchema, OutlookQueryStringSchema]) as z.ZodType<OutlookQuery | string>;\nexport type OutlookQueryParameter = z.infer<typeof OutlookQueryParameterSchema>;\n\nexport function parseOutlookQueryParameter(input: OutlookQuery | string | undefined): OutlookQuery | undefined {\n if (input === undefined) return undefined;\n if (typeof input === 'string') {\n return parseOutlookQueryString(input);\n }\n const validated = OutlookQuerySchema.safeParse(input);\n if (!validated.success) {\n throw new Error(`Invalid query JSON: ${validated.error.message}. Use {\"kqlQuery\":\"<query>\"} for KQL syntax.`);\n }\n return validated.data;\n}\n\nfunction parseOutlookQueryString(value: string): OutlookQuery {\n const raw = safeJsonParse(value, 'kqlQuery');\n const validated = OutlookQuerySchema.safeParse(raw);\n if (!validated.success) {\n throw new Error(`Invalid query JSON: ${validated.error.message}. Use {\"kqlQuery\":\"<query>\"} for KQL syntax.`);\n }\n return validated.data;\n}\n\nfunction safeJsonParse(value: string, rawField: 'kqlQuery'): unknown {\n try {\n return JSON.parse(value);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Invalid JSON';\n throw new Error(`Query must be valid JSON. ${message}. Wrap KQL syntax in {\"${rawField}\":\"<query>\"} if needed.`);\n }\n}\n\nexport type OutlookQuery = BaseEmailQueryFields & {\n $and?: OutlookQuery[];\n $or?: OutlookQuery[];\n $not?: OutlookQuery;\n exactPhrase?: string;\n categories?:\n | OutlookSystemCategory\n | {\n $any?: OutlookSystemCategory[];\n $all?: OutlookSystemCategory[];\n $none?: OutlookSystemCategory[];\n };\n label?: string | FieldOperator;\n importance?: 'high' | 'normal' | 'low';\n kqlQuery?: string;\n};\n"],"names":["OutlookQueryParameterSchema","OutlookQuerySchema","OutlookSystemCategorySchema","parseOutlookQueryParameter","z","enum","lazy","object","$and","array","optional","describe","$or","$not","baseEmailQueryFields","exactPhrase","string","min","categories","union","$any","$all","$none","strict","label","FieldOperatorSchema","importance","kqlQuery","OutlookQueryStringSchema","transform","value","ctx","parseOutlookQueryString","error","message","Error","addIssue","code","ZodIssueCode","custom","NEVER","input","undefined","validated","safeParse","success","data","raw","safeJsonParse","rawField","JSON","parse"],"mappings":";;;;;;;;;;;QAgGaA;eAAAA;;QA9DAC;e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AAK,CAACrB;IACpB,EAAE,OAAOG,OAAO;QACd,IAAMC,UAAUD,AAAK,YAALA,OAAiBE,SAAQF,MAAMC,OAAO,GAAG;QACzD,MAAM,IAAIC,MAAM,AAAC,6BAA6Dc,OAAjCf,SAAQ,2BAAkC,OAATe,UAAS;IACzF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/schemas/outlook-query-schema.ts"],"sourcesContent":["import { type BaseEmailQueryFields, baseEmailQueryFields, type FieldOperator, FieldOperatorSchema } from '@mcp-z/email';\nimport { z } from 'zod';\n\n/**\n * Outlook system category values.\n * These are the built-in category types that Outlook recognizes.\n * Note: This is distinct from OutlookCategory (user-created category objects with id/displayName/color).\n */\nexport type OutlookSystemCategory = 'work' | 'personal' | 'family' | 'travel' | 'important' | 'urgent';\n\n/** Zod schema for validating OutlookSystemCategory values */\nexport const OutlookSystemCategorySchema = z.enum(['work', 'personal', 'family', 'travel', 'important', 'urgent']);\n\n/**\n * Outlook-specific query schema with recursive operators and Outlook features.\n *\n * Includes Microsoft Graph/Outlook-specific features:\n * - exactPhrase: Strict exact phrase matching via KQL $search parameter\n * - categories: Outlook system categories (work, personal, family, travel, important, urgent)\n * - label: User-created Outlook categories (case-sensitive, discovered via outlook-categories-list)\n * - importance: Message importance level (high, normal, low)\n * - kqlQuery: Escape hatch for advanced KQL (Keyword Query Language) syntax\n *\n * Plus all base fields from baseEmailQueryFields:\n * - Email addresses: from, to, cc, bcc (support string or field operators)\n * - Content: subject, body, text\n * - Flags: hasAttachment, isRead\n * - Date range: date { $gte, $lt }\n * - Logical operators: $and, $or, $not (recursive)\n *\n * Note: Cast through unknown to work around Zod's lazy schema type inference issue\n * with exactOptionalPropertyTypes. The runtime schema is correct; this cast ensures\n * TypeScript sees the strict OutlookQuery type everywhere the schema is used.\n */\nexport const OutlookQuerySchema = z.lazy(() =>\n z\n .object({\n // Logical operators for combining conditions (recursive)\n $and: z.array(OutlookQuerySchema).optional().describe('Array of conditions that must ALL match'),\n $or: z.array(OutlookQuerySchema).optional().describe('Array of conditions where ANY must match'),\n $not: OutlookQuerySchema.optional().describe('Nested condition that must NOT match'),\n\n // Spread base email query fields (from, to, subject, body, etc.)\n ...baseEmailQueryFields,\n\n // Outlook-specific features\n\n // Exact phrase matching - KQL strict search with double quotes\n exactPhrase: z.string().min(1).optional().describe('Exact phrase matching - words must appear together in exact order (strict matching). Outlook uses KQL.'),\n\n // Outlook system categories with field operator support\n categories: z\n .union([\n OutlookSystemCategorySchema,\n z\n .object({\n $any: z.array(OutlookSystemCategorySchema).optional(),\n $all: z.array(OutlookSystemCategorySchema).optional(),\n $none: z.array(OutlookSystemCategorySchema).optional(),\n })\n .strict(),\n ])\n .optional()\n .describe('Filter by Outlook system categories (work, personal, family, travel, important, urgent)'),\n\n // User-created categories\n label: z\n .union([z.string().min(1), FieldOperatorSchema])\n .optional()\n .describe('Filter by user-created categories (case-sensitive). Use outlook-categories-list to see available categories'),\n\n // Message importance level - Outlook-specific property\n importance: z.enum(['high', 'normal', 'low']).optional().describe('Filter by message importance level (high, normal, low)'),\n\n // Raw KQL query string - escape hatch for advanced syntax\n kqlQuery: z.string().min(1).optional().describe('Raw KQL (Keyword Query Language) syntax for advanced use cases. Bypasses schema validation - use sparingly.'),\n })\n .strict()\n) as unknown as z.ZodType<OutlookQuery>;\n\nconst OutlookQueryStringSchema = z\n .string()\n .min(1)\n .transform((value, ctx) => {\n try {\n return parseOutlookQueryString(value);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Invalid query input';\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message,\n });\n return z.NEVER;\n }\n });\n\nexport const OutlookQueryParameterSchema = z.union([OutlookQuerySchema, OutlookQueryStringSchema]) as z.ZodType<OutlookQuery | string>;\nexport type OutlookQueryParameter = z.infer<typeof OutlookQueryParameterSchema>;\n\nexport function parseOutlookQueryParameter(input: OutlookQuery | string | undefined): OutlookQuery | undefined {\n if (input === undefined) return undefined;\n if (typeof input === 'string') {\n return parseOutlookQueryString(input);\n }\n const validated = OutlookQuerySchema.safeParse(input);\n if (!validated.success) {\n throw new Error(`Invalid query JSON: ${validated.error.message}. Use {\"kqlQuery\":\"<query>\"} for KQL syntax.`);\n }\n return validated.data;\n}\n\nfunction parseOutlookQueryString(value: string): OutlookQuery {\n const raw = safeJsonParse(value, 'kqlQuery');\n const validated = OutlookQuerySchema.safeParse(raw);\n if (!validated.success) {\n throw new Error(`Invalid query JSON: ${validated.error.message}. Use {\"kqlQuery\":\"<query>\"} for KQL syntax.`);\n }\n return validated.data;\n}\n\nfunction safeJsonParse(value: string, rawField: 'kqlQuery'): unknown {\n try {\n return JSON.parse(value);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Invalid JSON';\n throw new Error(`Query must be valid JSON. ${message}. Wrap KQL syntax in {\"${rawField}\":\"<query>\"} if needed.`);\n }\n}\n\nexport type OutlookQuery = BaseEmailQueryFields & {\n $and?: OutlookQuery[];\n $or?: OutlookQuery[];\n $not?: OutlookQuery;\n exactPhrase?: string;\n categories?:\n | OutlookSystemCategory\n | {\n $any?: OutlookSystemCategory[];\n $all?: OutlookSystemCategory[];\n $none?: OutlookSystemCategory[];\n };\n label?: string | FieldOperator;\n importance?: 'high' | 'normal' | 'low';\n kqlQuery?: string;\n};\n"],"names":["OutlookQueryParameterSchema","OutlookQuerySchema","OutlookSystemCategorySchema","parseOutlookQueryParameter","z","enum","lazy","object","$and","array","optional","describe","$or","$not","baseEmailQueryFields","exactPhrase","string","min","categories","union","$any","$all","$none","strict","label","FieldOperatorSchema","importance","kqlQuery","OutlookQueryStringSchema","transform","value","ctx","parseOutlookQueryString","error","message","Error","addIssue","code","ZodIssueCode","custom","NEVER","input","undefined","validated","safeParse","success","data","raw","safeJsonParse","rawField","JSON","parse"],"mappings":";;;;;;;;;;;QAgGaA;eAAAA;;QA9DAC;eAAAA;;QAvBAC;eAAAA;;QAwFGC;eAAAA;;;qBAnGyF;mBACvF;;;;;;;;;;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AAiBE,SAAQF,MAAMC,OAAO,GAAG;QACzD,MAAM,IAAIC,MAAM,AAAC,6BAA6Dc,OAAjCf,SAAQ,2BAAkC,OAATe,UAAS;IACzF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/schemas/outlook-validation.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Base schemas for common Microsoft types\nexport const EmailAddressSchema = z.object({\n name: z.string().optional().describe('Display name of the recipient'),\n address: z.string().email().describe('Email address'),\n});\n\nexport const RecipientSchema = z.object({\n emailAddress: EmailAddressSchema,\n});\n\n// Outlook Message schema based on Microsoft Graph API\nexport const OutlookMessageSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the message'),\n subject: z.string().optional().describe('Subject of the email message'),\n body: z\n .object({\n contentType: z.enum(['text', 'html']).optional().describe('Content type of the body'),\n content: z.string().optional().describe('Body content of the message'),\n })\n .optional(),\n bodyPreview: z.string().optional().describe('First 255 characters of the message body'),\n importance: z.enum(['low', 'normal', 'high']).optional().describe('Importance level of the message'),\n hasAttachments: z.boolean().optional().describe('Indicates whether the message has attachments'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n sender: RecipientSchema.optional().describe('Account used to send the message'),\n from: RecipientSchema.optional().describe('Sender of the message'),\n toRecipients: z.array(RecipientSchema).optional().describe('To recipients of the message'),\n ccRecipients: z.array(RecipientSchema).optional().describe('CC recipients of the message'),\n bccRecipients: z.array(RecipientSchema).optional().describe('BCC recipients of the message'),\n replyTo: z.array(RecipientSchema).optional().describe('Reply-to recipients'),\n conversationId: z.string().optional().describe('ID of the conversation the email belongs to'),\n conversationIndex: z.string().optional().describe('Index for conversation threading'),\n receivedDateTime: z.string().optional().describe('ISO datetime when message was received'),\n sentDateTime: z.string().optional().describe('ISO datetime when message was sent'),\n createdDateTime: z.string().optional().describe('ISO datetime when message was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when message was last modified'),\n changeKey: z.string().optional().describe('Version of the message'),\n categories: z.array(z.string()).optional().describe('Categories associated with the message'),\n isDeliveryReceiptRequested: z.boolean().optional().describe('Whether delivery receipt is requested'),\n isReadReceiptRequested: z.boolean().optional().describe('Whether read receipt is requested'),\n isRead: z.boolean().optional().describe('Whether the message has been read'),\n isDraft: z.boolean().optional().describe('Whether the message is a draft'),\n webLink: z.string().optional().describe('URL to open the message in Outlook on the web'),\n inferenceClassification: z.enum(['focused', 'other']).optional().describe('Classification for focused inbox'),\n flag: z\n .object({\n flagStatus: z.enum(['notFlagged', 'complete', 'flagged']).describe('Status of the flag'),\n startDateTime: z.string().optional().describe('Start date for the flag'),\n dueDateTime: z.string().optional().describe('Due date for the flag'),\n })\n .optional()\n .describe('Flag information for the message'),\n});\n\n// Outlook Folder schema\nexport const OutlookFolderSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the folder'),\n displayName: z.string().optional().describe('Display name of the folder'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n childFolderCount: z.number().optional().describe('Number of immediate child folders'),\n unreadItemCount: z.number().optional().describe('Number of unread items in the folder'),\n totalItemCount: z.number().optional().describe('Total number of items in the folder'),\n sizeInBytes: z.number().optional().describe('Size of the folder in bytes'),\n isHidden: z.boolean().optional().describe('Whether the folder is hidden'),\n wellKnownName: z\n .enum(['archive', 'clutter', 'conflicts', 'conversationhistory', 'deleteditems', 'drafts', 'inbox', 'junkemail', 'localfailures', 'msgfolderroot', 'outbox', 'recoverableitemsdeletions', 'scheduled', 'searchfolders', 'sentitems', 'serverfailures', 'syncissues'])\n .optional()\n .describe('Well-known folder name if applicable'),\n});\n\n// Outlook Attachment schema\nexport const OutlookAttachmentSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the attachment'),\n name: z.string().optional().describe('Name of the attachment'),\n contentType: z.string().optional().describe('MIME type of the attachment'),\n size: z.number().optional().describe('Size of the attachment in bytes'),\n isInline: z.boolean().optional().describe('Whether the attachment is inline'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when attachment was last modified'),\n contentId: z.string().optional().describe('Content ID for inline attachments'),\n contentLocation: z.string().optional().describe('Content location for inline attachments'),\n contentBytes: z.string().optional().describe('Base64-encoded content of the attachment'),\n});\n\n// OneDrive file schema (subset of Microsoft Graph DriveItem)\nexport const OneDriveFileSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the file'),\n name: z.string().optional().describe('Name of the file'),\n size: z.number().optional().describe('Size of the file in bytes'),\n createdDateTime: z.string().optional().describe('ISO datetime when file was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when file was last modified'),\n webUrl: z.string().optional().describe('URL to view the file in OneDrive'),\n downloadUrl: z.string().optional().describe('Direct download URL for the file'),\n parentReference: z\n .object({\n driveId: z.string().optional().describe('ID of the drive containing the file'),\n driveType: z.enum(['personal', 'business', 'documentLibrary']).optional().describe('Type of drive'),\n id: z.string().optional().describe('ID of the parent folder'),\n name: z.string().optional().describe('Name of the parent folder'),\n path: z.string().optional().describe('Path to the parent folder'),\n })\n .optional()\n .describe('Reference to the parent folder'),\n file: z\n .object({\n mimeType: z.string().optional().describe('MIME type of the file'),\n hashes: z\n .object({\n quickXorHash: z.string().optional().describe('QuickXorHash of the file'),\n sha1Hash: z.string().optional().describe('SHA1 hash of the file'),\n sha256Hash: z.string().optional().describe('SHA256 hash of the file'),\n })\n .optional()\n .describe('Hash values for the file'),\n })\n .optional()\n .describe('File-specific properties'),\n folder: z\n .object({\n childCount: z.number().optional().describe('Number of children in the folder'),\n })\n .optional()\n .describe('Folder-specific properties (present if item is a folder)'),\n shared: z\n .object({\n scope: z.enum(['anonymous', 'organization', 'users']).optional().describe('Scope of sharing'),\n owner: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Sharing information'),\n createdBy: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('User who created the file'),\n lastModifiedBy: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('User who last modified the file'),\n});\n\n// Microsoft Calendar Event schema\nexport const OutlookCalendarEventSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the event'),\n subject: z.string().optional().describe('Subject of the event'),\n body: z\n .object({\n contentType: z.enum(['text', 'html']).optional().describe('Content type of the body'),\n content: z.string().optional().describe('Body content of the event'),\n })\n .optional(),\n start: z\n .object({\n dateTime: z.string().describe('Start date and time in ISO format'),\n timeZone: z.string().optional().describe('Time zone for the start time'),\n })\n .optional()\n .describe('Start time of the event'),\n end: z\n .object({\n dateTime: z.string().describe('End date and time in ISO format'),\n timeZone: z.string().optional().describe('Time zone for the end time'),\n })\n .optional()\n .describe('End time of the event'),\n location: z\n .object({\n displayName: z.string().optional().describe('Display name of the location'),\n address: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional(),\n coordinates: z\n .object({\n latitude: z.number().optional(),\n longitude: z.number().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Location of the event'),\n attendees: z\n .array(\n z.object({\n type: z.enum(['required', 'optional', 'resource']).optional().describe('Type of attendee'),\n status: z\n .object({\n response: z.enum(['none', 'organizer', 'tentativelyAccepted', 'accepted', 'declined', 'notResponded']).optional(),\n time: z.string().optional().describe('Time when response was given'),\n })\n .optional(),\n emailAddress: EmailAddressSchema.optional(),\n })\n )\n .optional()\n .describe('Attendees of the event'),\n organizer: z\n .object({\n emailAddress: EmailAddressSchema.optional(),\n })\n .optional()\n .describe('Organizer of the event'),\n recurrence: z\n .object({\n pattern: z\n .object({\n type: z.enum(['daily', 'weekly', 'absoluteMonthly', 'relativeMonthly', 'absoluteYearly', 'relativeYearly']).describe('Recurrence pattern type'),\n interval: z.number().describe('Interval between occurrences'),\n month: z.number().optional().describe('Month for yearly recurrence'),\n dayOfMonth: z.number().optional().describe('Day of month for monthly recurrence'),\n daysOfWeek: z.array(z.enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'])).optional(),\n firstDayOfWeek: z.enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']).optional(),\n index: z.enum(['first', 'second', 'third', 'fourth', 'last']).optional(),\n })\n .describe('Recurrence pattern'),\n range: z\n .object({\n type: z.enum(['endDate', 'noEnd', 'numbered']).describe('Type of recurrence range'),\n startDate: z.string().describe('Start date for recurrence'),\n endDate: z.string().optional().describe('End date for recurrence'),\n numberOfOccurrences: z.number().optional().describe('Number of occurrences'),\n })\n .describe('Recurrence range'),\n })\n .optional()\n .describe('Recurrence pattern for the event'),\n isAllDay: z.boolean().optional().describe('Whether the event is an all-day event'),\n showAs: z.enum(['free', 'tentative', 'busy', 'oof', 'workingElsewhere', 'unknown']).optional().describe('Show as status'),\n sensitivity: z.enum(['normal', 'personal', 'private', 'confidential']).optional().describe('Sensitivity level'),\n importance: z.enum(['low', 'normal', 'high']).optional().describe('Importance level'),\n reminderMinutesBeforeStart: z.number().optional().describe('Minutes before start to show reminder'),\n isReminderOn: z.boolean().optional().describe('Whether reminder is enabled'),\n hasAttachments: z.boolean().optional().describe('Whether the event has attachments'),\n webLink: z.string().optional().describe('URL to open the event in Outlook on the web'),\n onlineMeetingUrl: z.string().optional().describe('URL for online meeting'),\n isOnlineMeeting: z.boolean().optional().describe('Whether the event is an online meeting'),\n onlineMeetingProvider: z.enum(['unknown', 'skypeForBusiness', 'skypeForConsumer', 'teamsForBusiness']).optional(),\n allowNewTimeProposals: z.boolean().optional().describe('Whether attendees can propose new times'),\n hideAttendees: z.boolean().optional().describe('Whether to hide attendee list'),\n responseRequested: z.boolean().optional().describe('Whether response is requested'),\n seriesMasterId: z.string().optional().describe('ID of recurring series master'),\n isCancelled: z.boolean().optional().describe('Whether the event is cancelled'),\n isDraft: z.boolean().optional().describe('Whether the event is a draft'),\n isOrganizer: z.boolean().optional().describe('Whether current user is the organizer'),\n createdDateTime: z.string().optional().describe('ISO datetime when event was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when event was last modified'),\n});\n\n// Outlook Category schema based on Microsoft Graph API\nexport const OutlookCategorySchema = z.object({\n id: z.string().describe('Unique identifier for the category'),\n displayName: z.string().describe('Display name of the category'),\n color: z\n .enum(['preset0', 'preset1', 'preset2', 'preset3', 'preset4', 'preset5', 'preset6', 'preset7', 'preset8', 'preset9', 'preset10', 'preset11', 'preset12', 'preset13', 'preset14', 'preset15', 'preset16', 'preset17', 'preset18', 'preset19', 'preset20', 'preset21', 'preset22', 'preset23', 'preset24'])\n .describe('Color preset for the category'),\n});\n\n// Microsoft Contact schema\nexport const OutlookContactSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the contact'),\n displayName: z.string().optional().describe('Display name of the contact'),\n givenName: z.string().optional().describe('First name'),\n surname: z.string().optional().describe('Last name'),\n middleName: z.string().optional().describe('Middle name'),\n nickName: z.string().optional().describe('Nickname'),\n title: z.string().optional().describe('Job title'),\n companyName: z.string().optional().describe('Company name'),\n department: z.string().optional().describe('Department'),\n officeLocation: z.string().optional().describe('Office location'),\n profession: z.string().optional().describe('Profession'),\n businessPhones: z.array(z.string()).optional().describe('Business phone numbers'),\n homePhones: z.array(z.string()).optional().describe('Home phone numbers'),\n mobilePhone: z.string().optional().describe('Mobile phone number'),\n emailAddresses: z\n .array(\n z.object({\n name: z.string().optional().describe('Name for the email address'),\n address: z.string().email().describe('Email address'),\n })\n )\n .optional()\n .describe('Email addresses'),\n homeAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Home address'),\n businessAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Business address'),\n otherAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Other address'),\n birthday: z.string().optional().describe('Birthday in ISO date format'),\n personalNotes: z.string().optional().describe('Personal notes about the contact'),\n categories: z.array(z.string()).optional().describe('Categories assigned to the contact'),\n createdDateTime: z.string().optional().describe('ISO datetime when contact was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when contact was last modified'),\n changeKey: z.string().optional().describe('Version of the contact'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n});\n\n// Export TypeScript types inferred from schemas\nexport type EmailAddress = z.infer<typeof EmailAddressSchema>;\nexport type Recipient = z.infer<typeof RecipientSchema>;\nexport type OutlookMessage = z.infer<typeof OutlookMessageSchema>;\nexport type OutlookFolder = z.infer<typeof OutlookFolderSchema>;\nexport type OutlookAttachment = z.infer<typeof OutlookAttachmentSchema>;\nexport type OneDriveFile = z.infer<typeof OneDriveFileSchema>;\nexport type OutlookCalendarEvent = z.infer<typeof OutlookCalendarEventSchema>;\nexport type OutlookContact = z.infer<typeof OutlookContactSchema>;\nexport type OutlookCategory = z.infer<typeof OutlookCategorySchema>;\n"],"names":["EmailAddressSchema","OneDriveFileSchema","OutlookAttachmentSchema","OutlookCalendarEventSchema","OutlookCategorySchema","OutlookContactSchema","OutlookFolderSchema","OutlookMessageSchema","RecipientSchema","z","object","name","string","optional","describe","address","email","emailAddress","id","subject","body","contentType","enum","content","bodyPreview","importance","hasAttachments","boolean","parentFolderId","sender","from","toRecipients","array","ccRecipients","bccRecipients","replyTo","conversationId","conversationIndex","receivedDateTime","sentDateTime","createdDateTime","lastModifiedDateTime","changeKey","categories","isDeliveryReceiptRequested","isReadReceiptRequested","isRead","isDraft","webLink","inferenceClassification","flag","flagStatus","startDateTime","dueDateTime","displayName","childFolderCount","number","unreadItemCount","totalItemCount","sizeInBytes","isHidden","wellKnownName","size","isInline","contentId","contentLocation","contentBytes","webUrl","downloadUrl","parentReference","driveId","driveType","path","file","mimeType","hashes","quickXorHash","sha1Hash","sha256Hash","folder","childCount","shared","scope","owner","user","createdBy","lastModifiedBy","start","dateTime","timeZone","end","location","street","city","state","countryOrRegion","postalCode","coordinates","latitude","longitude","attendees","type","status","response","time","organizer","recurrence","pattern","interval","month","dayOfMonth","daysOfWeek","firstDayOfWeek","index","range","startDate","endDate","numberOfOccurrences","isAllDay","showAs","sensitivity","reminderMinutesBeforeStart","isReminderOn","onlineMeetingUrl","isOnlineMeeting","onlineMeetingProvider","allowNewTimeProposals","hideAttendees","responseRequested","seriesMasterId","isCancelled","isOrganizer","color","givenName","surname","middleName","nickName","title","companyName","department","officeLocation","profession","businessPhones","homePhones","mobilePhone","emailAddresses","homeAddress","businessAddress","otherAddress","birthday","personalNotes"],"mappings":";;;;;;;;;;;QAGaA;eAAAA;;QAmFAC;eAAAA;;QAbAC;eAAAA;;QA4FAC;eAAAA;;QAgHAC;eAAAA;;QASAC;eAAAA;;QArOAC;eAAAA;;QA5CAC;eAAAA;;QALAC;eAAAA;;;mBARK;AAGX,IAAMR,qBAAqBS,MAAC,CAACC,MAAM,CAAC;IACzCC,MAAMF,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IACrCC,SAASN,MAAC,CAACG,MAAM,GAAGI,KAAK,GAAGF,QAAQ,CAAC;AACvC;AAEO,IAAMN,kBAAkBC,MAAC,CAACC,MAAM,CAAC;IACtCO,cAAcjB;AAChB;AAGO,IAAMO,uBAAuBE,MAAC,CAACC,MAAM,CAAC;IAC3CQ,IAAIT,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IACnCK,SAASV,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IACxCM,MAAMX,MAAC,CACJC,MAAM,CAAC;QACNW,aAAaZ,MAAC,CAACa,IAAI,CAAC;YAAC;YAAQ;SAAO,EAAET,QAAQ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ACpCmF,YAAYvF,MAAC,CAACG,MAAM,GAAGC,QAAQ;IACjC,GACCA,QAAQ,GACRC,QAAQ,CAAC;IACZuI,UAAU5I,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IACzCwI,eAAe7I,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IAC9C6B,YAAYlC,MAAC,CAACuB,KAAK,CAACvB,MAAC,CAACG,MAAM,IAAIC,QAAQ,GAAGC,QAAQ,CAAC;IACpD0B,iBAAiB/B,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IAChD2B,sBAAsBhC,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IACrD4B,WAAWjC,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;IAC1Cc,gBAAgBnB,MAAC,CAACG,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;AACjD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/schemas/outlook-validation.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Base schemas for common Microsoft types\nexport const EmailAddressSchema = z.object({\n name: z.string().optional().describe('Display name of the recipient'),\n address: z.string().email().describe('Email address'),\n});\n\nexport const RecipientSchema = z.object({\n emailAddress: EmailAddressSchema,\n});\n\n// Outlook Message schema based on Microsoft Graph API\nexport const OutlookMessageSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the message'),\n subject: z.string().optional().describe('Subject of the email message'),\n body: z\n .object({\n contentType: z.enum(['text', 'html']).optional().describe('Content type of the body'),\n content: z.string().optional().describe('Body content of the message'),\n })\n .optional(),\n bodyPreview: z.string().optional().describe('First 255 characters of the message body'),\n importance: z.enum(['low', 'normal', 'high']).optional().describe('Importance level of the message'),\n hasAttachments: z.boolean().optional().describe('Indicates whether the message has attachments'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n sender: RecipientSchema.optional().describe('Account used to send the message'),\n from: RecipientSchema.optional().describe('Sender of the message'),\n toRecipients: z.array(RecipientSchema).optional().describe('To recipients of the message'),\n ccRecipients: z.array(RecipientSchema).optional().describe('CC recipients of the message'),\n bccRecipients: z.array(RecipientSchema).optional().describe('BCC recipients of the message'),\n replyTo: z.array(RecipientSchema).optional().describe('Reply-to recipients'),\n conversationId: z.string().optional().describe('ID of the conversation the email belongs to'),\n conversationIndex: z.string().optional().describe('Index for conversation threading'),\n receivedDateTime: z.string().optional().describe('ISO datetime when message was received'),\n sentDateTime: z.string().optional().describe('ISO datetime when message was sent'),\n createdDateTime: z.string().optional().describe('ISO datetime when message was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when message was last modified'),\n changeKey: z.string().optional().describe('Version of the message'),\n categories: z.array(z.string()).optional().describe('Categories associated with the message'),\n isDeliveryReceiptRequested: z.boolean().optional().describe('Whether delivery receipt is requested'),\n isReadReceiptRequested: z.boolean().optional().describe('Whether read receipt is requested'),\n isRead: z.boolean().optional().describe('Whether the message has been read'),\n isDraft: z.boolean().optional().describe('Whether the message is a draft'),\n webLink: z.string().optional().describe('URL to open the message in Outlook on the web'),\n inferenceClassification: z.enum(['focused', 'other']).optional().describe('Classification for focused inbox'),\n flag: z\n .object({\n flagStatus: z.enum(['notFlagged', 'complete', 'flagged']).describe('Status of the flag'),\n startDateTime: z.string().optional().describe('Start date for the flag'),\n dueDateTime: z.string().optional().describe('Due date for the flag'),\n })\n .optional()\n .describe('Flag information for the message'),\n});\n\n// Outlook Folder schema\nexport const OutlookFolderSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the folder'),\n displayName: z.string().optional().describe('Display name of the folder'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n childFolderCount: z.number().optional().describe('Number of immediate child folders'),\n unreadItemCount: z.number().optional().describe('Number of unread items in the folder'),\n totalItemCount: z.number().optional().describe('Total number of items in the folder'),\n sizeInBytes: z.number().optional().describe('Size of the folder in bytes'),\n isHidden: z.boolean().optional().describe('Whether the folder is hidden'),\n wellKnownName: z\n .enum(['archive', 'clutter', 'conflicts', 'conversationhistory', 'deleteditems', 'drafts', 'inbox', 'junkemail', 'localfailures', 'msgfolderroot', 'outbox', 'recoverableitemsdeletions', 'scheduled', 'searchfolders', 'sentitems', 'serverfailures', 'syncissues'])\n .optional()\n .describe('Well-known folder name if applicable'),\n});\n\n// Outlook Attachment schema\nexport const OutlookAttachmentSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the attachment'),\n name: z.string().optional().describe('Name of the attachment'),\n contentType: z.string().optional().describe('MIME type of the attachment'),\n size: z.number().optional().describe('Size of the attachment in bytes'),\n isInline: z.boolean().optional().describe('Whether the attachment is inline'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when attachment was last modified'),\n contentId: z.string().optional().describe('Content ID for inline attachments'),\n contentLocation: z.string().optional().describe('Content location for inline attachments'),\n contentBytes: z.string().optional().describe('Base64-encoded content of the attachment'),\n});\n\n// OneDrive file schema (subset of Microsoft Graph DriveItem)\nexport const OneDriveFileSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the file'),\n name: z.string().optional().describe('Name of the file'),\n size: z.number().optional().describe('Size of the file in bytes'),\n createdDateTime: z.string().optional().describe('ISO datetime when file was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when file was last modified'),\n webUrl: z.string().optional().describe('URL to view the file in OneDrive'),\n downloadUrl: z.string().optional().describe('Direct download URL for the file'),\n parentReference: z\n .object({\n driveId: z.string().optional().describe('ID of the drive containing the file'),\n driveType: z.enum(['personal', 'business', 'documentLibrary']).optional().describe('Type of drive'),\n id: z.string().optional().describe('ID of the parent folder'),\n name: z.string().optional().describe('Name of the parent folder'),\n path: z.string().optional().describe('Path to the parent folder'),\n })\n .optional()\n .describe('Reference to the parent folder'),\n file: z\n .object({\n mimeType: z.string().optional().describe('MIME type of the file'),\n hashes: z\n .object({\n quickXorHash: z.string().optional().describe('QuickXorHash of the file'),\n sha1Hash: z.string().optional().describe('SHA1 hash of the file'),\n sha256Hash: z.string().optional().describe('SHA256 hash of the file'),\n })\n .optional()\n .describe('Hash values for the file'),\n })\n .optional()\n .describe('File-specific properties'),\n folder: z\n .object({\n childCount: z.number().optional().describe('Number of children in the folder'),\n })\n .optional()\n .describe('Folder-specific properties (present if item is a folder)'),\n shared: z\n .object({\n scope: z.enum(['anonymous', 'organization', 'users']).optional().describe('Scope of sharing'),\n owner: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Sharing information'),\n createdBy: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('User who created the file'),\n lastModifiedBy: z\n .object({\n user: z\n .object({\n displayName: z.string().optional(),\n id: z.string().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('User who last modified the file'),\n});\n\n// Microsoft Calendar Event schema\nexport const OutlookCalendarEventSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the event'),\n subject: z.string().optional().describe('Subject of the event'),\n body: z\n .object({\n contentType: z.enum(['text', 'html']).optional().describe('Content type of the body'),\n content: z.string().optional().describe('Body content of the event'),\n })\n .optional(),\n start: z\n .object({\n dateTime: z.string().describe('Start date and time in ISO format'),\n timeZone: z.string().optional().describe('Time zone for the start time'),\n })\n .optional()\n .describe('Start time of the event'),\n end: z\n .object({\n dateTime: z.string().describe('End date and time in ISO format'),\n timeZone: z.string().optional().describe('Time zone for the end time'),\n })\n .optional()\n .describe('End time of the event'),\n location: z\n .object({\n displayName: z.string().optional().describe('Display name of the location'),\n address: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional(),\n coordinates: z\n .object({\n latitude: z.number().optional(),\n longitude: z.number().optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Location of the event'),\n attendees: z\n .array(\n z.object({\n type: z.enum(['required', 'optional', 'resource']).optional().describe('Type of attendee'),\n status: z\n .object({\n response: z.enum(['none', 'organizer', 'tentativelyAccepted', 'accepted', 'declined', 'notResponded']).optional(),\n time: z.string().optional().describe('Time when response was given'),\n })\n .optional(),\n emailAddress: EmailAddressSchema.optional(),\n })\n )\n .optional()\n .describe('Attendees of the event'),\n organizer: z\n .object({\n emailAddress: EmailAddressSchema.optional(),\n })\n .optional()\n .describe('Organizer of the event'),\n recurrence: z\n .object({\n pattern: z\n .object({\n type: z.enum(['daily', 'weekly', 'absoluteMonthly', 'relativeMonthly', 'absoluteYearly', 'relativeYearly']).describe('Recurrence pattern type'),\n interval: z.number().describe('Interval between occurrences'),\n month: z.number().optional().describe('Month for yearly recurrence'),\n dayOfMonth: z.number().optional().describe('Day of month for monthly recurrence'),\n daysOfWeek: z.array(z.enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'])).optional(),\n firstDayOfWeek: z.enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']).optional(),\n index: z.enum(['first', 'second', 'third', 'fourth', 'last']).optional(),\n })\n .describe('Recurrence pattern'),\n range: z\n .object({\n type: z.enum(['endDate', 'noEnd', 'numbered']).describe('Type of recurrence range'),\n startDate: z.string().describe('Start date for recurrence'),\n endDate: z.string().optional().describe('End date for recurrence'),\n numberOfOccurrences: z.number().optional().describe('Number of occurrences'),\n })\n .describe('Recurrence range'),\n })\n .optional()\n .describe('Recurrence pattern for the event'),\n isAllDay: z.boolean().optional().describe('Whether the event is an all-day event'),\n showAs: z.enum(['free', 'tentative', 'busy', 'oof', 'workingElsewhere', 'unknown']).optional().describe('Show as status'),\n sensitivity: z.enum(['normal', 'personal', 'private', 'confidential']).optional().describe('Sensitivity level'),\n importance: z.enum(['low', 'normal', 'high']).optional().describe('Importance level'),\n reminderMinutesBeforeStart: z.number().optional().describe('Minutes before start to show reminder'),\n isReminderOn: z.boolean().optional().describe('Whether reminder is enabled'),\n hasAttachments: z.boolean().optional().describe('Whether the event has attachments'),\n webLink: z.string().optional().describe('URL to open the event in Outlook on the web'),\n onlineMeetingUrl: z.string().optional().describe('URL for online meeting'),\n isOnlineMeeting: z.boolean().optional().describe('Whether the event is an online meeting'),\n onlineMeetingProvider: z.enum(['unknown', 'skypeForBusiness', 'skypeForConsumer', 'teamsForBusiness']).optional(),\n allowNewTimeProposals: z.boolean().optional().describe('Whether attendees can propose new times'),\n hideAttendees: z.boolean().optional().describe('Whether to hide attendee list'),\n responseRequested: z.boolean().optional().describe('Whether response is requested'),\n seriesMasterId: z.string().optional().describe('ID of recurring series master'),\n isCancelled: z.boolean().optional().describe('Whether the event is cancelled'),\n isDraft: z.boolean().optional().describe('Whether the event is a draft'),\n isOrganizer: z.boolean().optional().describe('Whether current user is the organizer'),\n createdDateTime: z.string().optional().describe('ISO datetime when event was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when event was last modified'),\n});\n\n// Outlook Category schema based on Microsoft Graph API\nexport const OutlookCategorySchema = z.object({\n id: z.string().describe('Unique identifier for the category'),\n displayName: z.string().describe('Display name of the category'),\n color: z\n .enum(['preset0', 'preset1', 'preset2', 'preset3', 'preset4', 'preset5', 'preset6', 'preset7', 'preset8', 'preset9', 'preset10', 'preset11', 'preset12', 'preset13', 'preset14', 'preset15', 'preset16', 'preset17', 'preset18', 'preset19', 'preset20', 'preset21', 'preset22', 'preset23', 'preset24'])\n .describe('Color preset for the category'),\n});\n\n// Microsoft Contact schema\nexport const OutlookContactSchema = z.object({\n id: z.string().optional().describe('Unique identifier for the contact'),\n displayName: z.string().optional().describe('Display name of the contact'),\n givenName: z.string().optional().describe('First name'),\n surname: z.string().optional().describe('Last name'),\n middleName: z.string().optional().describe('Middle name'),\n nickName: z.string().optional().describe('Nickname'),\n title: z.string().optional().describe('Job title'),\n companyName: z.string().optional().describe('Company name'),\n department: z.string().optional().describe('Department'),\n officeLocation: z.string().optional().describe('Office location'),\n profession: z.string().optional().describe('Profession'),\n businessPhones: z.array(z.string()).optional().describe('Business phone numbers'),\n homePhones: z.array(z.string()).optional().describe('Home phone numbers'),\n mobilePhone: z.string().optional().describe('Mobile phone number'),\n emailAddresses: z\n .array(\n z.object({\n name: z.string().optional().describe('Name for the email address'),\n address: z.string().email().describe('Email address'),\n })\n )\n .optional()\n .describe('Email addresses'),\n homeAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Home address'),\n businessAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Business address'),\n otherAddress: z\n .object({\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n countryOrRegion: z.string().optional(),\n postalCode: z.string().optional(),\n })\n .optional()\n .describe('Other address'),\n birthday: z.string().optional().describe('Birthday in ISO date format'),\n personalNotes: z.string().optional().describe('Personal notes about the contact'),\n categories: z.array(z.string()).optional().describe('Categories assigned to the contact'),\n createdDateTime: z.string().optional().describe('ISO datetime when contact was created'),\n lastModifiedDateTime: z.string().optional().describe('ISO datetime when contact was last modified'),\n changeKey: z.string().optional().describe('Version of the contact'),\n parentFolderId: z.string().optional().describe('ID of the parent folder'),\n});\n\n// Export TypeScript types inferred from schemas\nexport type EmailAddress = z.infer<typeof EmailAddressSchema>;\nexport type Recipient = z.infer<typeof RecipientSchema>;\nexport type OutlookMessage = z.infer<typeof OutlookMessageSchema>;\nexport type OutlookFolder = z.infer<typeof OutlookFolderSchema>;\nexport type OutlookAttachment = z.infer<typeof OutlookAttachmentSchema>;\nexport type OneDriveFile = z.infer<typeof OneDriveFileSchema>;\nexport type OutlookCalendarEvent = z.infer<typeof OutlookCalendarEventSchema>;\nexport type OutlookContact = z.infer<typeof OutlookContactSchema>;\nexport type OutlookCategory = z.infer<typeof OutlookCategorySchema>;\n"],"names":["EmailAddressSchema","OneDriveFileSchema","OutlookAttachmentSchema","OutlookCalendarEventSchema","OutlookCategorySchema","OutlookContactSchema","OutlookFolderSchema","OutlookMessageSchema","RecipientSchema","z","object","name","string","optional","describe","address","email","emailAddress","id","subject","body","contentType","enum","content","bodyPreview","importance","hasAttachments","boolean","parentFolderId","sender","from","toRecipients","array","ccRecipients","bccRecipients","replyTo","conversationId","conversationIndex","receivedDateTime","sentDateTime","createdDateTime","lastModifiedDateTime","changeKey","categories","isDeliveryReceiptRequested","isReadReceiptRequested","isRead","isDraft","webLink","inferenceClassification","flag","flagStatus","startDateTime","dueDateTime","displayName","childFolderCount","number","unreadItemCount","totalItemCount","sizeInBytes","isHidden","wellKnownName","size","isInline","contentId","contentLocation","contentBytes","webUrl","downloadUrl","parentReference","driveId","driveType","path","file","mimeType","hashes","quickXorHash","sha1Hash","sha256Hash","folder","childCount","shared","scope","owner","user","createdBy","lastModifiedBy","start","dateTime","timeZone","end","location","street","city","state","countryOrRegion","postalCode","coordinates","latitude","longitude","attendees","type","status","response","time","organizer","recurrence","pattern","interval","month","dayOfMonth","daysOfWeek","firstDayOfWeek","index","range","startDate","endDate","numberOfOccurrences","isAllDay","showAs","sensitivity","reminderMinutesBeforeStart","isReminderOn","onlineMeetingUrl","isOnlineMeeting","onlineMeetingProvider","allowNewTimeProposals","hideAttendees","responseRequested","seriesMasterId","isCancelled","isOrganizer","color","givenName","surname","middleName","nickName","title","companyName","department","officeLocation","profession","businessPhones","homePhones","mobilePhone","emailAddresses","homeAddress","businessAddress","otherAddress","birthday","personalNotes"],"mappings":";;;;;;;;;;;QAGaA;eAAAA;;QAmFAC;eAAAA;;QAbAC;eAAAA;;QA4FAC;eAAAA;;QAgHAC;eAAAA;;QASAC;eAAAA;;QArOAC;eAAAA;;QA5CAC;eAAAA;;QALAC;eAAAA;;;mBARK;AAGX,IAAMR,qBAAqBS,MAAC,CAACC,MAAM,CAAC;IACzCC,MAAMF,MAAC,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OAuthMicrosoft from '@mcp-z/oauth-microsoft';\nimport type * as McpServer from '@mcp-z/server';\nimport { Module } from 'module';\nimport { homedir } from 'os';\nimport * as path from 'path';\nimport { parseArgs } from 'util';\nimport { MS_SCOPE } from '../constants.ts';\nimport type { ServerConfig } from '../types.ts';\nimport { readPkg } from './version-help.ts';\n\nconst pkg = readPkg();\n\n// @mcp-z/oauth-microsoft and @mcp-z/server are requireable at the >=20 floor; deferred so\n// --version/--help (handled via version-help.ts, never this file) load neither package.\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Parse Outlook server configuration from CLI arguments and environment.\n *\n * CLI Arguments (all optional):\n * - --auth=<mode> Authentication mode (default: loopback-oauth)\n * Modes: loopback-oauth, device-code, dcr\n * - --headless Disable browser auto-open, return auth URL instead\n * - --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n * - --tenant-id=<id> Microsoft tenant ID (overrides MS_TENANT_ID env var)\n * - --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n * - --dcr-verify-url=<url> External verification endpoint (required for external mode)\n * - --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n * - --port=<port> Enable HTTP transport on specified port\n * - --stdio Enable stdio transport (default if no port)\n * - --log-level=<level> Logging level (default: info)\n * - --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-outlook/files)\n * - --base-url=<url> Base URL for HTTP file serving (default: http://localhost for HTTP transports)\n *\n * Environment Variables:\n * - MS_CLIENT_ID OAuth client ID (REQUIRED)\n * - MS_TENANT_ID Microsoft tenant ID (REQUIRED)\n * - MS_CLIENT_SECRET OAuth client secret (optional)\n * - AUTH_MODE Default authentication mode (optional)\n * - HEADLESS Disable browser auto-open (optional)\n * - DCR_MODE DCR mode (optional, same format as --dcr-mode)\n * - DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n * - DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n * - TOKEN_STORE_URI Token storage URI (optional)\n * - PORT Default HTTP port (optional)\n * - LOG_LEVEL Default logging level (optional)\n * - RESOURCE_STORE_URI Resource store URI (optional, file://)\n * - BASE_URL Base URL for HTTP file serving (optional)\n *\n * OAuth Scopes (from constants.ts):\n * openid profile offline_access https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.ReadWrite https://graph.microsoft.com/Mail.Send https://graph.microsoft.com/MailboxSettings.ReadWrite\n */\nexport function parseConfig(args: string[], env: Record<string, string | undefined>): ServerConfig {\n const oauthMicrosoft = _require('@mcp-z/oauth-microsoft') as typeof OAuthMicrosoft;\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n\n const transportConfig = mcpServer.parseConfig(args, env);\n const oauthConfig = oauthMicrosoft.parseConfig(args, env);\n\n // Parse DCR configuration if DCR mode is enabled\n const dcrConfig = oauthConfig.auth === 'dcr' ? oauthMicrosoft.parseDcrConfig(args, env, MS_SCOPE) : undefined;\n\n // Parse application-level config (LOG_LEVEL, RESOURCE_STORE_URI, BASE_URL)\n const { values } = parseArgs({\n args,\n options: {\n 'log-level': { type: 'string' },\n 'base-url': { type: 'string' },\n 'resource-store-uri': { type: 'string' },\n },\n strict: false, // Allow other arguments\n allowPositionals: true,\n });\n\n const name = pkg.name.replace(/^@[^/]+\\//, '');\n // Parse repository URL from package.json, stripping git+ prefix and .git suffix\n const rawRepoUrl = typeof pkg.repository === 'object' ? pkg.repository.url : pkg.repository;\n const repositoryUrl = rawRepoUrl?.replace(/^git\\+/, '').replace(/\\.git$/, '') ?? `https://github.com/mcp-z/${name}`;\n let rootDir = homedir();\n try {\n const configPath = mcpServer.findConfigPath({ config: '.mcp.json', cwd: process.cwd(), stopDir: homedir() });\n rootDir = path.dirname(configPath);\n } catch {\n rootDir = homedir();\n }\n const baseDir = path.join(rootDir, '.mcp-z');\n const cliLogLevel = typeof values['log-level'] === 'string' ? values['log-level'] : undefined;\n const envLogLevel = env.LOG_LEVEL;\n const logLevel = cliLogLevel ?? envLogLevel ?? 'info';\n\n // Parse file storage configuration\n const cliResourceStoreUri = typeof values['resource-store-uri'] === 'string' ? values['resource-store-uri'] : undefined;\n const envResourceStoreUri = env.RESOURCE_STORE_URI;\n const defaultResourceStorePath = path.join(baseDir, name, 'files');\n const resourceStoreUri = normalizeResourceStoreUri(cliResourceStoreUri ?? envResourceStoreUri ?? defaultResourceStorePath);\n\n const cliBaseUrl = typeof values['base-url'] === 'string' ? values['base-url'] : undefined;\n const envBaseUrl = env.BASE_URL;\n const baseUrl = cliBaseUrl ?? envBaseUrl;\n\n // Combine configs\n const result: ServerConfig = {\n ...oauthConfig, // Includes clientId, auth, headless, redirectUri\n transport: transportConfig.transport,\n logLevel,\n baseDir,\n name,\n version: pkg.version,\n repositoryUrl,\n resourceStoreUri,\n };\n if (baseUrl !== undefined) result.baseUrl = baseUrl;\n if (dcrConfig !== undefined) result.dcrConfig = dcrConfig;\n return result;\n}\n\n/**\n * Build production configuration from process globals.\n * Entry point for production server.\n */\nexport function createConfig(): ServerConfig {\n return parseConfig(process.argv, process.env);\n}\n\nfunction normalizeResourceStoreUri(resourceStoreUri: string): string {\n const filePrefix = 'file://';\n if (resourceStoreUri.startsWith(filePrefix)) {\n const rawPath = resourceStoreUri.slice(filePrefix.length);\n const filePath = rawPath.startsWith('~') ? rawPath.replace(/^~/, homedir()) : rawPath.startsWith('/') ? fileURLToPath(resourceStoreUri) : rawPath;\n return pathToFileURL(path.resolve(filePath)).href;\n }\n\n if (resourceStoreUri.includes('://')) return resourceStoreUri;\n\n const expandedPath = resourceStoreUri.startsWith('~') ? resourceStoreUri.replace(/^~/, homedir()) : resourceStoreUri;\n return pathToFileURL(path.resolve(expandedPath)).href;\n}\n"],"names":["createConfig","parseConfig","pkg","readPkg","_require","require","Module","createRequire","args","env","cliLogLevel","cliResourceStoreUri","oauthMicrosoft","mcpServer","transportConfig","oauthConfig","dcrConfig","auth","parseDcrConfig","MS_SCOPE","undefined","values","parseArgs","options","type","strict","allowPositionals","name","replace","rawRepoUrl","repository","url","repositoryUrl","rootDir","homedir","configPath","findConfigPath","config","cwd","process","stopDir","path","dirname","baseDir","join","envLogLevel","LOG_LEVEL","logLevel","envResourceStoreUri","RESOURCE_STORE_URI","defaultResourceStorePath","resourceStoreUri","normalizeResourceStoreUri","cliBaseUrl","envBaseUrl","BASE_URL","baseUrl","result","transport","version","argv","filePrefix","startsWith","rawPath","slice","length","filePath","fileURLToPath","pathToFileURL","resolve","href","includes","expandedPath"],"mappings":";;;;;;;;;;;QAyHgBA;eAAAA;;QApEAC;eAAAA;;;uBArD6B;sBAGtB;kBACC;4DACF;oBACI;2BACD;6BAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,IAAMC,MAAMC,IAAAA,sBAAO;AAEnB,0FAA0F;AAC1F,wFAAwF;AACxF,IAAMC,WAAW,OAAOC,YAAY,cAAcC,cAAM,CAACC,aAAa,CAAC,uDAAmBF;AAsCnF,SAASJ,YAAYO,IAAc,EAAEC,GAAuC;cAoChEC,OAMkCC;IAzCnD,IAAMC,iBAAiBR,SAAS;IAChC,IAAMS,YAAYT,SAAS;IAE3B,IAAMU,kBAAkBD,UAAUZ,WAAW,CAACO,MAAMC;IACpD,IAAMM,cAAcH,eAAeX,WAAW,CAACO,MAAMC;IAErD,iDAAiD;IACjD,IAAMO,YAAYD,YAAYE,IAAI,KAAK,QAAQL,eAAeM,cAAc,CAACV,MAAMC,KAAKU,qBAAQ,IAAIC;IAEpG,2EAA2E;IAC3E,IAAM,AAAEC,SAAWC,IAAAA,eAAS,EAAC;QAC3Bd,MAAAA;QACAe,SAAS;YACP,aAAa;gBAAEC,MAAM;YAAS;YAC9B,YAAY;gBAAEA,MAAM;YAAS;YAC7B,sBAAsB;gBAAEA,MAAM;YAAS;QACzC;QACAC,QAAQ;QACRC,kBAAkB;IACpB,GATQL;IAWR,IAAMM,OAAOzB,IAAIy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AAcC;IAE9B,kBAAkB;IAClB,IAAMG,SAAuB,wCACxB1C;QACH2C,WAAW5C,gBAAgB4C,SAAS;QACpCX,UAAAA;QACAJ,SAAAA;QACAhB,MAAAA;QACAgC,SAASzD,IAAIyD,OAAO;QACpB3B,eAAAA;QACAmB,kBAAAA;;IAEF,IAAIK,YAAYpC,WAAWqC,OAAOD,OAAO,GAAGA;IAC5C,IAAIxC,cAAcI,WAAWqC,OAAOzC,SAAS,GAAGA;IAChD,OAAOyC;AACT;AAMO,SAASzD;IACd,OAAOC,YAAYsC,QAAQqB,IAAI,EAAErB,QAAQ9B,GAAG;AAC9C;AAEA,SAAS2C,0BAA0BD,gBAAwB;IACzD,IAAMU,aAAa;IACnB,IAAIV,iBAAiBW,UAAU,CAACD,aAAa;QAC3C,IAAME,UAAUZ,iBAAiBa,KAAK,CAACH,WAAWI,MAAM;QACxD,IAAMC,WAAWH,QAAQD,UAAU,CAAC,OAAOC,QAAQnC,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAM6B,QAAQD,UAAU,CAAC,OAAOK,IAAAA,sBAAa,EAAChB,oBAAoBY;QAC1I,OAAOK,IAAAA,sBAAa,EAAC3B,MAAK4B,OAAO,CAACH,WAAWI,IAAI;IACnD;IAEA,IAAInB,iBAAiBoB,QAAQ,CAAC,QAAQ,OAAOpB;IAE7C,IAAMqB,eAAerB,iBAAiBW,UAAU,CAAC,OAAOX,iBAAiBvB,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAMiB;IACpG,OAAOiB,IAAAA,sBAAa,EAAC3B,MAAK4B,OAAO,CAACG,eAAeF,IAAI;AACvD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/setup/config.ts"],"sourcesContent":["import { fileURLToPath, pathToFileURL } from 'node:url';\nimport type * as OAuthMicrosoft from '@mcp-z/oauth-microsoft';\nimport type * as McpServer from '@mcp-z/server';\nimport { Module } from 'module';\nimport { homedir } from 'os';\nimport * as path from 'path';\nimport { parseArgs } from 'util';\nimport { MS_SCOPE } from '../constants.ts';\nimport type { ServerConfig } from '../types.ts';\nimport { readPkg } from './version-help.ts';\n\nconst pkg = readPkg();\n\n// @mcp-z/oauth-microsoft and @mcp-z/server are requireable at the >=20 floor; deferred so\n// --version/--help (handled via version-help.ts, never this file) load neither package.\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Parse Outlook server configuration from CLI arguments and environment.\n *\n * CLI Arguments (all optional):\n * - --auth=<mode> Authentication mode (default: loopback-oauth)\n * Modes: loopback-oauth, device-code, dcr\n * - --headless Disable browser auto-open, return auth URL instead\n * - --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n * - --tenant-id=<id> Microsoft tenant ID (overrides MS_TENANT_ID env var)\n * - --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n * - --dcr-verify-url=<url> External verification endpoint (required for external mode)\n * - --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n * - --port=<port> Enable HTTP transport on specified port\n * - --stdio Enable stdio transport (default if no port)\n * - --log-level=<level> Logging level (default: info)\n * - --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-outlook/files)\n * - --base-url=<url> Base URL for HTTP file serving (default: http://localhost for HTTP transports)\n *\n * Environment Variables:\n * - MS_CLIENT_ID OAuth client ID (REQUIRED)\n * - MS_TENANT_ID Microsoft tenant ID (REQUIRED)\n * - MS_CLIENT_SECRET OAuth client secret (optional)\n * - AUTH_MODE Default authentication mode (optional)\n * - HEADLESS Disable browser auto-open (optional)\n * - DCR_MODE DCR mode (optional, same format as --dcr-mode)\n * - DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n * - DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n * - TOKEN_STORE_URI Token storage URI (optional)\n * - PORT Default HTTP port (optional)\n * - LOG_LEVEL Default logging level (optional)\n * - RESOURCE_STORE_URI Resource store URI (optional, file://)\n * - BASE_URL Base URL for HTTP file serving (optional)\n *\n * OAuth Scopes (from constants.ts):\n * openid profile offline_access https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.ReadWrite https://graph.microsoft.com/Mail.Send https://graph.microsoft.com/MailboxSettings.ReadWrite\n */\nexport function parseConfig(args: string[], env: Record<string, string | undefined>): ServerConfig {\n const oauthMicrosoft = _require('@mcp-z/oauth-microsoft') as typeof OAuthMicrosoft;\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n\n const transportConfig = mcpServer.parseConfig(args, env);\n const oauthConfig = oauthMicrosoft.parseConfig(args, env);\n\n // Parse DCR configuration if DCR mode is enabled\n const dcrConfig = oauthConfig.auth === 'dcr' ? oauthMicrosoft.parseDcrConfig(args, env, MS_SCOPE) : undefined;\n\n // Parse application-level config (LOG_LEVEL, RESOURCE_STORE_URI, BASE_URL)\n const { values } = parseArgs({\n args,\n options: {\n 'log-level': { type: 'string' },\n 'base-url': { type: 'string' },\n 'resource-store-uri': { type: 'string' },\n },\n strict: false, // Allow other arguments\n allowPositionals: true,\n });\n\n const name = pkg.name.replace(/^@[^/]+\\//, '');\n // Parse repository URL from package.json, stripping git+ prefix and .git suffix\n const rawRepoUrl = typeof pkg.repository === 'object' ? pkg.repository.url : pkg.repository;\n const repositoryUrl = rawRepoUrl?.replace(/^git\\+/, '').replace(/\\.git$/, '') ?? `https://github.com/mcp-z/${name}`;\n let rootDir = homedir();\n try {\n const configPath = mcpServer.findConfigPath({ config: '.mcp.json', cwd: process.cwd(), stopDir: homedir() });\n rootDir = path.dirname(configPath);\n } catch {\n rootDir = homedir();\n }\n const baseDir = path.join(rootDir, '.mcp-z');\n const cliLogLevel = typeof values['log-level'] === 'string' ? values['log-level'] : undefined;\n const envLogLevel = env.LOG_LEVEL;\n const logLevel = cliLogLevel ?? envLogLevel ?? 'info';\n\n // Parse file storage configuration\n const cliResourceStoreUri = typeof values['resource-store-uri'] === 'string' ? values['resource-store-uri'] : undefined;\n const envResourceStoreUri = env.RESOURCE_STORE_URI;\n const defaultResourceStorePath = path.join(baseDir, name, 'files');\n const resourceStoreUri = normalizeResourceStoreUri(cliResourceStoreUri ?? envResourceStoreUri ?? defaultResourceStorePath);\n\n const cliBaseUrl = typeof values['base-url'] === 'string' ? values['base-url'] : undefined;\n const envBaseUrl = env.BASE_URL;\n const baseUrl = cliBaseUrl ?? envBaseUrl;\n\n // Combine configs\n const result: ServerConfig = {\n ...oauthConfig, // Includes clientId, auth, headless, redirectUri\n transport: transportConfig.transport,\n logLevel,\n baseDir,\n name,\n version: pkg.version,\n repositoryUrl,\n resourceStoreUri,\n };\n if (baseUrl !== undefined) result.baseUrl = baseUrl;\n if (dcrConfig !== undefined) result.dcrConfig = dcrConfig;\n return result;\n}\n\n/**\n * Build production configuration from process globals.\n * Entry point for production server.\n */\nexport function createConfig(): ServerConfig {\n return parseConfig(process.argv, process.env);\n}\n\nfunction normalizeResourceStoreUri(resourceStoreUri: string): string {\n const filePrefix = 'file://';\n if (resourceStoreUri.startsWith(filePrefix)) {\n const rawPath = resourceStoreUri.slice(filePrefix.length);\n const filePath = rawPath.startsWith('~') ? rawPath.replace(/^~/, homedir()) : rawPath.startsWith('/') ? fileURLToPath(resourceStoreUri) : rawPath;\n return pathToFileURL(path.resolve(filePath)).href;\n }\n\n if (resourceStoreUri.includes('://')) return resourceStoreUri;\n\n const expandedPath = resourceStoreUri.startsWith('~') ? resourceStoreUri.replace(/^~/, homedir()) : resourceStoreUri;\n return pathToFileURL(path.resolve(expandedPath)).href;\n}\n"],"names":["createConfig","parseConfig","pkg","readPkg","_require","require","Module","createRequire","args","env","cliLogLevel","cliResourceStoreUri","oauthMicrosoft","mcpServer","transportConfig","oauthConfig","dcrConfig","auth","parseDcrConfig","MS_SCOPE","undefined","values","parseArgs","options","type","strict","allowPositionals","name","replace","rawRepoUrl","repository","url","repositoryUrl","rootDir","homedir","configPath","findConfigPath","config","cwd","process","stopDir","path","dirname","baseDir","join","envLogLevel","LOG_LEVEL","logLevel","envResourceStoreUri","RESOURCE_STORE_URI","defaultResourceStorePath","resourceStoreUri","normalizeResourceStoreUri","cliBaseUrl","envBaseUrl","BASE_URL","baseUrl","result","transport","version","argv","filePrefix","startsWith","rawPath","slice","length","filePath","fileURLToPath","pathToFileURL","resolve","href","includes","expandedPath"],"mappings":";;;;;;;;;;;QAyHgBA;eAAAA;;QApEAC;eAAAA;;;uBArD6B;sBAGtB;kBACC;4DACF;oBACI;2BACD;6BAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,IAAMC,MAAMC,IAAAA,sBAAO;AAEnB,0FAA0F;AAC1F,wFAAwF;AACxF,IAAMC,WAAW,OAAOC,YAAY,cAAcC,cAAM,CAACC,aAAa,CAAC,uDAAmBF;AAsCnF,SAASJ,YAAYO,IAAc,EAAEC,GAAuC;cAoChEC,OAMkCC;IAzCnD,IAAMC,iBAAiBR,SAAS;IAChC,IAAMS,YAAYT,SAAS;IAE3B,IAAMU,kBAAkBD,UAAUZ,WAAW,CAACO,MAAMC;IACpD,IAAMM,cAAcH,eAAeX,WAAW,CAACO,MAAMC;IAErD,iDAAiD;IACjD,IAAMO,YAAYD,YAAYE,IAAI,KAAK,QAAQL,eAAeM,cAAc,CAACV,MAAMC,KAAKU,qBAAQ,IAAIC;IAEpG,2EAA2E;IAC3E,IAAM,AAAEC,SAAWC,IAAAA,eAAS,EAAC;QAC3Bd,MAAAA;QACAe,SAAS;YACP,aAAa;gBAAEC,MAAM;YAAS;YAC9B,YAAY;gBAAEA,MAAM;YAAS;YAC7B,sBAAsB;gBAAEA,MAAM;YAAS;QACzC;QACAC,QAAQ;QACRC,kBAAkB;IACpB,GATQL;IAWR,IAAMM,OAAOzB,IAAIyB,IAAI,CAACC,OAAO,CAAC,aAAa;IAC3C,gFAAgF;IAChF,IAAMC,aAAa,SAAO3B,IAAI4B,UAAU,MAAK,WAAW5B,I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SAAAA;QACAhB,MAAAA;QACAgC,SAASzD,IAAIyD,OAAO;QACpB3B,eAAAA;QACAmB,kBAAAA;;IAEF,IAAIK,YAAYpC,WAAWqC,OAAOD,OAAO,GAAGA;IAC5C,IAAIxC,cAAcI,WAAWqC,OAAOzC,SAAS,GAAGA;IAChD,OAAOyC;AACT;AAMO,SAASzD;IACd,OAAOC,YAAYsC,QAAQqB,IAAI,EAAErB,QAAQ9B,GAAG;AAC9C;AAEA,SAAS2C,0BAA0BD,gBAAwB;IACzD,IAAMU,aAAa;IACnB,IAAIV,iBAAiBW,UAAU,CAACD,aAAa;QAC3C,IAAME,UAAUZ,iBAAiBa,KAAK,CAACH,WAAWI,MAAM;QACxD,IAAMC,WAAWH,QAAQD,UAAU,CAAC,OAAOC,QAAQnC,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAM6B,QAAQD,UAAU,CAAC,OAAOK,IAAAA,sBAAa,EAAChB,oBAAoBY;QAC1I,OAAOK,IAAAA,sBAAa,EAAC3B,MAAK4B,OAAO,CAACH,WAAWI,IAAI;IACnD;IAEA,IAAInB,iBAAiBoB,QAAQ,CAAC,QAAQ,OAAOpB;IAE7C,IAAMqB,eAAerB,iBAAiBW,UAAU,CAAC,OAAOX,iBAAiBvB,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAMiB;IACpG,OAAOiB,IAAAA,sBAAa,EAAC3B,MAAK4B,OAAO,CAACG,eAAeF,IAAI;AACvD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/mcp-outlook/src/setup/http.ts"],"sourcesContent":["import { composeMiddleware, connectHttp, createFileServingRouter, defaultCacheHints, McpServer, registerPrompts, registerResources, registerTools } from '@mcp-z/server';\nimport cors from 'cors';\nimport express from 'express';\nimport type { RuntimeOverrides, ServerConfig } from '../types.ts';\nimport { createDefaultRuntime } from './runtime.ts';\n\nexport async function createHTTPServer(config: ServerConfig, overrides?: RuntimeOverrides) {\n const runtime = await createDefaultRuntime(config, overrides);\n const modules = runtime.createDomainModules();\n const layers = runtime.middlewareFactories.map((factory) => factory(runtime.deps));\n const composed = composeMiddleware(modules, layers);\n const logger = runtime.deps.logger;\n const port = config.transport.port;\n if (!port) throw new Error('Port is required for HTTP transport');\n\n const tools = [...composed.tools, ...runtime.deps.oauthAdapters.accountTools];\n const filteredTools =\n config.auth === 'dcr'\n ? tools.filter((tool) => tool.name !== 'messages-export-csv') // No file storage in DCR (public cloud responsibility)\n : tools;\n const prompts = [...composed.prompts, ...runtime.deps.oauthAdapters.accountPrompts];\n\n // Built per request (HTTP) and per connection (stdio), not shared. The SDK caches the\n // negotiated protocol revision on the McpServer instance - its own docs say a negotiated\n // session never re-routes a method onto the other era - so one shared instance pins itself\n // to whichever revision reaches it first and answers the other with -32601.\n const buildServer = () => {\n const mcpServer = new McpServer({ name: config.name, version: config.version }, { cacheHints: defaultCacheHints });\n registerTools(mcpServer, filteredTools);\n registerResources(mcpServer, composed.resources);\n registerPrompts(mcpServer, prompts);\n return mcpServer;\n };\n\n const app = express();\n app.use(express.json({ limit: '10mb' }));\n\n // Must mount '/mcp' before any permissive app-level cors(), or that layer answers its\n // preflight first; pass baseUrl's origin/host below or a public deployment 403s itself.\n const publicUrl = config.baseUrl ? new URL(config.baseUrl) : undefined;\n logger.info(`Starting ${config.name} MCP server (http)`);\n const { close, httpServer } = await connectHttp(buildServer, {\n logger,\n app,\n port,\n allowedOrigins: publicUrl ? [publicUrl.origin] : undefined,\n allowedHosts: publicUrl ? [publicUrl.host] : undefined,\n });\n\n // The loopback OAuth callback, the file-export download, and the DCR discovery/\n // registration endpoints are all meant to be reached from a browser on another\n // origin. Keep cors() for them, scoped to their own routes - never in front of '/mcp'.\n if (runtime.deps.oauthAdapters.loopbackRouter) {\n app.use('/', cors(), runtime.deps.oauthAdapters.loopbackRouter);\n logger.info('Mounted loopback OAuth callback router');\n }\n\n if (config.auth !== 'dcr') {\n const fileRouter = createFileServingRouter({ resourceStoreUri: config.resourceStoreUri }, { contentType: 'text/csv', contentDisposition: 'attachment' });\n app.use('/files', cors(), fileRouter);\n }\n\n if (runtime.deps.oauthAdapters.dcrRouter) {\n app.use('/', cors(), runtime.deps.oauthAdapters.dcrRouter);\n logger.info('Mounted DCR router with OAuth endpoints');\n }\n\n logger.info('http transport ready');\n\n return {\n httpServer,\n logger,\n close: async () => {\n await close();\n await runtime.close();\n },\n };\n}\n"],"names":["createHTTPServer","config","overrides","runtime","modules","layers","composed","logger","port","tools","filteredTools","prompts","buildServer","app","publicUrl","close","httpServer","fileRouter","createDefaultRuntime","createDomainModules","middlewareFactories","map","factory","deps","composeMiddleware","transport","Error","oauthAdapters","accountTools","auth","filter","tool","name","accountPrompts","mcpServer","McpServer","version","cacheHints","defaultCacheHints","registerTools","registerResources","resources","registerPrompts","express","use","json","limit","baseUrl","URL","undefined","info","connectHttp","allowedOrigins","origin","allowedHosts","host","loopbackRouter","cors","createFileServingRouter","resourceStoreUri","contentType","contentDisposition","dcrRouter"],"mappings":";;;;+BAMsBA;;;eAAAA;;;sBANmI;2DACxI;8DACG;yBAEiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,SAAeA,iBAAiBC,MAAoB,EAAEC,SAA4B;;YACjFC,SACAC,SACAC,QACAC,UACAC,QACAC,MAGAC,OACAC,eAIAC,SAMAC,aAQAC,KAKAC,WAEwB,MAAtBC,OAAOC,YAiBPC;;;;oBAnDQ;;wBAAMC,IAAAA,+BAAoB,EAACjB,QAAQC;;;oBAA7CC,UAAU;oBACVC,UAAUD,QAAQgB,mBAAmB;oBACrCd,SAASF,QAAQiB,mBAAmB,CAACC,GAAG,CAAC,SAACC;+BAAYA,QAAQnB,QAAQoB,IAAI;;oBAC1EjB,WAAW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A;4BACA4C,gBAAgBtC;gCAAaA,UAAUuC,MAAM;gCAAIJ;4BACjDK,cAAcxC;gCAAaA,UAAUyC,IAAI;gCAAIN;wBAC/C;;;oBAN8B,OAAA,eAAtBlC,QAAsB,KAAtBA,OAAOC,aAAe,KAAfA;oBAQf,gFAAgF;oBAChF,+EAA+E;oBAC/E,uFAAuF;oBACvF,IAAIb,QAAQoB,IAAI,CAACI,aAAa,CAAC6B,cAAc,EAAE;wBAC7C3C,IAAI+B,GAAG,CAAC,KAAKa,IAAAA,aAAI,KAAItD,QAAQoB,IAAI,CAACI,aAAa,CAAC6B,cAAc;wBAC9DjD,OAAO2C,IAAI,CAAC;oBACd;oBAEA,IAAIjD,OAAO4B,IAAI,KAAK,OAAO;wBACnBZ,aAAayC,IAAAA,+BAAuB,EAAC;4BAAEC,kBAAkB1D,OAAO0D,gBAAgB;wBAAC,GAAG;4BAAEC,aAAa;4BAAYC,oBAAoB;wBAAa;wBACtJhD,IAAI+B,GAAG,CAAC,UAAUa,IAAAA,aAAI,KAAIxC;oBAC5B;oBAEA,IAAId,QAAQoB,IAAI,CAACI,aAAa,CAACmC,SAAS,EAAE;wBACxCjD,IAAI+B,GAAG,CAAC,KAAKa,IAAAA,aAAI,KAAItD,QAAQoB,IAAI,CAACI,aAAa,CAACmC,SAAS;wBACzDvD,OAAO2C,IAAI,CAAC;oBACd;oBAEA3C,OAAO2C,IAAI,CAAC;oBAEZ;;wBAAO;4BACLlC,YAAAA;4BACAT,QAAAA;4BACAQ,OAAO,SAAPA;;;;;gDACE;;oDAAMA;;;gDAAN;gDACA;;oDAAMZ,QAAQY,KAAK;;;gDAAnB;;;;;;gCACF;;wBACF;;;;IACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/setup/http.ts"],"sourcesContent":["import { composeMiddleware, connectHttp, createFileServingRouter, defaultCacheHints, McpServer, registerPrompts, registerResources, registerTools } from '@mcp-z/server';\nimport cors from 'cors';\nimport express from 'express';\nimport type { RuntimeOverrides, ServerConfig } from '../types.ts';\nimport { createDefaultRuntime } from './runtime.ts';\n\nexport async function createHTTPServer(config: ServerConfig, overrides?: RuntimeOverrides) {\n const runtime = await createDefaultRuntime(config, overrides);\n const modules = runtime.createDomainModules();\n const layers = runtime.middlewareFactories.map((factory) => factory(runtime.deps));\n const composed = composeMiddleware(modules, layers);\n const logger = runtime.deps.logger;\n const port = config.transport.port;\n if (!port) throw new Error('Port is required for HTTP transport');\n\n const tools = [...composed.tools, ...runtime.deps.oauthAdapters.accountTools];\n const filteredTools =\n config.auth === 'dcr'\n ? tools.filter((tool) => tool.name !== 'messages-export-csv') // No file storage in DCR (public cloud responsibility)\n : tools;\n const prompts = [...composed.prompts, ...runtime.deps.oauthAdapters.accountPrompts];\n\n // Built per request (HTTP) and per connection (stdio), not shared. The SDK caches the\n // negotiated protocol revision on the McpServer instance - its own docs say a negotiated\n // session never re-routes a method onto the other era - so one shared instance pins itself\n // to whichever revision reaches it first and answers the other with -32601.\n const buildServer = () => {\n const mcpServer = new McpServer({ name: config.name, version: config.version }, { cacheHints: defaultCacheHints });\n registerTools(mcpServer, filteredTools);\n registerResources(mcpServer, composed.resources);\n registerPrompts(mcpServer, prompts);\n return mcpServer;\n };\n\n const app = express();\n app.use(express.json({ limit: '10mb' }));\n\n // Must mount '/mcp' before any permissive app-level cors(), or that layer answers its\n // preflight first; pass baseUrl's origin/host below or a public deployment 403s itself.\n const publicUrl = config.baseUrl ? new URL(config.baseUrl) : undefined;\n logger.info(`Starting ${config.name} MCP server (http)`);\n const { close, httpServer } = await connectHttp(buildServer, {\n logger,\n app,\n port,\n allowedOrigins: publicUrl ? [publicUrl.origin] : undefined,\n allowedHosts: publicUrl ? [publicUrl.host] : undefined,\n });\n\n // The loopback OAuth callback, the file-export download, and the DCR discovery/\n // registration endpoints are all meant to be reached from a browser on another\n // origin. Keep cors() for them, scoped to their own routes - never in front of '/mcp'.\n if (runtime.deps.oauthAdapters.loopbackRouter) {\n app.use('/', cors(), runtime.deps.oauthAdapters.loopbackRouter);\n logger.info('Mounted loopback OAuth callback router');\n }\n\n if (config.auth !== 'dcr') {\n const fileRouter = createFileServingRouter({ resourceStoreUri: config.resourceStoreUri }, { contentType: 'text/csv', contentDisposition: 'attachment' });\n app.use('/files', cors(), fileRouter);\n }\n\n if (runtime.deps.oauthAdapters.dcrRouter) {\n app.use('/', cors(), runtime.deps.oauthAdapters.dcrRouter);\n logger.info('Mounted DCR router with OAuth endpoints');\n }\n\n logger.info('http transport ready');\n\n return {\n httpServer,\n logger,\n close: async () => {\n await close();\n await runtime.close();\n },\n };\n}\n"],"names":["createHTTPServer","config","overrides","runtime","modules","layers","composed","logger","port","tools","filteredTools","prompts","buildServer","app","publicUrl","close","httpServer","fileRouter","createDefaultRuntime","createDomainModules","middlewareFactories","map","factory","deps","composeMiddleware","transport","Error","oauthAdapters","accountTools","auth","filter","tool","name","accountPrompts","mcpServer","McpServer","version","cacheHints","defaultCacheHints","registerTools","registerResources","resources","registerPrompts","express","use","json","limit","baseUrl","URL","undefined","info","connectHttp","allowedOrigins","origin","allowedHosts","host","loopbackRouter","cors","createFileServingRouter","resourceStoreUri","contentType","contentDisposition","dcrRouter"],"mappings":";;;;+BAMsBA;;;eAAAA;;;sBANmI;2DACxI;8DACG;yBAEiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,SAAeA,iBAAiBC,MAAoB,EAAEC,SAA4B;;YACjFC,SACAC,SACAC,QACAC,UACAC,QACAC,MAGAC,OACAC,eAIAC,SAMAC,aAQAC,KAKAC,WAEwB,MAAtBC,OAAOC,YAiBPC;;;;oBAnDQ;;wBAAMC,IAAAA,+BAAoB,EAACjB,QAAQC;;;oBAA7CC,UAAU;oB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/ai/mcp-z/mcp-outlook/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport { createOAuthAdapters } from './oauth-microsoft.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","createHTTPServer","createOAuthAdapters","createStdioServer","parseConfig"],"mappings":";;;;;;;;;;;QAASA;eAAAA,sBAAY;;QACZC;eAAAA,wBAAgB;;QAChBC;eAAAA,qCAAmB;;QAEnBC;eAAAA,0BAAiB;;QAJHC;eAAAA,qBAAW;;;wBAAQ;sBACT;gCACG;qBACtB;uBACoB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-outlook/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport { createOAuthAdapters } from './oauth-microsoft.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","createHTTPServer","createOAuthAdapters","createStdioServer","parseConfig"],"mappings":";;;;;;;;;;;QAASA;eAAAA,sBAAY;;QACZC;eAAAA,wBAAgB;;QAChBC;eAAAA,qCAAmB;;QAEnBC;eAAAA,0BAAiB;;QAJHC;eAAAA,qBAAW;;;wBAAQ;sBACT;gCACG;qBACtB;uBACoB"}