Enables access to Safari browser automation features specifically on macOS systems, using macOS-specific components like SafariDriver.
Provides browser automation and developer tools access for Safari, enabling navigation, console logs retrieval, network activity monitoring, element inspection, JavaScript execution, and screenshot capturing.
Leverages Selenium WebDriver technology to control Safari browser sessions, providing browser automation capabilities.
Safari MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with Safari browser automation and developer tools access. This server enables LLMs to interact with Safari, access console logs, monitor network activity, and perform browser automation tasks.
Features
- 🚀 Safari Browser Automation: Start, control, and manage Safari sessions
- 🔍 Developer Tools Access: Get console logs, network logs, and performance metrics
- 📸 Screenshots: Capture page screenshots for visual analysis
- 🕵️ Element Inspection: Inspect DOM elements and their properties
- ⚡ JavaScript Execution: Run custom JavaScript in the browser context
- 📊 Performance Monitoring: Access timing metrics and performance data
- 🔧 Multiple Sessions: Manage multiple Safari automation sessions
Prerequisites
System Requirements
- macOS only (Safari and SafariDriver are only available on macOS)
- Node.js 18+
- Safari 10+ (comes with built-in WebDriver support)
Safari Setup
Before using this MCP server, you need to enable Safari's automation features:
- Enable Developer Menu:
- Open Safari → Preferences → Advanced
- Check "Show Develop menu in menu bar"
- Enable Remote Automation:
- In Safari's menu bar: Develop → Allow Remote Automation
- Authorize SafariDriver:Enter your admin password when prompted.
Installation
- Clone or navigate to the project directory:
- Install dependencies:
- Build the project:
Usage
Running the Server
The server will start and listen for MCP protocol messages on stdio.
Development Mode
Available Tools
Session Management
safari_start_session
- Start a new Safari automation sessionsafari_close_session
- Close a Safari sessionsafari_list_sessions
- List all active sessions
Navigation & Page Info
safari_navigate
- Navigate to a URLsafari_get_page_info
- Get current page URL and title
Developer Tools Access
safari_get_console_logs
- Get browser console logssafari_get_network_logs
- Get network activity logssafari_get_performance_metrics
- Get page performance metrics
Browser Interaction
safari_execute_script
- Execute JavaScript in the browsersafari_take_screenshot
- Capture page screenshotssafari_inspect_element
- Inspect DOM elements
Example Usage with Claude Desktop
Add this configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Example Commands
Once connected to an MCP client like Claude Desktop, you can use commands like:
Configuration Options
When starting a session, you can specify options:
Limitations
- Single Session Limit: Safari only allows one WebDriver session at a time
- macOS Only: This server only works on macOS systems
- Safari-Specific: Unlike Chrome DevTools Protocol, Safari has limited debugging API access
- Network Logs: Network logging depends on Safari's performance logs and may have limitations
Development
Project Structure
Building
Watching for Changes
Cleaning Build
Troubleshooting
Common Issues
- "Session not found" errors:
- Make sure you've started a session before using other commands
- Check that Safari didn't crash or close unexpectedly
- "Remote Automation not enabled":
- Verify Safari's Developer menu is enabled
- Check that "Allow Remote Automation" is enabled in the Develop menu
- Permission errors:
- Run
sudo safaridriver --enable
and enter your password - Make sure Terminal has the necessary permissions
- Run
- Safari not responding:
- Only one Safari automation session can be active at a time
- Close any existing automation sessions before starting new ones
Debug Mode
To see detailed logging, you can modify the server to include more verbose output or check Safari's Web Inspector while automation is running.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Provides AI assistants with Safari browser automation and developer tools access, enabling LLMs to control Safari, access console logs, monitor network activity, and perform browser automation tasks.
Related MCP Servers
- AsecurityAlicenseAqualityFacilitates browser automation with custom capabilities and agent-based interactions, integrated through the browser-use library.Last updated -1646PythonMIT License
- AsecurityFlicenseAqualityEnables AI agents to interact with web browsers using natural language, featuring automated browsing, form filling, vision-based element detection, and structured JSON responses for systematic browser control.Last updated -147Python
- -securityFlicense-qualityEnables AI agents to control web browsers via a standardized interface for operations like launching, interacting with, and closing browsers.Last updated -0JavaScript
- -securityAlicense-qualityEnables browser automation and real-time computer vision tasks through AI-driven commands, offering zero-cost digital navigation and interaction for enhanced web experiences.Last updated -01JavaScriptMIT License