# Claude for Safari
Gives Claude Desktop the ability to control Safari — navigate pages, read content, click elements, fill forms — via the MCP protocol, just like "Claude in Chrome".
[](https://glama.ai/mcp/servers/Lyosis/claudeForSafari)
[](https://glama.ai/mcp/servers/Lyosis/claudeForSafari)
## Architecture
```
Claude Desktop (MCP stdio)
↕ JSON-RPC
bridge/bridge.js (Node.js)
↕ WebSocket ws://localhost:45678
Safari Extension background.js (MV2)
↕ browser.tabs / executeScript
Active Safari tab
```
---
## Repository structure
```
claudeForSafari/ ← git root
├── .gitignore
├── README.md
├── bridge/ ← Node.js bridge (MCP ↔ WebSocket)
│ ├── bridge.js
│ ├── package.json
│ └── package-lock.json
└── app/ ← Xcode project
├── claudeExtension.xcodeproj
├── claudeExtension/ ← Swift host app (macOS)
└── claudeExtension Extension/
└── Resources/ ← SINGLE SOURCE for extension files
├── manifest.json
├── background.js
├── content.js
├── popup.html / popup.js / popup.css
├── images/
└── _locales/
```
> **Rule:** all extension file edits go directly in `app/claudeExtension Extension/Resources/`. There is no separate `safari-extension/` folder.
---
## Requirements
- macOS 14+ (Sonoma or later)
- Xcode 16+
- Node.js v18+ — [nodejs.org](https://nodejs.org) if not yet installed
- An Apple developer account (free account is enough for local use)
- Claude Desktop with MCP support
---
## Installation
### Step 1 — Clone the repository
```bash
git clone git@github.com:Lyosis/claudeForSafari.git
cd claudeForSafari
```
### Step 2 — Install bridge dependencies
```bash
cd bridge
npm install
cd ..
```
### Step 3 — Build the extension in Xcode
1. Open `app/claudeExtension.xcodeproj` in Xcode
2. Select the **claudeExtension** scheme (the host app)
3. Choose **My Mac** as the destination
4. Press **Cmd+R** — Xcode builds and launches the app
macOS will show a banner: *"claudeExtension wants to add a Safari extension"* → click **Open Safari Preferences** and enable the extension.
### Step 4 — Enable the extension in Safari
1. Safari → **Settings (Cmd+,)** → **Extensions** tab
2. Check **claudeExtension**
3. In the right column → **Allow on all websites**
> Without this permission, script injection into pages will fail silently.
### Step 5 — Configure Claude Desktop
Open (or create):
```
~/Library/Application Support/Claude/claude_desktop_config.json
```
Add the `safari` entry under `mcpServers`:
```json
{
"mcpServers": {
"safari": {
"command": "node",
"args": [
"/absolute/path/to/claudeForSafari/bridge/bridge.js"
]
}
}
}
```
Replace `/absolute/path/to/` with the actual path where you cloned the repo.
If `node` is not in Claude Desktop's PATH, use its full path:
```bash
which node # e.g. /usr/local/bin/node or /opt/homebrew/bin/node
```
Then **restart Claude Desktop**.
---
## Usage
The bridge starts automatically with Claude Desktop.
Safari must be open with the extension enabled.
The extension reconnects automatically to the bridge after sleep or after visiting Safari Settings — no manual action required.
---
## Available tools (13)
| Tool | Description |
|---|---|
| `safari_list_profiles` | List available Safari profiles |
| `safari_navigate` | Navigate to a URL |
| `safari_get_page_text` | Read the visible text of the current page |
| `safari_read_page` | Get the full HTML of the current page |
| `safari_javascript` | Execute arbitrary JavaScript |
| `safari_find` | Find elements by CSS selector or text content |
| `safari_click` | Click an element |
| `safari_form_input` | Fill an `` or `