@softeria/ms-365-mcp-server 0.16.0 → 0.17.0

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.
@@ -389,6 +389,13 @@ function findUsedSchemas(openApiSpec) {
389
389
  const schemaName = content.schema.$ref.replace('#/components/schemas/', '');
390
390
  schemasToProcess.push(schemaName);
391
391
  }
392
+ if (content.schema?.properties?.requests?.items?.$ref) {
393
+ const schemaName = content.schema.properties.requests.items.$ref.replace(
394
+ '#/components/schemas/',
395
+ ''
396
+ );
397
+ schemasToProcess.push(schemaName);
398
+ }
392
399
  });
393
400
  }
394
401
 
@@ -413,6 +420,21 @@ function findUsedSchemas(openApiSpec) {
413
420
  const schemaName = content.schema.$ref.replace('#/components/schemas/', '');
414
421
  schemasToProcess.push(schemaName);
415
422
  }
423
+ if (content.schema?.allOf) {
424
+ content.schema.allOf.forEach((allOfItem) => {
425
+ if (allOfItem.$ref) {
426
+ const schemaName = allOfItem.$ref.replace('#/components/schemas/', '');
427
+ schemasToProcess.push(schemaName);
428
+ }
429
+ if (allOfItem.properties?.value?.items?.$ref) {
430
+ const schemaName = allOfItem.properties.value.items.$ref.replace(
431
+ '#/components/schemas/',
432
+ ''
433
+ );
434
+ schemasToProcess.push(schemaName);
435
+ }
436
+ });
437
+ }
416
438
  });
417
439
  }
418
440
  });
@@ -2805,7 +2805,203 @@ const microsoft_graph_plannerPlan = z.object({
2805
2805
  details: microsoft_graph_plannerPlanDetails.optional(),
2806
2806
  tasks: z.array(microsoft_graph_plannerTask).describe("Read-only. Nullable. Collection of tasks in the plan.").optional()
2807
2807
  }).strict();
