Safari MCP
Drives macOS Safari, enabling tab and window management, navigation, accessibility-tree page reading, element finding, JavaScript execution, screenshots, clicks and typing, form input, waiting for conditions, console and network inspection, and window resizing using the user's existing Safari sessions and cookies.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Safari MCP
An MCP server that lets Claude Code drive Safari on macOS, in the same way as the Claude in Chrome extension. It controls your real Safari, so your sign-ins and cookies are available.
It has no dependencies and needs no Safari extension. It uses AppleScript/JXA (do JavaScript), screencapture and AppKit.
Requirements
macOS with Safari (tested on macOS 26 / Safari 26)
Node.js 18 or later
Related MCP server: familiar-mcp
Setup
Get the code. Clone the repository, or download and unzip the latest release:
git clone https://github.com/Sausagerolls/safari-mcp.git ~/safari-mcpAllow scripted JavaScript in Safari.
Open Safari > Settings > Advanced and turn on "Show features for web developers".
Open the new Developer tab and turn on "Allow JavaScript from Apple Events".
Register the server with Claude Code. User scope makes it available in every project. Use the absolute path to
server.mjs:claude mcp add safari -s user -- node ~/safari-mcp/server.mjsRestart Claude Code. Then check the connection:
claude mcp get safariGrant macOS permissions to the app that runs Claude Code (your terminal, IDE or desktop app) when macOS asks. You can also set them in System Settings > Privacy & Security:
Automation > Safari (required)
Screen & System Audio Recording (required for screenshots)
Accessibility (only for
native: trueinput)
Then ask Claude, for example: "open localhost:3000 in Safari and check the console for errors".
Optional: use Safari instead of Claude in Chrome
To stop Claude Code from using or setting up the Chrome integration in any project:
Run
/chromein Claude Code and turn off "Enabled by default".Block the Chrome tools in
~/.claude/settings.json:{ "permissions": { "deny": ["mcp__claude-in-chrome"] } }Tell Claude to prefer Safari in
~/.claude/CLAUDE.md:# Browser automation - Use the Safari MCP server (`mcp__safari__*` tools) for all browser tasks. - Never use Claude in Chrome (`mcp__claude-in-chrome__*`).
Tools
Tool | Purpose |
| List windows and tabs. Tab ids are |
| Manage tabs. |
| Go to a URL, or |
| Accessibility-style tree with element refs ( |
| Keyword search for elements. Returns refs and coordinates. |
| Readable page text. |
| Run JS in the page. Supports |
|
|
| Set inputs, selects, checkboxes by ref. |
| Wait for a selector, text or JS condition. |
| Console output, uncaught errors, and auto-dismissed dialogs. |
| Resource Timing entries plus fetch/XHR with method and status. |
| Resize the Safari window. |
Screenshots are cropped to the page viewport. Image pixel coordinates equal page CSS coordinates (scaled only when the viewport is wider than 1400 px).
How input works
By default, clicks, typing and keys are synthesized DOM events inside the page. Safari does not need to be in front, and your mouse does not move. This works for most sites and frameworks (React, Vue and others).
Some actions need trusted events: CSS :hover, file pickers, native <select> popups, and sites that check event.isTrusted. For these, pass native: true. Safari then comes to the front, and the real mouse or keyboard is used. This needs Accessibility permission.
Limitations
Console and network capture start when a tool first touches a page.
navigateinstalls capture right after load, so logs during initial page load are missed. Usenavigatewithreload, or read the network list, which includes all resources from Resource Timing.Safari does not expose HTTP status for non-fetch/XHR resources in Resource Timing, so those show
-.Tab ids use the tab index, which shifts when you close an earlier tab in the same window.
Cross-origin iframe content is not visible to
read_pageorfind. Use screenshots and coordinates instead.alert,confirmandpromptare replaced after the first tool call on a page, because a blocking dialog would freeze AppleScript.confirm()returnsfalseunless you setwindow.__mcp.confirmResult = true.Page zoom other than 100% breaks the screenshot coordinate mapping.
Troubleshooting
Error | Fix |
"Safari blocks scripted JavaScript" | Do setup step 2. |
"macOS denied Automation access to Safari" | System Settings > Privacy & Security > Automation: allow your terminal app to control Safari. |
"Screenshot failed" | Grant Screen Recording permission to your terminal app, and make sure the Safari window is not minimized. |
A tool call hangs, then times out | A page dialog opened before the server touched the page. Dismiss it in Safari. |
Test
The smoke test opens a fixture page in a new Safari tab and runs every main tool:
(cd test && python3 -m http.server 8765 --bind 127.0.0.1 &)
node test/smoke.mjs http://127.0.0.1:8765/fixture.htmlLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
Related MCP Servers
- AlicenseAqualityBmaintenanceSafari 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.4131MIT
- AlicenseNot gradedqualityCmaintenanceMCP 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.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to drive your everyday logged-in browser session — opening and closing tabs, navigating, clicking, typing, scrolling, filling forms, uploading files, taking screenshots, and reading page text, console output and network requests. It runs through a local native-messaging bridge, scoping each client session to its own window behind yours.260 npm2MIT
- AlicenseAqualityCmaintenanceEnables Claude and other MCP clients to control Safari on macOS, opening tabs, reading pages, clicking, filling forms, pressing keys, running JavaScript, and taking screenshots in the user's real signed-in browser.14MIT