The applescript-mcp server enables LLM applications to interact with macOS through AppleScript, providing control over various system functions and applications.
System Control: Set volume, get frontmost app, launch/quit apps, toggle dark mode, check battery status
Calendar Operations: Add events, list today's events
Finder & File Operations: Get selected files, search files, preview files
Clipboard Management: Get, set, and clear clipboard contents
Notification Management: Send notifications, toggle Do Not Disturb
iTerm Operations: Paste clipboard, run commands
Mail Operations: Create emails, list emails, get email
Messages: List chats, get messages, search messages, compose messages
Notes: Create formatted/HTML notes, list notes, search notes
Pages: Create documents
Shortcuts: Run shortcuts with optional input, list shortcuts
Allows interaction with macOS through AppleScript, including calendar management, clipboard operations, Finder integration, system notifications, system controls, and iTerm terminal integration
Required as a prerequisite for running the MCP server
Planned feature to allow opening pages in Safari, saving page content, and getting selected page/tab
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., "@applescript-mcpSet my Mac's volume to 30%"
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.
applescript-mcp MCP Server
A Model Context Protocol server that enables LLM applications to interact with macOS through AppleScript. This server provides a standardized interface for AI applications to control system functions, manage files, handle notifications, and more.
Features
ποΈ Calendar management (events, reminders)
π Clipboard operations
π Finder integration
π System notifications
βοΈ System controls (volume, dark mode, apps)
π iTerm terminal integration
π¬ Mail (create new email, list emails, get email)
π Shortcuts automation
π¬ Messages (list chats, get messages, search messages, send a message)
ποΈ Notes (create formatted notes, list notes, search notes)
π Pages (create documents)
Planned Features
π§ Safari (open in Safari, save page content, get selected page/tab)
β Reminders (create, get)
Related MCP server: MCP-AppleMusic
Prerequisites
macOS 10.15 or later
Node.js 18 or later
Available Categories
Calendar
Command | Description | Parameters |
| Create calendar event |
|
| List today's events | None |
Examples
// Create a new calendar event
Create a calendar event titled "Team Meeting" starting tomorrow at 2pm for 1 hour
// List today's events
What events do I have scheduled for today?Clipboard
Command | Description | Parameters |
| Copy to clipboard |
|
| Get clipboard contents | None |
| Clear clipboard | None |
Examples
// Copy text to clipboard
Copy "Remember to buy groceries" to my clipboard
// Get clipboard contents
What's currently in my clipboard?
// Clear clipboard
Clear my clipboardFinder
Command | Description | Parameters |
| Get selected files | None |
| Search for files |
|
| Preview file |
|
Examples
// Get selected files in Finder
What files do I currently have selected in Finder?
// Search for files
Find all PDF files in my Documents folder
// Preview a file
Show me a preview of ~/Documents/report.pdfNotifications
Note: Sending notification requires that you enable notifications in System Settings > Notifications > Script Editor.
Command | Description | Parameters |
| Show notification |
|
| Toggle DND mode | None |
Examples
// Send a notification
Send me a notification with the title "Reminder" and message "Time to take a break"
// Toggle Do Not Disturb
Turn on Do Not Disturb modeSystem
Command | Description | Parameters |
| Set system volume |
|
| Get active app | None |
| Open application |
|
| Close application |
|
| Toggle dark mode | None |
Examples
// Set system volume
Set my Mac's volume to 50%
// Get active application
What app am I currently using?
// Launch an application
Open Safari
// Quit an application
Close Spotify
// Toggle dark mode
Switch to dark modeiTerm
Command | Description | Parameters |
| Paste to iTerm | None |
| Execute command |
|
Examples
// Paste clipboard to iTerm
Paste my clipboard contents into iTerm
// Run a command in iTerm
Run "ls -la" in iTerm
// Run a command in a new iTerm window
Run "top" in a new iTerm windowShortcuts
Command | Description | Parameters |
| Run a shortcut |
|
| List all available shortcuts |
|
Examples
// List available shortcuts
List all my available shortcuts
// List with limit
Show me my top 5 shortcuts
// Run a shortcut
Run my "Daily Note in Bear" shortcut
// Run a shortcut with input
Run my "Add to-do" shortcut with input "Buy groceries"Command | Description | Parameters |
| Create a new email in Mail.app |
|
| List emails from a mailbox |
|
| Get a specific email by search |
|
Examples
// Create a new email
Compose an email to john@example.com with subject "Meeting Tomorrow" and body "Hi John, Can we meet tomorrow at 2pm?"
// List emails
Show me my 10 most recent unread emails
// Get a specific email
Find the email from sarah@example.com about "Project Update"Messages
Command | Description | Parameters |
| List available iMessage and SMS chats |
|
| Get messages from the Messages app |
|
| Search for messages containing specific text |
|
| Open Messages app with pre-filled message or auto-send |
|
Examples
// List available chats
Show me my recent message conversations
// Get recent messages
Show me my last 20 messages
// Search messages
Find messages containing "dinner plans" from John in the last week
// Compose a message
Send a message to 555-123-4567 saying "I'll be there in 10 minutes"Notes
Command | Description | Parameters |
| Create a note with markdown-like formatting |
|
| Create a note with direct HTML content |
|
| List notes, optionally from a specific folder |
|
| Get a specific note by title |
|
| Search for notes containing specific text |
|
Examples
// Create a new note with markdown formatting
Create a note titled "Meeting Minutes" with content "# Discussion Points\n- Project timeline\n- Budget review\n- Next steps" and format headings and lists
// Create a note with HTML
Create a note titled "Formatted Report" with HTML content "<h1>Quarterly Report</h1><p>Sales increased by <strong>15%</strong></p>"
// List notes
Show me all my notes in the "Work" folder
// Get a specific note
Show me my note titled "Shopping List"
// Search notes
Find notes containing "recipe" in my "Cooking" folderPages
Command | Description | Parameters |
| Create a new Pages document with plain text |
|
Examples
// Create a new Pages document
Create a Pages document with the content "Project Proposal\n\nThis document outlines the scope and timeline for the upcoming project."Architecture
The applescript-mcp server is built using TypeScript and follows a modular architecture:
Core Components
AppleScriptFramework (
framework.ts): The main server class that:Manages MCP protocol communication
Handles tool registration and execution
Provides logging functionality
Executes AppleScript commands
Categories (
src/categories/*.ts): Modular script collections organized by functionality:Each category contains related scripts (e.g., calendar, system, notes)
Categories are registered with the framework in
index.ts
Types (
src/types/index.ts): TypeScript interfaces defining:ScriptDefinition: Structure for individual scriptsScriptCategory: Collection of related scriptsLogLevel: Standard logging levelsFrameworkOptions: Configuration options
Execution Flow
Client sends a tool request via MCP protocol
Server identifies the appropriate category and script
Script content is generated (static or dynamically via function)
AppleScript is executed via macOS
osascriptcommandResults are returned to the client
Logging System
The framework includes a comprehensive logging system that:
Logs to both stderr and MCP logging protocol
Supports multiple severity levels (debug, info, warning, error, etc.)
Provides detailed execution information for troubleshooting
Development
Setup
# Install dependencies
npm install
# Build the server
npm run build
# Launch MCP Inspector
# See: https://modelcontextprotocol.io/docs/tools/inspector
npx @modelcontextprotocol/inspector node path/to/server/index.js args...Adding New Functionality
1. Create Category File
Create src/categories/newcategory.ts:
import { ScriptCategory } from "../types/index.js";
export const newCategory: ScriptCategory = {
name: "category_name",
description: "Category description",
scripts: [
// Scripts will go here
],
};2. Add Scripts
{
name: "script_name",
description: "What the script does",
schema: {
type: "object",
properties: {
paramName: {
type: "string",
description: "Parameter description"
}
},
required: ["paramName"]
},
script: (args) => `
tell application "App"
// AppleScript code using ${args.paramName}
end tell
`
}3. Register Category
Update src/index.ts:
import { newCategory } from "./categories/newcategory.js";
// ...
server.addCategory(newCategory);Advanced Script Development
For more complex scripts, you can:
Use dynamic script generation:
script: (args) => { // Process arguments and build script dynamically let scriptContent = `tell application "App"\n`; if (args.condition) { scriptContent += ` // Conditional logic\n`; } scriptContent += `end tell`; return scriptContent; }Process complex data:
// Example from Notes category function generateNoteHtml(args: any): string { // Process markdown-like syntax into HTML let processedContent = content; if (format.headings) { processedContent = processedContent.replace(/^# (.+)$/gm, '<h1>$1</h1>'); // ... } return processedContent; }
Debugging
Using MCP Inspector
The MCP Inspector provides a web interface for testing and debugging your server:
npm run inspectorLogging
Enable debug logging by setting the environment variable:
DEBUG=applescript-mcp* npm startExample configuration
After running npm run build add the following to your mcp.json file:
{
"mcpServers": {
"applescript-mcp-server": {
"command": "node",
"args": ["/path/to/applescript-mcp/dist/index.js"]
}
}
}Common Issues
Permission Errors: Check System Preferences > Security & Privacy > Privacy > Automation
Script Failures: Test scripts directly in Script Editor.app before integration
Communication Issues: Check stdio streams aren't being redirected
Database Access: Some features (like Messages) require Full Disk Access permission
Resources
Contributing
Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request
License
MIT License - see LICENSE for details