mcp-server-osascript
Click on "Deploy 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., "@mcp-server-osascript tell Finder to make new folder on desktop"
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.
MCP osascript Server
Secure AppleScript execution for AI applications via Model Context Protocol with configurable security profiles and automatic TCC permission handling.
Overview
This MCP server provides a bridge between AI models and macOS automation through secure AppleScript execution. It features a modular architecture with configurable security profiles, automatic permission management, and comprehensive error handling.
Related MCP server: macOS Automator MCP Server
Installation
Development Setup
# Clone and setup dependencies
uv sync
# Optional: Development mode installation
uv pip install -e .Production Installation
# System-wide installation with uvx
uvx install /path/to/mcp-server-osascript
# From Git repository
uvx install git+https://github.com/your-username/mcp-server-osascript.git
# From PyPI (when published)
uvx install mcp-server-osascriptUsage
Production Usage
# After uvx installation (available system-wide)
mcp-server-osascriptDevelopment Usage
# From project directory
uv run mcp-server-osascript
# From any directory
uv run --project /path/to/mcp-server-osascript mcp-server-osascript
# Alternative: Direct module execution
uv run python -m mcp_server_osascript.serverMCP Client Configuration
Add this configuration to your MCP client:
Production Configuration:
{
"mcpServers": {
"osascript": {
"command": "mcp-server-osascript",
"args": []
}
}
}Development Configuration:
{
"mcpServers": {
"osascript": {
"command": "uv",
"args": ["run", "--project", "/path/to/mcp-server-osascript", "mcp-server-osascript"]
}
}
}Architecture
The server is built with a modular architecture consisting of six focused components:
Security System: Configurable risk assessment with three security profiles
Execution Engine: Direct osascript execution with timeout management
Permission Handler: Automatic TCC permission dialog triggering
Response Builder: Standardized API response formatting
User Interface: Interactive confirmation dialogs
Server Core: FastMCP integration and tool registration
Features
Configurable Security Profiles
Strict: Maximum security with blocked dangerous operations
Balanced: Recommended default with risk warnings (default)
Permissive: Minimal restrictions with audit logging
Advanced Permission Management
Automatic TCC permission dialog triggering
Intelligent error parsing and user guidance
Support for common macOS applications
Manual permission configuration instructions
Comprehensive Tool Interface
Single unified
execute_osascripttoolDry-run mode for script analysis without execution
Configurable execution timeouts
Detailed success and error reporting
Tool Reference
execute_osascript
Execute or analyze AppleScript/JavaScript code with comprehensive security and permission handling.
Parameters:
script(str): AppleScript or JavaScript code to executeexecution_timeout(int): Timeout in seconds (default: 30)security_profile(str): Security level - "strict", "balanced", or "permissive" (default: "balanced")enable_auto_permissions(bool): Auto-trigger TCC permission dialogs (default: true)dry_run(bool): Analyze script without executing (default: false)
Response Structure:
{
"status": "success|error",
"timestamp": "2024-01-01T12:00:00.000Z",
"data": {
"stdout": "execution output",
"stderr": "error output",
"execution_time": 1.23
}
}Error Response:
{
"status": "error",
"timestamp": "2024-01-01T12:00:00.000Z",
"error": {
"type": "SECURITY_BLOCKED|TCC_PERMISSION_DENIED|EXECUTION_TIMEOUT|SYNTAX_ERROR",
"message": "Human-readable error description",
"details": "Additional error context and repair suggestions"
}
}Security Features
Script Analysis
Pattern matching for dangerous operations
Risk scoring and classification
High-risk operation confirmation prompts
Comprehensive audit logging
Permission Management
TCC error code detection (-1743)
Application-specific permission guidance
Automatic permission dialog triggering
Manual configuration instructions
Execution Safety
Direct execution for proper TCC dialog display
Configurable timeout protection
Subprocess error handling
Memory and resource management
System Requirements
Operating System: macOS (required for AppleScript runtime)
Python: 3.10 or higher
Package Manager: uv (recommended) or pip
Permissions: User must grant necessary TCC permissions for target applications
Development
Testing
# Validate syntax for all modules
python3 -m py_compile mcp_server_osascript/*.py
# Test individual modules
python3 -c "from mcp_server_osascript.security import SecurityProfileManager; print('Security module OK')"Architecture Overview
The codebase follows a modular design with clear separation of concerns:
Security assessment and policy enforcement
Script execution and subprocess management
Permission handling and TCC error parsing
Standardized response formatting
User interface and confirmation dialogs
License
MIT License
Available Tools
3 toolsexecute_osascriptA
Execute or analyze scripts using osascript with comprehensive functionality and automatic permission handling.
This unified tool handles both AppleScript/JavaScript execution and security analysis with full osascript
capabilities including shell script execution and intelligent TCC permission management.
Security Profiles:
- "strict": Maximum security, blocks potentially dangerous operations
- "balanced": Recommended default, warns about risks but allows execution
- "permissive": Minimal restrictions, full functionality with audit logging
Features:
- Complete osascript support for AppleScript and JavaScript
- Shell script execution via "do shell script"
- Automatic TCC permission dialog handling
- Intelligent error recovery and user guidance
- Security risk assessment and warnings
- Comprehensive execution logging
- Dry-run mode for analysis without execution
Args:
script: The script code to execute or analyze (AppleScript or JavaScript for osascript)
execution_timeout: Maximum execution time in seconds (default: 30, ignored in dry_run)
security_profile: Security mode ("strict", "balanced", "permissive")
enable_auto_permissions: Automatically handle macOS permission dialogs (default: True)
dry_run: If True, only analyze security without executing (default: False)
Returns:
Standardized response with execution results, security analysis, and guidance
Inputs: script (required), dry_run, security_profile, execution_timeout, +1 more. Returns: object
get_security_profilesA
Get information about all available security profiles.
Returns detailed information about each security profile including their
patterns, risk levels, and usage recommendations.
Returns:
Dictionary with security profile information and current configuration
Inputs: no named parameters. Returns: object
set_security_profileA
Set the default security profile for script execution.
This sets the default security profile that will be used when no explicit
profile is specified in execute_applescript calls.
Args:
security_profile: Security profile to set as default ("strict", "balanced", "permissive")
Returns:
Confirmation of the configuration change
Inputs: security_profile (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: execute_osascript for running scripts, get_security_profiles for listing profiles, and set_security_profile for changing the default. There is no functional overlap between them.
All tool names follow a consistent snake_case verb_noun pattern (execute_osascript, get_security_profiles, set_security_profile), making the naming predictable and easy to learn.
Three tools is an appropriate size for this focused server, covering the core execution capability and necessary security configuration without unnecessary bloat.
The server provides complete lifecycle coverage for its domain: executing scripts (with dry-run and security profiles), reading available security profiles, and updating the default profile. There are no obvious missing operations for this purpose.
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables running AppleScript code to interact with Mac applications and system features including Notes, Calendar, Contacts, Messages, file management, and more.1159 npm469MIT
- AlicenseAqualityFmaintenanceProvides a Model Context Protocol server for executing AppleScript and JavaScript for Automation scripts on macOS, featuring a knowledge base of pre-defined scripts and supporting automation of macOS applications and system functions.2742 npm881MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables execution of AppleScript and JavaScript for Automation scripts on macOS, allowing programmatic control of applications and system functions through a rich knowledge base of pre-defined scripts.29MIT
- AlicenseAqualityDmaintenanceEnables Large Language Models to automate macOS applications and execute AppleScript commands through natural language. It features built-in security protections including application allowlists and dangerous pattern detection to prevent unauthorized or risky system operations.21MIT