MCP Directory

Safari MCP

Native Safari browser automation for AI agents on macOS — 80 tools, your real logged-in browser, no Chrome.

Unverified
stdio (local)
No auth
JavaScript

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
npx safari-mcp

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

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

Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf

Before you start

  • macOS (any version with Safari)
  • Node.js 18+
  • Safari → Settings → Advanced → Show features for web developers enabled
  • Safari → Develop → Allow JavaScript from Apple Events enabled
  • Automation → Safari permission granted to the MCP client's parent process (e.g. VS Code or Terminal)
  • Optional: Safari MCP extension (built via Xcode) for closed Shadow DOM, strict CSP, and framework-heavy editors

About Safari MCP

Safari MCP is a macOS-only Model Context Protocol server that lets AI agents automate the user's real, logged-in Safari browser via 80 tools, with no Chrome, Puppeteer, Playwright, or WebDriver dependencies. It uses a dual-engine approach: a Safari extension (preferred) plus an AppleScript fallback driven by a persistent Swift helper, achieving ~5ms per command and ~60% less CPU than Chrome while keeping Safari in the background without stealing focus. The recommended workflow is snapshot → interact by ref → snapshot to verify.

Tools & capabilities (79)

safari_navigate

Navigate to a URL (auto HTTPS, wait for load).

safari_go_back

Go back in browser history.

safari_go_forward

Go forward in browser history.

safari_reload

Reload the page (optional hard reload).

safari_read_page

Get the page title, URL, and text content.

safari_get_source

Get the full HTML source of the page.

safari_navigate_and_read

Navigate to a URL and read the page in one call.

safari_click

Click an element by CSS selector, visible text, or coordinates.

safari_double_click

Double-click an element (e.g. to select a word).

safari_right_click

Right-click to open a context menu.

safari_hover

Hover over an element.

safari_click_and_wait

Click an element and wait for navigation.

safari_fill

Fill an input (React/Vue/Angular compatible via native setters).

safari_clear_field

Clear an input field.

safari_select_option

Select an option from a dropdown.

safari_fill_form

Batch fill multiple form fields.

safari_fill_and_submit

Fill a form and submit it in one call.

safari_type_text

Type real keystrokes via JavaScript (no System Events).

safari_press_key

Press a key with optional modifiers.

safari_screenshot

Capture a screenshot as PNG (viewport or full page).

safari_screenshot_element

Screenshot a specific element.

safari_save_pdf

Export the page as a PDF.

safari_scroll

Scroll up or down by a number of pixels.

safari_scroll_to

Scroll to an exact position.

safari_scroll_to_element

Smooth scroll to a specific element.

safari_list_tabs

List all tabs with index, title, and URL.

safari_new_tab

Open a new tab in the background (no focus steal).

safari_close_tab

Close a tab.

safari_switch_tab

Switch to a tab by index.

safari_wait_for

Wait for an element, text, or URL change.

safari_wait

Wait for a specified number of milliseconds.

safari_evaluate

Execute arbitrary JavaScript and return the result.

safari_get_element

Get element details (tag, rect, attributes, visibility).

safari_query_all

Find all elements matching a selector.

safari_get_computed_style

Get computed CSS styles for an element.

safari_detect_forms

Auto-detect all forms with their field selectors.

safari_accessibility_snapshot

Get the full a11y tree: roles, ARIA, focusable elements.

safari_drag

Drag between elements or coordinates.

safari_upload_file

Upload a file via JS DataTransfer (no file dialog).

safari_paste_image

Paste an image into an editor (no clipboard touch).

safari_handle_dialog

Handle alert/confirm/prompt dialogs.

safari_resize

Resize the browser window.

safari_emulate

Emulate a device (iPhone, iPad, Pixel, Galaxy).

safari_reset_emulation

Reset device emulation back to desktop.

safari_get_cookies

Get all cookies.

safari_set_cookie

Set a cookie with all options.

safari_delete_cookies

Delete one or all cookies.

safari_local_storage

Read localStorage.

safari_set_local_storage

Write to localStorage.

safari_delete_local_storage

Delete or clear localStorage.

safari_session_storage

Read sessionStorage.

safari_set_session_storage

Write to sessionStorage.

safari_delete_session_storage

Delete or clear sessionStorage.

safari_export_storage

