caldav-mcp 0.4.1 → 0.6.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 +18 -0
- package/dist/index.js +2 -0
- package/dist/tools/create-event.js +9 -3
- package/dist/tools/delete-event.js +4 -1
- package/dist/tools/update-event.js +47 -0
- package/package.json +16 -14
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- List calendars
|
|
20
20
|
- List calendar events within a specific timeframe
|
|
21
21
|
- Create calendar events
|
|
22
|
+
- Update calendar events
|
|
22
23
|
- Delete calendar events by UID
|
|
23
24
|
|
|
24
25
|
## Setup
|
|
@@ -97,6 +98,23 @@ Returns:
|
|
|
97
98
|
- `start`: Event start time
|
|
98
99
|
- `end`: Event end time
|
|
99
100
|
|
|
101
|
+
### update-event
|
|
102
|
+
|
|
103
|
+
Updates an existing calendar event. Only provided fields are changed.
|
|
104
|
+
|
|
105
|
+
Parameters:
|
|
106
|
+
- `uid`: String - Unique identifier of the event to update (obtained from list-events)
|
|
107
|
+
- `calendarUrl`: String - URL of the calendar
|
|
108
|
+
- `summary`: String (optional) - New event title/summary
|
|
109
|
+
- `start`: DateTime string (optional) - New event start time
|
|
110
|
+
- `end`: DateTime string (optional) - New event end time
|
|
111
|
+
- `description`: String (optional) - New event description
|
|
112
|
+
- `location`: String (optional) - New event location
|
|
113
|
+
- `recurrenceRule`: Object (optional) - New recurrence rule
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
- The unique ID of the updated event
|
|
117
|
+
|
|
100
118
|
### delete-event
|
|
101
119
|
|
|
102
120
|
Deletes an event from the calendar.
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerCreateEvent } from "./tools/create-event.js";
|
|
|
6
6
|
import { registerDeleteEvent } from "./tools/delete-event.js";
|
|
7
7
|
import { registerListCalendars } from "./tools/list-calendars.js";
|
|
8
8
|
import { registerListEvents } from "./tools/list-events.js";
|
|
9
|
+
import { registerUpdateEvent } from "./tools/update-event.js";
|
|
9
10
|
const server = new McpServer({
|
|
10
11
|
name: "caldav-mcp",
|
|
11
12
|
version: "0.1.0",
|
|
@@ -30,6 +31,7 @@ async function main() {
|
|
|
30
31
|
registerCreateEvent(client, server);
|
|
31
32
|
registerListEvents(client, server);
|
|
32
33
|
registerDeleteEvent(client, server);
|
|
34
|
+
registerUpdateEvent(client, server);
|
|
33
35
|
await registerListCalendars(client, server);
|
|
34
36
|
// Start receiving messages on stdin and sending messages on stdout
|
|
35
37
|
const transport = new StdioServerTransport();
|
|
@@ -3,7 +3,7 @@ const recurrenceRuleSchema = z.object({
|
|
|
3
3
|
freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
|
|
4
4
|
interval: z.number().optional(),
|
|
5
5
|
count: z.number().optional(),
|
|
6
|
-
until: z.string().datetime().optional(), // ISO 8601 string
|
|
6
|
+
until: z.string().datetime({ offset: true }).optional(), // ISO 8601 string
|
|
7
7
|
byday: z.array(z.string()).optional(), // e.g. ["MO", "TU"]
|
|
8
8
|
bymonthday: z.array(z.number()).optional(),
|
|
9
9
|
bymonth: z.array(z.number()).optional(),
|
|
@@ -13,8 +13,14 @@ export function registerCreateEvent(client, server) {
|
|
|
13
13
|
description: "Creates an event in the calendar specified by its URL",
|
|
14
14
|
inputSchema: {
|
|
15
15
|
summary: z.string(),
|
|
16
|
-
start: z
|
|
17
|
-
|
|
16
|
+
start: z
|
|
17
|
+
.string()
|
|
18
|
+
.datetime({ offset: true })
|
|
19
|
+
.describe("Start datetime (ISO 8601)"),
|
|
20
|
+
end: z
|
|
21
|
+
.string()
|
|
22
|
+
.datetime({ offset: true })
|
|
23
|
+
.describe("End datetime (ISO 8601)"),
|
|
18
24
|
calendarUrl: z.string(),
|
|
19
25
|
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
20
26
|
},
|
|
@@ -5,7 +5,10 @@ export function registerDeleteEvent(client, server) {
|
|
|
5
5
|
inputSchema: { uid: z.string(), calendarUrl: z.string() },
|
|
6
6
|
}, async (args) => {
|
|
7
7
|
const { uid, calendarUrl } = args;
|
|
8
|
-
|
|
8
|
+
const base = calendarUrl.endsWith("/") ? calendarUrl : `${calendarUrl}/`;
|
|
9
|
+
const href = `${base}${uid}.ics`;
|
|
10
|
+
const etag = await client.getETag(href);
|
|
11
|
+
await client.deleteEvent(calendarUrl, uid, etag);
|
|
9
12
|
return {
|
|
10
13
|
content: [{ type: "text", text: "Event deleted" }],
|
|
11
14
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const recurrenceRuleSchema = z.object({
|
|
3
|
+
freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
|
|
4
|
+
interval: z.number().optional(),
|
|
5
|
+
count: z.number().optional(),
|
|
6
|
+
until: z.string().datetime({ offset: true }).optional(),
|
|
7
|
+
byday: z.array(z.string()).optional(),
|
|
8
|
+
bymonthday: z.array(z.number()).optional(),
|
|
9
|
+
bymonth: z.array(z.number()).optional(),
|
|
10
|
+
});
|
|
11
|
+
export function registerUpdateEvent(client, server) {
|
|
12
|
+
server.registerTool("update-event", {
|
|
13
|
+
description: "Updates an existing event in the calendar specified by its URL. Only provided fields are changed.",
|
|
14
|
+
inputSchema: {
|
|
15
|
+
uid: z.string(),
|
|
16
|
+
calendarUrl: z.string(),
|
|
17
|
+
summary: z.string().optional(),
|
|
18
|
+
start: z.string().datetime({ offset: true }).optional(),
|
|
19
|
+
end: z.string().datetime({ offset: true }).optional(),
|
|
20
|
+
description: z.string().optional(),
|
|
21
|
+
location: z.string().optional(),
|
|
22
|
+
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
23
|
+
},
|
|
24
|
+
}, async (args) => {
|
|
25
|
+
const { uid, calendarUrl, summary, start, end, description, location, recurrenceRule, } = args;
|
|
26
|
+
const base = calendarUrl.endsWith("/") ? calendarUrl : `${calendarUrl}/`;
|
|
27
|
+
const href = `${base}${uid}.ics`;
|
|
28
|
+
const [existing] = await client.getEventsByHref(calendarUrl, [href]);
|
|
29
|
+
if (!existing) {
|
|
30
|
+
throw new Error(`Event not found: ${uid}`);
|
|
31
|
+
}
|
|
32
|
+
const updated = await client.updateEvent(calendarUrl, {
|
|
33
|
+
...existing,
|
|
34
|
+
...(summary !== undefined && { summary }),
|
|
35
|
+
...(start !== undefined && { start: new Date(start) }),
|
|
36
|
+
...(end !== undefined && { end: new Date(end) }),
|
|
37
|
+
...(description !== undefined && { description }),
|
|
38
|
+
...(location !== undefined && { location }),
|
|
39
|
+
...(recurrenceRule !== undefined && {
|
|
40
|
+
recurrenceRule: recurrenceRule,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: updated.uid }],
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caldav-mcp",
|
|
3
3
|
"description": "A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && shx chmod +x dist/*.js",
|
|
15
15
|
"dev": "tsx --watch --env-file=.env src/index.ts",
|
|
16
|
-
"prepare": "
|
|
16
|
+
"prepare": "lefthook install",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"test:watch": "vitest",
|
|
19
19
|
"test:coverage": "vitest run --coverage",
|
|
20
20
|
"check": "biome check .",
|
|
21
21
|
"check:fix": "biome check --write .",
|
|
22
22
|
"check:ci": "biome ci .",
|
|
23
|
-
"validate": "npm run check && npm test && npm run build",
|
|
23
|
+
"validate": "npm run check && npm test && npm run knip && npm run build",
|
|
24
|
+
"smoke": "npm run build && tsx --env-file=.env scripts/smoke.ts",
|
|
25
|
+
"smoke:agent": "npm run build && bash scripts/smoke-agent.sh",
|
|
24
26
|
"watch": "tsc --watch",
|
|
25
27
|
"semantic-release": "semantic-release",
|
|
26
28
|
"knip": "knip"
|
|
@@ -41,25 +43,25 @@
|
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
45
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
44
|
-
"ts-caldav": "^0.2.
|
|
45
|
-
"zod": "^
|
|
46
|
+
"ts-caldav": "^0.2.9",
|
|
47
|
+
"zod": "^4.4.3"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"@biomejs/biome": "2.
|
|
49
|
-
"@commitlint/cli": "^
|
|
50
|
-
"@commitlint/config-conventional": "^
|
|
50
|
+
"@biomejs/biome": "^2.4.14",
|
|
51
|
+
"@commitlint/cli": "^21.0.0",
|
|
52
|
+
"@commitlint/config-conventional": "^21.0.0",
|
|
51
53
|
"@semantic-release/changelog": "^6.0.3",
|
|
52
54
|
"@semantic-release/git": "^10.0.1",
|
|
53
55
|
"@semantic-release/github": "^12.0.5",
|
|
54
56
|
"@semantic-release/npm": "^13.1.4",
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"@vitest/coverage-v8": "^
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"@types/node": "^25.6.2",
|
|
58
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
59
|
+
"knip": "^6.12.1",
|
|
60
|
+
"lefthook": "^2.1.6",
|
|
59
61
|
"semantic-release": "^25.0.3",
|
|
60
62
|
"shx": "^0.4.0",
|
|
61
63
|
"tsx": "^4.21.0",
|
|
62
|
-
"typescript": "^
|
|
63
|
-
"vitest": "^
|
|
64
|
+
"typescript": "^6.0.3",
|
|
65
|
+
"vitest": "^4.1.5"
|
|
64
66
|
}
|
|
65
67
|
}
|