icloud-calendar-mcp

icloud-calendar-mcp

MCP server for iCloud (Apple) Calendar access via CalDAV

Category
访问服务器

README

iCloud Calendar MCP Server

Build npm PyPI License MCP Registry Tests Security

A security-first MCP (Model Context Protocol) server that provides AI assistants with secure access to iCloud Calendar via CalDAV. Built with comprehensive security controls aligned with the OWASP MCP Top 10.

[!CAUTION] Never use your main Apple ID password. This server requires an app-specific password which can be revoked independently without affecting your Apple ID.

Features

MCP Tools

Tool Description Read-Only Destructive
list_calendars List all calendars from iCloud account Yes No
get_events Get events within a date range from a calendar Yes No
create_event Create a new calendar event No No
update_event Update an existing event No No
delete_event Delete an event by ID No Yes

MCP Resources

Resource Description
calendar://calendars Browse available calendars

Security Features

  • Credential Protection - Environment variables only, never in code or config
  • Input Validation - All parameters validated with SSRF protection
  • Rate Limiting - 60 reads/min, 20 writes/min per MCP specification
  • Secure Error Handling - No sensitive data leakage in error messages
  • OWASP MCP Top 10 Compliance - 239 security tests covering all major risks
  • ReDoS Protection - All regex patterns tested against catastrophic backtracking
  • Unicode Security - Protection against homoglyph and encoding attacks

Quick Start

Prerequisites

Installation

Choose your preferred installation method:

Option 1: npm (Recommended)

npx @icloud-calendar-mcp/server

Option 2: Python (uvx)

uvx icloud-calendar-mcp

Option 3: Direct JAR

# Download from GitHub Releases
curl -LO https://github.com/icloud-calendar-mcp/icloud-calendar-mcp/releases/latest/download/icloud-calendar-mcp-1.0.0-all.jar

# Run
java -jar icloud-calendar-mcp-1.0.0-all.jar

Option 4: Build from Source

git clone https://github.com/icloud-calendar-mcp/icloud-calendar-mcp.git
cd icloud-calendar-mcp
./gradlew fatJar
java -jar build/libs/icloud-calendar-mcp-1.0.0-all.jar

Configuration

Set your iCloud credentials as environment variables:

export ICLOUD_USERNAME="your-apple-id@icloud.com"
export ICLOUD_PASSWORD="your-app-specific-password"

Security Note: Use an app-specific password, not your main Apple ID password.


Claude Desktop Integration

Add to your Claude Desktop configuration:

Platform Config Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Linux ~/.config/claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json

<details open> <summary><strong>Using npm (Recommended)</strong></summary>

{
  "mcpServers": {
    "icloud-calendar": {
      "command": "npx",
      "args": ["@icloud-calendar-mcp/server"],
      "env": {
        "ICLOUD_USERNAME": "your-apple-id@icloud.com",
        "ICLOUD_PASSWORD": "your-app-specific-password"
      }
    }
  }
}

</details>

<details> <summary><strong>Using uvx (Python)</strong></summary>

{
  "mcpServers": {
    "icloud-calendar": {
      "command": "uvx",
      "args": ["icloud-calendar-mcp"],
      "env": {
        "ICLOUD_USERNAME": "your-apple-id@icloud.com",
        "ICLOUD_PASSWORD": "your-app-specific-password"
      }
    }
  }
}

</details>

<details> <summary><strong>Using JAR directly</strong></summary>

{
  "mcpServers": {
    "icloud-calendar": {
      "command": "java",
      "args": ["-jar", "/path/to/icloud-calendar-mcp-1.0.0-all.jar"],
      "env": {
        "ICLOUD_USERNAME": "your-apple-id@icloud.com",
        "ICLOUD_PASSWORD": "your-app-specific-password"
      }
    }
  }
}

</details>


Usage Examples