Export all storage as JSON (backup/restore sessions).

safari_import_storage

Import storage state from JSON.

safari_clipboard_read

Read clipboard text.

safari_clipboard_write

Write text to the clipboard.

safari_network

Get quick network requests via the Performance API.

safari_start_network_capture

Start detailed network capture (fetch + XHR).

safari_network_details

Get captured requests with headers and timing.

safari_clear_network

Clear captured network requests.

safari_mock_route

Mock network responses (intercept fetch/XHR).

safari_clear_mocks

Remove all network mocks.

safari_start_console

Start capturing console messages.

safari_get_console

Get all captured console messages.

safari_clear_console

Clear captured console messages.

safari_console_filter

Filter console messages by level (log/warn/error).

safari_performance_metrics

Get navigation timing, Web Vitals, and memory.

safari_throttle_network

Simulate slow-3g/fast-3g/4g/offline network conditions.

safari_extract_tables

Extract tables as structured JSON.

safari_extract_meta

Extract all meta: OG, Twitter, JSON-LD, canonical.

safari_extract_images

Extract images with dimensions and loading info.

safari_extract_links

Extract links with rel, external/nofollow detection.

safari_override_geolocation

Override the browser geolocation.

safari_list_indexed_dbs

List IndexedDB databases.

safari_get_indexed_db

Read IndexedDB records.

safari_css_coverage

Find unused CSS rules.

safari_analyze_page

Run a full page analysis in one call.

safari_run_script

Run multiple actions in a single batched call.

What this server can do

Safari MCP provides tools for these capabilities — tap one to see every MCP server that does the same:

When to use it

  • Let an AI coding agent drive your real, logged-in Safari (Gmail, GitHub, Ahrefs, Slack, dashboards) without re-authenticating
  • Automate modern SPAs with closed Shadow DOM or strict CSP using the Safari extension engine
  • Fill and submit React/Vue/Angular forms reliably via native setters
  • Scrape structured data — tables, meta tags, images, links — and capture or mock network requests
  • Run background browser automation on macOS with minimal CPU/heat while you keep using your Mac

Security notes

Runs locally on macOS with no remote connections (stdio + localhost only) and no telemetry. The optional Safari extension communicates only with localhost:9224. Requires macOS system permissions: Automation → Safari (granted to the parent process running the MCP client, e.g. VS Code/Terminal), "Allow JavaScript from Apple Events" in Safari's Develop menu, Screen Recording (for screenshots), and Accessibility for safari-helper (for native CGEvent click/keyboard tools). The safari_evaluate tool runs arbitrary JavaScript in your real, logged-in Safari, so it has access to authenticated sessions.

Safari MCP FAQ

Does Safari MCP work without installing the Safari extension?

Yes. Roughly 80% of functionality works through the AppleScript engine alone. The optional extension adds closed Shadow DOM access, strict-CSP bypass via the MAIN world, deeper framework state manipulation, and smart loading-state detection.

Is it cross-platform?

No. Safari MCP is macOS only, since it drives Safari via AppleScript/WebKit. It requires Node.js 18+ and enabling 'Allow JavaScript from Apple Events' in Safari's Develop menu.

Why does Automation permission need to be granted to my IDE rather than to safari-mcp?

macOS TCC grants Automation permission to the parent process that spawns the MCP server (e.g. VS Code or Terminal), not to safari-mcp itself. If the prompt doesn't appear, run `osascript -e 'tell application "Safari" to get URL of current tab of window 1'` once from a Terminal that already has Automation permission to register it.

Does it send any data remotely?

No. All communication is local (stdio plus localhost), there's no telemetry or analytics, and the code is fully open source under MIT. The optional extension talks only to localhost:9224.

Alternatives to Safari MCP

Compare all alternatives →

All-in-one web access MCP — Web Unlocker, SERP, Scraper API, and a cloud Scraping Browser.

Verified
stdio (local)
API key
JavaScript
12 tools
Updated 18 days agoRepo

Popular community Playwright + API testing MCP server with codegen, screenshots, and device emulation.

Verified
stdio (local)
No auth
TypeScript
12 tools
Updated 1 month agoRepo

Official Browserbase cloud-browser MCP built on Stagehand — natural-language act/extract/observe.

Verified
stdio (local)
API key
TypeScript
8 tools
Updated 18 days agoRepo