caldav-mcp 0.11.0 → 0.11.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.
@@ -104,7 +104,9 @@ export function startHttpServer(config, createServer) {
104
104
  send(res, 400, "Bad Request");
105
105
  return;
106
106
  }
107
- if (pathname === HEALTH_PATH && req.method === "GET") {
107
+ // Node omits the body for HEAD, which some health probes send.
108
+ if (pathname === HEALTH_PATH &&
109
+ (req.method === "GET" || req.method === "HEAD")) {
108
110
  send(res, 200, "ok");
109
111
  return;
110
112
  }
package/dist/index.js CHANGED
@@ -11,7 +11,8 @@ function listeningUrl(server) {
11
11
  function shutDownOnSignals(server) {
12
12
  const shutdown = () => {
13
13
  server.close(() => process.exit(0));
14
- server.closeIdleConnections();
14
+ // closeIdleConnections only exists from Node 18.2; engines allows 18.0.
15
+ server.closeIdleConnections?.();
15
16
  };
16
17
  process.once("SIGINT", shutdown);
17
18
  process.once("SIGTERM", shutdown);
@@ -56,4 +57,36 @@ async function main() {
56
57
  // Start receiving messages on stdin and sending messages on stdout
57
58
  await createServer(client).connect(new StdioServerTransport());
58
59
  }
59
- main();
60
+ const MAX_CAUSE_DEPTH = 5;
61
+ /** undici's AggregateError for a refused multi-address connect has no message. */
62
+ function messageOf(error) {
63
+ if (error.message) {
64
+ return error.message;
65
+ }
66
+ const { code } = error;
67
+ return typeof code === "string" ? code : error.name;
68
+ }
69
+ /**
70
+ * One line for a startup error, with its cause chain: ts-caldav and fetch
71
+ * keep the actual network reason (ENOTFOUND, TLS errors) only in `cause`.
72
+ */
73
+ function describeError(error) {
74
+ if (!(error instanceof Error)) {
75
+ return String(error);
76
+ }
77
+ const causes = [];
78
+ let { cause } = error;
79
+ while (cause instanceof Error && causes.length < MAX_CAUSE_DEPTH) {
80
+ causes.push(messageOf(cause));
81
+ ({ cause } = cause);
82
+ }
83
+ return causes.length > 0
84
+ ? `${error.message} (${causes.join(": ")})`
85
+ : error.message;
86
+ }
87
+ main().catch((error) => {
88
+ // e.g. EADDRINUSE or an unreachable CalDAV server: one readable line
89
+ // instead of an unhandled rejection.
90
+ console.error(`caldav-mcp: failed to start: ${describeError(error)}`);
91
+ process.exit(1);
92
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caldav-mcp",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.",
5
5
  "homepage": "https://github.com/dominik1001/caldav-mcp#readme",
6
6
  "bugs": {