safari-mcp 2.16.2 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -8
- package/extension/background.js +2241 -358
- package/extension/command-content.js +333 -0
- package/extension/content.js +103 -0
- package/extension/manifest.json +24 -17
- package/index.js +1099 -132
- package/ownership-match.js +17 -2
- package/ownership-state.js +30 -7
- package/package.json +2 -2
- package/safari-helper +0 -0
- package/safari-helper.swift +434 -0
- package/safari.js +300 -17
package/README.md
CHANGED
|
@@ -353,6 +353,19 @@ Prefer stdio (one process per agent) over a persistent daemon? That works too
|
|
|
353
353
|
|
|
354
354
|
---
|
|
355
355
|
|
|
356
|
+
## Environment variables
|
|
357
|
+
|
|
358
|
+
| Variable | Default | What it does |
|
|
359
|
+
|----------|---------|--------------|
|
|
360
|
+
| `SAFARI_MCP_HTTP` | off | Run one shared HTTP daemon instead of a process per client (see above). |
|
|
361
|
+
| `SAFARI_MCP_HTTP_PORT` | `9225` | Port for that daemon. |
|
|
362
|
+
| `SAFARI_PROFILE` | unset | Bind sessions to a named Safari profile. Unset = your ordinary windows. |
|
|
363
|
+
| `SAFARI_MCP_RAISE_ON_NAVIGATE` | off | Let navigation bring Safari to the front, and stop the focus guard from putting your previous app back. |
|
|
364
|
+
|
|
365
|
+
`SAFARI_MCP_RAISE_ON_NAVIGATE=1` is for agents whose whole point is *showing* you a page — a voice assistant answering "open YouTube", a demo driver. Everything else should leave it off: by default Safari MCP works in the background and hands focus back to whatever app you were using, so an agent can drive a page while you keep typing somewhere else.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
356
369
|
## Tools (97)
|
|
357
370
|
|
|
358
371
|
<details>
|
|
@@ -568,7 +581,7 @@ Safari MCP runs locally on your Mac with minimal attack surface:
|
|
|
568
581
|
| Network | **No remote connections** — all communication is local (stdio + localhost) |
|
|
569
582
|
| Permissions | macOS system permissions required (Screen Recording for screenshots) |
|
|
570
583
|
| Data | No telemetry, no analytics, no data sent anywhere |
|
|
571
|
-
| Extension | Communicates only with `localhost:9224
|
|
584
|
+
| Extension | Communicates only with the local profile bridges (`localhost:9224/9228/9232/9236`), validated by Safari |
|
|
572
585
|
| Code | Fully open source (MIT) — audit every line |
|
|
573
586
|
|
|
574
587
|
---
|
|
@@ -698,23 +711,25 @@ The extension requires a one-time build with Xcode (free, included with macOS).
|
|
|
698
711
|
git clone https://github.com/achiya-automation/safari-mcp.git
|
|
699
712
|
cd safari-mcp
|
|
700
713
|
|
|
701
|
-
# 2. Build
|
|
714
|
+
# 2. Build a clean, Apple Development-signed app
|
|
715
|
+
# If needed, first choose your Team in Xcode → Signing & Capabilities.
|
|
702
716
|
xcodebuild -project "xcode/Safari MCP/Safari MCP.xcodeproj" \
|
|
703
|
-
-scheme "Safari MCP (macOS)" -configuration Release
|
|
717
|
+
-scheme "Safari MCP (macOS)" -configuration Release \
|
|
718
|
+
-allowProvisioningUpdates clean build
|
|
704
719
|
|
|
705
|
-
# 3.
|
|
706
|
-
# (xcodebuild without a signing identity produces a bundle Safari silently rejects)
|
|
720
|
+
# 3. Locate the signed app
|
|
707
721
|
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData/Safari_MCP-*/Build/Products/Release -name "Safari MCP.app" -maxdepth 2 | head -1)
|
|
708
|
-
codesign --sign - --force --deep "$APP_PATH"
|
|
709
722
|
|
|
710
723
|
# 4. Re-sign safari-helper with the Apple Events entitlement
|
|
711
724
|
# (helps macOS surface the TCC Automation prompt reliably)
|
|
712
725
|
codesign --sign - --force --entitlements safari-helper.entitlements safari-helper
|
|
713
726
|
|
|
714
|
-
#
|
|
727
|
+
# 5. Open the app (needed once so Safari registers the extension)
|
|
715
728
|
open "$APP_PATH"
|
|
716
729
|
```
|
|
717
730
|
|
|
731
|
+
> **Do not ad-hoc re-sign `Safari MCP.app` with `codesign --deep --sign -`.** That replaces the Apple Development identity on the wrapper and embedded extension; current Safari can then silently disable or mark the extension as removed. If a previous build was ad-hoc signed, run the `clean build` command above again.
|
|
732
|
+
|
|
718
733
|
Alternatively, open `xcode/Safari MCP/Safari MCP.xcodeproj` directly in Xcode, select your Apple ID under Signing & Capabilities, and click Run. A free personal Apple Developer account is sufficient for local use.
|
|
719
734
|
|
|
720
735
|
Then in Safari:
|
|
@@ -722,7 +737,7 @@ Then in Safari:
|
|
|
722
737
|
2. Safari → Develop → **Allow Unsigned Extensions** (required each Safari restart)
|
|
723
738
|
3. Safari → Settings → Extensions → enable **Safari MCP Bridge**
|
|
724
739
|
|
|
725
|
-
The extension connects automatically to the
|
|
740
|
+
The extension connects automatically to the first local bridge whose declared Safari profile matches its own. The default bridge ports are `9224`, `9228`, `9232`, and `9236`; a single-profile setup normally uses `9224`.
|
|
726
741
|
|
|
727
742
|
> **Note:** "Allow Unsigned Extensions" resets every time Safari restarts. You'll need to re-enable it in the Develop menu after each restart. The extension itself stays installed.
|
|
728
743
|
|