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 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
+ [![Release](https://github.com/dominik1001/caldav-mcp/actions/workflows/release.yml/badge.svg)](https://github.com/dominik1001/caldav-mcp/actions/workflows/release.yml)
8
+ [![npm version](https://badge.fury.io/js/caldav-mcp.svg)](https://www.npmjs.com/package/caldav-mcp)
7
9
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
8
10
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
9
11
  [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io)
@@ -14,8 +16,10 @@
14
16
  ## ✨ Features
15
17
 
16
18
  - Connect to CalDAV servers
17
- - Create calendar events
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
- ## Usage
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
- 1. Compile TypeScript to JavaScript:
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 the MCP server:
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
- - A list of event summaries that fall within the given timeframe
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.tool("create-event", "Creates an event in the calendar specified by its URL", {
13
- summary: z.string(),
14
- start: z.string().datetime(),
15
- end: z.string().datetime(),
16
- calendarUrl: z.string(),
17
- recurrenceRule: recurrenceRuleSchema.optional(),
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.tool("delete-event", "Deletes an event in the calendar specified by its URL", { uid: z.string(), calendarUrl: z.string() }, async ({ uid, calendarUrl }) => {
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.tool("list-calendars", "List all calendars returning both name and URL", {}, async () => {
4
- const data = calendars.map((c) => ({ name: c.displayName, url: c.url }));
5
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
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.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 }) => {
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
- "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.2.1",
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "bin": {
8
- "caldav-mcp": "dist/index.js"
9
- },
10
- "files": [
11
- "dist"
12
- ],
13
- "scripts": {
14
- "build": "tsc && shx chmod +x dist/*.js",
15
- "prepare": "npm run build && husky",
16
- "test": "vitest run",
17
- "test:watch": "vitest",
18
- "lint": "eslint src/",
19
- "lint:fix": "eslint src/ --fix",
20
- "watch": "tsc --watch",
21
- "semantic-release": "semantic-release",
22
- "format": "prettier --write src/.",
23
- "format:check": "prettier --check src/."
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
- "dependencies": {
36
- "@modelcontextprotocol/sdk": "^1.13.0",
37
- "dotenv": "^16.5.0",
38
- "ts-caldav": "^0.2.0"
39
- },
40
- "devDependencies": {
41
- "@eslint/js": "^9.29.0",
42
- "@semantic-release/changelog": "^6.0.3",
43
- "@semantic-release/git": "^10.0.1",
44
- "@semantic-release/github": "^11.0.3",
45
- "@types/node": "^24.0.3",
46
- "eslint": "^9.29.0",
47
- "eslint-config-prettier": "^10.1.5",
48
- "husky": "^9.1.7",
49
- "lint-staged": "^16.1.2",
50
- "prettier": "3.5.3",
51
- "semantic-release": "^24.2.5",
52
- "shx": "^0.4.0",
53
- "typescript": "^5.8.3",
54
- "typescript-eslint": "^8.34.1",
55
- "vitest": "^3.0.0"
56
- },
57
- "lint-staged": {
58
- "src/**/*.{ts,tsx,js,jsx}": [
59
- "eslint --fix",
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
  }
@@ -1,4 +0,0 @@
1
- import { describe, test } from "vitest";
2
- describe("registerCreateEvent", () => {
3
- test("to be implemented", () => { });
4
- });