2808
- const search_query_Body = z.object({ requests: z.array(z.object({}).partial().strict()) }).partial().strict();
2808
+ const microsoft_graph_bucketAggregationRange = z.object({
2809
+ from: z.string().describe(
2810
+ "Defines the lower bound from which to compute the aggregation. This can be a numeric value or a string representation of a date using the YYYY-MM-DDTHH:mm:ss.sssZ format. Required."
2811
+ ).optional(),
2812
+ to: z.string().describe(
2813
+ "Defines the upper bound up to which to compute the aggregation. This can be a numeric value or a string representation of a date using the YYYY-MM-DDTHH:mm:ss.sssZ format. Required."
2814
+ ).optional()
2815
+ }).strict();
2816
+ const microsoft_graph_bucketAggregationSortProperty = z.enum([
2817
+ "count",
2818
+ "keyAsString",
2819
+ "keyAsNumber",
2820
+ "unknownFutureValue"
2821
+ ]);
2822
+ const microsoft_graph_bucketAggregationDefinition = z.object({
2823
+ isDescending: z.boolean().describe(
2824
+ "True to specify the sort order as descending. The default is false, with the sort order as ascending. Optional."
2825
+ ).nullish(),
2826
+ minimumCount: z.number().gte(-2147483648).lte(2147483647).describe(
2827
+ "The minimum number of items that should be present in the aggregation to be returned in a bucket. Optional."
2828
+ ).nullish(),
2829
+ prefixFilter: z.string().describe(
2830
+ "A filter to define a matching criteria. The key should start with the specified prefix to be returned in the response. Optional."
2831
+ ).nullish(),
2832
+ ranges: z.array(microsoft_graph_bucketAggregationRange).describe(
2833
+ "Specifies the manual ranges to compute the aggregations. This is only valid for nonstring refiners of date or numeric type. Optional."
2834
+ ).optional(),
2835
+ sortBy: microsoft_graph_bucketAggregationSortProperty.optional()
2836
+ }).strict();
2837
+ const microsoft_graph_aggregationOption = z.object({
2838
+ bucketDefinition: microsoft_graph_bucketAggregationDefinition.optional(),
2839
+ field: z.string().describe(
2840
+ "Computes aggregation on the field while the field exists in the current entity type. Required."
2841
+ ).optional(),
2842
+ size: z.number().gte(-2147483648).lte(2147483647).describe(
2843
+ "The number of searchBucket resources to be returned. This isn't required when the range is provided manually in the search request. The minimum accepted size is 1, and the maximum is 65535. Optional."
2844
+ ).nullish()
2845
+ }).strict();
2846
+ const microsoft_graph_collapseProperty = z.object({
2847
+ fields: z.array(z.string()).describe(
2848
+ "Defines the collapse group to trim results. The properties in this collection must be sortable/refinable properties. Required."
2849
+ ).optional(),
2850
+ limit: z.number().gte(-32768).lte(32767).describe(
2851
+ "Defines a maximum limit count for this field. This numeric value must be a positive integer. Required."
2852
+ ).optional()
2853
+ }).strict();
2854
+ const microsoft_graph_entityType = z.enum([
2855
+ "event",
2856
+ "message",
2857
+ "driveItem",
2858
+ "externalItem",
2859
+ "site",
2860
+ "list",
2861
+ "listItem",
2862
+ "drive",
2863
+ "unknownFutureValue",
2864
+ "chatMessage",
2865
+ "person",
2866
+ "acronym",
2867
+ "bookmark"
2868
+ ]);
2869
+ const microsoft_graph_searchQuery = z.object({
2870
+ queryString: z.string().describe("The search query containing the search terms. Required.").optional(),
2871
+ queryTemplate: z.string().describe(
2872
+ "Provides a way to decorate the query string. Supports both KQL and query variables. Optional."
2873
+ ).nullish()
2874
+ }).strict();
2875
+ const microsoft_graph_searchAlterationOptions = z.object({
2876
+ enableModification: z.boolean().describe(
2877
+ "Indicates whether spelling modifications are enabled. If enabled, the user gets the search results for the corrected query if there were no results for the original query with typos. The response will also include the spelling modification information in the queryAlterationResponse property. Optional."
2878
+ ).nullish(),
2879
+ enableSuggestion: z.boolean().describe(
2880
+ "Indicates whether spelling suggestions are enabled. If enabled, the user gets the search results for the original search query and suggestions for spelling correction in the queryAlterationResponse property of the response for the typos in the query. Optional."
2881
+ ).nullish()
2882
+ }).strict();
2883
+ const microsoft_graph_resultTemplateOption = z.object({
2884
+ enableResultTemplate: z.boolean().describe(
2885
+ "Indicates whether search display layouts are enabled. If enabled, the user will get the result template to render the search results content in the resultTemplates property of the response. The result template is based on Adaptive Cards. Optional."
2886
+ ).nullish()
2887
+ }).strict();
2888
+ const microsoft_graph_searchContent = z.enum([
2889
+ "sharedContent",
2890
+ "privateContent",
2891
+ "unknownFutureValue"
2892
+ ]);
2893
+ const microsoft_graph_sharePointOneDriveOptions = z.object({ includeContent: microsoft_graph_searchContent.optional() }).strict();
2894
+ const microsoft_graph_sortProperty = z.object({
2895
+ isDescending: z.boolean().describe(
2896
+ "True if the sort order is descending. Default is false, with the sort order as ascending. Optional."
2897
+ ).nullish(),
2898
+ name: z.string().describe("The name of the property to sort on. Required.").optional()
2899
+ }).strict();
2900
+ const microsoft_graph_searchRequest = z.object({
2901
+ aggregationFilters: z.array(z.string().nullable()).describe(
2902
+ "Contains one or more filters to obtain search results aggregated and filtered to a specific value of a field. Optional.Build this filter based on a prior search that aggregates by the same field. From the response of the prior search, identify the searchBucket that filters results to the specific value of the field, use the string in its aggregationFilterToken property, and build an aggregation filter string in the format '{field}:/'{aggregationFilterToken}/''. If multiple values for the same field need to be provided, use the strings in its aggregationFilterToken property and build an aggregation filter string in the format '{field}:or(/'{aggregationFilterToken1}/',/'{aggregationFilterToken2}/')'. For example, searching and aggregating drive items by file type returns a searchBucket for the file type docx in the response. You can conveniently use the aggregationFilterToken returned for this searchBucket in a subsequent search query and filter matches down to drive items of the docx file type. Example 1 and example 2 show the actual requests and responses."
2903
+ ).optional(),
2904
+ aggregations: z.array(microsoft_graph_aggregationOption).describe(
2905
+ "Specifies aggregations (also known as refiners) to be returned alongside search results. Optional."
2906
+ ).optional(),
2907
+ collapseProperties: z.array(microsoft_graph_collapseProperty).describe(
2908
+ "Contains the ordered collection of fields and limit to collapse results. Optional."
2909
+ ).optional(),
2910
+ contentSources: z.array(z.string().nullable()).describe("Contains the connection to be targeted.").optional(),
2911
+ enableTopResults: z.boolean().describe(
2912
+ "This triggers hybrid sort for messages : the first 3 messages are the most relevant. This property is only applicable to entityType=message. Optional."
2913
+ ).nullish(),
2914
+ entityTypes: z.array(z.union([microsoft_graph_entityType, z.object({}).partial().strict()])).describe(
2915
+ "One or more types of resources expected in the response. Possible values are: event, message, driveItem, externalItem, site, list, listItem, drive, chatMessage, person, acronym, bookmark. Use the Prefer: include-unknown-enum-members request header to get the following value(s) in this evolvable enum: chatMessage, person, acronym, bookmark. See known limitations for those combinations of two or more entity types that are supported in the same search request. Required."
2916
+ ).optional(),
2917
+ fields: z.array(z.string().nullable()).describe(
2918
+ "Contains the fields to be returned for each resource object specified in entityTypes, allowing customization of the fields returned by default; otherwise, including additional fields such as custom managed properties from SharePoint and OneDrive, or custom fields in externalItem from the content that Microsoft 365 Copilot connectors bring in. The fields property can use the semantic labels applied to properties. For example, if a property is labeled as title, you can retrieve it using the following syntax: label_title. Optional."
2919
+ ).optional(),
2920
+ from: z.number().gte(-2147483648).lte(2147483647).describe(
2921
+ "Specifies the offset for the search results. Offset 0 returns the very first result. Optional."
2922
+ ).optional(),
2923
+ query: microsoft_graph_searchQuery.optional(),
2924
+ queryAlterationOptions: microsoft_graph_searchAlterationOptions.optional(),
2925
+ region: z.string().describe(
2926
+ "The geographic location for the search. Required for searches that use application permissions. For details, see Get the region value."
2927
+ ).nullish(),
2928
+ resultTemplateOptions: microsoft_graph_resultTemplateOption.optional(),
2929
+ sharePointOneDriveOptions: microsoft_graph_sharePointOneDriveOptions.optional(),
2930
+ size: z.number().gte(-2147483648).lte(2147483647).describe("The size of the page to be retrieved. The maximum value is 500. Optional.").optional(),
2931
+ sortProperties: z.array(microsoft_graph_sortProperty).describe(
2932
+ "Contains the ordered collection of fields and direction to sort results. There can be at most 5 sort properties in the collection. Optional."
2933
+ ).optional()
2934
+ }).strict();
2935
+ const search_query_Body = z.object({ requests: z.array(microsoft_graph_searchRequest) }).partial().strict();
2936
+ const BaseCollectionPaginationCountResponse = z.object({ "@odata.count": z.number().int().nullable(), "@odata.nextLink": z.string().nullable() }).partial().strict();
2937
+ const microsoft_graph_searchBucket = z.object({
2938
+ aggregationFilterToken: z.string().describe(
2939
+ "A token containing the encoded filter to aggregate search matches by the specific key value. To use the filter, pass the token as part of the aggregationFilter property in a searchRequest object, in the format '{field}:/'{aggregationFilterToken}/''. See an example."
2940
+ ).nullish(),
2941
+ count: z.number().gte(-2147483648).lte(2147483647).describe(
2942
+ "The approximate number of search matches that share the same value specified in the key property. Note that this number is not the exact number of matches."
2943
+ ).nullish(),
2944
+ key: z.string().describe("The discrete value of the field that an aggregation was computed on.").nullish()
2945
+ }).strict();
2946
+ const microsoft_graph_searchAggregation = z.object({
2947
+ buckets: z.array(microsoft_graph_searchBucket).optional(),
2948
+ field: z.string().nullish()
2949
+ }).strict();
2950
+ const microsoft_graph_entity = z.object({ id: z.string().describe("The unique identifier for an entity. Read-only.").optional() }).strict();
2951
+ const microsoft_graph_searchHit = z.object({
2952
+ contentSource: z.string().describe("The name of the content source that the externalItem is part of.").nullish(),
2953
+ hitId: z.string().describe(
2954
+ "The internal identifier for the item. The format of the identifier varies based on the entity type. For details, see hitId format."
2955
+ ).nullish(),
2956
+ isCollapsed: z.boolean().describe(
2957
+ "Indicates whether the current result is collapsed when the collapseProperties property in the searchRequest is used."
2958
+ ).nullish(),
2959
+ rank: z.number().gte(-2147483648).lte(2147483647).describe("The rank or the order of the result.").nullish(),
2960
+ resultTemplateId: z.string().describe(
2961
+ "ID of the result template used to render the search result. This ID must map to a display layout in the resultTemplates dictionary that is also included in the searchResponse."
2962
+ ).nullish(),
2963
+ summary: z.string().describe("A summary of the result, if a summary is available.").nullish(),
2964
+ resource: microsoft_graph_entity.optional()
2965
+ }).strict();
2966
+ const microsoft_graph_searchHitsContainer = z.object({
2967
+ aggregations: z.array(microsoft_graph_searchAggregation).optional(),
2968
+ hits: z.array(microsoft_graph_searchHit).describe("A collection of the search results.").optional(),
2969
+ moreResultsAvailable: z.boolean().describe(
2970
+ "Provides information if more results are available. Based on this information, you can adjust the from and size properties of the searchRequest accordingly."
2971
+ ).nullish(),
2972
+ total: z.number().gte(-2147483648).lte(2147483647).describe(
2973
+ "The total number of results. Note this isn't the number of results on the page, but the total number of results satisfying the query."
2974
+ ).nullish()
2975
+ }).strict();
2976
+ const microsoft_graph_alteredQueryToken = z.object({
2977
+ length: z.number().gte(-2147483648).lte(2147483647).describe("Defines the length of a changed segment.").nullish(),
2978
+ offset: z.number().gte(-2147483648).lte(2147483647).describe("Defines the offset of a changed segment.").nullish(),
2979
+ suggestion: z.string().describe("Represents the corrected segment string.").nullish()
2980
+ }).strict();
2981
+ const microsoft_graph_searchAlteration = z.object({
2982
+ alteredHighlightedQueryString: z.string().describe(
2983
+ "Defines the altered highlighted query string with spelling correction. The annotation around the corrected segment is: /ue000, /ue001."
2984
+ ).nullish(),
2985
+ alteredQueryString: z.string().describe("Defines the altered query string with spelling correction.").nullish(),
2986
+ alteredQueryTokens: z.array(microsoft_graph_alteredQueryToken).describe("Represents changed segments related to an original user query.").optional()
2987
+ }).strict();
2988
+ const microsoft_graph_searchAlterationType = z.enum([
2989
+ "suggestion",
2990
+ "modification",
2991
+ "unknownFutureValue"
2992
+ ]);
2993
+ const microsoft_graph_alterationResponse = z.object({
2994
+ originalQueryString: z.string().describe("Defines the original user query string.").nullish(),
2995
+ queryAlteration: microsoft_graph_searchAlteration.optional(),
2996
+ queryAlterationType: microsoft_graph_searchAlterationType.optional()
2997
+ }).strict();
2998
+ const microsoft_graph_resultTemplateDictionary = z.object({}).strict();
2999
+ const microsoft_graph_searchResponse = z.object({
3000
+ hitsContainers: z.array(microsoft_graph_searchHitsContainer).describe("A collection of search results.").optional(),
3001
+ queryAlterationResponse: microsoft_graph_alterationResponse.optional(),
3002
+ resultTemplates: microsoft_graph_resultTemplateDictionary.optional(),
3003
+ searchTerms: z.array(z.string().nullable()).describe("Contains the search terms sent in the initial search query.").optional()
3004
+ }).strict();
2809
3005
  const microsoft_graph_root = z.object({}).strict();
