Safari MCP: Native Browser Automation for AI Agents on macOS
MCP

Safari MCP: Native Browser Automation for AI Agents on macOS

4 min read

Every MCP browser automation tool — Playwright MCP, Chrome DevTools MCP, Browserbase — requires Chrome. On macOS, that means a separate Chromium process eating 200-400MB of RAM, spinning up your fans, and running a browser you don’t actually use for anything else.

Safari MCP takes a different approach: automate the browser you already have open.

What is MCP?

Model Context Protocol (MCP) is the open standard for connecting AI agents to external tools. When your AI coding assistant needs to browse the web, fill a form, or take a screenshot, it calls an MCP server. That server executes the action and returns the result. If you’re new to AI agents, we wrote a practical guide to AI agents for small business covering what they actually do and how to build one.

Most MCP browser servers wrap Chrome via DevTools Protocol or Playwright. Safari MCP wraps native Safari via AppleScript and a persistent Swift helper process.

Why Safari Instead of Chrome?

The practical differences matter for daily use:

Performance

Safari MCP runs commands in ~5ms through a persistent osascript process. No browser startup, no DevTools Protocol overhead. On Apple Silicon, Safari’s native WebKit engine uses roughly 60% less CPU than Chrome for the same pages — which translates directly to less heat and longer battery life.

Your Real Browser

Chrome automation tools launch a fresh browser profile. That means no logins, no cookies, no sessions. Every test starts from scratch.

Safari MCP uses your actual Safari — Gmail, GitHub, Slack, Ahrefs, whatever you’re logged into. Your AI agent browses as you, with your sessions intact.

No Focus Stealing

Chrome DevTools MCP and Chrome extensions steal window focus on every tool call. You’re typing in your editor, and Chrome jumps to the foreground. This is a known pain point for developers using AI browser tools.

Safari MCP operates entirely in the background. Safari never comes to the foreground unless you explicitly ask it to.

Quick Setup

Add Safari MCP to your MCP client config:

{
  "mcpServers": {
    "safari": {
      "command": "npx",
      "args": ["-y", "safari-mcp"]
    }
  }
}

Or use the one-click install buttons for VS Code and Cursor.

Then enable JavaScript from Apple Events:

  1. Safari → Develop menu → Allow JavaScript from Apple Events
  2. Grant Automation → Safari to your IDE in System Settings

That’s it. Your AI agent can now browse Safari.

What Can It Do? (80 Tools)

Safari MCP provides 80 tools organized by category:

Navigation & Tabs — Open URLs, manage tabs, go back/forward, reload. Tab operations are safe — the AI agent tracks which tabs it opened and never touches yours.

Page Interaction — Click elements, fill forms, type text, hover, drag, scroll. Includes native CGEvent-based clicking for sites that require trusted events.

Data Extraction — Read page content, extract links, tables, images, metadata. Get computed styles, accessibility snapshots, structured data.

Screenshots & Visual — Capture full-page or element-specific screenshots. Device emulation for responsive testing.

Network & Performance — Monitor network requests, mock API responses, throttle connections, measure page load performance.

Storage & State — Read and write cookies, localStorage, sessionStorage, IndexedDB. Export and import storage snapshots.

Accessibility — Full accessibility tree snapshots for testing screen reader compatibility and WCAG compliance.

Framework Support

Modern web apps use frameworks that intercept standard DOM events. Setting .value on a React input doesn’t trigger state updates — the framework’s internal state tracker ignores it.

Safari MCP solves this with framework-aware form filling:

  • React — Uses _valueTracker to reset React’s change detection before dispatching events
  • Vue.js — Triggers input events that v-model listens for
  • Angular — Dispatches both input and change events for reactive forms
  • ProseMirror / Draft.js / Slate / Lexical — Uses execCommand('insertText') + OS-level clipboard paste for rich text editors. The deep-dive on why MCP tools silently fail on rich-text editors explains the isTrusted security boundary that trips up LinkedIn, Notion, and Google Docs automation.
  • Shadow DOM — Reaches into closed shadow roots that standard automation can’t access

When to Use Chrome Instead

Safari MCP handles 95% of browser automation tasks. For the remaining 5%, Chrome DevTools MCP is better:

  • Lighthouse audits — Chrome-only feature
  • Chrome-specific DevTools ��� Performance traces, Memory snapshots, Coverage reports
  • Cross-browser testing — When you specifically need Chrome rendering behavior

The two servers complement each other. Use Safari MCP for daily browsing and testing, Chrome DevTools MCP for Chrome-specific diagnostics. For a broader look at how we use automation in production, see our business automation guide.

Open Source

Safari MCP is MIT licensed and open source. The entire codebase is two JavaScript files — safari.js for the automation layer and index.js for the MCP server.

Currently at 28 GitHub stars and 2,000+ monthly npm downloads, with contributions from the community including TypeScript declarations, bug fixes, and cross-project collaboration with other macOS MCP tool authors.

Links:

Losing leads because no one's answering?

A WhatsApp bot answers, schedules, and captures leads 24/7 — from $1,000 one-time. Free consultation →

Chat on WhatsApp

See full pricing · our projects · how it works

Achiya - Business automation and bot specialist

Achiya Cohen

Business Automation Expert · Building bots since 2020

Built 50+ automation systems for businesses — WhatsApp bots, CRM integrations, and automated workflows that save hours of work every day. Specializing in n8n, Make, and WhatsApp Business API.

Ready to automate your business?

50+ businesses already save 15 hours/week. Tell me about yours — I'll show you exactly what we can automate.

Free Consultation on WhatsApp

Response within hours · No commitment

Share this article: