Provides a comprehensive suite of 80 tools for native Safari browser automation on macOS, enabling navigation, element interaction, tab management, and session-aware browsing while preserving existing user logins and cookies.
🦁 Safari MCP
Native Safari automation for AI agents — zero Chrome overhead.
Use your real Safari browser with all your logins, cookies, and sessions. No headless browsers, no Chrome, no Puppeteer. Just pure AppleScript + JavaScript running natively on macOS.
Why? Chrome DevTools MCP heats up your Mac. Playwright launches a separate browser without your logins. Safari MCP uses your actual Safari — lightweight, native WebKit, and you stay logged in everywhere.
Highlights
80 tools — navigation, clicks, forms, screenshots, network, storage, accessibility, and more
Zero heat — native WebKit on Apple Silicon, ~60% less CPU than Chrome
Your real browser — keeps all logins, cookies, sessions (Gmail, GitHub, Ahrefs, etc.)
Background operation — Safari stays in the background, no window stealing
No dependencies — no Puppeteer, no Playwright, no WebDriver, no Chrome
Persistent process — reuses a single osascript process (~5ms per command vs ~80ms)
Framework-compatible — React, Vue, Angular, Svelte form filling via native setters
Quick Start
Prerequisites
macOS (any version with Safari)
Node.js 18+
Safari → Settings → Advanced → Show features for web developers ✓
Safari → Develop → Allow JavaScript from Apple Events ✓
Install
git clone https://github.com/achiya-automation/safari-mcp.git
cd safari-mcp
npm installConfigure
Add to your MCP client config:
{
"mcpServers": {
"safari": {
"command": "node",
"args": ["/path/to/safari-mcp/index.js"]
}
}
}{
"mcpServers": {
"safari": {
"command": "node",
"args": ["/path/to/safari-mcp/index.js"]
}
}
}{
"mcpServers": {
"safari": {
"command": "node",
"args": ["/path/to/safari-mcp/index.js"]
}
}
}{
"mcpServers": {
"safari": {
"command": "node",
"args": ["/path/to/safari-mcp/index.js"]
}
}
}Tools (80)
Navigation (4)
Tool | Description |
| Navigate to URL (auto HTTPS, wait for load) |
| Go back in history |
| Go forward in history |
| Reload page (optional hard reload) |
Page Reading (3)
Tool | Description |
| Get title, URL, and text content |
| Get full HTML source |
| Navigate + read in one call |
Click & Interaction (5)
Tool | Description |
| Click by CSS selector, visible text, or coordinates |
| Double-click (select word, etc.) |
| Right-click (context menu) |
| Hover over element |
| Click + wait for navigation |
Form Input (7)
Tool | Description |
| Fill input (React/Vue/Angular compatible) |
| Clear input field |
| Select dropdown option |
| Batch fill multiple fields |
| Fill form + submit in one call |
| Type real keystrokes (JS-based, no System Events) |
| Press key with modifiers |
Screenshots & PDF (3)
Tool | Description |
| Screenshot as PNG (viewport or full page) |
| Screenshot a specific element |
| Export page as PDF |
Scroll (3)
Tool | Description |
| Scroll up/down by pixels |
| Scroll to exact position |
| Smooth scroll to element |
Tab Management (4)
Tool | Description |
| List all tabs (index, title, URL) |
| Open new tab (background, no focus steal) |
| Close tab |
| Switch to tab by index |
Wait (2)
Tool | Description |
| Wait for element, text, or URL change |
| Wait for specified milliseconds |
JavaScript (1)
Tool | Description |
| Execute arbitrary JavaScript, return result |
Element Inspection (4)
Tool | Description |
| Element details (tag, rect, attrs, visibility) |
| Find all matching elements |
| Computed CSS styles |
| Auto-detect all forms with field selectors |
Accessibility (1)
Tool | Description |
| Full a11y tree: roles, ARIA, focusable elements |
Drag & Drop (1)
Tool | Description |
| Drag between elements or coordinates |
File Operations (2)
Tool | Description |
| Upload file via JS DataTransfer (no file dialog!) |
| Paste image into editor (no clipboard touch!) |
Dialog & Window (2)
Tool | Description |
| Handle alert/confirm/prompt |
| Resize browser window |
Device Emulation (2)
Tool | Description |
| Emulate device (iPhone, iPad, Pixel, Galaxy) |
| Reset to desktop |
Cookies & Storage (10)
Tool | Description |
| Get all cookies |
| Set cookie with all options |
| Delete one or all cookies |
| Read localStorage |
| Write localStorage |
| Delete/clear localStorage |
| Read sessionStorage |
| Write sessionStorage |
| Delete/clear sessionStorage |
| Export all storage as JSON (backup/restore sessions) |
| Import storage state from JSON |
Clipboard (2)
Tool | Description |
| Read clipboard text |
| Write text to clipboard |
Network (6)
Tool | Description |
| Quick network requests via Performance API |
| Start detailed capture (fetch + XHR) |
| Get captured requests with headers/timing |
| Clear captured requests |
| Mock network responses (intercept fetch/XHR) |
| Remove all network mocks |
Console (4)
Tool | Description |
| Start capturing console messages |
| Get all captured messages |
| Clear captured messages |
| Filter by level (log/warn/error) |
Performance (2)
Tool | Description |
| Navigation timing, Web Vitals, memory |
| Simulate slow-3g/fast-3g/4g/offline |
Data Extraction (4)
Tool | Description |
| Tables as structured JSON |
| All meta: OG, Twitter, JSON-LD, canonical |
| Images with dimensions and loading info |
| Links with rel, external/nofollow detection |
Advanced (5)
Tool | Description |
| Override browser geolocation |
| List IndexedDB databases |
| Read IndexedDB records |
| Find unused CSS rules |
| Full page analysis in one call |
Automation (1)
Tool | Description |
| Run multiple actions in a single call (batch) |
Safari MCP vs Alternatives
Feature | Safari MCP | Chrome DevTools MCP | Playwright MCP |
CPU/Heat | 🟢 Minimal | 🔴 High | 🟡 Medium |
Your logins | ✅ Yes | ✅ Yes | ❌ No |
macOS native | ✅ WebKit | ❌ Chromium | ❌ Chromium/WebKit |
Dependencies | None | Chrome + debug port | Playwright runtime |
Tools | 80 | ~30 | ~25 |
File upload | JS (no dialog) | CDP | Playwright API |
Image paste | JS (no clipboard) | CDP | Playwright API |
Focus steal | ❌ Background | ❌ Background | ❌ Headless |
Network mocking | ✅ | ❌ | ✅ |
Lighthouse | ❌ | ✅ | ❌ |
Performance trace | ❌ | ✅ | ❌ |
Tip: Use Safari MCP for daily browsing tasks (95% of work) and Chrome DevTools MCP only for Lighthouse/Performance audits.
Architecture
Claude/Cursor/AI Agent
↓ MCP Protocol (stdio)
Safari MCP Server (Node.js)
↓ Persistent osascript process (~5ms/cmd)
AppleScript → Safari
↓ do JavaScript in tab N
Page DOM (your real browser)Key design decisions:
Persistent osascript process — one long-running process instead of spawning per command (16x faster)
Tab-indexed operations — all JS runs on a specific tab by index, never steals visual focus
JS-first approach — typing, clicking, file upload all use JavaScript events (no System Events keyboard conflicts)
No
activate— Safari is never brought to foreground
macOS Permissions
Safari MCP needs these one-time permissions:
Permission | Where | Why |
JavaScript from Apple Events | Safari → Develop menu | Required for |
Screen Recording | System Settings → Privacy | Required for |
Accessibility | System Settings → Privacy | Required for |
Troubleshooting
Issue | Fix |
"AppleScript error" | Enable "Allow JavaScript from Apple Events" in Safari → Develop |
Screenshots empty | Grant Screen Recording permission to Terminal/VS Code |
Tab not found | Call |
Hebrew keyboard issues | All typing uses JS events — immune to keyboard layout |
HTTPS blocked |
|
Safari steals focus | Ensure you're on latest version — |
Contributing
PRs welcome! The codebase is two files:
safari.js— Safari automation layer (AppleScript + JavaScript)index.js— MCP server with tool definitions
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.