caldav-mcp 0.7.0 → 0.9.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 +52 -36
- package/dist/tools/create-event.js +44 -18
- package/dist/tools/delete-event.js +14 -3
- package/dist/tools/list-calendars.js +9 -3
- package/dist/tools/list-events.js +25 -17
- package/dist/tools/update-event.js +39 -13
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -70,70 +70,86 @@ node dist/index.js
|
|
|
70
70
|
|
|
71
71
|
## Available Tools
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
<!-- TOOLS:START - generated by scripts/gen-tool-docs.ts -->
|
|
74
|
+
### list-calendars
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
List all calendars returning both name and URL
|
|
76
77
|
|
|
77
|
-
Parameters:
|
|
78
|
-
- `summary`: String - Event title/summary
|
|
79
|
-
- `start`: DateTime string - Event start time
|
|
80
|
-
- `end`: DateTime string - Event end time
|
|
78
|
+
Parameters: none
|
|
81
79
|
|
|
82
80
|
Returns:
|
|
83
|
-
-
|
|
81
|
+
- List of all available calendars
|
|
84
82
|
|
|
85
83
|
### list-events
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
List all events between start and end date in the calendar specified by its URL
|
|
88
86
|
|
|
89
87
|
Parameters:
|
|
90
|
-
- `start`:
|
|
91
|
-
- `end`:
|
|
92
|
-
- `calendarUrl`:
|
|
88
|
+
- `start`: string — Start date (ISO 8601)
|
|
89
|
+
- `end`: string — End date (ISO 8601)
|
|
90
|
+
- `calendarUrl`: string
|
|
93
91
|
|
|
94
92
|
Returns:
|
|
95
|
-
- A list of events that fall within the given timeframe, each containing
|
|
96
|
-
- `uid`: Unique identifier for the event (required for deletion)
|
|
97
|
-
- `summary`: Event title/summary
|
|
98
|
-
- `start`: Event start time
|
|
99
|
-
- `end`: Event end time
|
|
93
|
+
- A list of events that fall within the given timeframe, each containing `uid`, `summary`, `start`, `end`, and optionally `description` and `location`
|
|
100
94
|
|
|
101
|
-
###
|
|
95
|
+
### create-event
|
|
102
96
|
|
|
103
|
-
|
|
97
|
+
Creates an event in the calendar specified by its URL
|
|
104
98
|
|
|
105
99
|
Parameters:
|
|
106
|
-
- `
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
109
|
-
- `
|
|
110
|
-
- `
|
|
111
|
-
- `
|
|
112
|
-
- `
|
|
113
|
-
- `
|
|
100
|
+
- `summary`: string
|
|
101
|
+
- `start`: string — Start datetime (ISO 8601)
|
|
102
|
+
- `end`: string — End datetime (ISO 8601)
|
|
103
|
+
- `calendarUrl`: string
|
|
104
|
+
- `description`: string (optional)
|
|
105
|
+
- `location`: string (optional)
|
|
106
|
+
- `recurrenceRule`: object (optional)
|
|
107
|
+
- `freq`: enum (`DAILY` | `WEEKLY` | `MONTHLY` | `YEARLY`) (optional)
|
|
108
|
+
- `interval`: number (optional)
|
|
109
|
+
- `count`: number (optional)
|
|
110
|
+
- `until`: string (optional)
|
|
111
|
+
- `byday`: array of string (optional)
|
|
112
|
+
- `bymonthday`: array of number (optional)
|
|
113
|
+
- `bymonth`: array of number (optional)
|
|
114
114
|
|
|
115
115
|
Returns:
|
|
116
|
-
- The unique ID of the
|
|
116
|
+
- The unique ID of the created event
|
|
117
117
|
|
|
118
|
-
###
|
|
118
|
+
### update-event
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
Updates an existing event in the calendar specified by its URL. Only provided fields are changed.
|
|
121
121
|
|
|
122
122
|
Parameters:
|
|
123
|
-
- `uid`:
|
|
124
|
-
- `calendarUrl`:
|
|
123
|
+
- `uid`: string — Unique identifier of the event to update (obtained from list-events)
|
|
124
|
+
- `calendarUrl`: string
|
|
125
|
+
- `summary`: string (optional)
|
|
126
|
+
- `start`: string (optional)
|
|
127
|
+
- `end`: string (optional)
|
|
128
|
+
- `description`: string (optional)
|
|
129
|
+
- `location`: string (optional)
|
|
130
|
+
- `recurrenceRule`: object (optional)
|
|
131
|
+
- `freq`: enum (`DAILY` | `WEEKLY` | `MONTHLY` | `YEARLY`) (optional)
|
|
132
|
+
- `interval`: number (optional)
|
|
133
|
+
- `count`: number (optional)
|
|
134
|
+
- `until`: string (optional)
|
|
135
|
+
- `byday`: array of string (optional)
|
|
136
|
+
- `bymonthday`: array of number (optional)
|
|
137
|
+
- `bymonth`: array of number (optional)
|
|
125
138
|
|
|
126
139
|
Returns:
|
|
127
|
-
-
|
|
140
|
+
- The unique ID of the updated event
|
|
128
141
|
|
|
129
|
-
###
|
|
142
|
+
### delete-event
|
|
130
143
|
|
|
131
|
-
|
|
144
|
+
Deletes an event in the calendar specified by its URL
|
|
132
145
|
|
|
133
|
-
Parameters:
|
|
146
|
+
Parameters:
|
|
147
|
+
- `uid`: string — Unique identifier of the event to delete (obtained from list-events)
|
|
148
|
+
- `calendarUrl`: string
|
|
134
149
|
|
|
135
150
|
Returns:
|
|
136
|
-
-
|
|
151
|
+
- Confirmation message when the event is successfully deleted
|
|
152
|
+
<!-- TOOLS:END -->
|
|
137
153
|
|
|
138
154
|
## License
|
|
139
155
|
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
function toRecurrenceRule(r) {
|
|
3
|
+
const out = {};
|
|
4
|
+
if (r.freq !== undefined)
|
|
5
|
+
out.freq = r.freq;
|
|
6
|
+
if (r.interval !== undefined)
|
|
7
|
+
out.interval = r.interval;
|
|
8
|
+
if (r.count !== undefined)
|
|
9
|
+
out.count = r.count;
|
|
10
|
+
if (r.until !== undefined)
|
|
11
|
+
out.until = new Date(r.until);
|
|
12
|
+
if (r.byday !== undefined)
|
|
13
|
+
out.byday = r.byday;
|
|
14
|
+
if (r.bymonthday !== undefined)
|
|
15
|
+
out.bymonthday = r.bymonthday;
|
|
16
|
+
if (r.bymonth !== undefined)
|
|
17
|
+
out.bymonth = r.bymonth;
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
2
20
|
const recurrenceRuleSchema = z.object({
|
|
3
21
|
freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
|
|
4
22
|
interval: z.number().optional(),
|
|
@@ -8,24 +26,30 @@ const recurrenceRuleSchema = z.object({
|
|
|
8
26
|
bymonthday: z.array(z.number()).optional(),
|
|
9
27
|
bymonth: z.array(z.number()).optional(),
|
|
10
28
|
});
|
|
29
|
+
export const createEventDefinition = {
|
|
30
|
+
name: "create-event",
|
|
31
|
+
description: "Creates an event in the calendar specified by its URL",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
summary: z.string(),
|
|
34
|
+
start: z
|
|
35
|
+
.string()
|
|
36
|
+
.datetime({ offset: true })
|
|
37
|
+
.describe("Start datetime (ISO 8601)"),
|
|
38
|
+
end: z
|
|
39
|
+
.string()
|
|
40
|
+
.datetime({ offset: true })
|
|
41
|
+
.describe("End datetime (ISO 8601)"),
|
|
42
|
+
calendarUrl: z.string(),
|
|
43
|
+
description: z.string().optional(),
|
|
44
|
+
location: z.string().optional(),
|
|
45
|
+
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
46
|
+
},
|
|
47
|
+
returns: "The unique ID of the created event",
|
|
48
|
+
};
|
|
11
49
|
export function registerCreateEvent(client, server) {
|
|
12
|
-
server.registerTool(
|
|
13
|
-
description:
|
|
14
|
-
inputSchema:
|
|
15
|
-
summary: z.string(),
|
|
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)"),
|
|
24
|
-
calendarUrl: z.string(),
|
|
25
|
-
description: z.string().optional(),
|
|
26
|
-
location: z.string().optional(),
|
|
27
|
-
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
28
|
-
},
|
|
50
|
+
server.registerTool(createEventDefinition.name, {
|
|
51
|
+
description: createEventDefinition.description,
|
|
52
|
+
inputSchema: createEventDefinition.inputSchema,
|
|
29
53
|
}, async (args) => {
|
|
30
54
|
const { calendarUrl, summary, start, end, description, location, recurrenceRule, } = args;
|
|
31
55
|
const event = await client.createEvent(calendarUrl, {
|
|
@@ -34,7 +58,9 @@ export function registerCreateEvent(client, server) {
|
|
|
34
58
|
end: new Date(end),
|
|
35
59
|
...(description !== undefined && { description }),
|
|
36
60
|
...(location !== undefined && { location }),
|
|
37
|
-
recurrenceRule
|
|
61
|
+
...(recurrenceRule !== undefined && {
|
|
62
|
+
recurrenceRule: toRecurrenceRule(recurrenceRule),
|
|
63
|
+
}),
|
|
38
64
|
});
|
|
39
65
|
return {
|
|
40
66
|
content: [{ type: "text", text: event.uid }],
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export const deleteEventDefinition = {
|
|
3
|
+
name: "delete-event",
|
|
4
|
+
description: "Deletes an event in the calendar specified by its URL",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
uid: z
|
|
7
|
+
.string()
|
|
8
|
+
.describe("Unique identifier of the event to delete (obtained from list-events)"),
|
|
9
|
+
calendarUrl: z.string(),
|
|
10
|
+
},
|
|
11
|
+
returns: "Confirmation message when the event is successfully deleted",
|
|
12
|
+
};
|
|
2
13
|
export function registerDeleteEvent(client, server) {
|
|
3
|
-
server.registerTool(
|
|
4
|
-
description:
|
|
5
|
-
inputSchema:
|
|
14
|
+
server.registerTool(deleteEventDefinition.name, {
|
|
15
|
+
description: deleteEventDefinition.description,
|
|
16
|
+
inputSchema: deleteEventDefinition.inputSchema,
|
|
6
17
|
}, async (args) => {
|
|
7
18
|
const { uid, calendarUrl } = args;
|
|
8
19
|
const base = calendarUrl.endsWith("/") ? calendarUrl : `${calendarUrl}/`;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
export const listCalendarsDefinition = {
|
|
2
|
+
name: "list-calendars",
|
|
3
|
+
description: "List all calendars returning both name and URL",
|
|
4
|
+
inputSchema: {},
|
|
5
|
+
returns: "List of all available calendars",
|
|
6
|
+
};
|
|
1
7
|
export async function registerListCalendars(client, server) {
|
|
2
8
|
const calendars = await client.getCalendars();
|
|
3
|
-
server.registerTool(
|
|
4
|
-
description:
|
|
5
|
-
inputSchema:
|
|
9
|
+
server.registerTool(listCalendarsDefinition.name, {
|
|
10
|
+
description: listCalendarsDefinition.description,
|
|
11
|
+
inputSchema: listCalendarsDefinition.inputSchema,
|
|
6
12
|
}, async () => {
|
|
7
13
|
return { content: [{ type: "text", text: JSON.stringify(calendars) }] };
|
|
8
14
|
});
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export const listEventsDefinition = {
|
|
3
|
+
name: "list-events",
|
|
4
|
+
description: "List all events between start and end date in the calendar specified by its URL",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
start: z
|
|
7
|
+
.string()
|
|
8
|
+
.refine((val) => !Number.isNaN(Date.parse(val)), {
|
|
9
|
+
message: "Invalid date string",
|
|
10
|
+
})
|
|
11
|
+
.describe("Start date (ISO 8601)"),
|
|
12
|
+
end: z
|
|
13
|
+
.string()
|
|
14
|
+
.refine((val) => !Number.isNaN(Date.parse(val)), {
|
|
15
|
+
message: "Invalid date string",
|
|
16
|
+
})
|
|
17
|
+
.describe("End date (ISO 8601)"),
|
|
18
|
+
calendarUrl: z.string(),
|
|
19
|
+
},
|
|
20
|
+
returns: "A list of events that fall within the given timeframe, each containing `uid`, `summary`, `start`, `end`, and optionally `description` and `location`",
|
|
21
|
+
};
|
|
2
22
|
export function registerListEvents(client, server) {
|
|
3
|
-
server.registerTool(
|
|
4
|
-
description:
|
|
5
|
-
inputSchema:
|
|
6
|
-
start: z
|
|
7
|
-
.string()
|
|
8
|
-
.refine((val) => !Number.isNaN(Date.parse(val)), {
|
|
9
|
-
message: "Invalid date string",
|
|
10
|
-
})
|
|
11
|
-
.describe("Start date (ISO 8601)"),
|
|
12
|
-
end: z
|
|
13
|
-
.string()
|
|
14
|
-
.refine((val) => !Number.isNaN(Date.parse(val)), {
|
|
15
|
-
message: "Invalid date string",
|
|
16
|
-
})
|
|
17
|
-
.describe("End date (ISO 8601)"),
|
|
18
|
-
calendarUrl: z.string(),
|
|
19
|
-
},
|
|
23
|
+
server.registerTool(listEventsDefinition.name, {
|
|
24
|
+
description: listEventsDefinition.description,
|
|
25
|
+
inputSchema: listEventsDefinition.inputSchema,
|
|
20
26
|
}, async (args) => {
|
|
21
27
|
const { calendarUrl, start, end } = args;
|
|
22
28
|
const options = {
|
|
@@ -29,6 +35,8 @@ export function registerListEvents(client, server) {
|
|
|
29
35
|
summary: e.summary,
|
|
30
36
|
start: e.start,
|
|
31
37
|
end: e.end,
|
|
38
|
+
...(e.description && { description: e.description }),
|
|
39
|
+
...(e.location && { location: e.location }),
|
|
32
40
|
}));
|
|
33
41
|
return {
|
|
34
42
|
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
function toRecurrenceRule(r) {
|
|
3
|
+
const out = {};
|
|
4
|
+
if (r.freq !== undefined)
|
|
5
|
+
out.freq = r.freq;
|
|
6
|
+
if (r.interval !== undefined)
|
|
7
|
+
out.interval = r.interval;
|
|
8
|
+
if (r.count !== undefined)
|
|
9
|
+
out.count = r.count;
|
|
10
|
+
if (r.until !== undefined)
|
|
11
|
+
out.until = new Date(r.until);
|
|
12
|
+
if (r.byday !== undefined)
|
|
13
|
+
out.byday = r.byday;
|
|
14
|
+
if (r.bymonthday !== undefined)
|
|
15
|
+
out.bymonthday = r.bymonthday;
|
|
16
|
+
if (r.bymonth !== undefined)
|
|
17
|
+
out.bymonth = r.bymonth;
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
2
20
|
const recurrenceRuleSchema = z.object({
|
|
3
21
|
freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
|
|
4
22
|
interval: z.number().optional(),
|
|
@@ -8,19 +26,27 @@ const recurrenceRuleSchema = z.object({
|
|
|
8
26
|
bymonthday: z.array(z.number()).optional(),
|
|
9
27
|
bymonth: z.array(z.number()).optional(),
|
|
10
28
|
});
|
|
29
|
+
export const updateEventDefinition = {
|
|
30
|
+
name: "update-event",
|
|
31
|
+
description: "Updates an existing event in the calendar specified by its URL. Only provided fields are changed.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
uid: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe("Unique identifier of the event to update (obtained from list-events)"),
|
|
36
|
+
calendarUrl: z.string(),
|
|
37
|
+
summary: z.string().optional(),
|
|
38
|
+
start: z.string().datetime({ offset: true }).optional(),
|
|
39
|
+
end: z.string().datetime({ offset: true }).optional(),
|
|
40
|
+
description: z.string().optional(),
|
|
41
|
+
location: z.string().optional(),
|
|
42
|
+
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
43
|
+
},
|
|
44
|
+
returns: "The unique ID of the updated event",
|
|
45
|
+
};
|
|
11
46
|
export function registerUpdateEvent(client, server) {
|
|
12
|
-
server.registerTool(
|
|
13
|
-
description:
|
|
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
|
-
},
|
|
47
|
+
server.registerTool(updateEventDefinition.name, {
|
|
48
|
+
description: updateEventDefinition.description,
|
|
49
|
+
inputSchema: updateEventDefinition.inputSchema,
|
|
24
50
|
}, async (args) => {
|
|
25
51
|
const { uid, calendarUrl, summary, start, end, description, location, recurrenceRule, } = args;
|
|
26
52
|
const base = calendarUrl.endsWith("/") ? calendarUrl : `${calendarUrl}/`;
|
|
@@ -37,7 +63,7 @@ export function registerUpdateEvent(client, server) {
|
|
|
37
63
|
...(description !== undefined && { description }),
|
|
38
64
|
...(location !== undefined && { location }),
|
|
39
65
|
...(recurrenceRule !== undefined && {
|
|
40
|
-
recurrenceRule: recurrenceRule,
|
|
66
|
+
recurrenceRule: toRecurrenceRule(recurrenceRule),
|
|
41
67
|
}),
|
|
42
68
|
});
|
|
43
69
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caldav-mcp",
|
|
3
|
+
"mcpName": "io.github.dominik1001/caldav-mcp",
|
|
3
4
|
"description": "A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.",
|
|
4
|
-
"version": "0.
|
|
5
|
+
"version": "0.9.0",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"bin": {
|
|
@@ -20,7 +21,9 @@
|
|
|
20
21
|
"check": "biome check .",
|
|
21
22
|
"check:fix": "biome check --write .",
|
|
22
23
|
"check:ci": "biome ci .",
|
|
23
|
-
"
|
|
24
|
+
"docs": "tsx scripts/gen-tool-docs.ts",
|
|
25
|
+
"docs:check": "tsx scripts/gen-tool-docs.ts --check",
|
|
26
|
+
"validate": "npm run check && npm test && npm run knip && npm run docs:check && npm run build",
|
|
24
27
|
"smoke": "npm run build && tsx --env-file=.env scripts/smoke.ts",
|
|
25
28
|
"smoke:agent": "npm run build && bash scripts/smoke-agent.sh",
|
|
26
29
|
"watch": "tsc --watch",
|