2810
3006
  const microsoft_graph_siteArchiveStatus = z.enum([
2811
3007
  "recentlyArchived",
@@ -2897,6 +3093,7 @@ const microsoft_graph_listItemCollectionResponse = z.object({
2897
3093
  "@odata.nextLink": z.string().nullable(),
2898
3094
  value: z.array(microsoft_graph_listItem)
2899
3095
  }).partial().strict();
3096
+ const BaseDeltaFunctionResponse = z.object({ "@odata.nextLink": z.string().nullable(), "@odata.deltaLink": z.string().nullable() }).partial().strict();
2900
3097
  const microsoft_graph_channelCollectionResponse = z.object({
2901
3098
  "@odata.count": z.number().int().nullable(),
2902
3099
  "@odata.nextLink": z.string().nullable(),
@@ -3186,7 +3383,32 @@ const schemas = {
3186
3383
  microsoft_graph_plannerUserIds,
3187
3384
  microsoft_graph_plannerPlanDetails,
3188
3385
  microsoft_graph_plannerPlan,
3386
+ microsoft_graph_bucketAggregationRange,
3387
+ microsoft_graph_bucketAggregationSortProperty,
3388
+ microsoft_graph_bucketAggregationDefinition,
3389
+ microsoft_graph_aggregationOption,
3390
+ microsoft_graph_collapseProperty,
3391
+ microsoft_graph_entityType,
3392
+ microsoft_graph_searchQuery,
3393
+ microsoft_graph_searchAlterationOptions,
3394
+ microsoft_graph_resultTemplateOption,
3395
+ microsoft_graph_searchContent,
3396
+ microsoft_graph_sharePointOneDriveOptions,
3397
+ microsoft_graph_sortProperty,
3398
+ microsoft_graph_searchRequest,
3189
3399
  search_query_Body,
3400
+ BaseCollectionPaginationCountResponse,
3401
+ microsoft_graph_searchBucket,
3402
+ microsoft_graph_searchAggregation,
3403
+ microsoft_graph_entity,
3404
+ microsoft_graph_searchHit,
3405
+ microsoft_graph_searchHitsContainer,
3406
+ microsoft_graph_alteredQueryToken,
3407
+ microsoft_graph_searchAlteration,
3408
+ microsoft_graph_searchAlterationType,
3409
+ microsoft_graph_alterationResponse,
3410
+ microsoft_graph_resultTemplateDictionary,
3411
+ microsoft_graph_searchResponse,
3190
3412
  microsoft_graph_root,
3191
3413
  microsoft_graph_siteArchiveStatus,
3192
3414
  microsoft_graph_siteArchivalDetails,
@@ -3197,6 +3419,7 @@ const schemas = {
3197
3419
  microsoft_graph_baseItemCollectionResponse,
3198
3420
  microsoft_graph_listCollectionResponse,
3199
3421
  microsoft_graph_listItemCollectionResponse,
3422
+ BaseDeltaFunctionResponse,
3200
3423
  microsoft_graph_channelCollectionResponse,
3201
3424
  microsoft_graph_conversationMemberCollectionResponse
3202
3425
  };
@@ -6904,7 +7127,9 @@ open extensions or extended properties, and how to specify extended properties.`
6904
7127
  {
6905
7128
  status: NaN,
6906
7129
  description: `Success`,
6907
- schema: z.object({ value: z.array(z.object({}).partial().strict()) }).partial().strict()
7130
+ schema: BaseCollectionPaginationCountResponse.and(
7131
+ z.object({ value: z.array(microsoft_graph_searchResponse) }).partial().strict()
7132
+ )
6908
7133
  },
6909
7134
  {
6910
7135
  status: NaN,
@@ -7596,7 +7821,9 @@ To monitor future changes, call the delta API by using the @odata.deltaLink in t
7596
7821
  {
7597
7822
  status: NaN,
7598
7823
  description: `Success`,
7599
- schema: z.object({ value: z.array(microsoft_graph_site) }).partial().strict()
7824
+ schema: BaseDeltaFunctionResponse.and(
7825
+ z.object({ value: z.array(microsoft_graph_site) }).partial().strict()
7826
+ )
7600
7827
  },
7601
7828
  {
7602
7829
  status: NaN,
@@ -36,11 +36,7 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
36
36
  const paramSchema = {};
37
37
  if (tool.parameters && tool.parameters.length > 0) {
38
38
  for (const param of tool.parameters) {
39
- if (param.type === "Body" && param.schema) {
40
- paramSchema[param.name] = z.union([z.string(), param.schema]);
41
- } else {
42
- paramSchema[param.name] = param.schema || z.any();
43
- }
39
+ paramSchema[param.name] = param.schema || z.any();
44
40
  }
45
41
  }
46
42
  if (tool.method.toUpperCase() === "GET" && tool.path.includes("/")) {
@@ -89,31 +85,15 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
89
85
  queryParams[fixedParamName] = `${paramValue}`;
90
86
  break;
91
87
  case "Body":
92
- if (typeof paramValue === "string") {
93
- try {
94
- body = JSON.parse(paramValue);
95
- } catch {
96
- body = paramValue;
97
- }
98
- } else {
99
- body = paramValue;
100
- }
88
+ body = paramValue;
101
89
  break;
102
90
  case "Header":
103
91
  headers[fixedParamName] = `${paramValue}`;
104
92
  break;
105
93
  }
106
94
  } else if (paramName === "body") {
107
- if (typeof paramValue === "string") {
108
- try {
109
- body = JSON.parse(paramValue);
110
- } catch {
111
- body = paramValue;
112
- }
113
- } else {
114
- body = paramValue;
115
- }
116
- logger.info(`Set legacy body param: ${JSON.stringify(body)}`);
95
+ body = paramValue;
96
+ logger.info(`Set body param: ${JSON.stringify(body)}`);
117
97
  }
118
98
  }
119
99
  if (Object.keys(queryParams).length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",