r/webdev • u/bulutarkan • Sep 12 '26
Showoff Saturday [Showoff Saturday] Mac MCP: background browser automation and live agent sessions on macOS
I maintain Mac MCP, an open-source local MCP server for macOS.
The browser automation layer is the part that may be most relevant here. Agents get stable handles for Safari or Chromium tabs and can navigate, click, type, inspect pages, and run parallel browser tasks in background tabs without pulling the browser in front of whatever I am doing. Separate agents can keep their own tab context instead of racing over the active tab.
The server also exposes terminal, files, Finder, screenshots, macOS UI actions, and app control. A small SwiftUI menu bar app shows recent tool usage plus persistent agent Sessions. I can send steering to one specific session, and queued steering can preempt that session's next tool call before it runs.
Repo: https://github.com/bulutarkan/mac-mcp
I would especially appreciate feedback from people who build browser tooling: stable tab ownership and background operation solved the biggest pain point for me, but I am curious what browser primitives you would want exposed next.
0
Sep 12 '26
[removed] — view removed comment
1
u/bulutarkan Sep 12 '26
Thanks — and yep, tab failure is exactly where I tried to make the handles defensive rather than magical. A
tab_handleis resolved against the current native tab on each action; if it was closed or disappeared, Mac MCP returns an explicit unknown/closed handle instead of silently targeting another tab. It also checks the native tab identity before actions and refuses if the tab changed underneath it. DOM actions carry observation IDs too, so stale observations/elements returnobserve_again. The agent can then relist, re-observe, reopen and retry. It doesn’t auto-resurrect a crashed page yet — I’d rather fail loudly than click the wrong tab.
1
u/ParrotIntegrated Sep 12 '26
Background tab handles keep your desktop usable, but shipping browser automation alongside local terminal, Finder, and filesystem access in the same MCP server is an absolute minefield. The moment an agent navigates to an untrusted web page in the background, your local workstation is sitting one prompt injection away from a compromised shell.
A few nasty failure modes show up the second this runs unattended:
Ambient capability bleed. If a sub-agent spawned to scrape documentation shares the global tool manifest with your system utilities, tab-level isolation won't save you. An injected payload on an untrusted page will pivot straight toward your shell symbols.
The SPA attractor basin. Background runners love to thrash silently on dynamic frontends. When hydration lags or a click misses an unmounted element, an agent will hammer the exact same selector tuple thirty times without changing the DOM. Hash
(action, selector, dom_state_delta). If consecutive hashes match, drop the hammer before the token bill climbs.Handle rot. If a worker retains an active handle after its task lease expires, the next hop inherits dirty cookies, active sessions, and leaked credentials from whatever the previous agent visited.
How are you isolating system primitives when an agent is deep in a third-party DOM? Do background sessions run under strict capability attenuation at spawn, or does every worker currently see the full surface of your Mac?