safari-mcp 2.22.4 → 2.22.6
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/extension/background.js +16 -0
- package/extension/manifest.json +1 -1
- package/index.js +506 -149
- package/ownership-state.js +36 -44
- package/package.json +1 -1
- package/safari.js +965 -292
package/extension/background.js
CHANGED
|
@@ -1114,6 +1114,22 @@ async function handleCommand(type, payload) {
|
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
|
+
// Puts the MCP session's identity marker on its tab. The server's AppleScript side knows tabs
|
|
1118
|
+
// only by their position in a window, so it acts only on the tab that carries the session's
|
|
1119
|
+
// marker, and a tab this extension opened or picked gets it here, where the tab is known by
|
|
1120
|
+
// its id. Like any write, it reaches only a tab this session owns or a receipt names (the
|
|
1121
|
+
// ownership guard above), never merely the tab in front. A fixed function, unlike evaluate,
|
|
1122
|
+
// so no page CSP can refuse it.
|
|
1123
|
+
case "mark_tab": {
|
|
1124
|
+
const marker = String(payload.marker || "");
|
|
1125
|
+
if (!tabId || !/^MCP_[A-Za-z0-9_]+$/.test(marker)) throw new Error("mark_tab requires a tab and an MCP_ marker");
|
|
1126
|
+
return await execInTab((m) => {
|
|
1127
|
+
window.name = m;
|
|
1128
|
+
window.__mcpTabMarker = m;
|
|
1129
|
+
return window.name === m;
|
|
1130
|
+
}, [marker], tabId);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1117
1133
|
case "get_title": {
|
|
1118
1134
|
return targetTab.title;
|
|
1119
1135
|
}
|
package/extension/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Safari MCP Bridge",
|
|
4
4
|
"description": "Connects AI agents to Safari — fast JS execution, screenshots, clicks with your real cookies/logins",
|
|
5
|
-
"version": "2.10.
|
|
5
|
+
"version": "2.10.26",
|
|
6
6
|
"icons": {
|
|
7
7
|
"48": "images/icon-48.png",
|
|
8
8
|
"96": "images/icon-96.png",
|