Provides comprehensive tools for macOS automation, including system information retrieval, window and application management, input simulation, and UI element interaction via AppleScript and JXA.
Enables automation and control of the Safari web browser through macOS-level automation and accessibility frameworks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mac-mcp-serverList all running apps and tell me my current battery level"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mac-mcp-server
A macOS AppleScript MCP (Model Context Protocol) server that enables Claude Code and other AI assistants to automate macOS through AppleScript and JXA (JavaScript for Automation).
Overview
This MCP server provides 44 tools for comprehensive macOS automation, allowing AI assistants to:
Retrieve system information (hardware, battery, displays)
Manage applications (launch, quit, activate, list running apps)
Control windows (move, resize, focus, minimize)
Simulate keyboard and mouse input
Interact with UI elements via Accessibility APIs
Capture screenshots (auto-optimized for API compatibility)
Access clipboard and notifications
Control audio settings
Navigate menus and status bar items
The server communicates over stdio for seamless Claude Code integration and uses AppleScript/JXA for system automation.
Quick Start
Prerequisites
macOS 10.15 (Catalina) or later
Node.js 20.11.0 or later
Install from npm
Configure Claude Code
Add the following to your Claude Code MCP configuration (~/.claude.json or Claude Desktop settings):
Restart Claude Code to load the MCP server.
Grant macOS Permissions
On first use, macOS will prompt you to grant required permissions. See the Permissions Guide below for details.
Tool Reference
System Information
Tool | Description |
| Retrieves macOS version, hardware model, processor, and memory |
| Gets battery percentage and charging status (MacBooks) |
| Lists connected displays with resolution information |
Audio Control
Tool | Description |
| Gets current system volume (0-100) |
| Sets system volume to specified percentage |
| Checks if system audio is muted |
| Mutes or unmutes system audio |
Clipboard and Notifications
Tool | Description |
| Reads current clipboard content (text, image, or files) |
| Sets clipboard to specified text |
| Displays a macOS notification with optional subtitle and sound |
Application Management
Tool | Description |
| Lists all running GUI applications with bundle IDs and PIDs |
| Launches an application by name |
| Gracefully quits an application |
| Brings an application to the foreground |
Finder Integration
Tool | Description |
| Opens Finder and selects the specified file or folder |
| Gets paths of currently selected files in Finder |
| Gets the path of the frontmost Finder window |
Window Management
Tool | Description |
| Lists all visible windows with position and size |
| Brings a specific window to the front |
| Moves a window to specified coordinates |
| Resizes a window to specified dimensions |
| Minimizes a window to the Dock |
Mouse Control
Tool | Description |
| Performs a mouse click (left, right, or middle button) |
| Performs a double-click |
| Moves the cursor without clicking |
| Performs a drag operation from start to end coordinates |
Keyboard Input
Tool | Description |
| Types text at the current cursor position |
| Presses a key by name (Enter, Tab, Escape, F1-F12, etc.) |
| Presses a key combination (e.g., Cmd+C, Cmd+Shift+S) |
Scroll and Navigation
Tool | Description |
| Scrolls in a specified direction (up, down, left, right) |
| Scrolls until a UI element becomes visible |
Screenshots
Tool | Description |
| Captures screen, display, window, or region as PNG/JPEG |
Screenshot Features:
Auto-resize: Screenshots are resized to max 1600px (configurable) for API compatibility
Auto-compress: File size limited to 1.8MB using JPEG compression when needed
Full resolution: Use
rawFile: truefor file output at full resolutionDisable processing: Set
maxDimension: 0andmaxFileSize: 0to disable all processing
UI Element Interaction
Tool | Description |
| Retrieves the UI element tree for an application |
| Clicks a UI element by path |
| Gets the value of a UI element |
| Sets the value of an editable UI element |
| Sets keyboard focus to a UI element |
Menu Bar Operations
Tool | Description |
| Gets the menu hierarchy for an application |
| Clicks a menu item by path (e.g., "File > Save") |
| Gets enabled/checked state of a menu item |
| Lists visible status bar items |
| Clicks a status bar item to open its menu |
| Clicks a menu item within a status bar menu |
| Gets complete menu bar hierarchy for a process |
macOS Permissions
This server requires specific macOS permissions to function. The first time you use certain tools, macOS will prompt you to grant access.
Required Permissions
1. Accessibility
Required for: Keyboard input, mouse control, UI element interaction, window management
Grant access:
Open System Settings > Privacy & Security > Accessibility
Click the + button and add your terminal app (Terminal, iTerm2, or Claude Code)
Toggle the switch to enable access
Restart your terminal after granting permission
Quick access:
2. Automation
Required for: Controlling other applications (Finder, Safari, etc.)
Grant access:
Open System Settings > Privacy & Security > Automation
Find your terminal app in the list
Enable checkboxes for target applications you want to control
If prompted during first use, click OK to allow
Quick access:
3. Screen Recording
Required for: Screenshots
Grant access:
Open System Settings > Privacy & Security > Screen Recording
Click the + button and add your terminal app
Toggle the switch to enable access
Restart your terminal after granting permission
Quick access:
Troubleshooting Permissions
Issue | Solution |
Permission added but not working | Restart your terminal app completely (Cmd+Q, then reopen) |
App not appearing in permission list | Run the operation once to trigger the permission dialog |
Permission still denied after granting | Remove the app from the list, restart, then re-add it |
All permission issues persist | Restart macOS |
"assistive access" error | Grant Accessibility permission specifically |
"-1743" error code | Grant Automation permission for the target app |
Screenshot returns black image | Grant Screen Recording permission and restart |
Permission Checklist
Before using mac-mcp-server, verify these permissions are granted:
Accessibility - Terminal/Claude Code added and enabled
Automation - Target apps enabled under your terminal
Screen Recording - Terminal/Claude Code added and enabled
App restarted after granting permissions
Usage Examples
System Information
Application Management
Window Management
Keyboard and Mouse
Screenshots
UI Element Interaction
Menu Operations
Installation from Source
For development or customization:
Then configure Claude Code to use the local build:
Development
Commands
Command | Description |
| Build for production |
| Development mode (watch) |
| Run tests |
| TypeScript type checking |
| Lint code |
| Lint and auto-fix |
| Format code with Prettier |
Project Structure
Security
This MCP server is designed with security in mind:
AppleScript-only execution: All automation is performed through AppleScript and JXA. No arbitrary shell commands are executed.
Input sanitization: All user inputs are sanitized before being included in AppleScript to prevent injection attacks.
No data persistence: The server does not store any user data or credentials.
Permission-gated access: All sensitive operations require explicit macOS permission grants.
Scoped automation: Each tool has a specific, limited purpose rather than providing general system access.
Requirements
Requirement | Version |
macOS | 10.15 (Catalina) or later |
Node.js | 20.11.0 or later |
pnpm | 10.28.0 (for development) |
License
MIT
Author
Contributing
Contributions are welcome. Please open an issue first to discuss what you would like to change.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request