How to Connect Claude Code or Codex to Safari MCP (2026)
What you get
Safari 27.0, released in September 2026, includes a built-in MCP server that lets a coding agent control a Safari window. Apple’s own list of what the agent can then do: see how your code renders, verify user state in forms and checkout flows, compare computed styles and layout with other browsers, test for accessibility issues, and analyse performance with navigation timing and resource load times. In practice it removes the loop of “run it, screenshot it, paste the screenshot into the terminal, describe what is wrong.”
The server is /usr/bin/safaridriver — the same binary Safari has used for WebDriver since Safari 10 — started with a new --mcp flag. It runs locally, makes no network calls of its own and does not touch your personal Safari data.
Prerequisites
- macOS with Safari 27.0 or later. Check Safari > About Safari. (Safari 27 ships with macOS 27 and as an update for supported earlier macOS releases; if you do not see 27.0, run Software Update.)
- Claude Code, Codex, or any MCP-capable agent (Cursor, Antigravity, OpenCode and others read a
mcp.json). - A local dev server for the agent to load — e.g.
http://localhost:3000.
Step 1 — Enable external agents in Safari
- Open Safari > Settings.
- If there is no Developer tab, go to Advanced and tick “Show features for web developers.”
- Open the Developer tab and tick “Allow remote automation and external agents.”
Without this toggle safaridriver --mcp will start but refuse to open windows.
Step 2 — Register the server with your agent
Claude Code:
claude mcp add safari-mcp -- "/usr/bin/safaridriver" --mcp
Codex:
codex mcp add safari-mcp -- "/usr/bin/safaridriver" --mcp
Any other MCP client — add this to the client’s mcp.json or config.json:
{
"mcpServers": {
"safari-mcp": {
"command": "/usr/bin/safaridriver",
"args": ["--mcp"]
}
}
}
Verify with claude mcp list (or codex mcp list); safari-mcp should show as connected.
Step 3 — Give the agent a task that needs eyes
Start a session in your project and ask for something that requires the browser:
“Open http://localhost:3000/checkout in Safari, fill the form with test data, submit, and tell me whether the success state renders. Check the console for errors and list any failed network requests.”
The first time, Safari opens an automation window — marked with an orange Smart Search field — that starts from a clean slate with no history or logins. A transparent glass pane sits over it so stray clicks do not interfere. Let the agent work; it will read the DOM, capture screenshots and report back.
Useful follow-ups:
- “Compare the computed styles of
.hero h1here and in Chrome and explain the difference.” (Pair with Chrome DevTools MCP.) - “Run an accessibility pass on this page: missing labels, ARIA misuse, contrast.”
- “Report navigation timing and the five slowest resources on load.”
Step 4 — Keep it safe
- Only point it at sites you control or trust. A page can contain text designed to hijack an agent that is reading it. Automation windows carry no logins, which limits the blast radius, but do not use the agent to browse arbitrary sites.
- Untick the Developer toggle when you are done if the Mac is shared.
- Do not enable every browser MCP at once. Each server adds dozens of tool definitions to every turn. Enable Safari MCP for WebKit checks; use Chrome DevTools MCP or Playwright MCP for profiling and headless test runs.
- Keep your agent patched. Claude Code below 2.1.179 and Codex below 0.146.0 are exposed to the Plugin4Shell plugin vulnerability disclosed September 18, 2026.
Troubleshooting
| Symptom | Fix |
|---|---|
safari-mcp shows “failed” in claude mcp list | Confirm Safari is 27.0+, and the Developer toggle is on |
| Agent says it cannot open a window | Toggle “Allow remote automation and external agents” off and on; quit and relaunch Safari |
| Tools missing from the agent | Restart the agent session after adding the server; MCP servers are read at start-up |
| Page loads but screenshots are blank | Wait for load: ask the agent to check document.readyState before capturing |
| Works in Chrome, not Safari | That is the point — you have found a WebKit-specific bug; ask the agent to diff computed styles |
Why this matters
Until September 2026 the only ways to give an agent a real Safari were third-party WebDriver wrappers or Playwright’s WebKit build, which is not Safari. Apple shipping a first-party MCP server means iOS-facing web teams can put “verify in Safari” inside the agent loop instead of at the end of it — and it sets an expectation that browsers will expose themselves to agents natively rather than through extensions.