macOS Automation MCP Server

macOS Automation MCP Server

Enables macOS automation through 45 AppleScript-powered tools for system control, app management, calendar, reminders, notifications, clipboard, and task scheduling.

Category
访问服务器

README

macOS Automation MCP Server

A comprehensive MCP (Model Context Protocol) server for macOS automation via AppleScript. This server provides 45 universal tools for system control, application management, calendar, reminders, notifications, clipboard operations, and scheduled tasks.

Built with FastMCP and Pydantic for type-safe, production-ready operation.

✅ Verified Working

  • macOS 26.1+ compatible
  • All 45 tools registered and functional
  • AppleScript execution engine tested
  • Shell command safety validation active

Features

P0 - Essential Tools (12 System + 6 App + 3 Notification + 3 Clipboard = 24 tools)

  • System Control: Volume, dark mode, display sleep, WiFi, text-to-speech, screenshots
  • Application Control: Launch, quit, list, and manage running applications
  • Notifications: Send notifications, alerts, and dialogs
  • Clipboard: Read, write, and manage clipboard contents

P1 - Extended Tools (6 Finder + 3 Calendar + 5 Reminders = 14 tools)

  • Finder Operations: Create folders, move to trash, reveal files, search
  • Calendar Integration: List, create, and manage calendar events
  • Reminders Integration: List, create, complete, and manage reminders

P2 - Advanced Tools (4 Script + 3 Scheduler = 7 tools)

  • Script Execution: Run AppleScript and shell commands
  • Task Scheduler: Create and manage launchd scheduled tasks

Installation

Prerequisites

  • macOS 10.15 or later
  • Python 3.10 or later
  • uv (recommended) or pip

Install with uv (Recommended)

cd /path/to/mcp-applescript-automation
uv sync

Install with pip

cd /path/to/mcp-applescript-automation
pip install -e .

Configuration

Claude Desktop / Cursor

Add to your MCP configuration file:

{
  "mcpServers": {
    "macos-automation": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/mcp-applescript-automation", "python", "main.py"],
      "env": {}
    }
  }
}

Minerva Platform

Add to config/mcp-servers.json:

"macos-automation-mcp": {
  "command": "uv",
  "args": ["run", "--directory", "/Volumes/dev-4tb/AA-GitHub/MCP/mcp-applescript-automation", "python", "main.py"],
  "env": {},
  "description": "macOS Automation MCP: System control, app management, calendar, reminders, notifications, scheduled tasks via AppleScript"
}

Permissions

This server requires certain macOS permissions to function:

  1. Automation Permission (Required)

    • System Preferences > Privacy & Security > Privacy > Automation
    • Grant permission to your terminal app (Terminal, iTerm2, Cursor, etc.)
  2. Accessibility Permission (For some UI automation)

    • System Preferences > Privacy & Security > Privacy > Accessibility
    • Required for advanced UI interactions
  3. Calendar/Reminders Access (For calendar/reminder tools)

    • System Preferences > Privacy & Security > Privacy > Calendars/Reminders
    • Required for calendar and reminder management

Available Tools (45 Total)

System Control (12 tools)

Tool Description
get_system_info Get macOS version, hostname, user, and uptime
set_volume Set system volume (0-100)
get_volume Get current volume level
toggle_mute Toggle audio mute
toggle_dark_mode Toggle dark/light mode
set_dark_mode Set dark mode explicitly
is_dark_mode Check if dark mode is enabled
sleep_display Put display to sleep
say_text Speak text using TTS
take_screenshot Capture screenshot
get_wifi_network Get current WiFi network
toggle_wifi Enable/disable WiFi

Application Control (6 tools)

Tool Description
list_running_apps List all running applications
get_frontmost_app Get active application info
launch_app Launch an application
quit_app Quit an application
hide_app Hide an application
is_app_running Check if app is running

Notifications (3 tools)

Tool Description
send_notification Send macOS notification
send_alert Show alert dialog
choose_from_list Show selection dialog

Clipboard (3 tools)

Tool Description
get_clipboard Get clipboard text
set_clipboard Copy text to clipboard
clear_clipboard Clear clipboard

Finder (6 tools)

Tool Description
reveal_in_finder Reveal file in Finder
create_folder Create new folder
move_to_trash Move items to Trash
empty_trash Empty Trash
get_selected_files Get Finder selection
search_files Search using Spotlight

Calendar (3 tools)

Tool Description
list_calendars List all calendars
list_calendar_events List upcoming events
create_calendar_event Create new event

Reminders (5 tools)

Tool Description
list_reminder_lists List reminder lists
list_reminders List reminders
create_reminder Create new reminder
complete_reminder Mark reminder complete
get_overdue_reminders Get overdue items

