caldav-mcp 0.1.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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx tsc:*)"
5
+ ],
6
+ "deny": []
7
+ }
8
+ }
@@ -0,0 +1,30 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@v3
14
+
15
+ - name: Set up Node.js
16
+ uses: actions/setup-node@v3
17
+ with:
18
+ node-version: 16 # Specify your Node.js version
19
+ registry-url: https://registry.npmjs.org/
20
+
21
+ - name: Install dependencies
22
+ run: npm install
23
+
24
+ - name: Build package
25
+ run: npm run build
26
+
27
+ - name: Publish to npm
28
+ env:
29
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30
+ run: npm publish
package/CLAUDE.md ADDED
@@ -0,0 +1,46 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This project is a CalDAV client using the Model Context Protocol (MCP) server to expose calendar operations as tools. It uses:
8
+
9
+ - ts-caldav: A TypeScript CalDAV client for interacting with calendar servers
10
+ - MCP SDK: Model Context Protocol for creating tools that can be used by AI assistants
11
+ - dotenv: For environment variable management
12
+
13
+ ## Environment Setup
14
+
15
+ The project requires the following environment variables to be set in a `.env` file:
16
+
17
+ ```
18
+ CALDAV_BASE_URL=<CalDAV server URL>
19
+ CALDAV_USERNAME=<CalDAV username>
20
+ CALDAV_PASSWORD=<CalDAV password>
21
+ ```
22
+
23
+ ## Common Commands
24
+
25
+ ```bash
26
+ # Install dependencies
27
+ npm install
28
+
29
+ # Compile TypeScript to JavaScript
30
+ npx tsc
31
+
32
+ # Run the MCP server
33
+ node index.js
34
+ ```
35
+
36
+ ## Project Architecture
37
+
38
+ The codebase is a simple MCP server implementation that:
39
+
40
+ 1. Connects to a CalDAV server using credentials from environment variables
41
+ 2. Retrieves the user's calendars and uses the first one for operations
42
+ 3. Exposes two MCP tools:
43
+ - `create-event`: Creates a calendar event with summary, start, and end time
44
+ - `list-events`: Lists events between a start and end time
45
+
46
+ The MCP server uses the StdioServerTransport to communicate through stdin/stdout, making it suitable for integration with Claude or other AI assistants that support the Model Context Protocol.
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official email address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127
+ at [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dominik Grusemann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # caldav-mcp
2
+
3
+ A CalDAV client using Model Context Protocol (MCP) to expose calendar operations as tools for AI assistants.
4
+
5
+ ## Features
6
+
7
+ - Connect to CalDAV servers
8
+ - Create calendar events
9
+ - List calendar events within a specific timeframe
10
+
11
+ ## Setup
12
+
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
+ ```
20
+ CALDAV_BASE_URL=<CalDAV server URL>
21
+ CALDAV_USERNAME=<CalDAV username>
22
+ CALDAV_PASSWORD=<CalDAV password>
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ 1. Compile TypeScript to JavaScript:
28
+ ```bash
29
+ npx tsc
30
+ ```
31
+
32
+ 2. Run the MCP server:
33
+ ```bash
34
+ node index.js
35
+ ```
36
+
37
+ ## Available Tools
38
+
39
+ ### create-event
40
+
41
+ Creates a new calendar event.
42
+
43
+ Parameters:
44
+ - `summary`: String - Event title/summary
45
+ - `start`: DateTime string - Event start time
46
+ - `end`: DateTime string - Event end time
47
+
48
+ Returns:
49
+ - The unique ID of the created event
50
+
51
+ ### list-events
52
+
53
+ Lists events within a specified timeframe.
54
+
55
+ Parameters:
56
+ - `start`: DateTime string - Start of the timeframe
57
+ - `end`: DateTime string - End of the timeframe
58
+
59
+ Returns:
60
+ - A list of event summaries that fall within the given timeframe
61
+
62
+ ## License
63
+
64
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("dotenv/config");
4
+ const ts_caldav_1 = require("ts-caldav");
5
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
6
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
7
+ const zod_1 = require("zod");
8
+ const server = new mcp_js_1.McpServer({
9
+ name: "caldav-mcp",
10
+ version: "0.1.0"
11
+ });
12
+ async function main() {
13
+ const client = await ts_caldav_1.CalDAVClient.create({
14
+ baseUrl: process.env.CALDAV_BASE_URL || "",
15
+ auth: {
16
+ type: "basic",
17
+ username: process.env.CALDAV_USERNAME || "",
18
+ password: process.env.CALDAV_PASSWORD || ""
19
+ }
20
+ });
21
+ const calendars = await client.getCalendars();
22
+ const calendar = calendars[0];
23
+ server.tool("create-event", { summary: zod_1.z.string(), start: zod_1.z.string().datetime(), end: zod_1.z.string().datetime() }, async ({ summary, start, end }) => {
24
+ const event = await client.createEvent(calendar.url, {
25
+ summary: summary,
26
+ start: new Date(start),
27
+ end: new Date(end),
28
+ });
29
+ return {
30
+ content: [{ type: "text", text: event.uid }]
31
+ };
32
+ });
33
+ server.tool("list-events", { start: zod_1.z.string().datetime(), end: zod_1.z.string().datetime() }, async ({ start, end }) => {
34
+ const allEvents = await client.getEvents(calendar.url);
35
+ // Filter events that fall within the specified time range
36
+ const startDate = new Date(start);
37
+ const endDate = new Date(end);
38
+ const filteredEvents = allEvents.filter(event => {
39
+ const eventStart = new Date(event.start);
40
+ const eventEnd = new Date(event.end);
41
+ // Event starts before the end time and ends after the start time
42
+ return eventStart <= endDate && eventEnd >= startDate;
43
+ });
44
+ return {
45
+ content: [{ type: "text", text: filteredEvents.map(e => `${e.summary}\nStart: ${e.start}\nEnd: ${e.end}`).join("\n") }]
46
+ };
47
+ });
48
+ // Start receiving messages on stdin and sending messages on stdout
49
+ const transport = new stdio_js_1.StdioServerTransport();
50
+ await server.connect(transport);
51
+ }
52
+ main();
@@ -0,0 +1,9 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+
6
+ export default tseslint.config(
7
+ eslint.configs.recommended,
8
+ ...tseslint.configs.recommended
9
+ );
package/package.json ADDED
@@ -0,0 +1,27 @@
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.1.0",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "lint": "eslint src/"
10
+ },
11
+ "module": "esnext",
12
+ "target": "esnext",
13
+ "author": "Dominik Grusemann",
14
+ "license": "MIT",
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.11.3",
17
+ "dotenv": "^16.5.0",
18
+ "ts-caldav": "^0.1.3"
19
+ },
20
+ "devDependencies": {
21
+ "@eslint/js": "^9.27.0",
22
+ "@types/node": "^22.15.18",
23
+ "eslint": "^9.27.0",
24
+ "typescript": "^5.8.3",
25
+ "typescript-eslint": "^8.32.1"
26
+ }
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,69 @@
1
+ import 'dotenv/config'
2
+ import { CalDAVClient } from "ts-caldav";
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { z } from "zod";
6
+
7
+ const server = new McpServer({
8
+ name: "caldav-mcp",
9
+ version: "0.1.0"
10
+ });
11
+
12
+ async function main() {
13
+ const client = await CalDAVClient.create({
14
+ baseUrl: process.env.CALDAV_BASE_URL || "",
15
+ auth: {
16
+ type: "basic",
17
+ username: process.env.CALDAV_USERNAME || "",
18
+ password: process.env.CALDAV_PASSWORD || ""
19
+ }
20
+ });
21
+
22
+ const calendars = await client.getCalendars();
23
+ const calendar = calendars[0];
24
+
25
+ server.tool(
26
+ "create-event",
27
+ {summary: z.string(), start: z.string().datetime(), end: z.string().datetime()},
28
+ async ({summary, start, end}) => {
29
+ const event = await client.createEvent(calendar.url, {
30
+ summary: summary,
31
+ start: new Date(start),
32
+ end: new Date(end),
33
+ });
34
+ return {
35
+ content: [{type: "text", text: event.uid}]
36
+ };
37
+ }
38
+ );
39
+
40
+ server.tool(
41
+ "list-events",
42
+ {start: z.string().datetime(), end: z.string().datetime()},
43
+ async ({start, end}) => {
44
+ const allEvents = await client.getEvents(calendar.url);
45
+
46
+ // Filter events that fall within the specified time range
47
+ const startDate = new Date(start);
48
+ const endDate = new Date(end);
49
+
50
+ const filteredEvents = allEvents.filter(event => {
51
+ const eventStart = new Date(event.start);
52
+ const eventEnd = new Date(event.end);
53
+
54
+ // Event starts before the end time and ends after the start time
55
+ return eventStart <= endDate && eventEnd >= startDate;
56
+ });
57
+
58
+ return {
59
+ content: [{type: "text", text: filteredEvents.map(e => `${e.summary}\nStart: ${e.start}\nEnd: ${e.end}`).join("\n")}]
60
+ };
61
+ }
62
+ );
63
+
64
+ // Start receiving messages on stdin and sending messages on stdout
65
+ const transport = new StdioServerTransport();
66
+ await server.connect(transport);
67
+ }
68
+
69
+ main()
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2019",
4
+ "module": "commonjs",
5
+ "esModuleInterop": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src"
11
+ },
12
+ "include": [
13
+ "src/**/*"
14
+ ],
15
+ "exclude": [
16
+ "node_modules",
17
+ "dist"
18
+ ]
19
+ }