@softeria/ms-365-mcp-server 0.180.4 → 0.180.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile CHANGED
@@ -13,10 +13,11 @@ FROM node:24-alpine AS release
13
13
 
14
14
  WORKDIR /app
15
15
 
16
- COPY --from=builder /app/dist /app/dist
17
16
  COPY --from=builder /app/package*.json ./
18
17
 
19
18
  ENV NODE_ENV=production
20
19
  RUN npm ci --ignore-scripts --omit=dev
21
20
 
21
+ COPY --from=builder /app/dist /app/dist
22
+
22
23
  ENTRYPOINT ["node", "dist/index.js"]
package/README.md CHANGED
@@ -34,6 +34,8 @@ To route Graph traffic through a proxy of your own (one that terminates the clie
34
34
  - Tool filtering for granular access control
35
35
  - [Tool presets](#tool-presets) and [dynamic discovery](#dynamic-tool-discovery) to shrink the tool surface and token usage
36
36
 
37
+ For external document readers, see the [provider-neutral document processing guide](docs/document-processing.md), including continuation and coverage handling.
38
+
37
39
  ## Output Format: JSON vs TOON
38
40
 
39
41
  The server supports two output formats that can be configured globally:
@@ -2630,7 +2630,11 @@
2630
2630
  "presets": ["teams", "work"],
2631
2631
  "workScopes": ["OnlineMeetingTranscript.Read.All"],
2632
2632
  "acceptType": "text/vtt",
2633
- "llmTip": "Returns the transcript content in WebVTT format with speaker identification and timestamps."
2633
+ "acceptFallback": {
2634
+ "innerErrorCode": "SpeakerAttributionNotAllowed",
2635
+ "accept": "application/vnd.microsoft.graph.transcript+text"
2636
+ },
2637
+ "llmTip": "Returns the transcript content in WebVTT format with speaker identification and timestamps. When the tenant disables speaker attribution, the server retries once and returns timestamped text without speaker names."
2634
2638
  },
2635
2639
  {
2636
2640
  "pathPattern": "/me/adhocCalls/getAllTranscripts(userId='{userId}',startDateTime={startDateTime},endDateTime={endDateTime})",
@@ -34,6 +34,21 @@ function isBinaryContentType(contentType) {
34
34
  }
35
35
  return false;
36
36
  }
37
+ function graphInnerErrorCodes(errorText) {
38
+ let error;
39
+ try {
40
+ error = JSON.parse(errorText)?.error;
41
+ } catch {
42
+ return [];
43
+ }
44
+ const codes = [];
45
+ let node = error?.innerError ?? error?.innererror;
46
+ while (node && typeof node === "object") {
47
+ if (typeof node.code === "string") codes.push(node.code);
48
+ node = node.innerError ?? node.innererror;
49
+ }
50
+ return codes;
51
+ }
37
52
  class GraphApiError extends Error {
38
53
  constructor(message, httpStatus, graphErrorCode) {
39
54
  super(message);
@@ -166,9 +181,15 @@ class GraphClient {
166
181
  throw new Error("No access token available");
167
182
  }
168
183
  try {
169
- const response = await this.performRequest(endpoint, accessToken, options);
170
- if (response.status === 403) {
171
- throw await this.createGraphApiError(response);
184
+ let response = await this.performRequest(endpoint, accessToken, options);
185
+ if (response.status === 403 && options.acceptFallback) {
186
+ response = await this.retryWithAcceptFallback(
187
+ endpoint,
188
+ accessToken,
189
+ options,
190
+ options.acceptFallback,
191
+ response
192
+ );
172
193
  }
173
194
  if (!response.ok) {
174
195
  throw await this.createGraphApiError(response);
@@ -334,22 +355,48 @@ class GraphClient {
334
355
  return "This tool requires organization mode. Please restart with --org-mode flag.";
335
356
  }
336
357
  async createGraphApiError(response) {
337
- const errorText = await response.text();
358
+ return this.buildGraphApiError(response, await response.text());
359
+ }
360
+ // `note` names a retry in the message, so a failed fallback is not mistaken for the first call.
361
+ buildGraphApiError(response, errorText, note = "") {
338
362
  const graphErrorCode = extractGraphErrorCode(errorText);
339
363
  const isPermissionOrScopeError = errorText.includes("scope") || errorText.includes("permission");
340
364
  if (response.status === 403 && isPermissionOrScopeError) {
341
365
  return new GraphApiError(
342
- `Microsoft Graph API scope error: ${response.status} ${response.statusText} - ${errorText}. ${this.scopeErrorHint()}`,
366
+ `Microsoft Graph API scope error: ${response.status} ${response.statusText}${note} - ${errorText}. ${this.scopeErrorHint()}`,
343
367
  response.status,
344
368
  graphErrorCode
345
369
  );
346
370
  }
347
371
  return new GraphApiError(
348
- `Microsoft Graph API error: ${response.status} ${response.statusText} - ${errorText}`,
372
+ `Microsoft Graph API error: ${response.status} ${response.statusText}${note} - ${errorText}`,
349
373
  response.status,
350
374
  graphErrorCode
351
375
  );
352
376
  }
377
+ // On a 403 whose innerError chain carries the endpoint's fallback code, retry once with
378
+ // the fallback Accept. Returns the retry's response when it succeeds; throws otherwise.
379
+ async retryWithAcceptFallback(endpoint, accessToken, options, fallback, response) {
380
+ const errorText = await response.text();
381
+ if (!graphInnerErrorCodes(errorText).includes(fallback.innerErrorCode) || options.headers?.["Accept"]?.toLowerCase() === fallback.accept.toLowerCase()) {
382
+ throw this.buildGraphApiError(response, errorText);
383
+ }
384
+ logger.info(
385
+ `Graph refused the requested representation (${fallback.innerErrorCode}); retrying once with Accept: ${fallback.accept}`
386
+ );
387
+ const retry = await this.performRequest(endpoint, accessToken, {
388
+ ...options,
389
+ headers: { ...options.headers, Accept: fallback.accept }
390
+ });
391
+ if (!retry.ok) {
392
+ throw this.buildGraphApiError(
393
+ retry,
394
+ await retry.text(),
395
+ ` (after retrying with Accept: ${fallback.accept} on ${fallback.innerErrorCode})`
396
+ );
397
+ }
398
+ return retry;
399
+ }
353
400
  async performRequest(endpoint, accessToken, options) {
354
401
  const apiVersion = options.apiVersion || "v1.0";
355
402
  const url = `${getGraphBaseUrl(this.secrets.cloudType)}/${apiVersion}${endpoint}`;
@@ -509,6 +556,7 @@ export {
509
556
  GraphApiError,
510
557
  graph_client_default as default,
511
558
  getBlobMaxBytes,
559
+ graphInnerErrorCodes,
512
560
  isBinaryContentType,
513
561
  isBlobOutputEnabled
514
562
  };
@@ -16,7 +16,10 @@ import {
16
16
  } from "./auth.js";
17
17
  import { api as betaApi } from "./generated/client-beta.js";
18
18
  import { api } from "./generated/client.js";
19
- import { getBlobMaxBytes, isBlobOutputEnabled } from "./graph-client.js";
19
+ import {
20
+ getBlobMaxBytes,
21
+ isBlobOutputEnabled
22
+ } from "./graph-client.js";
20
23
  import { getAttachmentMinting } from "./lib/attachment-minting.js";
21
24
  import { MAX_UPLOAD_BYTES, uploadAttachment } from "./lib/attachment-upload.js";
22
25
  import { getUploadDirs, openUploadFile } from "./lib/upload-dirs.js";
@@ -73,6 +76,12 @@ import {
73
76
  validateMailTextArgs
74
77
  } from "./lib/mail-text.js";
75
78
  import { describeToolSchema, describeUtilityToolSchema } from "./lib/tool-schema.js";
79
+ import {
80
+ ACCEPT_VALUE_ERROR,
81
+ ACCEPT_VALUE_MAX_LENGTH,
82
+ ACCEPT_VALUE_PATTERN,
83
+ isAcceptValue
84
+ } from "./lib/media-type.js";
76
85
  import {
77
86
  restrictUserFieldQuery,
78
87
  restrictUserFieldUrl,
@@ -823,6 +832,23 @@ async function mintDownloadUrl(target, accountParam, authManager, probeWith) {
823
832
  ]
824
833
  };
825
834
  }
835
+ function acceptValueSchema() {
836
+ return z.string().max(ACCEPT_VALUE_MAX_LENGTH).regex(ACCEPT_VALUE_PATTERN, ACCEPT_VALUE_ERROR).optional();
837
+ }
838
+ function acceptParamSchema() {
839
+ return acceptValueSchema().describe(
840
+ "Optional Accept header. Set only when Graph asks for another format (transcript content: application/vnd.microsoft.graph.transcript+text)."
841
+ );
842
+ }
843
+ function invalidAcceptResult(accept) {
844
+ if (accept == null || typeof accept === "string" && isAcceptValue(accept)) {
845
+ return void 0;
846
+ }
847
+ return {
848
+ content: [{ type: "text", text: JSON.stringify({ error: ACCEPT_VALUE_ERROR }) }],
849
+ isError: true
850
+ };
851
+ }
826
852
  const UTILITY_TOOLS = [
827
853
  {
828
854
  name: "get-upload-url",
@@ -1164,7 +1190,8 @@ const UTILITY_TOOLS = [
1164
1190
  ),
1165
1191
  fileName: z.string().optional().describe(
1166
1192
  "Name of the file, used as the last segment of the returned resource URI when the server runs with blob output. Optional."
1167
- )
1193
+ ),
1194
+ accept: acceptParamSchema()
1168
1195
  };
1169
1196
  if (ctx.multiAccount) {
1170
1197
  schema["account"] = z.string().optional().describe(
@@ -1204,6 +1231,9 @@ const UTILITY_TOOLS = [
1204
1231
  if (alteredTarget) return alteredTarget;
1205
1232
  const restrictedTarget = userProfilePassthroughError(target, userFields);
1206
1233
  if (restrictedTarget) return restrictedTarget;
1234
+ const acceptError = invalidAcceptResult(params.accept);
1235
+ if (acceptError) return acceptError;
1236
+ const accept = params.accept;
1207
1237
  try {
1208
1238
  const accountModeError = await checkAccountParamInBearerMode(accountParam, authManager);
1209
1239
  if (accountModeError) {
@@ -1226,7 +1256,8 @@ const UTILITY_TOOLS = [
1226
1256
  accessToken: accountAccessToken,
1227
1257
  rawResponse: true,
1228
1258
  forceBinary: true,
1229
- ...blob
1259
+ ...blob,
1260
+ ...accept ? { headers: { Accept: accept } } : {}
1230
1261
  });
1231
1262
  } catch (error) {
1232
1263
  return {
@@ -1256,7 +1287,8 @@ const UTILITY_TOOLS = [
1256
1287
  ),
1257
1288
  outputPath: z.string().describe(
1258
1289
  "Absolute path on the server's filesystem where the bytes are written, e.g. /Users/me/downloads/invoice.pdf. Must be absolute; relative paths are rejected. The parent directory must already exist, and an existing file is never overwritten (the call errors if outputPath already exists)."
1259
- )
1290
+ ),
1291
+ accept: acceptParamSchema()
1260
1292
  };
1261
1293
  if (ctx.multiAccount) {
1262
1294
  schema["account"] = z.string().optional().describe(
@@ -1310,6 +1342,9 @@ const UTILITY_TOOLS = [
1310
1342
  if (alteredTarget) return alteredTarget;
1311
1343
  const restrictedTarget = userProfilePassthroughError(target, userFields);
1312
1344
  if (restrictedTarget) return restrictedTarget;
1345
+ const acceptError = invalidAcceptResult(params.accept);
1346
+ if (acceptError) return acceptError;
1347
+ const accept = params.accept;
1313
1348
  if (!path.isAbsolute(outputPath)) {
1314
1349
  return {
1315
1350
  content: [
@@ -1353,7 +1388,8 @@ const UTILITY_TOOLS = [
1353
1388
  accountAccessToken = await authManager.getTokenForAccount(accountParam);
1354
1389
  }
1355
1390
  const result = await graphClient.downloadToFile(target, outputPath, {
1356
- accessToken: accountAccessToken
1391
+ accessToken: accountAccessToken,
1392
+ ...accept ? { headers: { Accept: accept } } : {}
1357
1393
  });
1358
1394
  return {
1359
1395
  content: [
@@ -1964,7 +2000,12 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
1964
2000
  path2 = path2.replace(`{${paramName}}`, () => encodedValue).replace(`:${paramName}`, () => encodedValue).replace(`{${camelCaseParamName}}`, () => encodedValue).replace(`:${camelCaseParamName}`, () => encodedValue);
1965
2001
  logger.info(`Path param fallback: replaced :${camelCaseParamName} with encoded value`);
1966
2002
  } else if (paramName.toLowerCase() === "accept" && config?.acceptType) {
1967
- headers["Accept"] = `${paramValue}`;
2003
+ if (paramValue !== "" && paramValue != null) {
2004
+ if (typeof paramValue !== "string" || !isAcceptValue(paramValue)) {
2005
+ throw new Error(ACCEPT_VALUE_ERROR);
2006
+ }
2007
+ headers["Accept"] = paramValue;
2008
+ }
1968
2009
  } else if (isOdataParam) {
1969
2010
  queryParams[fixedParamName] = `${paramValue}`;
1970
2011
  logger.info(`OData param fallback: forwarded ${fixedParamName}=${paramValue}`);
@@ -2075,6 +2116,10 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2075
2116
  headers["Accept"] = config.acceptType;
2076
2117
  logger.info(`Setting custom Accept: ${config.acceptType}`);
2077
2118
  }
2119
+ const acceptFallback = (
2120
+ // Media types compare case-insensitively (RFC 9110 §8.3.1).
2121
+ config?.acceptType && headers["Accept"]?.toLowerCase() === config.acceptType.toLowerCase() && queryParams["$format"] === void 0 ? config.acceptFallback : void 0
2122
+ );
2078
2123
  const requestedSelect = parseSelectFields(queryParams["$select"]);
2079
2124
  const enforcement = userFields === void 0 ? "none" : userFieldEnforcement(path2);
2080
2125
  const isUserFieldBoundary = enforcement !== "none";
@@ -2103,7 +2148,8 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2103
2148
  }
2104
2149
  const options = {
2105
2150
  method: tool.method.toUpperCase(),
2106
- headers
2151
+ headers,
2152
+ ...acceptFallback ? { acceptFallback } : {}
2107
2153
  };
2108
2154
  if (config?.fixedBody) {
2109
2155
  body = { ...config.fixedBody };
@@ -2404,7 +2450,9 @@ function registerGraphToolWithMcp(server, tool, endpointConfig, graphClient, opt
2404
2450
  }
2405
2451
  }
2406
2452
  if (endpointConfig?.acceptType && paramSchema["Accept"] === void 0) {
2407
- paramSchema["Accept"] = z.string().optional().describe(getAcceptParamDescription(endpointConfig.acceptType));
2453
+ paramSchema["Accept"] = acceptValueSchema().describe(
2454
+ getAcceptParamDescription(endpointConfig.acceptType)
2455
+ );
2408
2456
  }
2409
2457
  if (endpointConfig?.blobOutput && paramSchema["fileName"] === void 0) {
2410
2458
  paramSchema["fileName"] = z.string().optional().describe(
@@ -0,0 +1,18 @@
1
+ const ACCEPT_VALUE_PATTERN = /^(?:[\x21-\x7E](?:[\x20-\x7E]*[\x21-\x7E])?)?$/;
2
+ const ACCEPT_VALUE_MAX_LENGTH = 256;
3
+ const ACCEPT_VALUE_ERROR = `Accept must be a printable header value of at most ${ACCEPT_VALUE_MAX_LENGTH} characters, e.g. text/vtt.`;
4
+ function isAcceptValue(value) {
5
+ return value.length <= ACCEPT_VALUE_MAX_LENGTH && ACCEPT_VALUE_PATTERN.test(value);
6
+ }
7
+ const ACCEPT_VALUE_JSON_SCHEMA = {
8
+ type: "string",
9
+ pattern: ACCEPT_VALUE_PATTERN.source,
10
+ maxLength: ACCEPT_VALUE_MAX_LENGTH
11
+ };
12
+ export {
13
+ ACCEPT_VALUE_ERROR,
14
+ ACCEPT_VALUE_JSON_SCHEMA,
15
+ ACCEPT_VALUE_MAX_LENGTH,
16
+ ACCEPT_VALUE_PATTERN,
17
+ isAcceptValue
18
+ };
@@ -71,7 +71,7 @@ const CONFIRM_PARAM_DESCRIPTION = 'For destructive operations when the confirm g
71
71
  const TIMEZONE_PARAM_DESCRIPTION = 'IANA timezone name (e.g., "America/New_York", "Europe/London", "Asia/Tokyo") for calendar event times. If not specified, times are returned in UTC.';
72
72
  const EXPAND_EXTENDED_PROPERTIES_PARAM_DESCRIPTION = "When true, expands singleValueExtendedProperties on each event. Use this to retrieve custom extended properties (e.g., sync metadata) stored on calendar events.";
73
73
  function getAcceptParamDescription(acceptType) {
74
- return `Accept header for the response representation. Defaults to "${acceptType}". Only set this when Graph asks for a different format \u2014 e.g. a 403 SpeakerAttributionNotAllowed on transcript content names the media type to retry with.`;
74
+ return `Accept header for the response representation. Defaults to "${acceptType}". Leave unset unless you need a different format.`;
75
75
  }
76
76
  function getAccountParamDescription(accountNames) {
77
77
  const accountHint = accountNames.length > 0 ? `Known accounts: ${accountNames.join(", ")}. ` : "";
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { queryParameterSchema } from "./query-parameter-schema.js";
3
3
  import { tidyToolJsonSchema, zodToToolJsonSchema } from "../normalize-tool-schema.js";
4
4
  import { isDestructiveOperation } from "./destructive-ops.js";
5
+ import { ACCEPT_VALUE_JSON_SCHEMA } from "./media-type.js";
5
6
  import {
6
7
  isFetchAllPagesApplicable,
7
8
  isSkiptokenApplicable,
@@ -140,7 +141,7 @@ function describeToolSchema(tool, config, ctx = {}) {
140
141
  in: "Header",
141
142
  required: false,
142
143
  description: getAcceptParamDescription(config.acceptType),
143
- schema: { type: "string" }
144
+ schema: { ...ACCEPT_VALUE_JSON_SCHEMA }
144
145
  });
145
146
  }
146
147
  const llmTip = config?.llmTip;
package/dist/server.js CHANGED
@@ -43,6 +43,8 @@ import OboClient from "./obo-client.js";
43
43
  import { isRejectedAssertion, oboAllowlistRefusal, readOboAllowlist } from "./lib/obo-access.js";
44
44
  import { requestContext } from "./request-context.js";
45
45
  import { getSecrets } from "./secrets.js";
46
+ const MAX_TOOL_INPUT_ELEMENTS = 5e4;
47
+ const MAX_REQUEST_BODY_BYTES = 100 * 1024;
46
48
  const LOOPBACK_HOSTNAMES = ["localhost", "127.0.0.1", "[::1]"];
47
49
  function isLoopbackHost(host) {
48
50
  if (!host) return false;
@@ -210,7 +212,8 @@ class MicrosoftGraphServer {
210
212
  readOnly: Boolean(this.options.readOnly),
211
213
  multiAccount: this.multiAccount,
212
214
  attachmentUrlsEnabled: Boolean(this.options.http && this.options.enableAttachmentUrls)
213
- })
215
+ }),
216
+ maxToolInputElements: MAX_TOOL_INPUT_ELEMENTS
214
217
  }
215
218
  );
216
219
  const shouldRegisterAuthTools = !this.options.appMode && (!this.options.http || this.options.enableAuthTools);
@@ -384,7 +387,7 @@ class MicrosoftGraphServer {
384
387
  hsts: { maxAge: 31536e3, includeSubDomains: true, preload: true }
385
388
  })
386
389
  );
387
- app.use(express.json());
390
+ app.use(express.json({ limit: MAX_REQUEST_BODY_BYTES }));
388
391
  app.use(express.urlencoded({ extended: true }));
389
392
  const corsOrigin = process.env.MS365_MCP_CORS_ORIGIN || "http://localhost:3000";
390
393
  app.use((req, res, next) => {
@@ -727,8 +730,9 @@ class MicrosoftGraphServer {
727
730
  const transport = new StreamableHTTPServerTransport({
728
731
  sessionIdGenerator: void 0,
729
732
  // Stateless mode
730
- enableJsonResponse: true
733
+ enableJsonResponse: true,
731
734
  // Reply to POSTs with plain JSON, not one-shot SSE
735
+ maxRequestBodySize: MAX_REQUEST_BODY_BYTES
732
736
  });
733
737
  res.on("close", () => {
734
738
  transport.close();
@@ -942,6 +946,7 @@ class MicrosoftGraphServer {
942
946
  }
943
947
  var server_default = MicrosoftGraphServer;
944
948
  export {
949
+ MAX_TOOL_INPUT_ELEMENTS,
945
950
  PKCE_SECRET_MIN_LENGTH,
946
951
  server_default as default,
947
952
  deriveServerCodeVerifier,
@@ -0,0 +1,99 @@
1
+ # Reading documents with an external processor
2
+
3
+ Microsoft 365 supplies the source; the MCP client chooses a processor and retains its
4
+ results. This server's `get-download-url` supplies a URL, not a conversion API. Any
5
+ processor that can fetch that URL and read the format can participate. MCP does not
6
+ define universal conversion tool names, continuation fields, offset units or coverage
7
+ metadata: inspect the selected processor's advertised schema and documented results.
8
+
9
+ ## Source → client → processor
10
+
11
+ For example, in HTTP mode with `--enable-attachment-urls` and appropriate mail scopes:
12
+
13
+ 1. Call `list-mail-attachments` with
14
+ `{"messageId":"example-message","select":"id,name,contentType,size,isInline"}`.
15
+ Select an attachment from this metadata rather than putting `contentBytes` in the
16
+ client transcript.
17
+ 2. Call `get-download-url` with
18
+ `{"target":"/me/messages/example-message/attachments/example-attachment/$value"}`.
19
+ Keep the returned `downloadUrl` as a temporary capability; give it to the processor
20
+ without sending the processor Microsoft credentials.
21
+ 3. Invoke that processor's actual tool using its own URL, selection and output-budget
22
+ arguments. Preserve its native result envelope, including completion, coverage,
23
+ warnings and errors, rather than reducing it to a text string.
24
+ 4. If more content is relevant, mint again for the **same source and account**, then
25
+ pass the processor's **exact returned continuation** with the same selection and
26
+ conversion options. Stop when the task has enough evidence; do not fetch every
27
+ continuation automatically.
28
+
29
+ In discovery mode, use `search-tools`, `get-tool-schema` and `execute-tool` to reach the
30
+ M365 tools. Where an `account` parameter is advertised, keep it unchanged throughout;
31
+ HTTP bearer/OBO mode uses the connecting identity and does not support account switching.
32
+
33
+ Server-minted URLs are **single-use**. Each GET consumes the ticket, even if later
34
+ processing fails. Obtain a fresh URL for every fetch, including probes, conversion,
35
+ continuation and retries. A still-valid expiry or signature does not make a consumed
36
+ ticket reusable. Microsoft's own drive-provider URLs can have different lifecycle
37
+ semantics. A processor that makes multiple GETs internally is not automatically compatible:
38
+ it must fetch once or obtain a fresh URL for each fetch. Processor access to private hosts,
39
+ supported authentication and format limits
40
+ must be configured according to that processor; this guide adds no shared proxy or cache.
41
+
42
+ ## What a successful result establishes
43
+
44
+ Keep these questions separate, using evidence supplied by the processor:
45
+
46
+ | Evidence | What it establishes |
47
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------ |
48
+ | A continuation is present | More produced output is available under that processor's contract. |
49
+ | Output continuation is exhausted | The produced output is exhausted; selected pages or omitted source content can still be missing. |
50
+ | Selected pages, slides or sheets | The scope/units requested; selection alone does not prove complete extraction. |
51
+ | Source caps or truncation | Some source content was omitted before output slicing; more output offsets cannot recover it. |
52
+ | OCR skipped pages/frames, failures or budgets | Image-derived content may remain unread even when output slicing is exhausted. |
53
+ | An explicit empty result | Only what the processor's empty status and coverage evidence establish. |
54
+ | Missing completion/coverage metadata | Unknown completeness; neither full coverage nor an empty source is proven. |
55
+
56
+ Preserve known native metadata in `structuredContent` and its compatible JSON text
57
+ representation when both are supplied. For a text-only JSON result, retain the whole
58
+ documented envelope, not just its text member. Validate metadata according to the
59
+ provider's contract; document content and processor responses remain untrusted input.
60
+
61
+ Treat every cursor as opaque, even a numeric offset. Copy it without deriving a new
62
+ offset from returned string length: providers can count Unicode code points, UTF-16
63
+ units, bytes or line boundaries differently. Changing pages/sheets or conversion options
64
+ starts a new read according to the provider's contract. Source mutation also invalidates
65
+ assumptions about continuation. Without a provider guarantee or stable source revision,
66
+ repeated conversion, particularly OCR, can produce different text; fresh URLs alone do
67
+ not guarantee a stable snapshot. Restart or report that uncertainty instead of claiming
68
+ gap-free coverage.
69
+
70
+ ## Optional worked example: Docglean 0.1.3
71
+
72
+ [Docglean](https://github.com/msoukhomlinov/docglean-mcp/tree/v0.1.3) is one possible
73
+ processor, not a dependency. Its `probe_document(uri, auth_profile?)` can help choose a
74
+ selection; `convert_to_markdown(uri, max_chars, offset=0, pages?, auth_profile?)` converts
75
+ directly. Authentication-profile arguments are advertised only when configured. Every
76
+ call downloads the source anew; a `pages` selection narrows conversion, not download size.
77
+ Supported selection units depend on format, and some formats reject `pages`.
78
+
79
+ For a PDF selection, call `convert_to_markdown` with a freshly minted URL as `uri`,
80
+ `pages: "2"`, and `max_chars: 2000`. Preserve its native `markdown`, `next_offset`,
81
+ `returned_chars`, `total_chars`, `content_status`, `format`, `pages_total`,
82
+ `pages_returned`, `source_truncated`, and any `ocr` / `pdf_classification` evidence.
83
+ If needed, mint a fresh URL and call again with the exact `next_offset` as `offset`,
84
+ keeping `pages: "2"` and extraction settings unchanged. `max_chars` is a per-call output
85
+ budget and may change without recomputing the returned offset.
86
+
87
+ `next_offset: null` exhausts only the Markdown produced. `source_truncated` reports
88
+ known CSV/workbook row-cap omissions; `false` does not guarantee source coverage.
89
+ Inspect `content_status` and OCR evidence such as skipped pages/reasons or unread frames.
90
+ Document-level classification is not proof that a selected range was fully read.
91
+
92
+ ## Verification and limits
93
+
94
+ `test/document-processing.test.ts` uses real M365 URL minting and HTTP ticket redemption,
95
+ then two local MCP reference processors with different tool names, arguments, output
96
+ fields and continuation formats. It exercises explicit continuation, fresh-ticket retry,
97
+ Unicode offset differences and preservation of native coverage evidence. Its source is
98
+ synthetic text and its coverage statuses are fixtures: it does not certify any real
99
+ converter's PDF, workbook or OCR fidelity. No external processor deployment is exercised.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
3
  "mcpName": "io.github.Softeria/ms-365-mcp-server",
4
- "version": "0.180.4",
4
+ "version": "0.180.6",
5
5
  "description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@azure/msal-node": "^7.1.1",
39
- "@modelcontextprotocol/sdk": "^1.29.0",
39
+ "@modelcontextprotocol/sdk": "^1.32.0",
40
40
  "@toon-format/toon": "^2.3.1",
41
41
  "commander": "^11.1.0",
42
42
  "dotenv": "^17.0.1",
@@ -2630,7 +2630,11 @@
2630
2630
  "presets": ["teams", "work"],
2631
2631
  "workScopes": ["OnlineMeetingTranscript.Read.All"],
2632
2632
  "acceptType": "text/vtt",
2633
- "llmTip": "Returns the transcript content in WebVTT format with speaker identification and timestamps."
2633
+ "acceptFallback": {
2634
+ "innerErrorCode": "SpeakerAttributionNotAllowed",
2635
+ "accept": "application/vnd.microsoft.graph.transcript+text"
2636
+ },
2637
+ "llmTip": "Returns the transcript content in WebVTT format with speaker identification and timestamps. When the tenant disables speaker attribution, the server retries once and returns timestamped text without speaker names."
2634
2638
  },
2635
2639
  {
2636
2640
  "pathPattern": "/me/adhocCalls/getAllTranscripts(userId='{userId}',startDateTime={startDateTime},endDateTime={endDateTime})",