Once configured, you can ask Claude:

  • "What's on my calendar this week?"
  • "Create a meeting with John tomorrow at 2pm"
  • "Show me all my calendars"
  • "Delete the dentist appointment on Friday"
  • "Move my 3pm meeting to 4pm"

Tool Parameters

list_calendars

No parameters required.

get_events

Parameter Type Required Description
calendar_id string Yes Calendar identifier
start_date string Yes Start date (YYYY-MM-DD)
end_date string Yes End date (YYYY-MM-DD)

create_event

Parameter Type Required Description
calendar_id string Yes Target calendar
title string Yes Event title
start_time string Yes ISO 8601 datetime or YYYY-MM-DD
end_time string Yes ISO 8601 datetime or YYYY-MM-DD
description string No Event description
location string No Event location
is_all_day boolean No All-day event flag

update_event

Parameter Type Required Description
event_id string Yes Event to update
title string No New title
start_time string No New start time
end_time string No New end time
description string No New description
location string No New location

delete_event

Parameter Type Required Description
event_id string Yes Event to delete

Security

This server is designed with security as a primary concern, following the OWASP MCP Top 10 guidelines.

Security Controls

Control Implementation
Credential Storage Environment variables only, never logged or exposed
Input Validation All inputs validated (calendar IDs, dates, times, text fields)
SSRF Protection Blocks internal IPs, localhost, and dangerous URI schemes
Rate Limiting Sliding window: 60 reads/min, 20 writes/min
Error Handling Passwords, tokens, paths, emails sanitized from errors
Injection Prevention ICS content properly escaped, command injection tested
ReDoS Protection All regex patterns tested for catastrophic backtracking
Unicode Security Homoglyph, normalization, and encoding bypass protection

OWASP MCP Top 10 Coverage

Risk Mitigation Tests
MCP01: Token Mismanagement Credentials masked in logs/errors, secure storage 14
MCP02: Privilege Escalation Fixed tool set, no dynamic registration 5
MCP03: Tool Argument Injection Input validation, parameterized operations 8
MCP04: Sensitive Data Exposure Error sanitization, credential masking 10
MCP05: Command Injection Input treated as data, not executed 3
MCP06: Prompt Injection Malicious text stored as data, not interpreted 3
MCP08: Insecure Logging Rate limiting, sensitive data sanitization 31
MCP09: Resource Exhaustion Rate limiting, input size limits, DoS protection 25
MCP10: Context Over-sharing Isolated state, no cross-request data leakage 3

See SECURITY.md for full security documentation and vulnerability disclosure process.


Testing

The server includes 555 comprehensive tests across 26 test suites:

./gradlew test

Test Coverage

Category Tests Description
Security 239 Adversarial inputs, OWASP MCP Top 10, ReDoS, Unicode
CalDAV Protocol 105 XML parsing, HTTP client, models
ICS Parsing 48 RFC 5545 compliance, edge cases
Input Validation 39 All parameter validation rules
Error Handling 32 Secure error responses
Integration 26 End-to-end tool execution
Service Layer 21 Calendar operations, caching
Rate Limiting 15 Concurrent access, window reset
Cancellation 12 Operation cancellation, cleanup
Logging 9 MCP logging compliance
Progress 9 Progress reporting

Security Test Categories

Category Tests Coverage
Adversarial Inputs 53 SQL/NoSQL injection, XSS, path traversal
Unicode Security 38 Homoglyphs, normalization, RTL override
Logger Security 31 Log injection, credential sanitization
OWASP MCP Risks 29 MCP01-10 specific attack vectors
Progress Security 27 Token enumeration, injection
ReDoS Protection 25 Catastrophic backtracking, resource exhaustion
Cancellation Security 22 Replay attacks, race conditions
Credential Security 14 Token masking, secure storage

Running Specific Tests

# All tests
./gradlew test

# Security tests only
./gradlew test --tests "*SecurityTest*"
./gradlew test --tests "AdversarialTest"

# OWASP MCP specific tests
./gradlew test --tests "OwaspMcpSecurityTest"

