feat: Implement a CalDAV client and integrate it as tools within the FastMCP server for calendar and event management.

This commit is contained in:
Lago
2026-01-18 22:30:14 +01:00
parent 9f60aafd15
commit d8cb818040
11 changed files with 1426 additions and 1 deletions

View File

@@ -1,2 +1,92 @@
# MCP-CalDAV
# MCP CalDAV Server
An Model Context Protocol (MCP) server that connects to a CalDAV server (tested with Baikal) to manage calendars and events.
## Features
- **List Calendars**: View all available calendars.
- **List Events**:
- Filter by specific calendar or search **globally across all calendars**.
- Filter by time range (start/end date).
- **Manage Events**:
- Create new events.
- Update existing events.
- Delete events.
## Prerequisites
- **Python 3.14** or higher
- **uv** (Universal Python Package Manager)
## Installation
1. Clone the repository:
```bash
git clone <repository_url>
cd MCP-CalDAV
```
2. Install dependencies:
```bash
uv sync
```
## Configuration
Create a `.env` file in the root directory with your CalDAV credentials:
```env
CALDAV_URL=http://your-server:port/dav.php
CALDAV_USERNAME=YourUsername
CALDAV_PASSWORD=YourPassword
```
## Usage
### Running Manually
You can run the server directly using `uv`. It communicates via standard input/output (stdio), so running it directly in a terminal will just wait for input.
```bash
uv run src/server.py
```
### Configuring an MCP Client
To use this with an MCP client (like Claude Desktop or another MCP-compatible app), add the following configuration to your client's settings (e.g., `claude_desktop_config.json`):
```json
{
"mcpServers": {
"caldav": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\LagoWorkStation\\OneDrive\\Documentos\\MCP-CalDAV",
"run",
"src/server.py"
]
}
}
}
```
*Note: Adjust the absolute path to point to your project directory.*
## Available Tools
- **`list_calendars()`**
- Returns a list of all calendars the user has access to.
- **`list_events(calendar_name=None, start_date=None, end_date=None)`**
- Lists events.
- `calendar_name` (optional): Name of the calendar. If omitted, searches **ALL** calendars.
- `start_date` (optional): Start of the range (YYYY-MM-DD or ISO).
- `end_date` (optional): End of the range.
- **`create_event(calendar_name, summary, start_time, end_time, description="")`**
- Creates an event.
- **`update_event(calendar_name, event_uid, summary=None, start_time=None, end_time=None, description=None)`**
- Updates an event by UID.
- **`delete_event(calendar_name, event_uid)`**
- Deletes an event by UID.