Allows execution of JavaScript code within the current page context in Safari, as well as monitoring JavaScript errors, console logs, and interacting with DOM elements through JavaScript.
Enables browser automation specifically on macOS systems through AppleScript commands to control Safari browser.
Provides programmatic control of Safari browser on macOS, enabling navigation, JavaScript execution, element interaction, page monitoring, and screenshot capture for web automation and testing.
MCP Safari Server
A Model Context Protocol (MCP) server that provides programmatic control of Safari browser on macOS. Perfect for web automation, testing, and debugging with AI assistants like Claude.
Overview
The Safari MCP Server enables AI assistants to interact with Safari browser through a standardized protocol. It provides tools for navigation, element interaction, JavaScript execution, and page monitoring, making it ideal for:
- 🤖 AI-assisted web development and debugging
- 🧪 Automated testing and QA
- 📊 Web scraping and data extraction
- 🔍 Real-time error monitoring
- 📸 Visual regression testing
Features
- Navigate: Open URLs in Safari
- Execute JavaScript: Run JS code in the current page context
- Get Page Info: Retrieve current URL and page title
- Take Screenshots: Capture the current Safari window
- Console Logs: Capture and retrieve console.log, console.error, and console.warn messages
- Page Navigation: Refresh, go back, or go forward in browser history
- Automatic Error Monitoring: Monitor JavaScript errors and send them to Claude Code for immediate fixing
- Click Elements: Click on page elements using CSS selectors
- Type Text: Fill in forms and input fields
- Scroll: Scroll to specific elements or positions
- Select Options: Choose options from dropdown menus
- Get Element Text: Extract text content from page elements
- Wait for Elements: Wait for elements to appear before interacting
Installation
- Install dependencies:
- Build the server:
Configuration
Add this server to your Claude configuration file (.mcp.json
or claude-code-config.json
):
Or for development:
Usage
Once configured, Claude can use the following tools:
navigate
Navigate Safari to a URL:
execute_script
Execute JavaScript in the current page:
get_page_info
Get information about the current page:
take_screenshot
Take a screenshot of the current Safari window:
get_console_logs
Retrieve console logs from the page:
refresh_page
Refresh the current page:
go_back / go_forward
Navigate through browser history:
start_error_monitoring
Start monitoring JavaScript errors and automatically send them to Claude Code:
Options:
interval
: Check interval in milliseconds (default: 2000)autoSendToClaude
: Automatically send errors to Claude Code (default: true)
stop_error_monitoring
Stop error monitoring:
click_element
Click on an element in the page:
type_text
Type text into an input field:
scroll_to
Scroll to an element or position:
select_option
Select an option from a dropdown:
get_element_text
Get the text content of an element:
wait_for_element
Wait for an element to appear:
You must be authenticated.
Tools
A server that provides AI assistants programmatic control of Safari browser on macOS for web automation, testing, and debugging.
- Overview
- Features
- Installation
- Configuration
- Usage
- Error Monitoring Feature
- Requirements
- Security Note
- Troubleshooting
Related Resources
Related MCP Servers
- -securityFlicense-qualityEnables AI agents to control web browsers via a standardized interface for operations like launching, interacting with, and closing browsers.Last updated -0JavaScript
- -securityFlicense-qualityA web browser automation server that allows AI assistants to control Chrome with persistent state management, enabling complex browsing tasks through asynchronous browser operations.Last updated -1Python
- -securityFlicense-qualityA Model Control Protocol server that enables AI assistants to control a browser through tools for web automation tasks like navigation, typing, clicking, and taking screenshots.Last updated -TypeScript
- -securityFlicense-qualityEnables 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.Last updated -TypeScript