Safari MCP Server
The Safari MCP Server provides AI assistants with a Model Context Protocol interface to automate and control Safari browser on macOS with full developer tools access.
Core Capabilities:
Session Management: Start, close, and list Safari automation sessions with configurable options (Web Inspector, timeline profiling, Safari Technology Preview)
Navigation & Control: Navigate to URLs, retrieve current page information (URL and title), and execute custom JavaScript in the browser context
Developer Tools: Access and filter console logs by level (ALL, DEBUG, INFO, WARNING, SEVERE), monitor network activity, and clear logs for debugging
Performance Monitoring: Retrieve page load timing metrics and resource usage data
Visual & DOM Interaction: Capture screenshots for visual analysis and inspect DOM elements using CSS selectors
Use Cases:
Web application testing and debugging
Automated browser workflows and web scraping
Performance monitoring and optimization
Visual regression testing
Interactive debugging with comprehensive log access
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.
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., "@Safari MCP Server take a screenshot of the current page and check for any JavaScript errors"
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.
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
Related MCP server: MCP Safari Server
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:
sudo safaridriver --enableEnter your admin password when prompted.
Installation
Clone or navigate to the project directory:
cd C:\Users\<USERNAME>\RiderProjects\AIPacketAnalyzer\safari-mcp-serverInstall dependencies:
npm installBuild the project:
npm run build
Usage
Running the Server
npm startThe server will start and listen for MCP protocol messages on stdio.
Development Mode
npm run devAvailable 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
{
"mcpServers": {
"safari-devtools": {
"command": "node",
"args": ["C:/Users/<USERNAME>/RiderProjects/AIPacketAnalyzer/safari-mcp-server/build/index.js"]
}
}
}Example Commands
Once connected to an MCP client like Claude Desktop, you can use commands like:
Start a Safari session with ID "main" and navigate to Google:
- Start session: safari_start_session with sessionId "main"
- Navigate: safari_navigate to "https://www.google.com"
- Take screenshot: safari_take_screenshot
- Get console logs: safari_get_console_logsConfiguration Options
When starting a session, you can specify options:
{
"sessionId": "my-session",
"options": {
"enableInspection": true, // Enable Web Inspector
"enableProfiling": true, // Enable timeline profiling
"usesTechnologyPreview": false // Use Safari Technology Preview
}
}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
safari-mcp-server/
āāā src/
ā āāā index.ts # Main entry point
ā āāā safari-mcp-server.ts # MCP server implementation
ā āāā safari-driver.ts # Safari WebDriver manager
ā āāā types.ts # TypeScript type definitions
āāā build/ # Compiled JavaScript
āāā package.json
āāā tsconfig.json
āāā README.mdBuilding
npm run buildWatching for Changes
npm run watchCleaning Build
npm run cleanTroubleshooting
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 --enableand enter your passwordMake sure Terminal has the necessary permissions
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
Available Tools
13 toolssafari_clear_console_logsC
Clear captured console logs for a session
Inputs: sessionId (required).
safari_clear_network_logsC
Clear captured network logs for a session
Inputs: sessionId (required).
safari_close_sessionB
Close a Safari automation session
Inputs: sessionId (required).
safari_execute_scriptC
Execute JavaScript in the browser context
Inputs: sessionId (required), script (required), args.
safari_get_console_logsC
Get browser console logs for debugging
Inputs: sessionId (required), logLevel.
safari_get_network_logsC
Get network activity logs for performance analysis
Inputs: sessionId (required).
safari_get_page_infoC
Get current page URL and title
Inputs: sessionId (required).
safari_get_performance_metricsC
Get page performance metrics
Inputs: sessionId (required).
safari_inspect_elementC
Inspect a DOM element and get its properties
Inputs: sessionId (required), selector (required).
safari_list_sessionsB
List all active Safari sessions
Inputs: no named parameters.
safari_start_sessionC
Start a new Safari automation session with dev tools access
Inputs: sessionId (required), options.
safari_take_screenshotC
Take a screenshot of the current page
Inputs: sessionId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose with no ambiguity. Tools like safari_get_console_logs and safari_get_network_logs serve different debugging aspects, while navigation, scripting, and inspection tools target separate browser automation tasks.
All tools follow a perfect verb_noun pattern with the 'safari_' prefix. The naming is highly consistent, using snake_case throughout and clear action descriptors like 'get', 'clear', 'execute', and 'start'.
13 tools is well-scoped for a Safari automation server, covering session management, navigation, debugging, and inspection without being overwhelming. Each tool earns its place in the automation workflow.
The toolset provides comprehensive coverage for core browser automation tasks, including session lifecycle, navigation, debugging, and inspection. A minor gap exists in lacking explicit page interaction tools like clicking or typing, but agents can work around this using execute_script.
Maintenance
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Live browser debugging for AI assistants ā DOM, console, network via MCP.
Web search, data extraction and controlled browser automation for AI assistants via OAuth.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- -licenseAqualityNot gradedmaintenanceA server that provides AI assistants programmatic control of Safari browser on macOS for web automation, testing, and debugging.161-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceA server that enables AI assistants to control a browser through tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0