# Unicode security tests
./gradlew test --tests "UnicodeSecurityTest"

# ReDoS protection tests
./gradlew test --tests "ReDoSSecurityTest"

# CalDAV tests
./gradlew test --tests "*CalDav*"

# ICS tests
./gradlew test --tests "*Ics*"

Architecture

+------------------------------------------------------------------+
|                    MCP Server (STDIO Transport)                    |
|                                                                    |
|  +----------------+  +----------------+  +----------------------+  |
|  | Rate Limiter   |  |   Input        |  |  Secure Error        |  |
|  | 60r/20w/min    |  |  Validator     |  |  Handler             |  |
|  +----------------+  +----------------+  +----------------------+  |
|                                                                    |
|  +----------------+  +----------------+  +----------------------+  |
|  | MCP Logger     |  | Cancellation   |  |  Progress            |  |
|  | (RFC 5424)     |  | Manager        |  |  Reporter            |  |
|  +----------------+  +----------------+  +----------------------+  |
|                                                                    |
|  Tools: list_calendars | get_events | create_event |               |
|         update_event | delete_event                                |
|                                                                    |
|  Resources: calendar://calendars                                   |
+------------------------------------------------------------------+
                              |
                              v
+------------------------------------------------------------------+
|                      CalendarService                               |
|  Orchestrates CalDAV operations, caches calendar metadata          |
+------------------------------------------------------------------+
                              |
                              v
+------------------------------------------------------------------+
|                      CalDAV Client Layer                           |
|                                                                    |
|  +-------------------+  +-------------------+  +----------------+  |
|  | OkHttpCalDav      |  |  IcsParser        |  |  IcsBuilder    |  |
|  | Client            |  |  (ical4j)         |  |  (RFC 5545)    |  |
|  +-------------------+  +-------------------+  +----------------+  |
|                                                                    |
|  +-------------------+  +-------------------+                      |
|  | ICloudXml         |  |  Credential       |                      |
|  | Parser            |  |  Manager          |                      |
|  +-------------------+  +-------------------+                      |
+------------------------------------------------------------------+
                              |
                              v
+------------------------------------------------------------------+
|                    iCloud CalDAV API                               |
|                    caldav.icloud.com                               |
+------------------------------------------------------------------+

Development

Build

# Build
./gradlew build

# Build fat JAR
./gradlew fatJar

# Run tests
./gradlew test

# Clean build
./gradlew clean build

Project Structure

src/main/kotlin/org/onekash/mcp/calendar/
├── Main.kt                 # MCP server entry point
├── caldav/                 # CalDAV protocol implementation
│   ├── CalDavClient.kt     # Client interface
│   ├── CalDavModels.kt     # Domain models
│   ├── OkHttpCalDavClient.kt
│   └── ICloudXmlParser.kt
├── ics/                    # ICS format handling
│   ├── IcsParser.kt        # Parse iCalendar data
│   └── IcsBuilder.kt       # Generate iCalendar data
├── service/                # Business logic
│   ├── CalendarService.kt
│   └── EventCache.kt
├── security/               # Security controls
│   └── CredentialManager.kt
├── validation/             # Input validation
│   └── InputValidator.kt
├── error/                  # Error handling
│   └── SecureErrorHandler.kt
├── ratelimit/              # Rate limiting
│   └── RateLimiter.kt
├── logging/                # MCP logging
│   └── McpLogger.kt
├── progress/               # Progress reporting
│   └── ProgressReporter.kt
└── cancellation/           # Operation cancellation
    └── CancellationManager.kt

Testing with MCP Inspector

ICLOUD_USERNAME="test@icloud.com" \
ICLOUD_PASSWORD="test-app-password" \
npx @mcp-use/inspector java -jar build/libs/icloud-calendar-mcp-1.0.0-all.jar

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Security Issues

For security vulnerabilities, please see SECURITY.md for our responsible disclosure process. Do not open public issues for security vulnerabilities.


License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选