caldav-mcp 0.12.1 → 0.13.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
@@ -120,18 +120,21 @@ The server supports two transports, selected at startup:
120
120
 
121
121
  ## Docker
122
122
 
123
- A `Dockerfile` is provided for running the server with the Streamable HTTP transport — useful when hosting the MCP server as a long-running container that remote MCP clients connect to over HTTP, rather than spawning the binary locally via stdio.
123
+ A container image is available for running the server with the Streamable HTTP transport — useful when hosting the MCP server as a long-running container that remote MCP clients connect to over HTTP, rather than spawning the binary locally via stdio.
124
+
125
+ Each release publishes a multi-arch image (`linux/amd64`, `linux/arm64`) to the GitHub Container Registry, tagged with its full, minor and major version (for example `1.2.3`, `1.2`, `1`) and `latest`:
124
126
 
125
127
  ```bash
126
- docker build -t caldav-mcp .
127
128
  docker run --rm -p 3000:3000 \
128
129
  -e CALDAV_BASE_URL=https://your-caldav-server.com/dav \
129
130
  -e CALDAV_USERNAME=your-username \
130
131
  -e CALDAV_PASSWORD=your-password \
131
132
  -e MCP_AUTH_TOKEN=your-shared-secret \
132
- caldav-mcp
133
+ ghcr.io/langmail/caldav-mcp
133
134
  ```
134
135
 
