Skip to main content
Glama

safari-browser-mcp

Let Claude drive Safari the way Claude in Chrome drives Chrome.

This is an MCP server for macOS. Hook it up to Claude Code, the Claude desktop app or any other MCP client, and Claude can open tabs, read pages, click, fill forms, press keys, run JavaScript and take screenshots in your real Safari, with your real sign-ins.

Unofficial community project. Not affiliated with or endorsed by Anthropic or Apple.

How it works

Claude in Chrome is a Chrome extension. Safari can't run it, but Safari has a built-in scripting interface, so this server controls Safari from the outside:

  • Tabs and navigation go through Safari's JavaScript for Automation API (osascript -l JavaScript).

  • Reading and interacting with pages uses Safari's do JavaScript to run small scripts inside the tab. Elements get stable ref_N ids so Claude can click or type into them later.

  • Screenshots use screencapture on the Safari window.

  • Key presses use System Events.

No browser extension and no Safari WebDriver session is needed. Claude works in the Safari you already have open.

Related MCP server: Browser Agent MCP Server

Tools

Tool

What it does

tabs_list

List open tabs (windowId:tabIndex, title, URL)

tabs_create

Open a new tab, optionally at a URL

tabs_select / tabs_close

Bring a tab to the front / close it

navigate

Load a URL, or back / forward / reload

get_page_text

Readable text of the page

read_page

Outline of the page with [ref_N] ids for interactive elements

find

Search elements by role, name or text

click

Click by ref or CSS selector

form_input

Set inputs, textareas, selects, checkboxes; optionally submit

press_key

Real key presses, e.g. Return, cmd+l, shift+tab

scroll

Scroll the page or scroll an element into view

javascript

Run JS in the page (await allowed, return a value)

screenshot

PNG of the Safari window

Every page tool takes an optional tab. Without it, it uses the active tab of the front window.

Setup

Requires macOS and Node.js 18 or newer.

git clone https://github.com/riguillen1972/safari-browser-mcp.git
cd safari-browser-mcp
npm install

1. Let Safari run JavaScript from automation

  1. Safari > Settings > Advanced > turn on Show features for web developers.

  2. In the menu bar: Develop > Allow JavaScript from Apple Events.

2. Add it to Claude

Claude Code:

claude mcp add safari -- node /absolute/path/to/safari-browser-mcp/src/index.js

Claude desktop app: add this to ~/Library/Application Support/Claude/claude_desktop_config.json, then restart the app:

{
  "mcpServers": {
    "safari": {
      "command": "node",
      "args": ["/absolute/path/to/safari-browser-mcp/src/index.js"]
    }
  }
}

3. Approve the macOS prompts

The first time Claude uses it, macOS asks for permission for the app that runs the server (Terminal, iTerm, Claude, …):

Permission

Needed for

Where

Automation → Safari

everything

prompted automatically

Screen Recording

screenshot

System Settings > Privacy & Security

Accessibility

press_key

System Settings > Privacy & Security

Check it works

With Safari open:

npm run smoke

It prints the tool list and your open tabs.

Try it

Open a new Safari tab, search Hacker News for "MCP" and summarise the top three results.

In my current Safari tab, fill in the contact form with test data but don't submit it.

Limits

  • click and form_input dispatch DOM events. They work on almost all sites, but a site that checks event.isTrusted will ignore them. Use press_key or javascript as a fallback.

  • Pages inside cross-origin iframes can't be read or controlled.

  • screenshot and press_key bring Safari to the front.

  • Private windows can't be scripted.

Safety

Claude acts as you, in your signed-in browser. Watch what it does, keep sensitive tabs closed, and don't let it act on instructions it reads on web pages.

License

MIT

Available Tools

14 tools
clickB

Click an element by ref (from read_page/find) or CSS selector.

Inputs: ref, tab, selector.

findB

Find visible elements whose role/name/text contains the query. Returns up to 20 refs.

Inputs: query (required), tab.

form_inputB

Set the value of an input, textarea, select, checkbox or contenteditable. Optionally submit its form.

Inputs: value (required), ref, tab, submit, +1 more.

get_page_textB

Get the readable text of the page (main/article first, else body).

Inputs: tab, max_chars.

javascriptA

Run JavaScript in the page. Write a function body and return the value you want (await is allowed). Result is JSON-serialised.

Inputs: code (required), tab, timeout_ms.

press_keyA

Send real key presses to Safari, e.g. "Return", "Tab", "cmd+l", "shift+tab". Needs Accessibility permission.

Inputs: key (required), repeat.

read_pageB

Read the page as an outline. Interactive elements get [ref_N] ids usable with click / form_input / scroll.

Inputs: tab, filter, max_chars.

screenshotA

Screenshot the Safari window (brings it to the front). Needs Screen Recording permission.

Inputs: tab.

scrollB

Scroll the page by ticks in a direction, or scroll an element (ref) into view.

Inputs: ref, tab, amount, direction.

tabs_closeC

Close a tab.

Inputs: tab (required).

tabs_createA

Open a new Safari tab (optionally at a URL) and make it active.

Inputs: url.

tabs_listA

List every open Safari tab with its id, title and URL.

Inputs: no named parameters.

tabs_selectC

Bring a tab to the front.

Inputs: tab (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 14 tools

    Disambiguation4/5

    Tab lifecycle tools (tabs_*) are cleanly separated from page-interaction tools, and click/find/read_page have clear distinct roles. Minor overlaps exist: get_page_text vs read_page both return page content, find returns refs like read_page does, and tabs_create can open a URL that navigate also handles, but descriptions make the intended split reasonably clear.

    Naming Consistency4/5

    Everything is snake_case, with a coherent noun_verb grouping for tab operations (tabs_list, tabs_create, tabs_select, tabs_close). The rest are bare verbs (navigate, click, find, scroll, screenshot), which is a deviation from the verb_noun pattern but is a systematic and readable split between tab management and page actions.

    Tool Count5/5

    14 tools is squarely in the well-scoped range for a browser automation server. Each tool maps to a distinct capability (tab control, navigation, reading, interaction, scripting, capture) with no obvious redundancy.

    Completeness4/5

    Covers the full loop of tab management, navigation, reading (text/outline/find), interaction (click, form_input, press_key, scroll), JS execution, and screenshots. Minor gaps remain: no explicit wait-for-load tool, no hover, and no history/cookie or window management, though javascript can work around some of these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Safari Web Extension + Node.js MCP bridge giving Claude Desktop full control over Safari — navigate, read pages, click elements, fill forms, and manage tabs. No Playwright or WebDriver dependency.
      4
      13
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server that drives the user's real signed-in Chrome on macOS via AppleScript (Apple Events). 32 tools covering tab/window control, navigation, DOM extraction, form interaction, and arbitrary JS execution. Same engine as the familiar Claude Code skill in the repository.
      1
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to control the user's real Safari on macOS, reading pages, taking screenshots, clicking, typing, and recording GIFs, with a per-host read-only policy and prompt-injection safeguards.
      21
      MIT