caldav-mcp 0.2.1 → 0.3.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 +48 -6
- package/dist/index.js +10 -2
- package/dist/tools/create-event.js +9 -6
- package/dist/tools/delete-event.js +4 -1
- package/dist/tools/list-calendars.js +5 -3
- package/dist/tools/list-events.js +9 -1
- package/package.json +58 -61
- package/dist/tools/create-event.test.js +0 -4
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
🗓️ A CalDAV Model Context Protocol (MCP) server to expose calendar operations as tools for AI assistants.
|
|
6
6
|
|
|
7
|
+
[](https://github.com/dominik1001/caldav-mcp/actions/workflows/release.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/caldav-mcp)
|
|
7
9
|
[](https://choosealicense.com/licenses/mit/)
|
|
8
10
|
[](https://github.com/prettier/prettier)
|
|
9
11
|
[](https://modelcontextprotocol.io)
|
|
@@ -14,8 +16,10 @@
|
|
|
14
16
|
## ✨ Features
|
|
15
17
|
|
|
16
18
|
- Connect to CalDAV servers
|
|
17
|
-
-
|
|
19
|
+
- List calendars
|
|
18
20
|
- List calendar events within a specific timeframe
|
|
21
|
+
- Create calendar events
|
|
22
|
+
- Delete calendar events by UID
|
|
19
23
|
|
|
20
24
|
## Setup
|
|
21
25
|
|
|
@@ -38,16 +42,29 @@
|
|
|
38
42
|
}
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
##
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
### Quick Start
|
|
48
|
+
|
|
49
|
+
Run the MCP server in development mode with auto-reload:
|
|
50
|
+
```bash
|
|
51
|
+
npm run dev
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This will run the TypeScript code directly with watch mode and automatically load environment variables from `.env`.
|
|
55
|
+
|
|
56
|
+
### Manual Build
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
Alternatively, you can compile TypeScript to JavaScript and run it:
|
|
59
|
+
|
|
60
|
+
1. Compile:
|
|
44
61
|
```bash
|
|
45
62
|
npx tsc
|
|
46
63
|
```
|
|
47
64
|
|
|
48
|
-
2. Run
|
|
65
|
+
2. Run:
|
|
49
66
|
```bash
|
|
50
|
-
node index.js
|
|
67
|
+
node dist/index.js
|
|
51
68
|
```
|
|
52
69
|
|
|
53
70
|
## Available Tools
|
|
@@ -71,9 +88,34 @@ Lists events within a specified timeframe.
|
|
|
71
88
|
Parameters:
|
|
72
89
|
- `start`: DateTime string - Start of the timeframe
|
|
73
90
|
- `end`: DateTime string - End of the timeframe
|
|
91
|
+
- `calendarUrl`: String - URL of the calendar
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
- A list of events that fall within the given timeframe, each containing:
|
|
95
|
+
- `uid`: Unique identifier for the event (required for deletion)
|
|
96
|
+
- `summary`: Event title/summary
|
|
97
|
+
- `start`: Event start time
|
|
98
|
+
- `end`: Event end time
|
|
99
|
+
|
|
100
|
+
### delete-event
|
|
101
|
+
|
|
102
|
+
Deletes an event from the calendar.
|
|
103
|
+
|
|
104
|
+
Parameters:
|
|
105
|
+
- `uid`: String - Unique identifier of the event to delete (obtained from list-events)
|
|
106
|
+
- `calendarUrl`: String - URL of the calendar
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
- Confirmation message when the event is successfully deleted
|
|
110
|
+
|
|
111
|
+
### list-calendars
|
|
112
|
+
|
|
113
|
+
Lists all available calendars.
|
|
114
|
+
|
|
115
|
+
Parameters: none
|
|
74
116
|
|
|
75
117
|
Returns:
|
|
76
|
-
-
|
|
118
|
+
- List of all available calendars
|
|
77
119
|
|
|
78
120
|
## License
|
|
79
121
|
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "dotenv/config";
|
|
3
|
-
import { CalDAVClient } from "ts-caldav";
|
|
4
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CalDAVClient } from "ts-caldav";
|
|
6
5
|
import { registerCreateEvent } from "./tools/create-event.js";
|
|
7
6
|
import { registerDeleteEvent } from "./tools/delete-event.js";
|
|
8
7
|
import { registerListCalendars } from "./tools/list-calendars.js";
|
|
@@ -20,6 +19,15 @@ async function main() {
|
|
|
20
19
|
password: process.env.CALDAV_PASSWORD || "",
|
|
21
20
|
},
|
|
22
21
|
});
|
|
22
|
+
// Test connection on startup
|
|
23
|
+
try {
|
|
24
|
+
await client.getCalendars();
|
|
25
|
+
console.log("✅ Connected to CalDAV server");
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("❌ Failed to connect to CalDAV server:", error);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
23
31
|
registerCreateEvent(client, server);
|
|
24
32
|
registerListEvents(client, server);
|
|
25
33
|
registerDeleteEvent(client, server);
|
|
@@ -9,12 +9,15 @@ const recurrenceRuleSchema = z.object({
|
|
|
9
9
|
bymonth: z.array(z.number()).optional(),
|
|
10
10
|
});
|
|
11
11
|
export function registerCreateEvent(client, server) {
|
|
12
|
-
server.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
server.registerTool("create-event", {
|
|
13
|
+
description: "Creates an event in the calendar specified by its URL",
|
|
14
|
+
inputSchema: {
|
|
15
|
+
summary: z.string(),
|
|
16
|
+
start: z.string().datetime(),
|
|
17
|
+
end: z.string().datetime(),
|
|
18
|
+
calendarUrl: z.string(),
|
|
19
|
+
recurrenceRule: recurrenceRuleSchema.optional(),
|
|
20
|
+
},
|
|
18
21
|
}, async ({ calendarUrl, summary, start, end, recurrenceRule }) => {
|
|
19
22
|
const event = await client.createEvent(calendarUrl, {
|
|
20
23
|
summary: summary,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export function registerDeleteEvent(client, server) {
|
|
3
|
-
server.
|
|
3
|
+
server.registerTool("delete-event", {
|
|
4
|
+
description: "Deletes an event in the calendar specified by its URL",
|
|
5
|
+
inputSchema: { uid: z.string(), calendarUrl: z.string() },
|
|
6
|
+
}, async ({ uid, calendarUrl }) => {
|
|
4
7
|
await client.deleteEvent(calendarUrl, uid);
|
|
5
8
|
return {
|
|
6
9
|
content: [{ type: "text", text: "Event deleted" }],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export async function registerListCalendars(client, server) {
|
|
2
2
|
const calendars = await client.getCalendars();
|
|
3
|
-
server.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
server.registerTool("list-calendars", {
|
|
4
|
+
description: "List all calendars returning both name and URL",
|
|
5
|
+
inputSchema: {},
|
|
6
|
+
}, async () => {
|
|
7
|
+
return { content: [{ type: "text", text: JSON.stringify(calendars) }] };
|
|
6
8
|
});
|
|
7
9
|
}
|
|
@@ -3,13 +3,21 @@ const dateString = z.string().refine((val) => !isNaN(Date.parse(val)), {
|
|
|
3
3
|
message: "Invalid date string",
|
|
4
4
|
});
|
|
5
5
|
export function registerListEvents(client, server) {
|
|
6
|
-
server.
|
|
6
|
+
server.registerTool("list-events", {
|
|
7
|
+
description: "List all events between start and end date in the calendar specified by its URL",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
start: dateString,
|
|
10
|
+
end: dateString,
|
|
11
|
+
calendarUrl: z.string(),
|
|
12
|
+
},
|
|
13
|
+
}, async ({ calendarUrl, start, end }) => {
|
|
7
14
|
const options = {
|
|
8
15
|
start: new Date(start),
|
|
9
16
|
end: new Date(end),
|
|
10
17
|
};
|
|
11
18
|
const allEvents = await client.getEvents(calendarUrl, options);
|
|
12
19
|
const data = allEvents.map((e) => ({
|
|
20
|
+
uid: e.uid,
|
|
13
21
|
summary: e.summary,
|
|
14
22
|
start: e.start,
|
|
15
23
|
end: e.end,
|
package/package.json
CHANGED
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"prettier --write"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
2
|
+
"name": "caldav-mcp",
|
|
3
|
+
"description": "A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"caldav-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": ["dist"],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && shx chmod +x dist/*.js",
|
|
13
|
+
"dev": "tsx --watch --env-file=.env src/index.ts",
|
|
14
|
+
"prepare": "husky",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"test:coverage": "vitest run --coverage",
|
|
18
|
+
"check": "biome check .",
|
|
19
|
+
"check:fix": "biome check --write .",
|
|
20
|
+
"check:ci": "biome ci .",
|
|
21
|
+
"validate": "npm run check && npm test && npm run build",
|
|
22
|
+
"watch": "tsc --watch",
|
|
23
|
+
"semantic-release": "semantic-release"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/dominik1001/caldav-mcp.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/dominik1001/caldav-mcp/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/dominik1001/caldav-mcp#readme",
|
|
33
|
+
"author": "Dominik Grusemann",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0",
|
|
37
|
+
"npm": ">=9.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.13.0",
|
|
41
|
+
"ts-caldav": "^0.2.5"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@biomejs/biome": "2.3.14",
|
|
45
|
+
"@commitlint/cli": "^20.4.1",
|
|
46
|
+
"@commitlint/config-conventional": "^20.4.1",
|
|
47
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
48
|
+
"@semantic-release/git": "^10.0.1",
|
|
49
|
+
"@semantic-release/github": "^12.0.5",
|
|
50
|
+
"@semantic-release/npm": "^13.1.4",
|
|
51
|
+
"@types/node": "^24.0.3",
|
|
52
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"semantic-release": "^25.0.3",
|
|
55
|
+
"shx": "^0.4.0",
|
|
56
|
+
"tsx": "^4.21.0",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vitest": "^3.2.4"
|
|
59
|
+
}
|
|
63
60
|
}
|