MCP 服务器概览
what is Safari MCP?
Safari MCP is a native Safari browser automation MCP (Model Context Protocol) server for macOS. It lets AI agents and developer tools drive the real Safari instance you are already logged into (cookies, sessions, extensions) instead of spinning up Chromium or using headless scrapers. It provides 97 tools for navigation, interaction, screenshots, network mocking, accessibility snapshots, device emulation, storage and more, with a dual-engine architecture (Safari extension + AppleScript/Swift helper) for speed and broad capability.
how to use Safari MCP?
- Prerequisites: macOS with Safari, Node.js 18+, enable “Show features for web developers” and “Allow JavaScript from Apple Events” in Safari.
- Quick install/run:
npx safari-mcp(ornpm install -g safari-mcp/ Homebrew / clone from source). - Configure your MCP client (Claude, Cursor, VS Code, LM Studio, etc.) to run
npx safari-mcpor point to the local HTTP daemon if running multiple agents. - Recommended workflow: 1) call
safari_snapshotto get element refs, 2) interact withsafari_click/safari_filletc., 3) callsafari_snapshotto verify the result. Use the optional Safari MCP Bridge extension for advanced sites and closed shadow DOM.
key features
- 97 specialized tools covering navigation, clicks, forms, screenshots, PDF export, network capture & mocking, accessibility snapshots, device emulation, cookies/localStorage/IndexedDB operations, native OS input (CGEvent), and more.
- Drives your real Safari (keeps logins and sessions), runs in background (no focus stealing), and uses native WebKit (~60% less CPU than Chrome in typical tasks).
- Dual-engine design: fast extension-based path plus AppleScript/Swift fallback so functionality works even without the extension.
- Persistent helper process for low-latency commands (~5ms per command) and optional single HTTP daemon for many concurrent agent sessions (isolated tab identity per session).
- Security: runs locally, no telemetry, open source MIT license, minimal attack surface.
use cases
- Letting AI coding agents browse and interact with authenticated web apps (Gmail, GitHub, Slack, banking dashboards).
- Automating complex SPAs with React/Vue/Angular-friendly form filling and editor handling (Monaco, ProseMirror, etc.).
- Reliable data extraction (tables, meta, images, links) and accessibility testing using the accessibility tree snapshots.
- Background automation workflows that must preserve user sessions and extensions (agent-driven UX tasks, integrations, or bots running on a developer machine).
- Network mocking and debugging of web interactions without spinning up Chromium-based tooling.
FAQ from the project
- Is Safari MCP cross-platform?
No. It is macOS-only and requires Safari.
- Do I need the Safari extension?
The extension is optional but recommended for advanced capabilities (closed shadow DOM, strict CSP sites, deep framework hooks). AppleScript/Swift covers ~80% of functionality without it.
- How do I run multiple agents concurrently?
Start the server as an HTTP daemon (
SAFARI_MCP_HTTP=1) and point each client to the daemon endpoint. Each session gets a unique tab marker so sessions are isolated.
- What permissions are required?
You must enable “Allow JavaScript from Apple Events” in Safari and grant macOS permissions for Automation, Screen Recording (for screenshots), and Accessibility for native input helpers (if you use native click/keyboard APIs).
- How does this compare to Apple’s safaridriver or Chrome DevTools MCP?
Safari MCP drives your real Safari with logins and storage and is optimized for low CPU/background operation and a broad toolset. Apple’s safaridriver provides isolated WebDriver sessions (useful for clean-room debugging). Chrome DevTools MCP offers Lighthouse and Chrome-specific traces — use Safari MCP for daily, sessionful automation on macOS.
- How do I install/update?
The easiest is
npx safari-mcp. You can also install globally, via Homebrew, or build from source (required to build the Xcode extension).