136
+ To build the image yourself instead, run `docker build -t caldav-mcp .` and use `caldav-mcp` as the image name.
137
+
135
138
  The image binds to `0.0.0.0:3000` (or the port in `MCP_PORT`/`PORT`), serves `POST /mcp`, and reports its health from `GET /health`. Because it listens on all interfaces, `MCP_AUTH_TOKEN` is required: without it the container exits at startup (see [Transports](#transports)). The container is not needed for the default stdio setup in [Setup](#setup) above.
136
139
 
137
140
  ## Available Tools
@@ -169,7 +172,7 @@ Parameters:
169
172
 
170
173
  - `calendarUrl`: string
171
174
  - `description`: string (optional)
172
- - `end`: string — End datetime (ISO 8601)
175
+ - `end`: string — End datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
173
176
  - `location`: string (optional)
174
177
  - `organizer`: string (optional) — Organizer email (no mailto:), written as ORGANIZER; a scheduling-capable server (e.g. Radicale with the email/iMIP hook) uses it to send invitations, updates and cancellations to the attendees.
175
178
  - `recurrenceRule`: object (optional)
@@ -179,8 +182,8 @@ Parameters:
179
182
  - `count`: number (optional)
180
183
  - `freq`: enum (`DAILY` | `WEEKLY` | `MONTHLY` | `YEARLY`) (optional)
181
184
  - `interval`: number (optional)
182
- - `until`: string (optional)
183
- - `start`: string — Start datetime (ISO 8601)
185
+ - `until`: string (optional) — Last occurrence at or before this datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
186
+ - `start`: string — Start datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
184
187
  - `attendees`: array of string (optional) — Attendee emails (no mailto:), written as ATTENDEE lines; a scheduling-capable server mails them the invitation. Requires organizer.
185
188
  - `summary`: string
186
189
  - `wholeDay`: boolean (optional) — Create as a whole-day event
@@ -197,7 +200,7 @@ Parameters:
197
200
 
198
201
  - `calendarUrl`: string
199
202
  - `description`: string (optional)
200
- - `end`: string (optional)
203
+ - `end`: string (optional) — New end datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
201
204
  - `location`: string (optional)
202
205
  - `organizer`: string (optional) — Organizer email (no mailto:); pass to set or change ORGANIZER, or an empty string to remove it (only when the event has no attendees). Omit to leave it as stored.
203
206
  - `recurrenceRule`: object (optional)
@@ -207,8 +210,8 @@ Parameters:
207
210
  - `count`: number (optional)
208
211
  - `freq`: enum (`DAILY` | `WEEKLY` | `MONTHLY` | `YEARLY`) (optional)
209
212
  - `interval`: number (optional)
210
- - `until`: string (optional)
211
- - `start`: string (optional)
213
+ - `until`: string (optional) — Last occurrence at or before this datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
214
+ - `start`: string (optional) — New start datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
212
215
  - `attendees`: array of string (optional) — The complete new attendee list (no mailto:): it replaces the stored one, so get the current attendees from list-events and include everyone who should stay. An empty list removes all attendees. Omit to leave them as stored. Requires an organizer.
213
216
  - `summary`: string (optional)
214
217
  - `uid`: string — Unique identifier of the event to update (obtained from list-events)
@@ -238,27 +241,28 @@ List tasks (VTODOs) in the calendar specified by its URL. By default returns onl
238
241
  Parameters:
239
242
 
240
243
  - `calendarUrl`: string
241
- - `due_after`: string (optional) — Only tasks with a due date at or after this (ISO 8601). Undated tasks are excluded when a due window is set.
242
- - `due_before`: string (optional) — Only tasks with a due date at or before this (ISO 8601). Undated tasks are excluded when a due window is set.
244
+ - `due_after`: string (optional) — Only tasks with a due date at or after this; undated tasks are excluded when a due window is set (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
245
+ - `due_before`: string (optional) — Only tasks with a due date at or before this; undated tasks are excluded when a due window is set (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
243
246
  - `limit`: number (optional) — Max tasks to return (default 50, max 500)
244
247
  - `offset`: number (optional) — Tasks to skip (default 0)
245
248
  - `status`: enum (`OPEN` | `ALL` | `NEEDS-ACTION` | `COMPLETED` | `IN-PROCESS` | `CANCELLED`) (optional) — Filter by status. `OPEN` (default) = NEEDS-ACTION + IN-PROCESS; `ALL` = everything; or an exact status (NEEDS-ACTION, COMPLETED, IN-PROCESS, CANCELLED).
246
249
 
247
250
  Returns:
248
251
 
249
- - An object `{ todos, total, limit, offset }` where `total` is the count before pagination. Each todo has `uid`, `summary`, `status`, and optionally `due`, `start`, `completed`, `description`, `location`.
252
+ - An object `{ todos, total, limit, offset }` where `total` is the count before pagination. Each todo has `uid`, `summary`, `status`, `reminders` (when the task will notify, as ISO datetimes, or as the raw offset such as `-PT15M` for a relative reminder on a task without `start`; empty when it has none), and optionally `due`, `start`, `completed`, `description`, `location`.
250
253
 
251
254
  ### create-todo
252
255
 
253
- Creates a task (VTODO) in the calendar specified by its URL. Only `summary` is required; a task may have no dates. Use `due` for a deadline and `start` for when work should begin.
256
+ Creates a task (VTODO) in the calendar specified by its URL. Only `summary` is required; a task may have no dates. Use `due` for a deadline and `start` for when work should begin. Use `reminderAt` when the user wants to be reminded ("remind me tomorrow at 9"); a task without it gets no reminder.
254
257
 
255
258
  Parameters:
256
259
 
257
260
  - `calendarUrl`: string
258
261
  - `description`: string (optional)
259
- - `due`: string (optional) — Due datetime (ISO 8601)
262
+ - `due`: string (optional) — Due datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
260
263
  - `location`: string (optional)
261
- - `start`: string (optional) — Start datetime (ISO 8601)
264
+ - `reminderAt`: string (optional) — When the user's devices should notify about the task: a clock time, not an offset from the due date. For "an hour before it's due", pass the due time minus one hour (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
265
+ - `start`: string (optional) — Start datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
262
266
  - `status`: enum (`NEEDS-ACTION` | `COMPLETED` | `IN-PROCESS` | `CANCELLED`) (optional) — Defaults to NEEDS-ACTION when omitted
263
267
  - `summary`: string
264
268
 
@@ -268,15 +272,16 @@ Returns:
268
272
 
269
273
  ### update-todo
270
274
 
271
- Updates an existing task (VTODO) in the calendar specified by its URL. Only provided fields are changed. To mark a task done, prefer the `complete-todo` tool.
275
+ Updates an existing task (VTODO) in the calendar specified by its URL. Only provided fields are changed. `reminderAt` replaces the task's reminders with one at that time, `null` removes all of them, and omitting it keeps them. To mark a task done, prefer the `complete-todo` tool.
272
276
 
273
277
  Parameters:
274
278
 
275
279
  - `calendarUrl`: string
276
280
  - `description`: string (optional)
277
- - `due`: string (optional)
281
+ - `due`: string (optional) — New due datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
278
282
  - `location`: string (optional)
279
- - `start`: string (optional)
283
+ - `reminderAt`: string | null (optional) — When the user's devices should notify about the task: a clock time, not an offset from the due date. For "an hour before it's due", pass the due time minus one hour. Replaces all existing reminders; `null` removes them; omit to keep them (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
284
+ - `start`: string (optional) — New start datetime (ISO 8601 with an offset, e.g. 2026-05-01T09:00:00+02:00 or 2026-05-01T07:00:00Z)
280
285
  - `status`: enum (`NEEDS-ACTION` | `COMPLETED` | `IN-PROCESS` | `CANCELLED`) (optional)
281
286
  - `summary`: string (optional)
282
287
  - `uid`: string — Unique identifier of the todo to update (from list-todos)
@@ -10,13 +10,18 @@ const ADDRESS = new RegExp(`^${ADDRESS_PART}@${ADDRESS_PART}$`, "u");
10
10
  const ADDRESS_OR_EMPTY = new RegExp(`^(?:${ADDRESS_PART}@${ADDRESS_PART})?$`, "u");
11
11
  const MAILTO_PREFIX = /^mailto:/iu;
12
12
  const ADDRESS_MESSAGE = "Expected a plain email address such as name@example.com (no mailto:, no display name)";
13
+ // A `refine`, not `.regex()`: zod emits `.regex()` as a JSON Schema `pattern`,
14
+ // which grammar-constrained clients such as llama.cpp may fail to compile
15
+ // (issue #171). The field descriptions carry the format hint instead.
13
16
  export const emailAddressSchema = z
14
17
  .string()
15
- .regex(ADDRESS, { message: ADDRESS_MESSAGE });
18
+ .refine((value) => ADDRESS.test(value), { message: ADDRESS_MESSAGE });
16
19
  // update-event takes "" to remove the stored organizer.
17
20
  export const emailAddressOrEmptySchema = z
18
21
  .string()
19
- .regex(ADDRESS_OR_EMPTY, { message: ADDRESS_MESSAGE });
22
+ .refine((value) => ADDRESS_OR_EMPTY.test(value), {
23
+ message: ADDRESS_MESSAGE,
24
+ });
20
25
  export function toCalAddress(email) {
21
26
  return `mailto:${email}`;
22
27
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { hrefFor, toCalendarPath } from "./caldav-href.js";
3
+ import { writableAlarms } from "./reminder.js";
3
4
  export const completeTodoDefinition = {
4
5
  description: "Marks a task (VTODO) as done. Sets its status to COMPLETED and records the completion time.",
5
6
  inputSchema: {
@@ -26,6 +27,7 @@ export function registerCompleteTodo(client, server) {
26
27
  // RFC 5545: a COMPLETED VTODO should carry a COMPLETED timestamp.
27
28
  const updated = await client.updateTodo(calendarUrl, {
28
29
  ...existing,
30
+ ...(existing.alarms && { alarms: writableAlarms(existing.alarms) }),
29
31
  completed: new Date(),
30
32
  status: "COMPLETED",
31
33
  });
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { toCalendarPath } from "./caldav-href.js";
3
3
  import { assertOrganizerForAttendees, emailAddressSchema, toCalAddress, } from "./calendar-address.js";
4
+ import { isoDateTime } from "./iso-datetime.js";
4
5
  import { recurrenceRuleSchema, toRecurrenceRule } from "./recurrence-rule.js";
5
6
  import { toWholeDayDate } from "./whole-day-date.js";
6
7
  export const createEventDefinition = {
@@ -8,19 +9,13 @@ export const createEventDefinition = {
8
9
  inputSchema: {
9
10
  calendarUrl: z.string(),
10
11
  description: z.string().optional(),
11
- end: z
12
- .string()
13
- .datetime({ offset: true })
14
- .describe("End datetime (ISO 8601)"),
12
+ end: isoDateTime("End datetime"),
15
13
  location: z.string().optional(),
16
14
  organizer: emailAddressSchema
17
15
  .optional()
18
16
  .describe("Organizer email (no mailto:), written as ORGANIZER; a scheduling-capable server (e.g. Radicale with the email/iMIP hook) uses it to send invitations, updates and cancellations to the attendees."),
19
17
  recurrenceRule: recurrenceRuleSchema.optional(),
20
- start: z
21
- .string()
22
- .datetime({ offset: true })
23
- .describe("Start datetime (ISO 8601)"),
18
+ start: isoDateTime("Start datetime"),
24
19
  attendees: z
25
20
  .array(emailAddressSchema)
26
21
  .optional()
@@ -1,22 +1,17 @@
1
1
  import { z } from "zod";
2
2
  import { toCalendarPath } from "./caldav-href.js";
3
+ import { isoDateTime } from "./iso-datetime.js";
4
+ import { reminderAlarm } from "./reminder.js";
3
5
  import { todoStatusSchema } from "./todo-status.js";
4
6
  export const createTodoDefinition = {
5
- description: "Creates a task (VTODO) in the calendar specified by its URL. Only `summary` is required; a task may have no dates. Use `due` for a deadline and `start` for when work should begin.",
7
+ description: 'Creates a task (VTODO) in the calendar specified by its URL. Only `summary` is required; a task may have no dates. Use `due` for a deadline and `start` for when work should begin. Use `reminderAt` when the user wants to be reminded ("remind me tomorrow at 9"); a task without it gets no reminder.',
6
8
  inputSchema: {
7
9
  calendarUrl: z.string(),
8
10
  description: z.string().optional(),
9
- due: z
10
- .string()
11
- .datetime({ offset: true })
12
- .optional()
13
- .describe("Due datetime (ISO 8601)"),
11
+ due: isoDateTime("Due datetime").optional(),
14
12
  location: z.string().optional(),
15
- start: z
16
- .string()
17
- .datetime({ offset: true })
18
- .optional()
19
- .describe("Start datetime (ISO 8601)"),
13
+ reminderAt: isoDateTime("When the user's devices should notify about the task: a clock time, not an offset from the due date. For \"an hour before it's due\", pass the due time minus one hour").optional(),
14
+ start: isoDateTime("Start datetime").optional(),
20
15
  status: todoStatusSchema
21
16
  .optional()
22
17
  .describe("Defaults to NEEDS-ACTION when omitted"),
@@ -30,7 +25,7 @@ export function registerCreateTodo(client, server) {
30
25
  description: createTodoDefinition.description,
31
26
  inputSchema: createTodoDefinition.inputSchema,
32
27
  }, async (args) => {
33
- const { summary, due, start, description, location, status } = args;
28
+ const { summary, due, start, description, location, reminderAt, status } = args;
34
29
  const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
35
30
  const todo = await client.createTodo(calendarUrl, {
36
31
  summary,
@@ -39,6 +34,9 @@ export function registerCreateTodo(client, server) {
39
34
  ...(description !== undefined && { description }),
40
35
  ...(location !== undefined && { location }),
41
36
  ...(status !== undefined && { status }),
37
+ ...(reminderAt !== undefined && {
38
+ alarms: [reminderAlarm(reminderAt, summary)],
39
+ }),
42
40
  });
43
41
  return {
44
42
  content: [{ text: todo.uid, type: "text" }],
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ const EXAMPLE = "2026-05-01T09:00:00+02:00";
3
+ const strictDateTime = z.iso.datetime({ offset: true });
4
+ /**
5
+ * An ISO 8601 datetime with an offset (`Z` or `±hh:mm`), checked by a
6
+ * `refine` rather than `.datetime()`: zod emits `.datetime()` as a long regex
7
+ * `pattern` in the JSON Schema, which grammar-constrained clients such as
8
+ * llama.cpp fail to compile (issue #171). A `refine` is not exported, so the
9
+ * advertised schema is a plain string and the description is the only format
10
+ * hint.
11
+ */
12
+ export const isoDateTime = (description) => z
13
+ .string()
14
+ .refine((value) => strictDateTime.safeParse(value).success, {
15
+ message: `Invalid datetime, expected ISO 8601 with an offset, e.g. ${EXAMPLE}`,
16
+ })
17
+ .describe(`${description} (ISO 8601 with an offset, e.g. ${EXAMPLE} or 2026-05-01T07:00:00Z)`);
@@ -1,5 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { toCalendarPath } from "./caldav-href.js";
3
+ import { isoDateTime } from "./iso-datetime.js";
4
+ import { reminderTimes } from "./reminder.js";
3
5
  import { todoStatusSchema } from "./todo-status.js";
4
6
  // `OPEN`/`ALL` are filter keywords expressing sets no single status can (a union
5
7
  // and "no filter"); the four raw statuses allow an exact-status query. The raw
@@ -37,16 +39,8 @@ export const listTodosDefinition = {
37
39
  description: "List tasks (VTODOs) in the calendar specified by its URL. By default returns only open tasks (NEEDS-ACTION and IN-PROCESS), sorted by manual order then due date. Use `status` to include completed (`COMPLETED`) or all (`ALL`) tasks, and `limit`/`offset` to page through long lists.",
38
40
  inputSchema: {
39
41
  calendarUrl: z.string(),
40
- due_after: z
41
- .string()
42
- .datetime({ offset: true })
43
- .optional()
44
- .describe("Only tasks with a due date at or after this (ISO 8601). Undated tasks are excluded when a due window is set."),
45
- due_before: z
46
- .string()
47
- .datetime({ offset: true })
48
- .optional()
49
- .describe("Only tasks with a due date at or before this (ISO 8601). Undated tasks are excluded when a due window is set."),
42
+ due_after: isoDateTime("Only tasks with a due date at or after this; undated tasks are excluded when a due window is set").optional(),
43
+ due_before: isoDateTime("Only tasks with a due date at or before this; undated tasks are excluded when a due window is set").optional(),
50
44
  limit: z
51
45
  .number()
52
46
  .int()
@@ -65,7 +59,7 @@ export const listTodosDefinition = {
65
59
  .describe("Filter by status. `OPEN` (default) = NEEDS-ACTION + IN-PROCESS; `ALL` = everything; or an exact status (NEEDS-ACTION, COMPLETED, IN-PROCESS, CANCELLED)."),
66
60
  },
67
61
  name: "list-todos",
68
- returns: "An object `{ todos, total, limit, offset }` where `total` is the count before pagination. Each todo has `uid`, `summary`, `status`, and optionally `due`, `start`, `completed`, `description`, `location`.",
62
+ returns: "An object `{ todos, total, limit, offset }` where `total` is the count before pagination. Each todo has `uid`, `summary`, `status`, `reminders` (when the task will notify, as ISO datetimes, or as the raw offset such as `-PT15M` for a relative reminder on a task without `start`; empty when it has none), and optionally `due`, `start`, `completed`, `description`, `location`.",
69
63
  };
70
64
  export function registerListTodos(client, server) {
71
65
  server.registerTool(listTodosDefinition.name, {
@@ -114,6 +108,7 @@ export function registerListTodos(client, server) {
114
108
  .filter((t) => matchesStatus(t) && matchesWindow(t))
115
109
  .sort(compareTodos);
116
110
  const todos = filtered.slice(offset, offset + limit).map((t) => ({
111
+ reminders: reminderTimes(t.alarms ?? [], t.start),
117
112
  status: statusOf(t),
118
113
  summary: t.summary,
119
114
  uid: t.uid,
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { isoDateTime } from "./iso-datetime.js";
2
3
  import { toWholeDayDate } from "./whole-day-date.js";
3
4
  export function toRecurrenceRule(r, wholeDay) {
4
5
  const out = {};
@@ -32,5 +33,5 @@ export const recurrenceRuleSchema = z.object({
32
33
  count: z.number().optional(),
33
34
  freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
34
35
  interval: z.number().optional(),
35
- until: z.string().datetime({ offset: true }).optional(), // ISO 8601 string
36
+ until: isoDateTime("Last occurrence at or before this datetime").optional(),
36
37
  });
@@ -0,0 +1,67 @@
1
+ import ICAL from "ical.js";
2
+ // A trigger that ts-caldav read back is a string: an ISO 8601 duration
3
+ // (`-PT15M`) for a relative alarm, or a datetime (`2026-11-27T08:00:00Z`) for
4
+ // an absolute one. ts-caldav's `addAlarms` hands the trigger to ical.js as is,
5
+ // which parses a string as a duration, so only an `ICAL.Time` writes a
6
+ // `TRIGGER;VALUE=DATE-TIME`. The `Alarm` type says `string`, hence the casts.
7
+ // Workaround for the lost trigger parameters, reported in issue #192.
8
+ const DURATION = /^[+-]?P/u;
9
+ function isDuration(trigger) {
10
+ return DURATION.test(trigger);
11
+ }
12
+ /** One display alarm that fires at `at` (ISO 8601 with offset). */
13
+ export function reminderAlarm(at, description) {
14
+ const trigger = ICAL.Time.fromJSDate(new Date(at), true);
15
+ return {
16
+ action: "DISPLAY",
17
+ description,
18
+ trigger: trigger,
19
+ };
20
+ }
21
+ /**
22
+ * Alarms as read from the server, made writable again: an absolute trigger
23
+ * becomes an `ICAL.Time`, so writing it back keeps `VALUE=DATE-TIME` instead
24
+ * of throwing `invalid duration value`.
25
+ */
26
+ export function writableAlarms(alarms) {
27
+ return alarms.map((alarm) => isDuration(alarm.trigger)
28
+ ? alarm
29
+ : {
30
+ ...alarm,
31
+ trigger: ICAL.Time.fromDateTimeString(alarm.trigger),
32
+ });
33
+ }
34
+ /**
35
+ * When each alarm fires, as ISO datetimes. A relative trigger is resolved
36
+ * against `start`; without one it is returned as the raw duration. ts-caldav
37
+ * drops `RELATED=END`, so a due-relative trigger is resolved wrongly (#192).
38
+ */
39
+ export function reminderTimes(alarms, start) {
40
+ return alarms.map(({ trigger }) => {
41
+ if (!isDuration(trigger)) {
42
+ return new Date(trigger).toISOString();
43
+ }
44
+ if (!start) {
45
+ return trigger;
46
+ }
47
+ const seconds = ICAL.Duration.fromString(trigger).toSeconds();
48
+ return new Date(start.getTime() + seconds * 1000).toISOString();
49
+ });
50
+ }
51
+ /**
52
+ * The alarms an update writes: `reminderAt` replaces them all with one,
53
+ * `null` removes them, and omitting it keeps the existing ones. A kept
54
+ * display alarm that showed the old summary shows the new one.
55
+ */
56
+ export function updatedAlarms(existing, reminderAt, summary) {
57
+ if (reminderAt === null) {
58
+ return [];
59
+ }
60
+ if (reminderAt !== undefined) {
61
+ return [reminderAlarm(reminderAt, summary.after)];
62
+ }
63
+ return (existing &&
64
+ writableAlarms(existing).map((alarm) => alarm.action === "DISPLAY" && alarm.description === summary.before
65
+ ? { ...alarm, description: summary.after }
66
+ : alarm));
67
+ }
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { hrefFor, toCalendarPath } from "./caldav-href.js";
3
3
  import { assertOrganizerForAttendees, emailAddressOrEmptySchema, emailAddressSchema, readScheduling, toCalAddress, } from "./calendar-address.js";
4
+ import { isoDateTime } from "./iso-datetime.js";
4
5
  import { recurrenceRuleSchema, toRecurrenceRule } from "./recurrence-rule.js";
5
6
  import { carryOverWholeDayDates, toWholeDayDate } from "./whole-day-date.js";
6
7
  export const updateEventDefinition = {
@@ -8,13 +9,13 @@ export const updateEventDefinition = {
8
9
  inputSchema: {
9
10
  calendarUrl: z.string(),
10
11
  description: z.string().optional(),
11
- end: z.string().datetime({ offset: true }).optional(),
12
+ end: isoDateTime("New end datetime").optional(),
12
13
  location: z.string().optional(),
13
14
  organizer: emailAddressOrEmptySchema
14
15
  .optional()
15
16
  .describe("Organizer email (no mailto:); pass to set or change ORGANIZER, or an empty string to remove it (only when the event has no attendees). Omit to leave it as stored."),
16
17
  recurrenceRule: recurrenceRuleSchema.optional(),
17
- start: z.string().datetime({ offset: true }).optional(),
18
+ start: isoDateTime("New start datetime").optional(),
18
19
  attendees: z
19
20
  .array(emailAddressSchema)
20
21
  .optional()
@@ -1,14 +1,23 @@
1
1
  import { z } from "zod";
2
2
  import { hrefFor, toCalendarPath } from "./caldav-href.js";
3
+ import { isoDateTime } from "./iso-datetime.js";
4
+ import { updatedAlarms } from "./reminder.js";
3
5
  import { todoStatusSchema } from "./todo-status.js";
6
+ // `.nullable()` wraps the schema, so the description is set again on the
7
+ // wrapper for clients and the generated docs to see it.
8
+ const reminderAtSchema = isoDateTime("When the user's devices should notify about the task: a clock time, not an offset from the due date. For \"an hour before it's due\", pass the due time minus one hour. Replaces all existing reminders; `null` removes them; omit to keep them");
4
9
  export const updateTodoDefinition = {
5
- description: "Updates an existing task (VTODO) in the calendar specified by its URL. Only provided fields are changed. To mark a task done, prefer the `complete-todo` tool.",
10
+ description: "Updates an existing task (VTODO) in the calendar specified by its URL. Only provided fields are changed. `reminderAt` replaces the task's reminders with one at that time, `null` removes all of them, and omitting it keeps them. To mark a task done, prefer the `complete-todo` tool.",
6
11
  inputSchema: {
7
12
  calendarUrl: z.string(),
8
13
  description: z.string().optional(),
9
- due: z.string().datetime({ offset: true }).optional(),
14
+ due: isoDateTime("New due datetime").optional(),
10
15
  location: z.string().optional(),
11
- start: z.string().datetime({ offset: true }).optional(),
16
+ reminderAt: reminderAtSchema
17
+ .nullable()
18
+ .optional()
19
+ .describe(reminderAtSchema.description ?? ""),
20
+ start: isoDateTime("New start datetime").optional(),
12
21
  status: todoStatusSchema.optional(),
13
22
  summary: z.string().optional(),
14
23
  uid: z
@@ -23,7 +32,7 @@ export function registerUpdateTodo(client, server) {
23
32
  description: updateTodoDefinition.description,
24
33
  inputSchema: updateTodoDefinition.inputSchema,
25
34
  }, async (args) => {
26
- const { uid, summary, due, start, description, location, status } = args;
35
+ const { uid, summary, due, start, description, location, reminderAt, status, } = args;
27
36
  const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
28
37
  const href = hrefFor(calendarUrl, uid);
29
38
  const [existing] = await client.getTodosByHref(calendarUrl, [href]);
@@ -45,6 +54,10 @@ export function registerUpdateTodo(client, server) {
45
54
  else if (status === "COMPLETED") {
46
55
  completed = priorCompleted ?? new Date();
47
56
  }
57
+ const alarms = updatedAlarms(base.alarms, reminderAt, {
58
+ after: summary ?? base.summary,
59
+ before: base.summary,
60
+ });
48
61
  const updated = await client.updateTodo(calendarUrl, {
49
62
  ...base,
50
63
  ...(summary !== undefined && { summary }),
@@ -54,6 +67,7 @@ export function registerUpdateTodo(client, server) {
54
67
  ...(location !== undefined && { location }),
55
68
  ...(status !== undefined && { status }),
56
69
  ...(completed !== undefined && { completed }),
70
+ ...(alarms !== undefined && { alarms }),
57
71
  });
58
72
  return {
59
73
  content: [{ text: updated.uid, type: "text" }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caldav-mcp",
3
- "version": "0.12.1",
3
+ "version": "0.13.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/langmail/caldav-mcp#readme",
6
6
  "bugs": {
@@ -33,7 +33,7 @@
33
33
  "prepare": "lefthook install",
34
34
  "semantic-release": "semantic-release",
35
35
  "smoke": "npm run build && tsx --env-file=.env scripts/smoke.ts",
36
- "smoke:agent": "npm run build && bash scripts/smoke-agent.sh",
36
+ "smoke:agent": "npm run build && bash scripts/smoke-agent.sh && tsx --env-file=.env scripts/smoke-agent-reminder.ts",
37
37
  "smoke:http": "npm run build && SMOKE_TRANSPORT=http tsx --env-file=.env scripts/smoke.ts",
38
38
  "test": "vitest run",
39
39
  "test:coverage": "vitest run --coverage",
@@ -43,6 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@modelcontextprotocol/sdk": "^1.26.0",
46
+ "ical.js": "^2.2.1",
46
47
  "ts-caldav": "^0.4.0",
47
48
  "zod": "^4.4.3"
48
49
  },