苹果提醒远程MCP服务

跨平台的苹果提醒MCP服务器,通过Python服务器在家庭macOS机器上运行,通过Cloudflare Tunnel暴露到互联网,可从Windows、手机等远程访问。

  • by avtomonstr
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 avtomonstr/apple-reminders-remote-mcp

使用说明

苹果提醒远程MCP

用于Apple提醒的跨平台MCP服务器。Python服务器运行在家庭macOS机器上(通过Swift CLI桥访问EventKit),通过Cloudflare隧道暴露在互联网上,从任何地方(Windows办公室、电话等)作为远程MCP服务器使用。

建筑

┌──────────────────────────┐                                    ┌──────────────────────────────────────────┐
│  Windows (office)        │      HTTPS (internet)              │  macOS at home                           │
│  Claude Code             │  ◄──────────────────────────────►  │                                          │
│                          │                                    │  cloudflared ──► localhost:8000           │
│  claude mcp add          │                                    │                    │                      │
│    --transport http      │                                    │              FastMCP server (Python)      │
│    reminders             │                                    │                    │                      │
│    https://reminders     │                                    │              Swift CLI (EventKitCLI)      │
│      .yourdomain.com/mcp │                                    │                    │                      │
│                          │                                    │              Apple Reminders (EventKit)   │
└──────────────────────────┘                                    └──────────────────────────────────────────┘
                                         │
                                    Cloudflare Tunnel
                                    (outbound-only from Mac,
                                     HTTPS + DDoS protection,
                                     no port forwarding needed)

Mac安装程序(服务器主机)

先决条件

  • 带苹果提醒的macOS
  • Python 3.12+
  • 紫外线 包管理器
  • Xcode命令行工具(用于Swift桥)
  • Cloudflare上的域名(免费计划有效)
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install cloudflared
brew install cloudflared

1.克隆并安装

git clone <repo-url> ~/apple-reminders-remote-mcp
cd ~/apple-reminders-remote-mcp
uv sync --all-extras

2.搭建Swift桥

cd swift-bridge && swift build -c release && cd ..

首次运行时,macOS将提示“提醒”访问权限——授予它。您可以通过以下方式验证权限:

./scripts/check-permissions.sh

3.配置环境

cp .env.example .env

编辑 .env:

# Generate a strong random token
REMINDERS_API_TOKEN=$(openssl rand -hex 32)
HOST=127.0.0.1
PORT=8000
SWIFT_BRIDGE_PATH=./swift-bridge/.build/release/EventKitCLI
# Your Cloudflare Tunnel hostname (required — without it, requests get 421)
EXTERNAL_HOST=reminders.yourdomain.com

4.本地测试

# Start the server
uv run python -m server

# In another terminal, verify it responds
curl -H "Authorization: Bearer <your-token>" http://localhost:8000/mcp

5.设置Cloudflare隧道

# Authenticate with Cloudflare
cloudflared tunnel login

# Create a named tunnel
cloudflared tunnel create apple-reminders

# Create DNS record pointing to the tunnel
cloudflared tunnel route dns apple-reminders reminders.yourdomain.com

创建 tunnel/config.yml (从示例中):

tunnel: <TUNNEL_UUID>
credentials-file: ~/.cloudflared/<TUNNEL_UUID>.json
ingress:
  - hostname: reminders.yourdomain.com
    service: http://localhost:8000
  - service: http_status:404

测试隧道:

cloudflared tunnel --config tunnel/config.yml run apple-reminders

6.作为启动代理安装(启动时自动启动)

./scripts/install-service.sh

这将安装两个macOS启动代理:

  • MCP 服务器 — ~/Library/LaunchAgents/com.reminders-mcp.server.plist
  • Cloudflare 隧道 — ~/Library/LaunchAgents/com.reminders-mcp.tunnel.plist

两者都会在登录时自动启动 KeepAlive 启用。日志转到 ~/Library/Logs/reminders-mcp-*.log.

重要提示: 在系统设置中启用自动登录,以便EventKit在Mac无头运行时工作。

Windows/远程客户端安装程序

克劳德代码(CLI)

原生HTTP传输支持——无需代理:

claude mcp add --transport http apple-reminders https://reminders.yourdomain.com/mcp \
  --header "Authorization: Bearer <your-token>" \
  --scope user

或添加到 .mcp.json 在您的主目录或项目根目录中:

{
  "mcpServers": {
    "apple-reminders": {
      "type": "http",
      "url": "https://reminders.yourdomain.com/mcp",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}

克劳德桌面版

Claude Desktop仅支持stdio传输,因此请使用 mcp遥控器 作为代理。 需要安装Node.js。

添加 claude_desktop_config.json (%APPDATA%\Claude\claude_desktop_config.json 在Windows上, ~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):

{
  "mcpServers": {
    "apple-reminders": {
      "command": "cmd",
      "args": [
        "/C",
        "npx",
        "-y",
        "mcp-remote",
        "https://reminders.yourdomain.com/mcp",
        "--header",
        "Authorization: Bearer <your-token>"
      ]
    }
  }
}

在macOS/Linux上,使用 npx 直接代替 cmd /C npx:

{
  "mcpServers": {
    "apple-reminders": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://reminders.yourdomain.com/mcp",
        "--header",
        "Authorization: Bearer <your-token>"
      ]
    }
  }
}

发展

# Install all dependencies (including dev)
uv sync --all-extras

# Run server (dev mode)
uv run python -m server

# Run server with auto-reload
uv run python -m server --reload

# Run tests
uv run pytest -v

# Lint and format
uv run ruff check .
uv run ruff format .

# Type check
uv run python -m mypy server/

# Full check
uv run ruff check . && uv run ruff format --check . && uv run python -m mypy server/

MCP工具

服务器公开了3个工具:

工具 操作 描述
reminders_lists 读取、创建、更新、删除 管理提醒列表
reminders_tasks 读取、创建、更新、删除 CRUD用于带过滤器的提醒(列表、优先级、截止日期、标签、搜索)
reminders_subtasks 读取、创建、更新、删除、切换、重新排序 管理提醒中的子任务

安全

  • 服务器绑定到 127.0.0.1 仅--无直接端口暴露
  • 对所有人进行承载令牌身份验证 /mcp 路线(时间安全比较)
  • 仅通过Cloudflare隧道进行外部访问(加密,仅限出站)
  • 令牌存储在 .env,从未承诺
  • 考虑启用 Cloudflare访问 用于额外的零信任身份验证层