LabscoMCP early access ↗
achiya-automationMCP SERVER

Safari MCP

Drives the Safari already running on your Mac — navigation, forms, screenshots, network capture and storage as MCP tools, with your existing logins intact.

by achiya-automation ↗Browser Automation, Control & ScreenshotsCommunity

LABSCO SUMMARY

You pay in macOS permissions, not in credentials.

This one automates the Safari session you already have, so anything behind a sign-in is reachable with no credential handoff and nothing to log into twice. Read that as the cost as well as the feature — every site that Safari is signed into is within reach of whatever is driving the tools, and the setup is a chain of local grants (Apple Events, Automation, Screen Recording, Accessibility) that each fail in their own quiet way. The failure modes are at least well marked: safari_doctor walks the chain, and when a session loses track of the tab it opened, the tools refuse rather than fall back onto the tab you are reading. Two things to size up before installing: it is macOS-only, and the extension-only capabilities need an Xcode build plus a Safari setting that resets on every restart.

What it is

A macOS-only MCP server that automates the Safari you already use, rather than launching a separate automation browser. Two engines sit underneath it: an optional Safari extension talking to a local bridge, and AppleScript driven through a persistent Swift helper, which is always available and takes over when the extension is not connected. It ships as the npm package safari-mcp (2.16.3) over stdio, runs npx safari-mcp with no arguments, and is MIT licensed. There is also an opt-in HTTP mode — SAFARI_MCP_HTTP=1 SAFARI_MCP_HTTP_PORT=9225 npx safari-mcp — so several clients share one process instead of one process each.

What you get

  • Navigation and page reading — safari_navigate, safari_navigate_and_read, safari_read_page, safari_get_source
  • Page state an agent can target by reference — safari_snapshot returns an accessibility tree with a ref id on every interactive element, and safari_accessibility_snapshot gives roles and ARIA
  • Clicking and pointing — safari_click, safari_click_and_read, safari_hover, safari_drag, addressable by CSS selector, visible text, coordinates, or a ref from a snapshot
  • Forms and editors — safari_fill, safari_fill_form, safari_fill_and_submit, safari_select_option, safari_react_select_set, plus safari_replace_editor for Monaco, CodeMirror, Ace and ProseMirror and safari_verify_state to read back framework-level state
  • Tabs — safari_list_tabs, safari_new_tab, safari_switch_tab, safari_wait_for_new_tab for popups such as an OAuth window
  • Capture — safari_screenshot, safari_screenshot_element, safari_save_pdf
  • Network and console — safari_start_network_capture, safari_network_details, safari_mock_route, safari_throttle_network, safari_start_console, safari_get_console
  • Cookies and storage — safari_get_cookies, safari_set_cookie, safari_local_storage, safari_session_storage, safari_export_storage, safari_import_storage, safari_list_indexed_dbs, safari_get_indexed_db
  • OS-level input — safari_native_click, safari_native_type, safari_native_keyboard, safari_native_hover send CGEvent events to Safari without bringing it to the front
  • Page analysis and diagnostics — safari_analyze_page, safari_performance_metrics, safari_css_coverage, safari_webkit_compat, safari_inspect_viewport, safari_safe_area_insets, safari_check_pwa, and safari_doctor for the permission chain
  • Batching — safari_run_script runs several actions in one call

Requirements

No account and no API key: it holds no remote connections, communicating over stdio and localhost only. What it needs instead is macOS with Safari, Node.js 20+, and a chain of local grants. Two switches inside Safari: Settings → Advanced → "Show features for web developers", then Develop → "Allow JavaScript from Apple Events". Three in System Settings → Privacy & Security: Automation → Safari, which macOS attaches to the app that launches the server (Terminal, VS Code) rather than to safari-mcp itself; Screen Recording for safari_screenshot; and Accessibility for the bundled safari-helper binary, without which the safari_native_* tools and safari_save_pdf report success but nothing moves. An npm update changes the binary's cdhash and macOS drops the Automation grant silently — the README's one-line osascript call re-triggers the prompt. The Safari extension is optional and is not in the npm package: clone the repo and build the Xcode project, and note that Develop → "Allow Unsigned Extensions" has to be re-enabled after every Safari restart.

Setup effort

One command — npx safari-mcp