macOS Automator MCP

repository·main·Indexed 21 days ago

https://github.com/steipete/macos-automator-mcp

A Model Context Protocol (MCP) server that enables AI agents to control macOS applications and system functions using AppleScript and JavaScript for Automation (JXA). It features a built-in knowledge base of automation scripts and provides tools to search for scripting tips via `get_scripting_tips` and run scripts via `execute_script`.

Tokens
176K
Snippets
461
Records
644
Agent score
74%

What's inside macos-automator-mcp

  1. Overview of available JXA UI Automation scripts

    main

    The macOS Automator MCP provides a suite of specialized JXA scripts for interacting with macOS applications. These scripts leverage macOS accessibility features to perform complex UI tasks.

    Available specialized scripts include:

    • UI Automation Base: Core functionality and parameter handling.
    • Click Element: Clicking specific UI elements.
    • Get & Set Values: Reading or modifying values of UI elements (e.g., text fields).
    • Window Information: Retrieving metadata about application windows.
    • UI Hierarchy: Exploring the tree structure of UI elements.
    • Menu Actions: Interacting with application menus.
    • Wait For Element: Pausing execution until a specific UI element becomes available.
    • Scroll Element: Scrolling within UI elements.
    • Drag and Drop: Executing drag-and-drop operations.
    • Find UI Element: A helper utility for locating elements using various criteria.
  2. Overview of the Mail Automation Script

    main

    The Mail Automation Script provides a comprehensive suite of automation capabilities for Apple Mail on macOS. It allows for advanced email management, including sending formatted emails, managing templates, searching/organizing messages, and performing batch operations.

    Note: Some operations require Apple Mail to be the frontmost application on your Mac.

  3. Overview of the System Backup Script

    main
    The System Backup Script is a comprehensive macOS utility for creating customizable backups of files and folders. It leverages rsync for efficient incremental backups and supports compression, encryption, and automated scheduling via launchd. It is designed to protect important data through a combination of core backup logic, scheduling, and retention management.
  4. Batch Rename Files using patterns

    main

    The Batch Rename Files tool allows for renaming multiple files simultaneously using customizable naming templates. It supports placeholders for sequence numbers and original filenames, ensuring consistent naming conventions across large sets of files.

    Key Features

    • Pattern-based renaming: Use placeholders to define the new name.
    • Sequential numbering: Automatic 3-digit padding (e.g., 001, 002) for consistent sorting.
    • Original name preservation: Keep the original filename as part of the new name.
    • Extension handling: Automatically preserves the original file extension.
    • Error resilience: Failed operations are logged, but the process continues for the remaining files.
  5. Automate web forms in Safari with Safari Form Filler

    main

    The Safari Form Filler tool automates the process of filling out web forms within the Safari browser. It is designed for repetitive tasks like logins, data entry, or registration forms.

    The tool follows this execution lifecycle:

    1. Open URL: Navigates to a specified URL in Safari.
    2. Wait for Load: Ensures the page is fully loaded before proceeding.
    3. Identify Elements: Locates form fields using various selectors such as ID, name, or label text.
    4. Inject Data: Fills the identified fields with the provided data.
    5. Submit (Optional): Submits the form after data injection.
  6. Manage VMware Fusion virtual machines with the VM Controller

    main

    The VMware Fusion VM Controller is an AppleScript-based interface designed to automate the management of virtual machines (VMs) within VMware Fusion on macOS. It provides a programmatic way to interact with the VMware Fusion application to perform common lifecycle tasks.

    Key capabilities include:

    • Verifying if VMware Fusion is installed on the host system.
    • Retrieving a list of all available virtual machines.
    • Starting a specific virtual machine.
    • Stopping, suspending, or powering off running virtual machines.
    • Querying the current status of virtual machines.
    • Providing an interactive user interface for manual VM management.
  7. Track File Versions with Kaleidoscope

    main

    This AppleScript provides a lightweight version control system for individual files. It automatically creates backups of files before changes and uses the Kaleidoscope application to perform visual diffs and comparisons between versions.

    Key Features

    • Automatic Backups: Creates a versioned history of any file.
    • Commit Messages: Allows attaching descriptions to each version saved.
    • Visual Comparison: Integrates with Kaleidoscope to compare any two versions.
    • Metadata Management: Tracks current version numbers and original file paths in a hidden .metadata file.

    Storage Location

    All versioned files and metadata are stored in: ~/Documents/FileVersions/[filename]/

  8. What is a HAR File and how to analyze it?

    main

    A HAR (HTTP Archive) is a JSON-formatted file containing a log of a web browser's interaction with a web server. It includes detailed timing data, HTTP headers, cookies, request/response content, and connection information.

    Common Uses

    • Debugging: Analyzing specific API requests and responses.
    • Performance: Identifying slow requests or network bottlenecks.
    • Testing/Documentation: Archiving real traffic for reference or test scenarios.

    Analysis Tools

    • Chrome DevTools: Import HAR files directly into the Network panel.
    • Online HAR Analyzers: Web-based tools for visualization.
    • Proxies: Tools like Fiddler or Charles Proxy can import and filter HAR data.

    ⚠️ Security Warning

    HAR files may contain sensitive information, including authentication tokens, cookies, and personal data. Always redact sensitive information before sharing HAR files with third parties.

  9. Use Chrome Form Filler to automate web forms

    main

    The Chrome Form Filler tool automates the process of filling out web forms within the Chrome browser. It is designed for repetitive tasks like logins, data entry, or registration.

    When invoked, the tool follows this lifecycle:

    1. Open URL: Navigates to a specified URL in Chrome.
    2. Wait for Load: Ensures the page is fully loaded before proceeding.
    3. Identify Elements: Locates form fields using various selectors such as ID, name, or label text.
    4. Inject Data: Fills the identified fields with the provided data.
    5. Submit (Optional): Can be configured to submit the form automatically after filling.
  10. Cross-browser automation techniques and patterns

    main

    When building multi-browser automation scripts in JXA, follow these patterns to ensure reliability:

    • Defensive Coding: Wrap each browser's logic in its own try/catch block. An error in Chrome (e.g., if it's not installed) should not prevent the script from successfully managing Safari.
    • State Verification: Use browser.running() to verify the application is active before attempting to iterate over windows or tabs.
    • Unified Control: Standardize operations (like opening a URL) by mapping browser-specific commands to a common workflow.
    • Property Mapping: Be aware of API discrepancies between browsers (e.g., tabs[j].name() in Safari vs tabs[j].title() in Chrome).