caldav-mcp 0.1.3 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +26 -11
  2. package/dist/index.js +35 -15
  3. package/package.json +22 -9
package/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # caldav-mcp
2
2
 
3
- A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.
3
+ <div align="center">
4
4
 
5
- ## Features
5
+ 🗓️ A CalDAV Model Context Protocol (MCP) server to expose calendar operations as tools for AI assistants.
6
+
7
+ [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
8
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io)
9
+ [![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
10
+
11
+ </div>
12
+
13
+ ## ✨ Features
6
14
 
7
15
  - Connect to CalDAV servers
8
16
  - Create calendar events
@@ -10,16 +18,23 @@ A CalDAV client using Model Context Protocol (MCP) to expose calendar operations
10
18
 
11
19
  ## Setup
12
20
 
13
- 1. Install dependencies:
14
- ```bash
15
- npm install
16
- ```
17
-
18
- 2. Create a `.env` file in the project root with your CalDAV credentials:
19
21
  ```
20
- CALDAV_BASE_URL=<CalDAV server URL>
21
- CALDAV_USERNAME=<CalDAV username>
22
- CALDAV_PASSWORD=<CalDAV password>
22
+ {
23
+ "mcpServers": {
24
+ ...,
25
+ "calendar": {
26
+ "command": "npx",
27
+ "args": [
28
+ "caldav-mcp"
29
+ ],
30
+ "env": {
31
+ "CALDAV_BASE_URL": "<CalDAV server URL>",
32
+ "CALDAV_USERNAME": "<CalDAV username>",
33
+ "CALDAV_PASSWORD": "<CalDAV password>"
34
+ }
35
+ }
36
+ }
37
+ }
23
38
  ```
24
39
 
25
40
  ## Usage
package/dist/index.js CHANGED
@@ -8,6 +8,20 @@ const server = new McpServer({
8
8
  name: "caldav-mcp",
9
9
  version: "0.1.0"
10
10
  });
11
+ const recurrenceRuleSchema = z.object({
12
+ freq: z.enum(["DAILY", "WEEKLY", "MONTHLY", "YEARLY"]).optional(),
13
+ interval: z.number().optional(),
14
+ count: z.number().optional(),
15
+ until: z.string().datetime().optional(), // ISO 8601 string
16
+ byday: z.array(z.string()).optional(), // e.g. ["MO", "TU"]
17
+ bymonthday: z.array(z.number()).optional(),
18
+ bymonth: z.array(z.number()).optional(),
19
+ });
20
+ const dateString = z
21
+ .string()
22
+ .refine((val) => !isNaN(Date.parse(val)), {
23
+ message: "Invalid date string",
24
+ });
11
25
  async function main() {
12
26
  const client = await CalDAVClient.create({
13
27
  baseUrl: process.env.CALDAV_BASE_URL || "",
@@ -18,32 +32,38 @@ async function main() {
18
32
  }
19
33
  });
20
34
  const calendars = await client.getCalendars();
21
- const calendar = calendars[0];
22
- server.tool("create-event", { summary: z.string(), start: z.string().datetime(), end: z.string().datetime() }, async ({ summary, start, end }) => {
23
- const event = await client.createEvent(calendar.url, {
35
+ server.tool("create-event", "Creates an event in the calendar specified by its URL", { summary: z.string(), start: z.string().datetime(), end: z.string().datetime(), calendarUrl: z.string(), recurrenceRule: recurrenceRuleSchema.optional() }, async ({ calendarUrl, summary, start, end, recurrenceRule }) => {
36
+ const event = await client.createEvent(calendarUrl, {
24
37
  summary: summary,
25
38
  start: new Date(start),
26
39
  end: new Date(end),
40
+ recurrenceRule: recurrenceRule,
27
41
  });
28
42
  return {
29
43
  content: [{ type: "text", text: event.uid }]
30
44
  };
31
45
  });
32
- server.tool("list-events", { start: z.string().datetime(), end: z.string().datetime() }, async ({ start, end }) => {
33
- const allEvents = await client.getEvents(calendar.url);
34
- // Filter events that fall within the specified time range
35
- const startDate = new Date(start);
36
- const endDate = new Date(end);
37
- const filteredEvents = allEvents.filter(event => {
38
- const eventStart = new Date(event.start);
39
- const eventEnd = new Date(event.end);
40
- // Event starts before the end time and ends after the start time
41
- return eventStart <= endDate && eventEnd >= startDate;
42
- });
46
+ server.tool("list-events", "List all events between start and end date in the calendar specified by its URL", { start: dateString, end: dateString, calendarUrl: z.string() }, async ({ calendarUrl, start, end }) => {
47
+ const options = {
48
+ start: new Date(start),
49
+ end: new Date(end),
50
+ };
51
+ const allEvents = await client.getEvents(calendarUrl, options);
52
+ const data = allEvents.map(e => ({ summary: e.summary, start: e.start, end: e.end }));
43
53
  return {
44
- content: [{ type: "text", text: filteredEvents.map(e => `${e.summary}\nStart: ${e.start}\nEnd: ${e.end}`).join("\n") }]
54
+ content: [{ type: "text", text: JSON.stringify(data) }]
45
55
  };
46
56
  });
57
+ server.tool("delete-event", "Deletes an event in the calendar specified by its URL", { uid: z.string(), calendarUrl: z.string() }, async ({ uid, calendarUrl }) => {
58
+ await client.deleteEvent(calendarUrl, uid);
59
+ return {
60
+ content: [{ type: "text", text: "Event deleted" }]
61
+ };
62
+ });
63
+ server.tool("list-calendars", "List all calendars returning both name and URL", {}, async () => {
64
+ const data = calendars.map(c => ({ name: c.displayName, url: c.url }));
65
+ return { content: [{ type: "text", text: JSON.stringify(data) }] };
66
+ });
47
67
  // Start receiving messages on stdin and sending messages on stdout
48
68
  const transport = new StdioServerTransport();
49
69
  await server.connect(transport);
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.1.3",
4
+ "version": "0.2.0",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -13,23 +13,36 @@
13
13
  "scripts": {
14
14
  "build": "tsc && shx chmod +x dist/*.js",
15
15
  "prepare": "npm run build",
16
- "test": "echo \"Error: no test specified\" && exit 1",
16
+ "test": "echo \"Error: no test specified\" && exit 0",
17
17
  "lint": "eslint src/",
18
- "watch": "tsc --watch"
18
+ "watch": "tsc --watch",
19
+ "semantic-release": "semantic-release"
19
20
  },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/dominik1001/caldav-mcp.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/dominik1001/caldav-mcp/issues"
27
+ },
28
+ "homepage": "https://github.com/dominik1001/caldav-mcp#readme",
20
29
  "author": "Dominik Grusemann",
21
30
  "license": "MIT",
22
31
  "dependencies": {
23
- "@modelcontextprotocol/sdk": "^1.11.3",
32
+ "@modelcontextprotocol/sdk": "^1.12.1",
24
33
  "dotenv": "^16.5.0",
25
- "ts-caldav": "^0.1.3"
34
+ "ts-caldav": "^0.1.7"
26
35
  },
27
36
  "devDependencies": {
28
- "@eslint/js": "^9.27.0",
29
- "@types/node": "^22.15.18",
30
- "eslint": "^9.27.0",
37
+ "@eslint/js": "^9.28.0",
38
+ "@semantic-release/changelog": "^6.0.3",
39
+ "@semantic-release/git": "^10.0.1",
40
+ "@semantic-release/github": "^11.0.3",
41
+ "@types/node": "^24.0.1",
42
+ "eslint": "^9.28.0",
43
+ "semantic-release": "^24.2.5",
31
44
  "shx": "^0.4.0",
32
45
  "typescript": "^5.8.3",
33
- "typescript-eslint": "^8.32.1"
46
+ "typescript-eslint": "^8.34.0"
34
47
  }
35
48
  }