Scripts (4 tools)

Tool Description
run_applescript Execute AppleScript code
run_shell_command Execute shell command (with safety checks)
open_url Open URL in browser
open_file Open file with app

Task Scheduler (3 tools)

Tool Description
create_scheduled_task Create launchd task
list_scheduled_tasks List managed tasks
remove_scheduled_task Remove a task

Complete Tool List (Alphabetical)

choose_from_list, clear_clipboard, complete_reminder, create_calendar_event,
create_folder, create_reminder, create_scheduled_task, empty_trash,
get_clipboard, get_frontmost_app, get_overdue_reminders, get_selected_files,
get_system_info, get_volume, get_wifi_network, hide_app, is_app_running,
is_dark_mode, launch_app, list_calendar_events, list_calendars,
list_reminder_lists, list_reminders, list_running_apps, list_scheduled_tasks,
move_to_trash, open_file, open_url, quit_app, remove_scheduled_task,
reveal_in_finder, run_applescript, run_shell_command, say_text, search_files,
send_alert, send_notification, set_clipboard, set_dark_mode, set_volume,
sleep_display, take_screenshot, toggle_dark_mode, toggle_mute, toggle_wifi

Example Usage

Via Claude/Cursor

"Set my system volume to 50%"
"What applications are currently running?"
"Send me a notification with title 'Reminder' and message 'Check email'"
"Create a calendar event for tomorrow at 2pm called 'Team Meeting'"
"What's on my clipboard?"

Via MCP Tool Calls

# Set volume
result = await callMCPTool('macos-automation__set_volume', {'level': 50})

# Send notification
result = await callMCPTool('macos-automation__send_notification', {
    'title': 'Hello',
    'message': 'World'
})

# List running apps
result = await callMCPTool('macos-automation__list_running_apps', {})

Security

Shell Command Safety

The run_shell_command tool includes safety checks that block dangerous commands. Only whitelisted commands are allowed:

  • System info: sw_vers, uname, hostname, whoami, etc.
  • File info: ls, pwd, stat, file, etc.
  • Network info: networksetup, ifconfig, etc.
  • macOS utilities: defaults, launchctl, open, etc.

Dangerous patterns like rm -rf /, sudo rm, fork bombs, etc. are blocked.

AppleScript Sandboxing

AppleScript execution respects macOS sandboxing and permission systems. Scripts cannot access protected resources without proper permissions.

Development

Running Tests

uv run pytest tests/ -v

Verification

# Verify server loads correctly
cd /Volumes/dev-4tb/AA-GitHub/MCP/mcp-applescript-automation
uv run python -c "from macos_automation_mcp import mcp; print(f'Server: {mcp.name}')"

# List all registered tools
uv run python -c "
from macos_automation_mcp.server import mcp
tools = list(mcp._tool_manager._tools.keys())
print(f'Registered {len(tools)} tools')
for t in sorted(tools): print(f'  - {t}')
"

# Test basic functionality
uv run python -c "
from macos_automation_mcp.domains import system
result = system.get_system_info()
print(f'macOS: {result.get(\"macos_version\")}')
print(f'Host: {result.get(\"hostname\")}')
"

Project Structure

mcp-applescript-automation/
├── macos_automation_mcp/
│   ├── __init__.py
│   ├── server.py              # FastMCP server with 45 tool definitions
│   ├── core/
│   │   ├── __init__.py
│   │   ├── applescript.py     # AppleScript execution engine (osascript)
│   │   ├── shell.py           # Safe shell command execution
│   │   └── scheduler.py       # launchd task integration
│   ├── domains/
│   │   ├── __init__.py
│   │   ├── system.py          # System controls (12 tools)
│   │   ├── applications.py    # Application control (6 tools)
│   │   ├── finder.py          # Finder operations (6 tools)
│   │   ├── calendar.py        # Calendar.app integration (3 tools)
│   │   ├── reminders.py       # Reminders.app integration (5 tools)
│   │   ├── notifications.py   # Notification Center (3 tools)
│   │   ├── clipboard.py       # Clipboard operations (3 tools)
│   │   └── scripts.py         # Script execution (4 tools)
│   └── models/
│       ├── __init__.py
│       └── schemas.py         # Pydantic models for type safety
├── tests/
│   ├── __init__.py
│   └── test_applescript.py    # Unit tests
├── main.py                    # Entry point
├── pyproject.toml             # Dependencies: mcp[cli], pydantic
├── uv.lock                    # Locked dependencies
└── README.md

Dependencies

  • mcp[cli]>=1.0.0 - FastMCP framework with CLI support
  • pydantic>=2.0.0 - Type-safe data validation

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选