caldav-mcp 0.11.4 → 0.12.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 +4 -0
- package/dist/tools/create-event.js +22 -1
- package/dist/tools/update-event.js +32 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,6 +164,7 @@ Parameters:
|
|
|
164
164
|
- `description`: string (optional)
|
|
165
165
|
- `end`: string — End datetime (ISO 8601)
|
|
166
166
|
- `location`: string (optional)
|
|
167
|
+
- `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.
|
|
167
168
|
- `recurrenceRule`: object (optional)
|
|
168
169
|
- `byday`: array of string (optional)
|
|
169
170
|
- `bymonth`: array of number (optional)
|
|
@@ -173,6 +174,7 @@ Parameters:
|
|
|
173
174
|
- `interval`: number (optional)
|
|
174
175
|
- `until`: string (optional)
|
|
175
176
|
- `start`: string — Start datetime (ISO 8601)
|
|
177
|
+
- `attendees`: array of string (optional) — Attendee emails (no mailto:), written as ATTENDEE lines; a scheduling-capable server mails them the invitation. Use with organizer.
|
|
176
178
|
- `summary`: string
|
|
177
179
|
- `wholeDay`: boolean (optional) — Create as a whole-day event
|
|
178
180
|
|
|
@@ -188,6 +190,7 @@ Parameters:
|
|
|
188
190
|
- `description`: string (optional)
|
|
189
191
|
- `end`: string (optional)
|
|
190
192
|
- `location`: string (optional)
|
|
193
|
+
- `organizer`: string (optional) — Organizer email (no mailto:); pass to set or change ORGANIZER. Omit to leave it as stored.
|
|
191
194
|
- `recurrenceRule`: object (optional)
|
|
192
195
|
- `byday`: array of string (optional)
|
|
193
196
|
- `bymonth`: array of number (optional)
|
|
@@ -197,6 +200,7 @@ Parameters:
|
|
|
197
200
|
- `interval`: number (optional)
|
|
198
201
|
- `until`: string (optional)
|
|
199
202
|
- `start`: string (optional)
|
|
203
|
+
- `attendees`: array of string (optional) — Full desired attendee list (no mailto:); pass to set/replace ATTENDEE lines. Omit to leave stored attendees untouched.
|
|
200
204
|
- `summary`: string (optional)
|
|
201
205
|
- `uid`: string — Unique identifier of the event to update (obtained from list-events)
|
|
202
206
|
- `wholeDay`: boolean (optional) — Update whether this is a whole-day event
|
|
@@ -12,11 +12,19 @@ export const createEventDefinition = {
|
|
|
12
12
|
.datetime({ offset: true })
|
|
13
13
|
.describe("End datetime (ISO 8601)"),
|
|
14
14
|
location: z.string().optional(),
|
|
15
|
+
organizer: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.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."),
|
|
15
19
|
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
16
20
|
start: z
|
|
17
21
|
.string()
|
|
18
22
|
.datetime({ offset: true })
|
|
19
23
|
.describe("Start datetime (ISO 8601)"),
|
|
24
|
+
attendees: z
|
|
25
|
+
.array(z.string())
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Attendee emails (no mailto:), written as ATTENDEE lines; a scheduling-capable server mails them the invitation. Use with organizer."),
|
|
20
28
|
summary: z.string(),
|
|
21
29
|
wholeDay: z.boolean().optional().describe("Create as a whole-day event"),
|
|
22
30
|
},
|
|
@@ -28,8 +36,18 @@ export function registerCreateEvent(client, server) {
|
|
|
28
36
|
description: createEventDefinition.description,
|
|
29
37
|
inputSchema: createEventDefinition.inputSchema,
|
|
30
38
|
}, async (args) => {
|
|
31
|
-
const { summary, start, end, wholeDay, description, location, recurrenceRule, } = args;
|
|
39
|
+
const { summary, start, end, wholeDay, description, location, recurrenceRule, organizer, attendees, } = args;
|
|
32
40
|
const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
|
|
41
|
+
// organizer/attendees are written through the ts-caldav customFields
|
|
42
|
+
// escape hatch (unknown props round-trip as raw ICS lines). The typed
|
|
43
|
+
// cast keeps this compiling across ts-caldav versions.
|
|
44
|
+
const customFields = {};
|
|
45
|
+
if (organizer) {
|
|
46
|
+
customFields.organizer = `mailto:${organizer}`;
|
|
47
|
+
}
|
|
48
|
+
if (attendees?.length) {
|
|
49
|
+
customFields.attendee = attendees.map((a) => `mailto:${a}`);
|
|
50
|
+
}
|
|
33
51
|
const event = await client.createEvent(calendarUrl, {
|
|
34
52
|
end: wholeDay ? toWholeDayDate(end) : new Date(end),
|
|
35
53
|
start: wholeDay ? toWholeDayDate(start) : new Date(start),
|
|
@@ -40,6 +58,9 @@ export function registerCreateEvent(client, server) {
|
|
|
40
58
|
...(recurrenceRule !== undefined && {
|
|
41
59
|
recurrenceRule: toRecurrenceRule(recurrenceRule, wholeDay),
|
|
42
60
|
}),
|
|
61
|
+
...(Object.keys(customFields).length > 0 && {
|
|
62
|
+
customFields: customFields,
|
|
63
|
+
}),
|
|
43
64
|
});
|
|
44
65
|
return {
|
|
45
66
|
content: [{ text: event.uid, type: "text" }],
|
|
@@ -9,8 +9,16 @@ export const updateEventDefinition = {
|
|
|
9
9
|
description: z.string().optional(),
|
|
10
10
|
end: z.string().datetime({ offset: true }).optional(),
|
|
11
11
|
location: z.string().optional(),
|
|
12
|
+
organizer: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Organizer email (no mailto:); pass to set or change ORGANIZER. Omit to leave it as stored."),
|
|
12
16
|
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
13
17
|
start: z.string().datetime({ offset: true }).optional(),
|
|
18
|
+
attendees: z
|
|
19
|
+
.array(z.string())
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Full desired attendee list (no mailto:); pass to set/replace ATTENDEE lines. Omit to leave stored attendees untouched."),
|
|
14
22
|
summary: z.string().optional(),
|
|
15
23
|
uid: z
|
|
16
24
|
.string()
|
|
@@ -23,12 +31,32 @@ export const updateEventDefinition = {
|
|
|
23
31
|
name: "update-event",
|
|
24
32
|
returns: "The unique ID of the updated event",
|
|
25
33
|
};
|
|
34
|
+
// Merge organizer/attendees into the event's stored customFields
|
|
35
|
+
// (ts-caldav round-trips unknown props there); never wipe other fields.
|
|
36
|
+
// An empty organizer or attendee list removes the stored value.
|
|
37
|
+
function mergeSchedulingFields(existing, organizer, attendees) {
|
|
38
|
+
const { organizer: storedOrganizer, attendee: storedAttendees, ...rest } = existing.customFields ?? {};
|
|
39
|
+
const next = { ...rest };
|
|
40
|
+
const nextOrganizer = organizer === undefined
|
|
41
|
+
? storedOrganizer
|
|
42
|
+
: organizer && `mailto:${organizer}`;
|
|
43
|
+
if (nextOrganizer) {
|
|
44
|
+
next.organizer = nextOrganizer;
|
|
45
|
+
}
|
|
46
|
+
const nextAttendees = attendees === undefined
|
|
47
|
+
? storedAttendees
|
|
48
|
+
: attendees.map((a) => `mailto:${a}`);
|
|
49
|
+
if (nextAttendees?.length) {
|
|
50
|
+
next.attendee = nextAttendees;
|
|
51
|
+
}
|
|
52
|
+
return next;
|
|
53
|
+
}
|
|
26
54
|
export function registerUpdateEvent(client, server) {
|
|
27
55
|
server.registerTool(updateEventDefinition.name, {
|
|
28
56
|
description: updateEventDefinition.description,
|
|
29
57
|
inputSchema: updateEventDefinition.inputSchema,
|
|
30
58
|
}, async (args) => {
|
|
31
|
-
const { uid, summary, start, end, wholeDay, description, location, recurrenceRule, } = args;
|
|
59
|
+
const { uid, summary, start, end, wholeDay, description, location, recurrenceRule, organizer, attendees, } = args;
|
|
32
60
|
const calendarUrl = toCalendarPath(args.calendarUrl, client.baseUrl);
|
|
33
61
|
const href = hrefFor(calendarUrl, uid);
|
|
34
62
|
const [existing] = await client.getEventsByHref(calendarUrl, [href]);
|
|
@@ -54,6 +82,9 @@ export function registerUpdateEvent(client, server) {
|
|
|
54
82
|
...(recurrenceRule !== undefined && {
|
|
55
83
|
recurrenceRule: toRecurrenceRule(recurrenceRule, effectiveWholeDay),
|
|
56
84
|
}),
|
|
85
|
+
...((organizer !== undefined || attendees !== undefined) && {
|
|
86
|
+
customFields: mergeSchedulingFields(existing, organizer, attendees),
|
|
87
|
+
}),
|
|
57
88
|
});
|
|
58
89
|
return {
|
|
59
90
|
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.12.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": {
|