Skip to content

Instantly share code, notes, and snippets.

@igor-makarov
Created February 10, 2026 12:12
Show Gist options
  • Select an option

  • Save igor-makarov/f85e98a3e46c9a24812789d54457837c to your computer and use it in GitHub Desktop.

Select an option

Save igor-makarov/f85e98a3e46c9a24812789d54457837c to your computer and use it in GitHub Desktop.
Auto-approve annoying Xcode 26.3 MCP prompts
#!/usr/bin/env osascript -l JavaScript
// Find and approve any MCP agent access dialogs in Xcode.
function run() {
var se = Application("System Events");
try { se.processes.byName("Xcode").name(); } catch (e) { return "Xcode not running."; }
var count = 0;
var windows = se.processes.byName("Xcode").windows();
for (var i = 0; i < windows.length; i++) {
try {
var w = windows[i];
if (w.subrole() !== "AXDialog") continue;
if (!w.staticTexts().some(function(t) { return (t.value() || "").indexOf("to access Xcode?") !== -1; })) continue;
w.buttons.byName("Allow").click();
count++;
} catch (e) {}
}
return count ? "Allowed " + count + " MCP connection(s)." : "No MCP dialogs found.";
}
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/path/to/hook_allow_mcp.js",
"timeout": 10
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment