safari-mcp 2.22.17 → 2.22.18
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 +4 -2
- package/index.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -752,8 +752,10 @@ xcodebuild -project "xcode/Safari MCP/Safari MCP.xcodeproj" \
|
|
|
752
752
|
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData/Safari_MCP-*/Build/Products/Release -name "Safari MCP.app" -maxdepth 2 | head -1)
|
|
753
753
|
|
|
754
754
|
# 4. Re-sign safari-helper with the Apple Events entitlement
|
|
755
|
-
# (helps macOS surface the TCC Automation prompt reliably)
|
|
756
|
-
|
|
755
|
+
# (helps macOS surface the TCC Automation prompt reliably).
|
|
756
|
+
# Keep the stable identifier: macOS keys the Accessibility grant to it.
|
|
757
|
+
codesign --sign - --force --identifier com.achiya-automation.safari-mcp \
|
|
758
|
+
--entitlements safari-helper.entitlements safari-helper
|
|
757
759
|
|
|
758
760
|
# 5. Open the app (needed once so Safari registers the extension)
|
|
759
761
|
open "$APP_PATH"
|
package/index.js
CHANGED
|
@@ -2115,6 +2115,18 @@ function _sanitizeTabResult(value) {
|
|
|
2115
2115
|
};
|
|
2116
2116
|
}
|
|
2117
2117
|
|
|
2118
|
+
// After a navigation, the session's current page is the URL it asked for. safari.navigate() records
|
|
2119
|
+
// one for the AppleScript path, but a navigation the extension served left safari.js holding the URL
|
|
2120
|
+
// the tab had left, which the tool then released: without SAFARI_PROFILE every later write of that
|
|
2121
|
+
// client was judged by a URL it no longer owned, and refused (#172). The requested URL, not the one
|
|
2122
|
+
// the page reports: extensionOrFallback has already claimed it, while a redirect target is the
|
|
2123
|
+
// site's choice (see run_script's newTab). Skipped when a call alongside has made another tab the
|
|
2124
|
+
// session's current one: the navigated page is not that tab's.
|
|
2125
|
+
function _pinNavigatedUrl(url, usedReceipt) {
|
|
2126
|
+
if ((usedReceipt || "") !== (_getActiveReceipt() || "")) return;
|
|
2127
|
+
safari.setActiveTabURL(url);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2118
2130
|
// A receipt is bound to the origin it was minted on, so a cross-origin navigation the
|
|
2119
2131
|
// caller itself asked for used to strand every following call ("not valid for this
|
|
2120
2132
|
// origin", ~80×/week). The caller chose the destination, so rotating here is safe —
|
|
@@ -2756,6 +2768,7 @@ server.tool(
|
|
|
2756
2768
|
);
|
|
2757
2769
|
// Tab kept its identity, just changed URL — drop the stale old URL from ownership.
|
|
2758
2770
|
if (oldUrl && oldUrl !== url && oldUrl !== 'about:blank') _removeOwnedURL(oldUrl);
|
|
2771
|
+
_pinNavigatedUrl(url, usedReceipt);
|
|
2759
2772
|
return textResult(await _rotateReceiptAfterNavigate(result, usedReceipt, oldUrl));
|
|
2760
2773
|
}
|
|
2761
2774
|
);
|
|
@@ -2859,6 +2872,7 @@ server.tool(
|
|
|
2859
2872
|
}
|
|
2860
2873
|
);
|
|
2861
2874
|
if (oldUrl && oldUrl !== url && oldUrl !== 'about:blank') _removeOwnedURL(oldUrl);
|
|
2875
|
+
_pinNavigatedUrl(url, usedReceipt);
|
|
2862
2876
|
return textResult(await _rotateReceiptAfterNavigate(result, usedReceipt, oldUrl));
|
|
2863
2877
|
}
|
|
2864
2878
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "safari-mcp",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.18",
|
|
4
4
|
"mcpName": "io.github.achiya-automation/safari-mcp",
|
|
5
5
|
"description": "Safari browser automation for AI agents — native macOS, zero Chrome overhead. 98 tools via AppleScript + JavaScript.",
|
|
6
6
|
"type": "module",
|