Get the FREE Ultimate OpenClaw Setup Guide →

mcp-safari

MCP server that provides programmatic control of Safari browser on macOS. Perfect for web automation, testing, and debugging with AI assistants like Claude.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio iclaudiumihaila-mcp-safari-server node /path/to/mcp-safari-server/dist/index.js

How to use

The MCP Safari Server exposes a standardized interface to control and interact with the Safari browser on macOS. It provides tools for navigation, JS execution, element interaction, form input, scrolling, screenshots, and real-time error monitoring, all accessible through the MCP protocol. This enables AI assistants (like Claude) to automate web tasks, test pages, extract data, and monitor page errors in a consistent, scriptable way. You configure Claude to talk to this server via your Claude configuration file, and then invoke the provided tools to drive Safari programmatically.

Once running, you can use tools such as navigate to open URLs, execute_script to run JavaScript in the current page context, get_page_info to read the current URL and title, and take_screenshot to capture the visible Safari window. There are also utilities for interacting with page elements (click_element, type_text, scroll_to, select_option, get_element_text) and for page navigation (refresh_page, go_back, go_forward). The server can also monitor JavaScript errors and forward them to Claude Code for debugging, enabling an integrated development workflow.

How to install

Prerequisites:

  • macOS with Safari installed
  • Node.js 16+ (recommended) or a compatible Node.js runtime
  • Ability to run npm install and npm run build

Installation steps:

  1. Clone or download the mcp-safari-server project:
git clone https://github.com/your-org/mcp-safari-server.git
cd mcp-safari-server
  1. Install dependencies:
npm install
  1. Build the server for distribution:
npm run build
  1. Configure Claude to use the server (example in Claude config):
{
  "mcpServers": {
    "safari": {
      "command": "node",
      "args": ["/path/to/mcp-safari-server/dist/index.js"],
      "env": {}
    }
  }
}
  1. Run the server (path adjusted to where you built it):
node dist/index.js
  1. Validate connectivity from Claude and start using the provided tools.

Additional notes

Notes and tips:

  • The server uses AppleScript under the hood to control Safari; ensure you grant Terminal/your IDE automation permissions in System Preferences > Security & Privacy > Privacy > Automation.
  • If you see permission or automation errors, re-check Safari automation settings and macOS privacy shields.
  • For development builds, you can run the TypeScript source directly via npx tsx as shown in the README’s development example, but for production use point Claude at the built dist/index.js.
  • The error monitoring feature can be configured with interval (ms) and autoSendToClaude to tailor notifications to your workflow.
  • When integrating with Claude, ensure your configuration references the correct path to the built server and that network access between Claude and Safari is permitted.

Related MCP Servers

Sponsor this space

Reach thousands of developers