@softeria/ms-365-mcp-server 0.112.1 → 0.112.2

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.
@@ -0,0 +1,41 @@
1
+ function dumpError(reason, depth = 0) {
2
+ if (depth > 5) {
3
+ return { truncated: true };
4
+ }
5
+ if (reason instanceof Error) {
6
+ const dump = {
7
+ name: reason.name,
8
+ constructor: reason.constructor?.name,
9
+ message: reason.message,
10
+ stack: reason.stack
11
+ };
12
+ const properties = {};
13
+ for (const key of Object.getOwnPropertyNames(reason)) {
14
+ if (key === "name" || key === "message" || key === "stack" || key === "cause") continue;
15
+ properties[key] = reason[key];
16
+ }
17
+ if (Object.keys(properties).length > 0) {
18
+ dump.properties = properties;
19
+ }
20
+ if ("cause" in reason && reason.cause !== void 0) {
21
+ dump.cause = dumpError(reason.cause, depth + 1);
22
+ }
23
+ return dump;
24
+ }
25
+ return { type: typeof reason, value: reason };
26
+ }
27
+ function getActiveResources() {
28
+ const fn = process.getActiveResourcesInfo;
29
+ if (typeof fn !== "function") {
30
+ return "unavailable (node < 17.3)";
31
+ }
32
+ try {
33
+ return fn.call(process);
34
+ } catch (err) {
35
+ return `error: ${err.message}`;
36
+ }
37
+ }
38
+ export {
39
+ dumpError,
40
+ getActiveResources
41
+ };
package/dist/index.js CHANGED
@@ -10,7 +10,27 @@ import {
10
10
  shouldUseLocalAuthStorage
11
11
  } from "./startup-pinning.js";
12
12
  import { createTokenCacheStorage } from "./token-cache-storage.js";
13
+ import { dumpError, getActiveResources } from "./crash-logging.js";
13
14
  import { version } from "./version.js";
15
+ process.on("unhandledRejection", (reason) => {
16
+ const dump = {
17
+ kind: "unhandledRejection",
18
+ reason: dumpError(reason),
19
+ activeResources: getActiveResources()
20
+ };
21
+ console.error("[ms365-mcp] unhandledRejection", JSON.stringify(dump));
22
+ logger.error("unhandledRejection", dump);
23
+ });
24
+ process.on("uncaughtException", (err, origin) => {
25
+ const dump = {
26
+ kind: "uncaughtException",
27
+ origin,
28
+ error: dumpError(err),
29
+ activeResources: getActiveResources()
30
+ };
31
+ console.error("[ms365-mcp] uncaughtException", JSON.stringify(dump));
32
+ logger.error("uncaughtException", dump);
33
+ });
14
34
  async function main() {
15
35
  try {
16
36
  const args = parseArgs();
package/dist/server.js CHANGED
@@ -25,6 +25,7 @@ import { isAllowedRedirectUri, parseAllowlist } from "./lib/redirect-uri-validat
25
25
  import { getSecrets } from "./secrets.js";
26
26
  import { getCloudEndpoints } from "./cloud-config.js";
27
27
  import { requestContext } from "./request-context.js";
28
+ import { dumpError } from "./crash-logging.js";
28
29
  import crypto from "node:crypto";
29
30
  import OboClient from "./obo-client.js";
30
31
  function parseHttpOption(httpOption) {
@@ -537,6 +538,9 @@ class MicrosoftGraphServer {
537
538
  }
538
539
  } else {
539
540
  const transport = new StdioServerTransport();
541
+ transport.onerror = (error) => {
542
+ logger.error("Stdio transport error", { error: dumpError(error) });
543
+ };
540
544
  await this.server.connect(transport);
541
545
  logger.info("Server connected to stdio transport");
542
546
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.112.1",
3
+ "version": "0.112.2",
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",