caldav-mcp 0.12.1 → 0.13.0
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 +11 -6
- package/dist/tools/complete-todo.js +2 -0
- package/dist/tools/create-todo.js +11 -2
- package/dist/tools/list-todos.js +3 -1
- package/dist/tools/reminder.js +67 -0
- package/dist/tools/update-todo.js +14 -2
- package/package.json +3 -2
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
|
|
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
|
|
@@ -246,11 +249,11 @@ Parameters:
|
|
|
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
|
|
|
@@ -258,6 +261,7 @@ Parameters:
|
|
|
258
261
|
- `description`: string (optional)
|
|
259
262
|
- `due`: string (optional) — Due datetime (ISO 8601)
|
|
260
263
|
- `location`: string (optional)
|
|
264
|
+
- `reminderAt`: string (optional) — When the user's devices should notify about the task: a clock time (ISO 8601 with offset), not an offset from the due date. For "an hour before it's due", pass the due time minus one hour.
|
|
261
265
|
- `start`: string (optional) — Start datetime (ISO 8601)
|
|
262
266
|
- `status`: enum (`NEEDS-ACTION` | `COMPLETED` | `IN-PROCESS` | `CANCELLED`) (optional) — Defaults to NEEDS-ACTION when omitted
|
|
263
267
|
- `summary`: string
|
|
@@ -268,7 +272,7 @@ 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
|
|
|
@@ -276,6 +280,7 @@ Parameters:
|
|
|
276
280
|
- `description`: string (optional)
|
|
277
281
|
- `due`: string (optional)
|
|
278
282
|
- `location`: string (optional)
|
|
283
|
+
- `reminderAt`: string | null (optional) — When the user's devices should notify about the task: a clock time (ISO 8601 with offset), 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.
|
|
279
284
|
- `start`: string (optional)
|
|
280
285
|
- `status`: enum (`NEEDS-ACTION` | `COMPLETED` | `IN-PROCESS` | `CANCELLED`) (optional)
|
|
281
286
|
- `summary`: string (optional)
|
|
@@ -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,8 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { toCalendarPath } from "./caldav-href.js";
|
|
3
|
+
import { reminderAlarm } from "./reminder.js";
|
|
3
4
|
import { todoStatusSchema } from "./todo-status.js";
|
|
4
5
|
export const createTodoDefinition = {
|
|
5
|
-
description:
|
|
6
|
+
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
7
|
inputSchema: {
|
|
7
8
|
calendarUrl: z.string(),
|
|
8
9
|
description: z.string().optional(),
|
|
@@ -12,6 +13,11 @@ export const createTodoDefinition = {
|
|
|
12
13
|
.optional()
|
|
13
14
|
.describe("Due datetime (ISO 8601)"),
|
|
14
15
|
location: z.string().optional(),
|
|
16
|
+
reminderAt: z
|
|
17
|
+
.string()
|
|
18
|
+
.datetime({ offset: true })
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("When the user's devices should notify about the task: a clock time (ISO 8601 with offset), not an offset from the due date. For \"an hour before it's due\", pass the due time minus one hour."),
|
|
15
21
|
start: z
|
|
16
22
|
.string()
|
|
17
23
|
.datetime({ offset: true })
|
|
@@ -30,7 +36,7 @@ export function registerCreateTodo(client, server) {
|
|
|
30
36
|
description: createTodoDefinition.description,
|
|
31
37
|
inputSchema: createTodoDefinition.inputSchema,
|
|
32
38
|
}, async (args) => {
|
|
33
|
-
const { summary, due, start, description, location, status } = args;
|
|
39
|
+
const { summary, due, start, description, location, reminderAt, status } = args;
|
|
34
40
|
const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
|
|
35
41
|
const todo = await client.createTodo(calendarUrl, {
|
|
36
42
|
summary,
|
|
@@ -39,6 +45,9 @@ export function registerCreateTodo(client, server) {
|
|
|
39
45
|
...(description !== undefined && { description }),
|
|
40
46
|
...(location !== undefined && { location }),
|
|
41
47
|
...(status !== undefined && { status }),
|
|
48
|
+
...(reminderAt !== undefined && {
|
|
49
|
+
alarms: [reminderAlarm(reminderAt, summary)],
|
|
50
|
+
}),
|
|
42
51
|
});
|
|
43
52
|
return {
|
|
44
53
|
content: [{ text: todo.uid, type: "text" }],
|
package/dist/tools/list-todos.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { toCalendarPath } from "./caldav-href.js";
|
|
3
|
+
import { reminderTimes } from "./reminder.js";
|
|
3
4
|
import { todoStatusSchema } from "./todo-status.js";
|
|
4
5
|
// `OPEN`/`ALL` are filter keywords expressing sets no single status can (a union
|
|
5
6
|
// and "no filter"); the four raw statuses allow an exact-status query. The raw
|
|
@@ -65,7 +66,7 @@ export const listTodosDefinition = {
|
|
|
65
66
|
.describe("Filter by status. `OPEN` (default) = NEEDS-ACTION + IN-PROCESS; `ALL` = everything; or an exact status (NEEDS-ACTION, COMPLETED, IN-PROCESS, CANCELLED)."),
|
|
66
67
|
},
|
|
67
68
|
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`.",
|
|
69
|
+
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
70
|
};
|
|
70
71
|
export function registerListTodos(client, server) {
|
|
71
72
|
server.registerTool(listTodosDefinition.name, {
|
|
@@ -114,6 +115,7 @@ export function registerListTodos(client, server) {
|
|
|
114
115
|
.filter((t) => matchesStatus(t) && matchesWindow(t))
|
|
115
116
|
.sort(compareTodos);
|
|
116
117
|
const todos = filtered.slice(offset, offset + limit).map((t) => ({
|
|
118
|
+
reminders: reminderTimes(t.alarms ?? [], t.start),
|
|
117
119
|
status: statusOf(t),
|
|
118
120
|
summary: t.summary,
|
|
119
121
|
uid: t.uid,
|
|
@@ -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,13 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { hrefFor, toCalendarPath } from "./caldav-href.js";
|
|
3
|
+
import { updatedAlarms } from "./reminder.js";
|
|
3
4
|
import { todoStatusSchema } from "./todo-status.js";
|
|
4
5
|
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.",
|
|
6
|
+
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
7
|
inputSchema: {
|
|
7
8
|
calendarUrl: z.string(),
|
|
8
9
|
description: z.string().optional(),
|
|
9
10
|
due: z.string().datetime({ offset: true }).optional(),
|
|
10
11
|
location: z.string().optional(),
|
|
12
|
+
reminderAt: z
|
|
13
|
+
.string()
|
|
14
|
+
.datetime({ offset: true })
|
|
15
|
+
.nullable()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("When the user's devices should notify about the task: a clock time (ISO 8601 with offset), 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."),
|
|
11
18
|
start: z.string().datetime({ offset: true }).optional(),
|
|
12
19
|
status: todoStatusSchema.optional(),
|
|
13
20
|
summary: z.string().optional(),
|
|
@@ -23,7 +30,7 @@ export function registerUpdateTodo(client, server) {
|
|
|
23
30
|
description: updateTodoDefinition.description,
|
|
24
31
|
inputSchema: updateTodoDefinition.inputSchema,
|
|
25
32
|
}, async (args) => {
|
|
26
|
-
const { uid, summary, due, start, description, location, status } = args;
|
|
33
|
+
const { uid, summary, due, start, description, location, reminderAt, status, } = args;
|
|
27
34
|
const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
|
|
28
35
|
const href = hrefFor(calendarUrl, uid);
|
|
29
36
|
const [existing] = await client.getTodosByHref(calendarUrl, [href]);
|
|
@@ -45,6 +52,10 @@ export function registerUpdateTodo(client, server) {
|
|
|
45
52
|
else if (status === "COMPLETED") {
|
|
46
53
|
completed = priorCompleted ?? new Date();
|
|
47
54
|
}
|
|
55
|
+
const alarms = updatedAlarms(base.alarms, reminderAt, {
|
|
56
|
+
after: summary ?? base.summary,
|
|
57
|
+
before: base.summary,
|
|
58
|
+
});
|
|
48
59
|
const updated = await client.updateTodo(calendarUrl, {
|
|
49
60
|
...base,
|
|
50
61
|
...(summary !== undefined && { summary }),
|
|
@@ -54,6 +65,7 @@ export function registerUpdateTodo(client, server) {
|
|
|
54
65
|
...(location !== undefined && { location }),
|
|
55
66
|
...(status !== undefined && { status }),
|
|
56
67
|
...(completed !== undefined && { completed }),
|
|
68
|
+
...(alarms !== undefined && { alarms }),
|
|
57
69
|
});
|
|
58
70
|
return {
|
|
59
71
|
content: [{ text: updated.uid, type: "text" }],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caldav-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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
|
},
|