Safari MCP is an open-source MCP server that lets AI coding agents like Claude Code and Cursor control your real Safari browser on macOS. Unlike headless Chromium, it reuses your existing browser sessions, meaning agents can access logged-in dashboards, GitHub, analytics, and other authenticated pages without any OAuth setup. The tutorial covers installation (one npx command plus two Safari settings), connecting to Claude Code or Cursor, reading pages, using accessibility-tree snapshot refs for reliable element targeting, automating logged-in workflows, and handling common pitfalls like tab safety, dynamic content, and framework forms. Limitations are clearly stated: macOS-only, single-browser, not suited for CI or parallel scraping.

15m read timeFrom freecodecamp.org
Post cover image
Table of contents
Table of ContentsWhat is MCP, and Why Does Browser Automation Need It?Why Safari Instead of Chrome or Playwright?Installing Safari MCPYour First Automation: Reading a PageThe Payoff: Automating a Logged-in WorkflowHandling the Tricky PartsLimitations: When Not to Use ThisWrapping Up
1.7K Impressions