@peac/mcp-server 0.13.1 → 0.13.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.
package/dist/cli.mjs CHANGED
@@ -28,7 +28,7 @@ var SERVER_NAME, SERVER_VERSION, MCP_PROTOCOL_VERSION;
28
28
  var init_constants = __esm({
29
29
  "src/infra/constants.ts"() {
30
30
  SERVER_NAME = "peac-mcp-server";
31
- SERVER_VERSION = "0.13.1";
31
+ SERVER_VERSION = "0.13.3";
32
32
  MCP_PROTOCOL_VERSION = "2025-11-25";
33
33
  }
34
34
  });
@@ -532,33 +532,33 @@ init_constants();
532
532
  // src/infra/errors.ts
533
533
  var McpServerError = class extends Error {
534
534
  code;
535
- constructor(code, message) {
536
- super(message);
535
+ constructor(code, message, options) {
536
+ super(message, options);
537
537
  this.name = "McpServerError";
538
538
  this.code = code;
539
539
  }
540
540
  };
541
541
  var KeyLoadError = class extends McpServerError {
542
- constructor(message) {
543
- super("E_MCP_KEY_LOAD", message);
542
+ constructor(message, options) {
543
+ super("E_MCP_KEY_LOAD", message, options);
544
544
  this.name = "KeyLoadError";
545
545
  }
546
546
  };
547
547
  var PolicyLoadError = class extends McpServerError {
548
- constructor(message) {
549
- super("E_MCP_POLICY_LOAD", message);
548
+ constructor(message, options) {
549
+ super("E_MCP_POLICY_LOAD", message, options);
550
550
  this.name = "PolicyLoadError";
551
551
  }
552
552
  };
553
553
  var JwksLoadError = class extends McpServerError {
554
- constructor(message) {
555
- super("E_MCP_JWKS_LOAD", message);
554
+ constructor(message, options) {
555
+ super("E_MCP_JWKS_LOAD", message, options);
556
556
  this.name = "JwksLoadError";
557
557
  }
558
558
  };
559
559
  var PathTraversalError = class extends McpServerError {
560
- constructor(message) {
561
- super("E_MCP_PATH_TRAVERSAL", message);
560
+ constructor(message, options) {
561
+ super("E_MCP_PATH_TRAVERSAL", message, options);
562
562
  this.name = "PathTraversalError";
563
563
  }
564
564
  };
@@ -642,7 +642,8 @@ async function loadPolicy(filePath) {
642
642
  raw = await readFile(filePath, "utf-8");
643
643
  } catch (err) {
644
644
  throw new PolicyLoadError(
645
- `Failed to read policy file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
645
+ `Failed to read policy file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
646
+ { cause: err }
646
647
  );
647
648
  }
648
649
  try {
@@ -658,8 +659,8 @@ async function loadPolicy(filePath) {
658
659
  let parsed;
659
660
  try {
660
661
  parsed = JSON.parse(raw);
661
- } catch {
662
- throw new PolicyLoadError(`Policy file is not valid JSON: ${filePath}`);
662
+ } catch (err) {
663
+ throw new PolicyLoadError(`Policy file is not valid JSON: ${filePath}`, { cause: err });
663
664
  }
664
665
  const result = PolicySchema.safeParse(parsed);
665
666
  if (!result.success) {
@@ -684,7 +685,8 @@ async function loadIssuerKey(schemeUri) {
684
685
  raw = await readFile(filePath, "utf-8");
685
686
  } catch (err) {
686
687
  throw new KeyLoadError(
687
- `Failed to read key file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
688
+ `Failed to read key file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
689
+ { cause: err }
688
690
  );
689
691
  }
690
692
  } else {
@@ -695,8 +697,8 @@ async function loadIssuerKey(schemeUri) {
695
697
  let jwk;
696
698
  try {
697
699
  jwk = JSON.parse(raw);
698
- } catch {
699
- throw new KeyLoadError("Key data is not valid JSON");
700
+ } catch (err) {
701
+ throw new KeyLoadError("Key data is not valid JSON", { cause: err });
700
702
  }
701
703
  if (typeof jwk !== "object" || jwk === null || !("kty" in jwk) || !("crv" in jwk) || !("d" in jwk)) {
702
704
  throw new KeyLoadError("JWK must contain kty, crv, and d fields");
@@ -738,14 +740,15 @@ async function loadJwksFile(filePath) {
738
740
  raw = await readFile(filePath, "utf-8");
739
741
  } catch (err) {
740
742
  throw new JwksLoadError(
741
- `Failed to read JWKS file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
743
+ `Failed to read JWKS file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
744
+ { cause: err }
742
745
  );
743
746
  }
744
747
  let parsed;
745
748
  try {
746
749
  parsed = JSON.parse(raw);
747
- } catch {
748
- throw new JwksLoadError(`JWKS file is not valid JSON: ${filePath}`);
750
+ } catch (err) {
751
+ throw new JwksLoadError(`JWKS file is not valid JSON: ${filePath}`, { cause: err });
749
752
  }
750
753
  if (typeof parsed !== "object" || parsed === null || !("keys" in parsed)) {
751
754
  throw new JwksLoadError('JWKS must contain a "keys" array');