SuperAPIAI Directory

safari-mcp

github.com · AI agents

Native Safari browser automation without a Chrome dependency.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsiOS · macOS

About this tool

Purpose

Safari MCP is a native Safari browser automation tool for AI agents. It lets AI coding agents or automation agents directly drive the user's already logged-in Safari browser, without having to launch Chromium, a headless browser, or a second Chrome instance. Its target scenario is: when an agent needs to browse web pages, fill out forms, click, take screenshots, or extract data, it can directly reuse the user's existing cookies, login sessions, and cookie state, such as Gmail, GitHub, Ahrefs, Slack, banking websites, and so on.

It is officially positioned as an alternative to Chrome DevTools MCP, emphasizing that on Apple Silicon it can reduce CPU usage and heat by about 40% to 60%, with command latency of about 5 milliseconds, and Safari stays running in the background without stealing focus.

Main capabilities

  • Provides 98 tools, which by official classification include: page reading (3), clicking and interaction (6), form input (11), screenshots and PDF (3), tab management (5), element inspection (4), accessibility (2), drag and drop (1), file operations (2), dialogs and windows (2), device emulation (2), cookies and storage (11), performance (2), data extraction (4), native input CGEvent (4), iOS and WebKit validation (4).
  • Operations such as navigation, clicking, form filling, screenshots, network requests, storage, and accessibility.
  • Element location supports multiple strategies; the official recommendation is to first use safari_snapshot to obtain an element reference, then use ref for precise operations, which is faster and more reliable than CSS selectors.
  • Form filling is compatible with React, Vue, Angular, and Svelte, implemented through native setters.
  • Supports background operation; Safari will not be brought to the foreground, and the agent can drive the page while the user continues typing in other applications.
  • Supports multi-agent concurrency: it can run through a shared HTTP daemon, with each session having independent tab state; the server binds activeTabIndex, ownership flags, and unique tab markers by MCP session id, preventing sessions from reading or operating on each other's tabs.
  • By default, it only operates on tabs it opened itself; if you need to operate on already-open tabs, you can set SAFARI_MCP_ALLOW_USER_TABS=1, and explicitly "adopt" the specified tab via safari_switch_tab.
  • Provides safari_doctor for local diagnostics.

Usage

The environment requirement is macOS (any version with Safari). You first need to enable in Safari: Settings → Advanced → Show features for web developers; Settings → Developer → Allow JavaScript from Apple Events.

Installation uses a single command: npx safari-mcp, with no global installation required; permanent installation is also optional. Configuration is done by pointing the MCP client to npx safari-mcp; the official documentation provides configuration examples for clients such as VS Code, VS Code Insiders, Cursor, Claude Desktop, Windsurf, Cline, Continue, Goose, LM Studio, and Zed. For example, for Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json and restart after saving; for Cursor, edit .cursor/mcp.json in the project; for VS Code, edit .vscode/mcp.json; for Windsurf, edit .windsurf/mcp.json in the project or the global ~/.codeium/windsurf/mcp_config.json; for Cline, open the MCP icon in VS Code and edit the settings; for Continue, edit ~/.continue/config.yaml; for Goose, edit ~/.config/goose/config.yaml; for LM Studio, add it in Settings → MCP Servers → Add Server, with Args set to safari-mcp; for Zed, search for Context Servers in Settings and add it.

For multi-agent concurrency, the official recommendation is to run a shared HTTP daemon, then have each client point to that daemon, so that one daemon serves multiple sessions and each session gets its own tab state. If you prefer stdio (one process per agent), you can also use the processBoundary implementation isolation; however, the official note states that if the client multiplexes through the mcporter proxy, mcporter caches one MCP client for all proxies, the server cannot see different sessions, and per-session isolation cannot take effect; in this case, mcporter-lanes can be used to fix it.

Regarding environment variables, SAFARI_PROFILE is optional; when not set, the session is bound to a normal Safari window, cookies, and login state; SAFARI_MCP_RAISE_ON_NAVIGATE=1 is suitable for proxies whose purpose is to display pages (such as a voice assistant executing "open YouTube"), and is off by default; SAFARI_MCP_ALLOW_USER_TABS=1 is used to allow explicitly adopting user tabs, and is off by default.

Applicable scenarios

  • AI coding agents need to perform browsing, form filling, clicking, screenshots, data extraction, and other operations on websites where they are already logged in.
  • Need to preserve real browser login state, cookies, and sessions, without wanting to log in again or use a headless browser.
  • Need to run silently in the background without stealing the user's current window focus.
  • On Apple Silicon, want to reduce the impact of browser automation on CPU and heat.
  • Multiple agents or subagents need to operate the same Safari in parallel without interfering with each other.

Limitations

  • Only supports macOS.
  • Requires enabling Safari's web developer features and JavaScript permission in Apple Events.
  • By default, does not operate tabs opened by the user; if operation is needed, the environment variable must be explicitly set and safari_switch_tab called to adopt them, and safari_close_tab will still refuse to close adopted tabs.
  • safari_native_* tools require system accessibility permission (in macOS 27 this panel is named Device Control and Data Access), and the safari-helper executable must be added to the allow list.
  • The Safari extension is optional but recommended; without the extension installed, about 80% of functionality is still available through AppleScript, and the extension can supplement capabilities that AppleScript cannot provide, such as modern SPAs with closed Shadow DOM, strict CSP sites, and framework-based editors (Draft.js, ProseMirror, Slate). The extension requires a one-time build with Xcode, and the npm package does not include the xcode/ directory, so the GitHub repository must be cloned to build from source.
  • The extension must be re-enabled after each Safari restart in Settings → Developer by enabling "Allow unsigned extensions."
  • The official description states that starting with Safari Technology Preview 247 (July 2026), Apple provides an official Safari MCP based on safaridriver in stable Safari 27.0, whose purpose is isolated WebDriver automation session debugging; safari-mcp is aimed at driving a real, logged-in Safari. If both are used at the same time, one of them must be renamed to avoid a name conflict.
  • The official documentation clearly states that safari-mcp's navigator.webdriver returns false, but this is not an anti-detection feature; the rest of the browser is not disguised, and real login is used, so it should be assumed that every page can identify the user's identity.
  • Regarding fees, pricing, platform expansion, performance promises, and other more information, the materials do not currently provide it.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools