@softeria/ms-365-mcp-server 0.116.0 → 0.116.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -575,7 +575,7 @@ Environment variables:
575
575
  - `MS365_MCP_MAX_TOP=<n>`: Hard cap for Graph `$top` / `top` on list requests (positive integer). When the model passes a larger value, the server clamps it to `n` so responses stay smaller. Example: `MS365_MCP_MAX_TOP=15`
576
576
  - `MS365_MCP_MAX_PAGES=<n>`: Maximum number of pages followed when a tool is called with `fetchAllPages: true` (positive integer, default `100`). Bounds memory and latency for large result sets.
577
577
  - `MS365_MCP_MAX_ITEMS=<n>`: Maximum number of items accumulated when `fetchAllPages: true` (positive integer, default `10000`). Pagination stops and the response is truncated once this many items are collected.
578
- - `MS365_MCP_ALLOW_PAGINATION=0|false|no`: Disable multi-page following entirely. When set, `fetchAllPages: true` returns only the first page (default: pagination enabled).
578
+ - `MS365_MCP_ALLOW_PAGINATION=0|false|no`: Disable multi-page following entirely. When set, the `fetchAllPages` parameter is not advertised on tools, and any request that still passes it returns only the first page (default: pagination enabled).
579
579
  - `MS365_MCP_BODY_FORMAT=html`: Return email bodies as HTML instead of plain text (default: text)
580
580
  - `MS365_MCP_CLOUD_TYPE=global|china`: Microsoft cloud environment (alternative to --cloud flag)
581
581
  - `LOG_LEVEL`: Set logging level (default: 'info')
@@ -252,6 +252,26 @@ describe("graph-tools", () => {
252
252
  registerGraphTools(server, graphClient);
253
253
  await server.tools.get("test-tool").handler({ fetchAllPages: true });
254
254
  expect(graphClient.graphRequest).toHaveBeenCalledTimes(1);
255
+ expect(server.tools.get("test-tool").schema.fetchAllPages).toBeUndefined();
256
+ });
257
+ it("should advertise fetchAllPages when pagination is enabled", async () => {
258
+ delete process.env.MS365_MCP_ALLOW_PAGINATION;
259
+ mockEndpoints.push(makeEndpoint());
260
+ mockEndpointsJson = [makeConfig()];
261
+ const server = createMockServer();
262
+ const { registerGraphTools } = await loadModule();
263
+ registerGraphTools(server, createMockGraphClient());
264
+ expect(server.tools.get("test-tool").schema.fetchAllPages).toBeDefined();
265
+ });
266
+ it("should reflect MS365_MCP_MAX_PAGES in the fetchAllPages description", async () => {
267
+ process.env.MS365_MCP_MAX_PAGES = "7";
268
+ mockEndpoints.push(makeEndpoint());
269
+ mockEndpointsJson = [makeConfig()];
270
+ const server = createMockServer();
271
+ const { registerGraphTools } = await loadModule();
272
+ registerGraphTools(server, createMockGraphClient());
273
+ const schema = server.tools.get("test-tool").schema.fetchAllPages;
274
+ expect(schema.description).toContain("up to 7 pages");
255
275
  });
256
276
  });
257
277
  });
@@ -542,9 +542,10 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
542
542
  paramSchema[pathParamName] = z.string().describe(`Path parameter: ${pathParamName}`);
543
543
  }
544
544
  }
545
- if (tool.method.toUpperCase() === "GET" && tool.path.includes("/")) {
545
+ if (tool.method.toUpperCase() === "GET" && tool.path.includes("/") && paginationAllowed()) {
546
+ const maxPages = positiveIntFromEnv("MS365_MCP_MAX_PAGES", DEFAULT_MAX_PAGES);
546
547
  paramSchema["fetchAllPages"] = z.boolean().describe(
547
- "Follow @odata.nextLink and merge up to 100 pages into one response. Can return enormous payloads\u2014only when the user explicitly needs a full export. Prefer a small $top first, then paginate or narrow with $filter/$search."
548
+ `Follow @odata.nextLink and merge up to ${maxPages} pages into one response. Can return enormous payloads\u2014only when the user explicitly needs a full export. Prefer a small $top first, then paginate or narrow with $filter/$search.`
548
549
  ).optional();
549
550
  }
550
551
  if (paramSchema["filter"] !== void 0 || paramSchema["$filter"] !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.116.0",
3
+ "version": "0.116.1",
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",