@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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Issue handler -- Wire 0.2 only, ZERO MCP SDK imports
3
3
  *
4
- * Signs and returns a Wire 0.2 PEAC receipt JWS (in-memory only, no side-effects).
4
+ * Signs and returns a Wire 0.2 PEAC record JWS (in-memory only, no side-effects).
5
5
  * Requires issuerKey + issuerId on ServerContext.
6
6
  */
7
7
  import type { HandlerParams, HandlerResult } from './types.js';
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ var nodePath__namespace = /*#__PURE__*/_interopNamespace(nodePath);
34
34
 
35
35
  // src/infra/constants.ts
36
36
  var SERVER_NAME = "peac-mcp-server";
37
- var SERVER_VERSION = "0.13.1";
37
+ var SERVER_VERSION = "0.13.3";
38
38
  var MCP_PROTOCOL_VERSION = "2025-11-25";
39
39
  var DEFAULT_MAX_JWS_BYTES = 16384;
40
40
  var DEFAULT_MAX_RESPONSE_BYTES = 65536;
@@ -47,45 +47,45 @@ var DEFAULT_MAX_TTL_SECONDS = 86400;
47
47
  // src/infra/errors.ts
48
48
  var McpServerError = class extends Error {
49
49
  code;
50
- constructor(code, message) {
51
- super(message);
50
+ constructor(code, message, options) {
51
+ super(message, options);
52
52
  this.name = "McpServerError";
53
53
  this.code = code;
54
54
  }
55
55
  };
56
56
  var KeyLoadError = class extends McpServerError {
57
- constructor(message) {
58
- super("E_MCP_KEY_LOAD", message);
57
+ constructor(message, options) {
58
+ super("E_MCP_KEY_LOAD", message, options);
59
59
  this.name = "KeyLoadError";
60
60
  }
61
61
  };
62
62
  var PolicyLoadError = class extends McpServerError {
63
- constructor(message) {
64
- super("E_MCP_POLICY_LOAD", message);
63
+ constructor(message, options) {
64
+ super("E_MCP_POLICY_LOAD", message, options);
65
65
  this.name = "PolicyLoadError";
66
66
  }
67
67
  };
68
68
  var JwksLoadError = class extends McpServerError {
69
- constructor(message) {
70
- super("E_MCP_JWKS_LOAD", message);
69
+ constructor(message, options) {
70
+ super("E_MCP_JWKS_LOAD", message, options);
71
71
  this.name = "JwksLoadError";
72
72
  }
73
73
  };
74
74
  var IssueToolError = class extends McpServerError {
75
- constructor(message) {
76
- super("E_MCP_ISSUE_FAILED", message);
75
+ constructor(message, options) {
76
+ super("E_MCP_ISSUE_FAILED", message, options);
77
77
  this.name = "IssueToolError";
78
78
  }
79
79
  };
80
80
  var BundleToolError = class extends McpServerError {
81
- constructor(message) {
82
- super("E_MCP_BUNDLE_FAILED", message);
81
+ constructor(message, options) {
82
+ super("E_MCP_BUNDLE_FAILED", message, options);
83
83
  this.name = "BundleToolError";
84
84
  }
85
85
  };
86
86
  var PathTraversalError = class extends McpServerError {
87
- constructor(message) {
88
- super("E_MCP_PATH_TRAVERSAL", message);
87
+ constructor(message, options) {
88
+ super("E_MCP_PATH_TRAVERSAL", message, options);
89
89
  this.name = "PathTraversalError";
90
90
  }
91
91
  };
@@ -104,14 +104,15 @@ async function loadJwksFile(filePath) {
104
104
  raw = await promises.readFile(filePath, "utf-8");
105
105
  } catch (err) {
106
106
  throw new JwksLoadError(
107
- `Failed to read JWKS file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
107
+ `Failed to read JWKS file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
108
+ { cause: err }
108
109
  );
109
110
  }
110
111
  let parsed;
111
112
  try {
112
113
  parsed = JSON.parse(raw);
113
- } catch {
114
- throw new JwksLoadError(`JWKS file is not valid JSON: ${filePath}`);
114
+ } catch (err) {
115
+ throw new JwksLoadError(`JWKS file is not valid JSON: ${filePath}`, { cause: err });
115
116
  }
116
117
  if (typeof parsed !== "object" || parsed === null || !("keys" in parsed)) {
117
118
  throw new JwksLoadError('JWKS must contain a "keys" array');
@@ -1516,7 +1517,8 @@ async function loadPolicy(filePath) {
1516
1517
  raw = await promises.readFile(filePath, "utf-8");
1517
1518
  } catch (err) {
1518
1519
  throw new PolicyLoadError(
1519
- `Failed to read policy file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
1520
+ `Failed to read policy file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
1521
+ { cause: err }
1520
1522
  );
1521
1523
  }
1522
1524
  try {
@@ -1532,8 +1534,8 @@ async function loadPolicy(filePath) {
1532
1534
  let parsed;
1533
1535
  try {
1534
1536
  parsed = JSON.parse(raw);
1535
- } catch {
1536
- throw new PolicyLoadError(`Policy file is not valid JSON: ${filePath}`);
1537
+ } catch (err) {
1538
+ throw new PolicyLoadError(`Policy file is not valid JSON: ${filePath}`, { cause: err });
1537
1539
  }
1538
1540
  const result = PolicySchema.safeParse(parsed);
1539
1541
  if (!result.success) {
@@ -1558,7 +1560,8 @@ async function loadIssuerKey(schemeUri) {
1558
1560
  raw = await promises.readFile(filePath, "utf-8");
1559
1561
  } catch (err) {
1560
1562
  throw new KeyLoadError(
1561
- `Failed to read key file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`
1563
+ `Failed to read key file: ${filePath} -- ${err instanceof Error ? err.message : String(err)}`,
1564
+ { cause: err }
1562
1565
  );
1563
1566
  }
1564
1567
  } else {
@@ -1569,8 +1572,8 @@ async function loadIssuerKey(schemeUri) {
1569
1572
  let jwk;
1570
1573
  try {
1571
1574
  jwk = JSON.parse(raw);
1572
- } catch {
1573
- throw new KeyLoadError("Key data is not valid JSON");
1575
+ } catch (err) {
1576
+ throw new KeyLoadError("Key data is not valid JSON", { cause: err });
1574
1577
  }
1575
1578
  if (typeof jwk !== "object" || jwk === null || !("kty" in jwk) || !("crv" in jwk) || !("d" in jwk)) {
1576
1579
  throw new KeyLoadError("JWK must contain kty, crv, and d fields");