safari-mcp 2.10.7 → 2.10.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/safari.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safari-mcp",
3
- "version": "2.10.7",
3
+ "version": "2.10.8",
4
4
  "mcpName": "io.github.achiya-automation/safari-mcp",
5
5
  "description": "Safari browser automation for AI agents — native macOS, zero Chrome overhead. 80 tools via AppleScript + JavaScript.",
6
6
  "type": "module",
package/safari.js CHANGED
@@ -727,14 +727,21 @@ async function _getSafariWindowGeometry() {
727
727
  if (parts.length !== 5 || parts.some(isNaN)) {
728
728
  throw new Error("Failed to parse Safari window geometry: " + boundsResult);
729
729
  }
730
+ // Dynamic toolbar height: outerHeight - innerHeight gives total chrome above content
731
+ // (title bar + URL bar + tab strip + optional bookmarks bar). Hardcoded 74 was wrong
732
+ // for modern Safari (Sequoia+) where chrome is ~90px. Fall back to 74 if JS unreachable.
733
+ let toolbarHeight = 74;
734
+ try {
735
+ const chromeStr = await runJS(`(window.outerHeight - window.innerHeight) + ''`);
736
+ const chrome = Number(chromeStr);
737
+ if (Number.isFinite(chrome) && chrome >= 50 && chrome <= 200) toolbarHeight = chrome;
738
+ } catch (_e) { /* keep fallback */ }
730
739
  return {
731
740
  windowX: parts[0],
732
741
  windowY: parts[1],
733
742
  windowRight: parts[2],
734
743
  windowBottom: parts[3],
735
- // Safari toolbar height: standard is ~74px (address bar + tab bar).
736
- // This is approximate — varies with compact tabs, bookmarks bar, etc.
737
- toolbarHeight: 74,
744
+ toolbarHeight,
738
745
  // CGWindow ID for background click targeting (no mouse move, no focus steal)
739
746
  windowId: parts[4]
740
747
  };