safari-mcp 2.7.12 → 2.7.14

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 CHANGED
@@ -437,6 +437,10 @@ xcodebuild -project "xcode/Safari MCP/Safari MCP.xcodeproj" \
437
437
  APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData/Safari_MCP-*/Build/Products/Release -name "Safari MCP.app" -maxdepth 2 | head -1)
438
438
  codesign --sign - --force --deep "$APP_PATH"
439
439
 
440
+ # 4. Re-sign safari-helper with the Apple Events entitlement
441
+ # (helps macOS surface the TCC Automation prompt reliably)
442
+ codesign --sign - --force --entitlements safari-helper.entitlements safari-helper
443
+
440
444
  # 4. Open the app (needed once so Safari registers the extension)
441
445
  open "$APP_PATH"
442
446
  ```
@@ -490,6 +494,7 @@ That call registers the Terminal app in the Automation database and then trigger
490
494
  |-------|-----|
491
495
  | "AppleScript error" | Enable "Allow JavaScript from Apple Events" in Safari → Develop |
492
496
  | "Not authorized to send Apple events to Safari" | Grant Automation → Safari to your IDE (see above) |
497
+ | "Not authorized" after `npm update` | Updating changes the binary's cdhash — macOS silently revokes Automation permission. Re-run the `osascript` one-liner above to re-grant it |
493
498
  | Screenshots empty | Grant Screen Recording permission to Terminal/VS Code |
494
499
  | Tab not found | Call `safari_list_tabs` to refresh tab indices |
495
500
  | Hebrew keyboard issues | All typing uses JS events — immune to keyboard layout |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safari-mcp",
3
- "version": "2.7.12",
3
+ "version": "2.7.14",
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",
@@ -61,6 +61,7 @@
61
61
  "safari.js",
62
62
  "mcp-helpers.js",
63
63
  "safari-helper",
64
+ "safari-helper.entitlements",
64
65
  "safari-helper.swift",
65
66
  "extension/",
66
67
  "glama.json",
package/safari-helper CHANGED
Binary file
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>com.apple.security.automation.apple-events</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
package/safari.js CHANGED
@@ -1560,7 +1560,12 @@ export async function pressKey({ key, modifiers = [] }) {
1560
1560
  if (!prevented) {
1561
1561
  if ('${safeKey}' === 'Enter') {
1562
1562
  if (el.tagName === 'INPUT') { el.form && el.form.dispatchEvent(new Event('submit',{bubbles:true})); }
1563
- else { document.execCommand('insertLineBreak'); }
1563
+ else if (el.tagName === 'TEXTAREA') { document.execCommand('insertLineBreak'); }
1564
+ else if (el.isContentEditable && ${shiftKey}) { document.execCommand('insertLineBreak'); }
1565
+ // ContentEditable + Enter (no Shift): do NOT insertLineBreak.
1566
+ // Modern editors (Discord Slate, Slack, Notion, Medium) handle Enter
1567
+ // in their own keydown listener to trigger submit/send/newBlock.
1568
+ // insertLineBreak would double-act: the app submits AND we add a newline.
1564
1569
  } else if ('${safeKey}' === 'Tab') {
1565
1570
  var focusable = [...document.querySelectorAll('input,textarea,select,button,a,[tabindex]')].filter(function(e){return e.tabIndex>=0;});
1566
1571
  var idx = focusable.indexOf(el);