caldav-mcp 0.4.1 → 0.5.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 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.string().datetime().describe("Start datetime (ISO 8601)"),
17
- end: z.string().datetime().describe("End datetime (ISO 8601)"),
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
- await client.deleteEvent(calendarUrl, uid);
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.1",
4
+ "version": "0.5.0",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {