Repository navigation
·
85 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
MCPSafari v0.4.2
Added
- Release downloads now carry a signed SLSA build provenance attestation, so
gh attestation verify <file> --repo Epistates/MCPSafarities a download to the commit and the workflow run that built it. It covers the threemcp-safaribinaries and both extension archives, alongsideSHA256SUMSand Apple's notarization. - Structured results now cover every tool's success path, including status, profile-qualified tab listings, interactions, screenshots, timed waits, and nested batch results. Text and HTML page reads preserve JSON-looking text verbatim, JavaScript results preserve JSON primitive types, and screenshot metadata avoids duplicating image bytes. Protocol-level tests exercise all 27 advertised tools against the actual server.
- Every tool result now carries its answer as data as well as prose. Failures have carried
structuredContentsince tool error codes shipped, so a caller got something parseable only when something went wrong; successes returned a paragraph. Each success now setsstructuredContentto an object whose keys name its payload (status,tabs,tab,page,snapshot,matches,messages,requests,result,results,wait,window,screenshot), with anything that qualifies the payload beside it, such asprofileFailuresorunreachableFrames;docs/tools.mdlists each tool's fields. A JSON listing arrives as an array a caller can index rather than a string they have to parse again. Text that is not JSON stays text, including a page whose whole content is42ornull, which a parser alone would have retyped into a number or an absent value. The wrapping object is required rather than stylistic:structuredContentmay only be a JSON object before protocol revision 2026-07-28, and this server negotiates 2025-11-25. NooutputSchemais declared to go with it, deliberately, since a declared schema makes clients reject any result that does not match and would turn every later shape change into a hard break while the tool surface is still settling. - The extension popup names the current site and whether MCPSafari can reach it: allowed, asking, or no access. Safari grants website access one site at a time and reports that nowhere the user is looking, so "the agent cannot read this page" and "the server is not connected" used to look identical from outside. Opening the popup is also what prompts Safari to ask if it has not already, which puts its dialog in front of someone who is already looking at MCPSafari rather than behind a window mid-task.
mcp-safari doctorwarns when more than one copy of the Safari extension is registered, names each copy, and gives the command that unregisters the extra ones. Xcode registers every app it builds, so a build left beside the installed app was enough: Safari can run both copies, each numbering tabs its own way, and tab handles then changed between calls, with calls failing as if the tab had closed.mcp-safari doctorreports which extension Safari is actually loading. Safari's own Uninstall button deletesMCPSafari.app, and on a machine with an Xcode checkout PlugInKit then falls back to whatever debug build is sitting in DerivedData. Neighbouring versions share a bridge protocol, so the handshake accepts the old build and nothing else in the product notices; the newextension_locationcheck warns when the registered extension lives outside the installed app and says how to get back. It stays quiet when the app is installed somewhere else entirely, sinceapp_installedalready covers that.- Every connected Safari profile is drivable.
tabs_contextnow asks all of them and returns one merged listing, and each tool call goes to the profile its tab handle names. A profile that fails to answertabs_contextis named in the result rather than dropped, so a short listing is not mistaken for a closed tab.statusgains ahandle(p0) and aselectedflag per profile, andselect_tabmoves the selection; it falls through to another profile if the pinned one goes away, so closing a window does not break calls that name no tab. Naming a profile that is not connected fails withprofile_not_connectedrather than answering from a different browser window. - The number of ports the server tries is configurable (#155).
--port-range <n>orMCP_SAFARI_PORT_RANGEsets it from 1 to 64, and the default stays ten, so8089and the next nine. The flag wins over the variable, and a value outside 1 to 64, or a range that would run past port 65535, stops the server with a message naming where it came from.statusreports the range asrequestedPortthrough a newlastPort, and the bind failure message says which ports were tried and points at--port-range. The extension needs no matching setting, since it connects to every port that has a token file; see the next entry. MCP_SAFARI_TOKEN_ROOTmoves the server's token files to another absolute path, for tests that start the real server. The Safari extension reads only the standard location, so it can't find a test server started this way, and a test that clicks or navigates can't reach your real browser.statusreports the override astokenRootOverride,mcp-safari doctorwarns withtoken_root_override, and the protected-path checks follow it.tabs_createtakesnewWindow: trueto open the tab in a new window of its own, for agents running side by side. A window shows one tab at a time, so agents sharing one hide each other's pages, and a page whose window is completely covered stops drawing. The new window is the size of the window in front and 40 points down and to the right of it, so a strip of each stays visible. An extension older than the server ignores the option and opens the tab in the window in front, and the result then says so. The new tab is found as the one that wasn't there before the call, in a window that wasn't either: what Safari answerswindows.createwith can point at an existing tab. If no single tab qualifies, the call fails and says how to find the window, rather than return a tab the caller didn't open.- A reply the server cannot read now fails its request at once with
malformed_response, and a result too large to send fails withresponse_too_large. Both are documented in the tools reference. - While a call is waiting for access to a site, MCPSafari's toolbar button shows a "!" badge, and its tooltip names the site when Safari lets the extension see it. Safari 27.2 doesn't ask when an extension first touches a site nobody has decided on: it refuses, and the only place to allow the site is the extension's toolbar button, which gave no sign anything was waiting. The "!" goes once a call on that site gets through, the tab navigates or closes, or after 15 minutes. It's one badge for the whole button, in Safari's own colour: Safari clears a tab's badge whenever the tab navigates, and ignores badge colours. The
permission_requiredmessage now says where to click, and the docs describe Safari 27.2's behaviour. - The toolbar popup names each connection. Several sessions can each run a server, and the popup listed them by port alone, so nobody could tell which was which. After the handshake a server now tells the extension its name, the folder it was started in, and the MCP client behind it, and each connected row shows the name (
--nameorMCP_SAFARI_NAME, else the last part of the folder) with the folder on a second line, the home folder shortened to~. The row's tooltip has the state and the client, such asclaude-code 2.1.0, andstatusreports the same asinstance. A name that is empty, longer than 64 characters or holds a control character stops the server with a message, rather than showing up in Safari as something other than what was asked for. The bridge protocol is unchanged: an extension without naming ignores the new fields and answers the newidentifyrequest with an error the server ignores, and a server without naming is shown by its port, as before. - A result from a page Safari isn't showing says so. Safari pauses a hidden page (a tab that isn't the one in front of its window, or one whose window is minimized, completely covered or on another Space), so a web app on it can show stale or empty content, and only a screenshot used to say why. Every reply from a page now carries its visibility, at no extra cost, and a result from a hidden page ends with a
Page visibility: hidden.line and carries"pageVisibility": "hidden"beside its payload. The call itself runs as before, since most reads and writes work on a hidden page. - A
waitfor a selector or text that runs out on a hidden page fails withpage_hiddenrather than the retryablewait_timeout, and says how the tab is hidden and what brings it back:call_select_tabwhen another tab is showing in its window,ask_userwhen its window is minimized, covered or on another Space. Retrying the wait as it stood waited out the same timeout again on a page that wasn't drawing. clicktakesnative: true. It moves the real macOS pointer to the target and presses the left button there, twice withdoubleClick, so a site that ignores synthetic events gets the same trusted events a person's click gives it. It has the same guards as nativehoveranddrag: Safari must be in front with Accessibility permission, the target must be reachable, and the point must be over a Safari window, which is checked again just before the press.clickused to refusenativeas an unknown argument.clear_cookiesdeletes one site's cookies in a Safari profile, including the sign-in cookies a page can't delete itself, so an agent can switch accounts on a site or sign-in service that remembers the last one (#164, contributed by @scriptease). Name the site withdomain, and its subdomains are cleared too;tabIdpicks the profile. A domain that unrelated sites share, such asco.ukorgithub.io, is refused. Only a count comes back, never a cookie's name or value. With per-site access, Safari hides the cookies of sites MCPSafari isn't allowed on, such as those set for a parent domain or by a sign-in service you only pass through, and the result says when that may have happened. To switch accounts reliably, use a separate Safari profile with MCPSafari allowed on every website.
Changed
- Native input no longer starts while you're using the Mac. A native call made within 5 seconds of your last key press, click, pointer move or scroll fails with the retryable
native_input_user_activeand sends nothing, rather than bringing Safari to the front and mixing its keys with yours. Input the servers posted themselves doesn't count, so an agent can click a field and type into it straight after. Native typing also stops if you move the mouse, click or scroll partway through, before your click can move the keyboard, and says how many characters went out. - Homebrew 6 and later need one extra step: trust MCPSafari's server formula once with
brew trust --formula epistates/tap/mcp-safari-server, then install withbrew install --cask epistates/tap/mcp-safari. Homebrew trusts a cask you install by its full name but not the formula it depends on, so without it an install stops at "Refusing to load formula epistates/tap/mcp-safari-server from untrusted tap". To upgrade, name both parts in full, server first:brew upgrade epistates/tap/mcp-safari-server, thenbrew upgrade --cask epistates/tap/mcp-safari. Naming them trusts them, which an install from before Homebrew 6 needs; a plainbrew upgrademay keep the version you have. Trusting the whole tap (brew trust epistates/tap) also works, but trusts everything in it, now and later. javascript_tooldecides which world to run in before any of the code runs, and runs it once. It used to decide from how the run in the page's world turned out, which goes through the page's ownPromiseand error objects, so a page could make a finished run look like a Content Security Policy refusal and have the code run a second time in the extension's isolated world, repeating any click, submission or purchase it made. A probe now compiles both forms of the code without running either, with the source text built in the extension, and the code then runs exactly once in the world the probe settled on.upload_fileanddrop_filetake up to 512 MB per call, up from 10 MB, which covers an App Store app preview. A file used to cross the bridge whole, as base64 in one message, and the bridge and Safari's own extension messaging both cap the size of one message. Files are now sent in 4 MB pieces, read from the descriptor the server checked, and held by the content script in the target's frame, out of the page's reach, until the action hands the finished files to the page. The target is checked before anything is sent, so a call aimed at the wrong element fails at once rather than after a long upload. A file that changes while it is being sent is refused, and a page that reloads or navigates mid-transfer fails the call with the retryablefile_transfer_lost.--portfrom 1 to 1023 is refused with a message. The extension never dials a port below 1024, so a server started there ran and could not be found.--port 0still takes any free port.- The extension finds servers by their token files rather than by scanning 8089 to 8098 (#155). A server writes a token for the port it actually bound and the handshake means the extension can only talk to a port it holds a token for, so every port with a token is now dialled, whichever it is. Before, a server started with
--port 9000, or one that fell back past 8098, wrote a token the extension never used unless the port was added by hand in the popup. That is no longer needed, and any--portand--port-rangework without a setting to keep in step in two places. A port is dropped from the popup when its server stops and removes its token, and the extension manages at most 64 discovered ports at once so a directory full of token files cannot create unbounded connections. Ports added by hand are unaffected and not counted. mcp-safari doctortakes--port-rangeand looks for the token anywhere in the range instead of only at the first port. A server whose first port was taken binds a later one, so checking just the first reported a working install as missing its token.- Breaking: the bridge protocol moves from version 1 to 2 for the challenge-response handshake, so the app, its extension and
mcp-safarimust be updated together. A 0.3.x extension that dials a newer server is told the versions differ and which to install, andstatusanddoctorreport the mismatch when the extension proved it holds the token. A newer extension that dials a 0.3.x server is closed without a message, because that server cannot read the new first frame. - Breaking:
tabIdis now a tab handle string such asp0t5, meaning tab 5 of profile 0, rather than an integer. Safari runs a separate instance of the extension in every profile and each one numbers its own tabs, so a bare number named a different page in each. The handle carries the profile the way an element UID carries its frame (f0e42): no tool gained a profile argument. Handles come fromtabs_context, which mints them, and fromtabs_createandselect_tab, which return them. An integertabIdis refused withinvalid_inputand a message naming the new form rather than being read as a tab in whichever profile happened to be selected. - Dialog automation is now opt-in and one-shot: call
handle_dialogbefore triggering a dialog, within 30 seconds. Native dialogs are unchanged outside that window; reading a captured result does not rearm interception. - Console/network filters use a bounded regex subset and reject invalid or potentially expensive patterns instead of silently ignoring filters. Captured fields report truncation; bridge messages and in-flight requests have explicit limits.
- The host app shows a message in its window, and logs it, when its bundled page is missing, rather than crashing on launch.
- A tab that doesn't answer is no longer always blamed on Safari's permission dialog. Each page call is checked first with a tiny script, and one that got no answer within two seconds failed with
permission_required, saying a dialog was waiting, even on a background tab of a site the user had allowed, so the user went looking for a dialog that wasn't there. Safari stops answering for the tab while its dialog is open, so the tab is now looked up once more. When Safari answers, the call fails withpage_hiddenif the tab isn't the one showing in its window (call_select_tab) or its window is minimized (ask_user), and withpage_not_respondingif it is the one showing, which leaves a covered window, another Space or a busy page (ask_user). A capture that times out is named the same way. When Safari doesn't answer, the dialog message is unchanged. The popup shows such a page as not answering rather than as asking or refused. - Tabs on sites MCPSafari hasn't confirmed access to are now described that way, rather than as not granted.
not_grantedhas always meant that no call has worked on the site yet. After a reinstall resets the extension's data, that's true of every site the user allowed, and the old wording ("has not been granted", "will fail with permission_required until the user grants it") sent agents to ask for access the user had already given. TheaccessHint, the note ontabs_context,tabs_createandselect_tabresults, and the landing note after a navigation now say that a call on such a tab works if the user has allowed the site, and otherwise fails withpermission_required. The listing note is now the server's own sentence and no longer repeats the extension's hint, which each tab's JSON still carries. Theaccessvalues are unchanged. tabs_createopens the new tab in the agent's own window: the window of the tab named bytabId, or else of the tab the agent pinned withselect_tab.tabIdused to choose only the Safari profile, so every new tab landed in the window in front, which is often yours or another agent's. With neither, a new tab still opens in the window in front. A named tab that has closed is now reported astab_closed.- A
screenshotof a tab behind another in its window puts back the tab that was showing once it has captured, instead of leaving the agent's tab in front of whatever you were looking at. If you switched tabs during the capture, your choice stands. - When Safari's extension stops answering altogether, which Safari can do while its windows are hidden or all minimized, a call now fails with
extension_not_respondingand says to bring a Safari window into view. It used to reportbridge_timeout, which reads like one slow call. After a timeout the server asks the extension a trivial question to tell the two apart.
Removed
- Breaking: the server no longer writes
~/.config/mcp-safari/at all, neither the per-porttokens/<port>files nor the sharedtokenfile, and the extension no longer falls back to a single shared token. They existed so that extension builds predating the move to Application Support, and predating per-port tokens, could still authenticate. Those builds cannot speak the current bridge protocol, so the files only served as a second copy of the secret, one in a directory that is often symlinked into a dotfiles repo and one in a shared file that any process could replace. Tokens live only under~/Library/Application Support/MCPSafari/tokens/. Install the matching app andmcp-safariversions together. - The extension no longer reads
~/.config/mcp-safari/, neither itstokens/directory nor the singletokenfile, and the native message handler no longer answersgetTokenor returns atokenkey. Only~/Library/Application Support/MCPSafari/tokens/is read. The old location existed so an extension build from before the move kept authenticating, and it was the reason the sandbox exception covered a second directory. The background script only ever sentgetTokens.
Fixed
tabs_createwith aurlreports a site the user has already allowed asgranted, with the page's title. It reported every site MCPSafari hadn't reached yet asnot_granted, so agents stopped to ask for access the user had already given. The new tab is now checked as soon as it loads. On a site the user hasn't decided yet, that check raises Safari's question straight away, as the agent's next call would have, and adds up to about 2 seconds totabs_create(#169, contributed by @ailenshen).- A call made while Safari's extension is still connecting, just after the server starts or while the extension reconnects, now waits for it, up to 12 seconds or the call's own time, instead of failing at once with
bridge_disconnectedand telling the agent to open Safari. Agents took that at face value and gave up on a Safari that was a second or two from ready.bridge_disconnected, andbridge_unavailablewhile the server is still starting, are now retryable. A server that couldn't open any of its ports still fails at once (#167, contributed by @ailenshen). - Native
press_keyandtype_textno longer fail whenever Safari's own controls hold the keyboard. After a new window or a navigation, Safari often leaves the keyboard in its address bar, nothing a page does can take it back, and every native key was refused withnative_input_focus_faileduntil someone clicked the page. When the agent's window is in front, MCPSafari now moves the keyboard into its page through Accessibility, the way Tab or VoiceOver does, with no mouse or page events. It first checks that the window in front is the agent's and is showing the agent's tab, and moves nothing if it isn't, or if another window looks the same. A nativeclickgoes ahead in that window even when the keyboard stays where it is, since clicking the page gives it the keyboard, so clicking a field withnative: trueand then typing works too. When the keyboard can't be moved, the error now says where it is: the address bar, the find bar, another Safari window or another application. - Native click, hover and drag land where they aim on a second display. Safari measures a window's top from the top of the display it's on, so on a display that isn't level with the main one every native pointer event landed off by the difference, in whatever window was there, including the user's own. The server now places each point from where Accessibility shows the agent's page. The check before the first event also requires the window under the point to be the agent's, not just any Safari window, and refuses with
native_input_focus_lostand nothing sent otherwise. Native typing could be refused in the agent's own window on such a display for the same reason; the window check now compares the window's size, title and page address, not its position. - Native
type_textstops when the keyboard moves into another page partway through, such as when you click in another tab or window. It checked only that the keyboard was in some page, so the rest of the text went into the page you clicked. It now stops at its next check, at most 15 characters later, and says how many characters went out. - Another agent can no longer take the keyboard while one is typing with native input. Servers took turns only for native input itself, so a second agent opening a tab or window, switching tabs or taking a screenshot mid-text moved Safari's keyboard, and the rest of the text went into the other page. Now
tabs_create,select_tabandscreenshotwait while any server types. One that can't get in within 30 seconds fails with the retryablenative_input_busyand does nothing. They still don't wait for each other. - A tab that was open when MCPSafari was updated or restarted now fails with
page_needs_reload, saying to reload it, instead ofreply_lost. Safari keeps the earlier MCPSafari's script attached to such a page and lets nothing reach it, and the script injected to replace it found the old one loaded and stepped aside, so every call failed as though the page had gone away mid-call and might have acted. Nothing was ever done to the page. Reloading it makes it work again; the error tells an agent to reload only a tab it opened and to ask you about the rest, since a reload discards unsaved text. After upgrading, reload the Safari tabs you want agents to use. - Every Safari profile now finds a newly started server on the same check, within about 15 seconds, so a second profile no longer trails the first by a minute or more (#168). Safari drops the reply to one of two native messages sent at the same moment, and every profile asked for the server list at the same moment, so at each check one profile at random missed the new server, sometimes several checks in a row. Each profile now asks at its own moment, every 15 seconds instead of 30, and asks again when a reply doesn't come. A call made in a new server's first 25 seconds waits for Safari to connect instead of failing after 12, and
tabs_contextin that time says a profile may still be connecting and when to look again. - A Safari profile no longer ignores a new server on a port an earlier server used. While the profile still held anything for the old server, such as a socket Safari hadn't reported closed, it didn't dial the new one. Each server run writes a new token, so a new token on a port now replaces whatever the profile held for that port, and the new server is dialled straight away.
- The extension no longer gives up on a port for good after a few refusals. Three failed dials in a row suppressed the port with its current token recorded as stale, and nothing clears that while the token stays the same, which it does for as long as the server runs. Anything holding the server's handshake slots, or one slow start, was enough, and only restarting Safari brought the extension back. Suppression is now a pause: the keepalive, about every 15 seconds, forgets it and dials again while the token file exists, and the port is dropped when the file is gone. A socket the server accepts and never answers is closed after five seconds so the next attempt can proceed instead of finding a connection that looks busy.
- Reconnecting while the old socket was still closing no longer loses the live one. A close event cleared the connection's socket without checking it was the current one, and a socket on its way out counted as free to dial over, so the popup's reconnect could orphan the live socket, dial a third, and have the server close the live one as a duplicate profile, repeating. A closing socket now counts as in use and a late close only updates a connection that still holds that socket.
- A tool result containing half of a character no longer makes its request wait out the 30 second timeout. A string cut through an emoji is written by
JSON.stringifyas a lone surrogate escape that the server's decoder refuses, so the reply was dropped for an action that had already run. Every string in a reply, keys included, is now well formed when it is sent, and a reply the server still cannot read fails its request at once withmalformed_response. - A result larger than the bridge can carry no longer drops the connection. The server closes a socket on a message over 32 MiB, which failed every other request in flight on it. A reply over 31 MiB now becomes a
response_too_largeerror for that request alone. A reply for a socket that closed in the meantime is dropped quietly instead of surfacing as an unhandled rejection. - Stopping the server is final. A start that was scheduled behind the stop, or a retry that had already woken, bound a port and wrote a token and owner file just before the process exited. A frame read just before the handshake deadline dropped its connection also no longer leaves a handshake entry behind, and
statusno longer reports another server's token file as its own after a failed bind. - Two servers starting together can no longer delete each other's token files. The sweep for a dead server's files read its pid and deleted afterwards, so a server that claimed the port in between lost its files. A live server now holds a lock on its owner file, and the sweep deletes only while holding it.
- The warning about refusing a connection when eight are mid-handshake is written at most once every 30 seconds, with a count of the ones held back. A process opening sockets in a loop wrote one line per socket to the stderr that MCP clients show their user.
- Synthetic events cross shadow boundaries. A click, hover, key press, typed input, drag or file drop on an element inside a shadow root was dispatched without
composed, so it stopped at the edge of that root and a listener on the host, or anywhere outside the component, never saw what a real event would have reached it with. Every event the content scripts dispatch now takes itsbubbles,cancelableandcomposedflags from one table following UI Events and HTML: composed and cancelable throughout, except thatpointerenterandmouseenterdo not bubble,input,changeanddragendcannot be cancelled, andchangeis not composed, which is what a browser does.dragendwas cancelable before and no longer is. - The extension's
get_page_textaction is bounded likeread_pagetext. It returned the wholeinnerText, with no default, no ceiling and no truncation notice. No tool sends it today, so nothing the server clamps stood in front of it. It now takesmaxCharswith the same 100,000 default, the same 1,000,000 ceiling and the same truncation notice, and the ceiling applies toread_pagetext and HTML in the extension itself rather than only in the server. - The field redaction recognises more secrets. A card, key or national id field under an ordinary name was reported verbatim: the hints knew
ssnbut notiban,cardNumber,card_number,ccnum,credit-card,api_key,apiKey,x-api-key,private_keyorsocial_security_number, and only looked at the field's attributes, so a genericname="field7"labelled "Card number" or with that placeholder got through.placeholder,titleand the text of the field's<label>are hints now, in the snapshot and in the trace's attribute recording alike, and a hint is read from its first 256 characters.cardon its own is not a hint, soscorecard_titleand a field labelled "Card name" stay readable. SECURITY.md lists what is covered. scrollhas finished by the time it answers, andhoverno longer bubbles its enter events. The scroll was smooth, so the tool replied while the page was still moving and the nextsnapshot, or aclickaimed at a position measured part-way, saw a page that had not arrived; it is instant now.hoverdispatchedpointerenterandmouseenterwithbubbles: true, though the browser never bubbles or cancels them, so a listener on an ancestor fired for a hover it should not have seen.- Native key preparation no longer leaves
tabindex="-1"on the page's<body>. When the page did not hold focus,press_keywithnative: truemade the body focusable to pull focus in and never undid it, so the page kept a focusable body for the rest of its life, which changes where tabbing and clicks land. The attribute is put back as it was, or removed if it was not there, whether or not the focus came. - A uid for an element the page has removed fails with
stale_uidinstead of acting on it. The uid lookup only noticed an element that had been garbage collected, but a removed node stays alive for as long as anything holds it, and frameworks routinely do, so aclickortype_texton it dispatched events to a node nobody can see and reported success. select_optionandform_inputhandle selects properly. Choosing by label assigned the select'svaluefrom the option's, which picks the first option with that value, so two options sharing a value could not be told apart; disabled options were chosen though a user cannot; and onlychangefired, where a real choice firesinputfirst. The option itself is now selected, a disabled one is refused withinvalid_input, and both events fire in order.form_inputon a<select>threw a raw "Illegal invocation" TypeError after the fields before it had been filled; a select now takes an option by value or label, and any field that cannot take its value is reported on its own line while the others proceed. The call fails only if nothing could be filled.drop_fileworks on a drop zone inside an open shadow root. The content script finds the target through the shadow-aware lookup and marks it, but the page-world script that dispatches the drop looked for the mark withdocument.querySelector, which does not see into a shadow root, so every such drop failed with "Drop target not found in page" and never fell back. It now searches each open root.type_textwithsubmitKey: "Enter"follows the HTML implicit submission rules. It calledform.requestSubmit()unconditionally after the key events, so a page that handled Enter itself was submitted twice, a<textarea>submitted its form although Enter there is a newline, and the form's default button was bypassed. It now submits only when the page did not cancel the key, never from a textarea or a field type that does not take part in implicit submission, by clicking the form's first submit button (nothing, if it is disabled), or, with no submit button, by submitting a form that has a single text-like field. A cancelled keydown also suppresses the keypress, as in a browser.- Native
click,hoveranddragno longer click through an overlay. The reachability check that makes a synthetic click fail withtarget_coveredwas never run for native points, so with a cookie banner over a "Delete" button a synthetic click was refused while a native one landed on the banner and reported success. The check now runs for each element a native call aims at, before the server is told where to click, and fails with the sametarget_coveredortarget_not_visible.force: truewaives the cover. An element with no area is refused even then, since it has no point to aim at. The aim point is now the middle of the target's visible part, the same as the synthetic path, so an element wider than the viewport is aimed inside it instead of failing the viewport check. clickandhoverby coordinates reach inside web components. They useddocument.elementFromPoint, which answers with the shadow host and never the button inside it, so a click at the visible button's position was dispatched to the component around it. They now ask each open shadow root in turn, down to the element a pointer would reach.- Targeting by text no longer matches text nobody can see.
click,hoverandfindmatched ontextContent, which includes the contents of hidden children,<script>and<style>, so<button>Cancel<span hidden>Delete account</span></button>was clicked for the text "Delete account", and a copy inside anaria-hiddenoropacity: 0container stayed a candidate because only the element itself was checked for visibility. They now match on the rendered text, following the rules the snapshot uses to decide what to show: a hidden subtree is skipped whole, the flattened shadow and slot children are walked, form controls contribute no text, and block-level neighbours are separate words. Ambiguous matches are still refused with their UIDs. - Accessible names are built more carefully. A whitespace-only
aria-label,<label>,alt,titleorplaceholderwon the name with a blank and hid everything beneath it,aria-labelledbylooked its ids up in the document only, so a control inside a shadow root was never named by its own label, names kept the source markup's line breaks and indentation, and a control with two labels was named by the first alone. A blank source is skipped now, whitespace is collapsed,aria-labelledbyresolves in the control's own root first, and every label contributes. - A page can no longer make
snapshotreturn gigabytes. The text and the name were capped at 500 characters, but an input'svalue, a link'shref, an iframe'ssrc, and the name taken fromaria-label, an elementaria-labelledbypoints at, a<label>,alt,titleorplaceholderwere not, so one megabytearia-labelon an element that two thousand nodes refer to was copied into the tree two thousand times. Names, values and text are now cut to 500 characters andhrefandframeSrcto 2,048,findcuts the name andidit reports the same way, and a snapshot as a whole stops at 2,000,000 characters and marks the roottruncated: true, the way it does at the node limit. A link whosehrefis an SVG object rather than a string no longer reports one. - Text cut to a limit is no longer cut through the middle of an emoji. Page text, snapshot text and names,
findresults, aclickresult, console and dialog capture, trace attribute values, and the replies the page-world scripts send back were all cut with a plain slice, which ends between the two halves of a surrogate pair when an astral character straddles the limit. The lone half is not valid Unicode, and a JSON encoder either rejects it or writes an escape that strict parsers refuse, so one unlucky emoji at the boundary could spoil a whole reply. Every one of those cuts now backs off to the character before. The scripts that run in the page's own world carry a copy of the helper, and a test fails if the copies drift. - Native
press_key,hoveranddragno longer stall the whole server while they wait between events. They waited with a blocking sleep on the server's own actor, about six tenths of a second for a drag, during which every other call, read-only ones included, sat unanswered. They suspend now, as native typing already did, and a cancelled drag still releases the mouse button. - Native
type_textchecks that keyboard focus is in the page, not only that Safari is in front. Safari being the active application says nothing about where the keyboard is: Command+L mid-text left the address bar holding it, and up to fifteen further characters and the submit Enter went there. Accessibility is already required, so the server now asks it whether the focused element has a web area among its ancestors, at the first key, at each 16-character recheck, and before the submit key, and fails withnative_input_focus_lostif it does not. If Accessibility cannot answer, behaviour is as before. Safari being in front is also checked before the extension is asked to prepare the input rather than only after, so refused input no longer scrolls the page first. The docs namednative_input_focus_failedwhere the server's checks reportnative_input_focus_lost; both exist, and the docs now say which is which. - A traced action now runs on the tab its trace started on.
start_traceresolved the selected tab, but the action that followed was sent with no tab and resolved the selection again, so a tab switch in between put the action on one tab and the trace on another. And arun_stepsbatch with a trace whose first step named a different tab took that tab for the batch's own and stopped the trace there, where there was none. The trace's tab is now the batch's tab, and stopping a trace always goes to the tab it was started on. - Every tool that is not read-only now runs one at a time, and native input is serialised across servers. The focus lock covered native input,
screenshotandselect_tab, buttabs_createactivates the new tab,close_tabhands focus to another, andclick,form_input,resize_windowandjavascript_toolcan all move it, so any of them could land between the extension focusing an element and the server typing into it. The lock now follows each tool's own annotation (soread_consoleandread_network, whichclearcan mutate, are in it), arun_stepsbatch holds it once for all its steps, and the read-only tools stay concurrent. Several servers can run at once and share one keyboard, so native input also takes anflockon a file beside the tokens; a call that cannot get it within 30 seconds fails with the retryablenative_input_busyand nothing sent. - Arguments are refused before anything is sent when they are unknown, of the wrong type, outside their declared values, or missing. A wrong-typed argument reached the extension, where
"false"is truthy:click {force: "false"}skipped the reachability check,doubleClick: "false"double-clicked, and a non-nativeclearFirst: "false"cleared the field. An argument the tool does not declare was ignored, soclick {native: true}ran a synthetic click and a typo such aswaitForSelctordid nothing. Each call is now held to the schema the tool advertises, the error names the argument and what is allowed, andrun_stepsapplies the same check to every step while it plans, including that each file named byupload_fileanddrop_fileopens and is not protected, so step 7 cannot be refused after steps 1 to 6 have acted.form_inputwith no usablefieldsalso returns a structuredinvalid_inputnow rather than a bare error.tabs_createandresize_windowdeclare thetabIdthey always honoured, andhandle_dialogno longer takes post-action options it never declared. read_consoleandread_networkare no longer advertised as read-only. They were annotatedreadOnlyHint: true, butclear: trueempties the buffer they read, so a client that auto-approved read-only tools was approving a mutation.- A wait, trace or snapshot that fails after an action succeeded now keeps what the action returned. The failure result carried only the error, so a caller told that
waitForSelectortimed out could not read what theclickitself had reported; itsstructuredContentnow holdsresultand whatever ofwait,traceandsnapshothad completed. - Native
hoveranddragno longer pick up modifier keys the user happens to be holding. Their pointer events were built from a source that reports the physical modifier state, so a held Command turned a drag into a copy or a hover into a Command-click. Typed text already cleared them; pointer events now do too. - Native
press_keyshortcuts are resolved the way macOS reads them and the refusal list is judged on the key that is posted. A Command shortcut was looked up on the keyboard layout in use, but macOS reads it from the ASCII-capable layout, so on a Russian, Greek or Dvorak-QWERTY layoutMeta+cposted the key that isjthere andMeta+йposted Command-Q, which the list, judging only the character you typed, let through. Command shortcuts, and the select-all ofclearFirst, now use the ASCII-capable layout, and the list is checked against what the posted keycode means under it as well as against the name you gave. - The native
press_keyrefusal list also covers Control with an arrow key (Spaces), F3 and F11 (Mission Control, Show Desktop), Command+Shift+3, 4 and 5 (screenshots), and Command+O, S and P (open, save and print sheets), none of which can be contained to the page. - A tool call cancelled while it waits for the focus lock now leaves the queue at once. The lock checked for cancellation, then queued, and a cancellation landing between the two ran its handler against an empty queue and was lost, so the call sat behind the holder, and ran its tool afterwards, although its client had given up on it.
snapshotnames links, buttons, headings and the other roles that take their name from their content (#152). A link with inline markup, such as a search result with its query terms in bold, reported only its direct text nodes with the words from the markup as separate children, soHuman <b>Brain</b> Organoidsread asHuman Organoids, and a link whose words all sat in child elements had no label at all. The accessible name now falls back to the element's whole text in reading order, whitespace collapsed and cut at the 500 characters text already is. It follows the same rules as the rest of the snapshot: hidden content andaria-hiddenicons are left out, a nestedaria-labelor imagealtstands in for what it wraps, it reads through open shadow roots and slots, and form controls contribute nothing, so a field's value cannot reach a name.aria-label,aria-labelledby, labels andaltstill win, and so doesplaceholderon inputs;titleis a tooltip, so on these roles it names the element only when the content is empty.textstays the element's own text, with the children keeping their own text and uids, and a node leavesnameout when it would only repeattext, so plain links, buttons and headings report what they did before andnameappears where it adds the full label.clickandhoverby text now ignore line wrapping and indentation in the page source, so the name a snapshot reports targets the element.- The extension notices when the last server stops. The native handler answers
no_token_fileswhen the token directory is empty, and the extension took that for a failed read and kept the final server's port and token in place indefinitely. - A listener that never settles can no longer hang the server's startup. The bind waited on a continuation that only resumed for
.ready,.failedand.cancelled, so a listener reporting.waitingleftstart()suspended forever, and because the server awaitedstart()before serving MCP,initializehung with it..waitingnow fails the attempt so the sweep moves on, each attempt has a two second deadline, and the bridge binds in the background: the server answersinitializeimmediately and tools reportbridge_unavailableuntil it is listening. - A bridge that could not start now says so, and recovers by itself. When every port in the range was taken, the token could not be written, or the listener failed later, the server kept running and every tool answered
bridge_disconnectedwith "Open Safari and click the extension icon", which sent people to fix the wrong end (#154). Those calls now fail withbridge_unavailable, carrying the recorded reason and what to do about it.statusreports the requested port after a failed start instead of the last port tried, which belongs to another server and has its token file. The server also retries the bind on a backoff of 2 seconds doubling to 30, so a port that frees up brings the bridge back without restarting the MCP client. - The extension recovers on its own after the MCP server restarts. A restarted server writes a new token, but the extension kept redialling with the one it had cached, and the server closed on the mismatch without saying anything, so the two stayed locked out of each other until the extension's next keepalive, about 30 seconds later (#156). The server now answers a wrong token with
{"auth":"error","error":"token_mismatch"}before closing, and the extension reads the token again before the next dial whenever a connection ends without having authenticated. A connection that arrives after the new server is listening but before its token is written is held until the token is published rather than closed. select_tabworks on a tab whose site has not been granted (#148). It asked for access to the page before pinning, so the one tab a caller most needs to pin, the one the user has yet to grant, could not be selected, and the failure was apermission_requiredthat said nothing about selection. Selecting only records which tab later calls mean, so it no longer needs the page: it pins the tab, brings it forward, and answerssuccesswith"access": "not_granted"and a hint. The first call that reads the page still fails withpermission_required.navigatewithbackorforward, andresize_window, now reportpermission_requiredon an ungranted tab instead of riding the 30-second bridge timeout. Both reach the tab through calls Safari parks on its permission dialog, and neither asked for access first, unlike every other page-touching action. One table-driven test now enumerates every action the router can dispatch and holds each to the rule, with a commented allowlist of the browser-chrome operations that are meant to work without access (tabs_context,tabs_create,close_tab,navigategotoandreload).- A screenshot can no longer return another tab's pixels. It activated the tab, waited a fixed 300 ms, and captured the window, trusting that the tab was still the one showing;
captureVisibleTabreturns whichever tab is, so a click on another tab in that gap produced the wrong page labelled as the requested one. The window's active tab is now checked before and after the capture, and native-input preparation checks it before returning, failing with the retryabletab_not_showingon a mismatch. - Native input no longer types into Safari's address bar. Preparing a native
type_textchecked that the page's active element was the target, which stays true while the address bar or find bar holds the keyboard, so the keys went to the bar andclearFirstcleared it. Native typing, key presses, and pointer moves now check that the document itself has focus and otherwise fail with the retryablenative_input_focus_failed. read_consoleshows errors instead of{}. AnErrorhas no enumerable fields, soconsole.error(err)and every unhandled promise rejection with an Error were captured as an empty object. Errors now read asName: messagefollowed by the stack, cut to 2,048 characters withtruncated: true, andundefined, functions, symbols and BigInts are named rather than dropped.- The network capture can no longer break a page's own requests.
fetch(url, null)threw inside the wrapper, because a default parameter only coversundefined, andXMLHttpRequest.openthrew on a method that was not a string, both calls the browser accepts. Afetch(new Request(url, { method: "POST" }))was also logged as aGET; the method now comes from the Request. The wrappers pass their arguments to the native call unchanged and give up on the capture rather than fail the request. javascript_toolno longer runs code twice because of what the code returns. A returned value was inspected for__cspBlocked, so a page value such aswindow.cartState = { __cspBlocked: true }read as a CSP refusal and the already-executed code was run again in the isolated world, doubling its side effects. The injected function now returns an envelope the user's value cannot occupy, and only a failure to compile, which happens before anything runs, can trigger the fallback; an error thrown by the code itself, even one that mentions a Content Security Policy, is reported as an error.- A call that names no tab now acts on one tab for its whole length. The extension looked the active tab up again at every step, once per frame of a search and once per follow-up, so a user switching tabs partway through could split one request across two pages. The router resolves the target once, hands it to every step, and reports it on the response as
resolvedTabId(absent from tools that act on no tab, which reportnull). Closing or selecting a tab still requires one by name. - A page whose frames cannot be listed no longer reads as a complete page.
snapshotfell back to the top frame without saying so; it now adds{"frameId": null, "origin": null, "reason": "frame_enumeration_failed"}tounreachableFrames, the same list that names a frame that will not answer. - A pinned tab that has closed no longer redirects the next call to whatever the user is looking at.
getActiveTabIdcleared theselect_tabpin on any lookup failure and fell through to the active tab, so an untabbedtype_textorclickcould land on the wrong page and succeed. It now fails withtab_closed(recovery:tabs_context, thenselect_tabagain) and clears the pin only when the tab is confirmed gone; any other failure keeps the pin. - The access-permission cache answers the question it is asked. It remembered only successful probes, so a blocked tab, which is the case it exists for, was probed again on every call and a frame search paid one probe per frame until the call ran past the bridge timeout. It was also keyed by tab alone while Safari grants by origin, so a
navigatefollowed straight away by a read reused the previous origin's grant inside the two-second window and went back to waiting on the new origin's dialog unbounded. Refusals are cached with their origin and recovery intact, and a tab that navigates loses its entry. resize_windowresizes the window the agent is driving. It readtabs.query({ currentWindow: true }), ignoring bothtabIdand the pinselect_tabsets, so on a two-window setup it resized whichever window the user had clicked into and a screenshot afterwards did not match the viewport that was asked for.- A
clickon a page with iframes can no longer fire twice. Targeting by selector or text tries each frame in turn, and any failure was read as "the target is not in this frame", so a frame that resolved the target and then failed handed the same action to the next frame that matched. A click that fired before something after it threw therefore fired again somewhere the caller never named. Onlytarget_not_found,wait_timeoutandpermission_requiredmove on now; anything else is the answer.waitis also put to every frame at once rather than in turn, because a selector that is not coming cost its whole timeout per frame, so a page with a few iframes ran past the bridge timeout and reported a generic failure in place ofwait_timeout. - A tab URL carrying
?token=or?session=no longer reports the value. Those are the two most ordinary names in the class the redaction exists for, and neither was on its list, while the comment above it already claimed session values were covered. PresignedX-Amz-SignatureURLs,jwt,sig,authorizationand several other spellings are covered now too. Names that describe a secret rather than carrying one stay readable, sotoken_type=bearerandpassword_hintare unchanged. SECURITY.md documents the control and its two limits, which it did not mention at all before. - The extension no longer gives up on a server that is still running. Its keepalive pruned any port "disconnected for longer than two minutes", but measured that from when the port authenticated rather than from when its socket went away, and that timestamp is never refreshed. So any server up longer than the grace period was dropped the first time Safari suspended the background page, which is the ordinary reason the socket closes. Pruning also recorded the live token as stale, and the server only mints a new one when it restarts, so the bridge stayed quiet until something was restarted. It now measures how long the socket has actually been gone, and closes the socket it is dropping rather than leaving one authenticating with nothing tracking it.
- A successful tool call is no longer reported as a failure with no reason, and a malformed frame no longer costs the full bridge timeout. The extension serialised its reply with
JSON.stringify(data), which is the valueundefinedrather than a string when a handler returns nothing, so the wholedatakey vanished from the frame and the server read a success as a contentless failure.snapshotreaches this whenever the top frame answers with a falsy tree. Separately, a frame that parsed tonull, a number, or a bare string was destructured without an id, and the error path then failed a second time reading that id, so no reply was sent at all and the server waited out its thirty seconds. - A tab waiting on Safari's permission dialog no longer hangs every call that names no tab. Resolving the active tab makes the same two calls
tabs_contextis deadlined for, and had no deadline at all, so one blocked tab put the whole tool surface back on the 30-secondbridge_timeoutwith the wrong reason attached. A pinned tab blocked that way is also no longer treated as a closed one, which used to drop the caller's chosen tab over a question nobody had answered yet.select_taband native input focus now check access before reading the tab, asscreenshotalready did. Navigating away from a blocked tab works rather than hanging: reading the page being left is best effort now, since leaving is the one move that gets a caller off a page they cannot use. - A reconnecting Safari profile can no longer be mistaken for a closed one. Connections were tracked by
ObjectIdentifier, which is the object's address, and an address is handed out again once the object behind it is gone. A new connection landing where a dead one used to be inherited its profile mapping and could take delivery of a response meant for it, silently and on the wrong profile. Each accepted socket now carries a counter that cannot repeat. statusno longer describes one profile using another's numbers. The extension version and bridge protocol it reports were a single pair that every profile wrote to, so an old build rejected in a second profile relabelled a healthy first one with its own version, anddoctorreported a mismatch for a bridge that was working. Those now come from whichever profile an untargeted call would drive, with each profile's own already listed inprofiles. A build turned away for a protocol mismatch is still named when nothing is connected, which is when there is nothing better to report. A cancelledtabs_contextis also no longer reported as every profile being unreachable withCancellationErrorgiven as the browser's reason. Profile ids are bounded and stripped of anything unprintable before they reach a log line or the MCP client, and the bridge tracks a fixed maximum of them rather than growing for as long as a client keeps inventing new ones.- A local process can no longer keep Safari from connecting, and a second handshake can no longer strand a profile. At the cap on connections awaiting authentication the bridge evicted the oldest, which is whichever one is furthest along and so most likely to be the extension mid-handshake, so anything opening sockets in a loop could starve it out: the newest is now refused instead, and a socket that opens and then says nothing gives up its slot after a deadline rather than holding it forever. A handshake is also only read before a connection has one, since taking a second under a different profile id registered the same socket twice and left the first entry reporting as connected after the socket closed. A connection rejected for a protocol mismatch now frees its slot immediately rather than only when its write completes. Frames are handled one at a time: handling and re-arming the read were separate tasks, which Swift orders however it likes, so a handshake could be overtaken by the frame behind it and have its own connection closed as unauthenticated traffic.
- The bridge recovers from a failed bind instead of staying dead.
start()setlistenerbefore knowing the bind had worked and never cleared it when the port sweep gave up, so thelistener == nilguard turned every laterstart()into a silent no-op: once something held all ten ports in the range, nothing would listen again until the process restarted, andstatusreported a dead bridge with no reason attached. The sweep now releases each listener it abandons and recordsbridge_bind_failedwith the range it tried. The bind also waits on a continuation that only.readyand.failedresumed, so a.cancelledlistener leftstart()suspended forever and took the MCP server down with it before it could answerinitialize. - The bridge no longer leaks a connection per reconnect, or keeps serving a socket nobody reads. Every accepted connection and every listener stored a state handler that captured it, which is a cycle that outlives
cancel(), so each Safari reconnect across a sleep, wake, or extension reload left its connection and receive buffers resident for the life of the process. A receive error or a close frame also returned without dropping the registry entry, so the profile kept reporting as connected while its read loop was over and every later call to it waited out the full 30-second timeout. dragno longer reports success on endpoints a real pointer could not reach. It took the raw centre of each element's rect, so a source or destination under a modal dragged without complaint, an element wider than the viewport was aimed outside it, and the destination was never scrolled into view at all, which put the drop at an off-screen coordinate whenever the target sat below the fold. Both ends are now scrolled to before either is measured, and both are hit-tested before anything is dispatched, so a refusal cannot leave the page holding a pointer down with nothing to drop. It fails withtarget_coveredortarget_not_visiblethe wayclickandhoverdo, and takes the sameforce: true.clickandhoverno longer report success on an element the user cannot reach. Text targeting took the first ranked match, sotext: "Delete"on a list of rows silently acted on one of them; it now fails withambiguous_targetand the candidates' UIDs when several elements tie. A synthetic event also reached a target under a modal or banner;clickandhovernow hit-test the target first and fail withtarget_coverednaming the element a real click would reach, ortarget_not_visiblewhen the target has no area in the viewport.force: truerestores the old dispatch. Text matches inside a control now act on the control, so a click on a button's label focuses the button.snapshotno longer returns a page with a silent hole in it. A frame it could not reach was dropped, so a tree missing a whole third-party iframe was indistinguishable from a complete one. Unreachable frames are now listed inunreachableFrameson the root, each with itsframeIdandorigin, and the key is absent when every frame answered. This is the ordinary case rather than an exotic one: Safari's Always Allow on This Website covers the top-level page only, so every user who granted per site was reading partial pages that looked whole. A frame with no origin to grant (about:,data:, sandboxed) reportsnullrather than the string"null"that the URL parser produces for an opaque origin, which also fixes that string reachingpermission_requiredmessages forfile://tabs.- Touching a site Safari has not been asked about no longer hangs for 30 seconds. Safari asks for website access with a modal dialog and blocks every extension call for that tab until it is answered, and that dialog can open behind another window where nobody knows it exists. Every tool rode that out to the server's 30-second bridge timeout and then reported
bridge_timeout, which is not what happened and is not something a retry fixes. Tab-touching calls are now probed first with a trivial injection, so a blocked tab fails in about two seconds withpermission_required, the origin, and the fact that the dialog may be hidden. A blockedtabs_contextandscreenshotreport the same way.permissions.containsis deliberately not used for this: on Safari it reports what the manifest asked for rather than what the user granted, so it answers true for origins with no access. mcp-safari doctorno longer reports a matching extension version while Safari runs a different build. It read the Info.plist inside the installed app, but Safari runs whichever bundle PlugInKit registered, so a stale copy produced a clean bill of health with the wrong extension driving. The version now comes from the bundle Safari actually loaded.- Native input no longer tells agents to bring Safari to the front themselves. The refusal said "activate Safari and retry", so agents running in the background activated Safari with
osascriptand took over the user's keyboard and mouse mid-task. The refusal, thenativeparameter descriptions, and the screenshot hidden-page and unfocused-window notes now tell the agent to ask the user first unless the user has already allowed it, and both focus failures reportrecoveryAction: "ask_user". Losing focus after events were sent is no longerretryable, since a retry sends the whole input again. The nativetype_textdescription also says it types one character at a time, is not paste, and is for short input only. - Bridge timeouts report the actual action and deadline and no longer recommend blindly repeating a possibly completed mutation. Canceled requests stop waiting, successful/failed requests cancel their timeout tasks, and late replies cannot complete a later request.
- File uploads validate and read one descriptor within a strict remaining byte budget, including when caller-selected paths change concurrently.
- Token publication failure stops the listener and reports a diagnostic. Stdio shutdown removes owned per-port tokens.
- Popup website-access status refreshes without overlapping probes and reports messaging failures.
- An interaction that starts a page load now answers once the load has finished, and a
waitno longer dies with the page it was polling (#153).clickreturned the moment its event was dispatched, so the next read showed the page being left, and a post-actionwaitForSelectoror awaitsent straight after was polling inside a document that the click was about to replace. Nothing ever answered it, so it ended at the 30-second bridge timeout, reported as a bridge failure, although the new page had loaded. Afterclick,press_key,form_input,select_option, andtype_textwith asubmitKey, the extension now watches the tab for 400 ms and, if a navigation starts, waits for it with the same load trackingnavigateuses, including single-page route changes. The result ends withPage navigated to <url>, redacted like every other URL and without a title for a site that has not been granted. A click that starts no navigation costs 400 ms; one that opens a new tab is not held for it. Awaitthat is pending when the tab starts loading, including a navigation the page started itself, is now sent again to the new document with the time that remains, and fails with a retryablewait_timeoutthat says so if that time runs out, rather than riding out the bridge timeout. - A click that navigates is no longer performed twice. When the page a click ran in is replaced before it can answer, Safari resolves the message with nothing, and the extension read that as "no content script here", injected the scripts and sent the click again: a pagination "Next" went two pages on, and a click by uid then failed on the new page with
target_not_found. Safari does not report a tab with no content script as an error, it answers the same nothing, so an action that must not run twice first asks the frame with apingand injects the scripts only if nobody answers; a read that changes nothing is injected into and asked again, as before. A reply that never came is treated as a click whose result was lost: if the tab loaded a page the call succeeds, says the click was dispatched and the page navigated before it could report a result, and ends with the usualPage navigated toline; if nothing loaded it fails with the new non-retryablereply_lost, which says to read the page before repeating the action. Await, which changes nothing, is still sent again. - Ending a navigation no longer rides the bridge timeout on a site Safari has not decided. The read of the tab that closes
navigate, and the settle after a navigating click, parked on the permission dialog with no deadline. They now give up after two seconds and answer from the last update the load delivered. - A closed tab is reported as closed, and a slow page keeps its grant. Every failure of the access probe, and its two second deadline, was reported as
permission_requiredand forgot the site's stored grant, so a tab that had closed sent you to Safari's settings and a granted page that took too long to answer vanished fromtabs_context. Only a deadline (the dialog is open) or Safari's own refusal now meanspermission_required, and only a refusal forgets a grant. Any other failure istab_closedwhen the tab is gone and the original error otherwise. The origin is read again after the probe so a tab that navigated in between is not credited, and concurrent calls on one tab share a single probe. - A tab Safari has not loaded fails with
tab_not_loaded, which says to callselect_tabon it. Safari reopens a window's tabs at launch without loading them, and loads each only when it is shown, so most tabs listed after a relaunch were unreadable. The call failed with Safari's own "Could not execute script on this tab" as a non-retryableextension_error, and before that aspermission_required, which also forgot the site's grant.navigatewithreloaddoes not load such a tab, andselect_tabdoes. tabs_createwith aurlanswers once the page has loaded, asnavigatedoes. It answered as soon as Safari made the tab, before Safari had given the tab its URL, and Safari refuses access to a tab with none, so a call made straight after it failed withpermission_requiredon a site the user had granted.snapshot,findand the selector forms ofclick,hover,drag,scrollandwaitcheck website access before listing the page's frames. The listing parks on the permission dialog like any other call into the page, so these rode the bridge timeout instead of reportingpermission_required.- Two MCP clients no longer share a
select_tabpin. The pin was one value for every server connection, so a second client's calls that name no tab landed in the first client's tab. It is now kept per server, in memory and in its stored copy, and one server's pin is untouched by another's. A pin also ends with the server run that made it, so a server started later on the same port does not inherit it; it is tied to a short digest of the server's token, which changes on every start, and the token itself is never stored. A pin survives the background page being suspended and woken while the same server is running. findsays which frames it could not search. It dropped any frame that would not answer, and ignored a frame list that could not be read, so a short list looked complete. The structured result still carries the list asmatches, and a search that left frames out addsunreachableFramesbeside it, in the formsnapshotuses.- A reused
XMLHttpRequestis recorded once per request. The network capture added a listener on every send and never removed it, so the second request on an object was recorded twice and the third three times. waitwithsecondscan no longer fail withwait_timeout. A navigation that used up the time failed a sleep, which waits for nothing; it now reportsWaited N seconds, and a sleep resumed after a navigation reports the time asked for rather than the remainder.- A refusal seen while the stored list of granted sites is still loading is no longer undone when the list arrives. The late read was merged under what had been learned, and resurrected the site as granted, in memory and in storage.
- The popup describes the tab you are looking at rather than one an agent pinned, startup no longer waits on a pinned tab that is parked behind Safari's dialog, and a rejected storage write is dropped quietly instead of surfacing as an unhandled promise rejection.
screenshotand native input no longer fail withtab_not_showingwhen a window of the same profile is showing one of Safari's pinned tabs. Safari lists a profile's pinned tabs once for every window, each copy with the same id and active flag. So asking which tab a window shows also returned another window's pinned tab, first, and the check read that as the user having switched tabs. A call that names no tab could also land on that pinned tab.tabs_contextno longer lists a pinned tab once per window.
Security
- Releases are harder to tamper with. A release is signed and published only from a tagged commit on
main, after the full test suite on both supported toolchains and a dependency audit pass, with every workflow action pinned to a commit. The signing certificate is available only to the signing step and is deleted straight after it. Before anything is published, the app and everymcp-safaribinary are checked for a valid signature from the expected team, the hardened runtime, Apple's accepted notarization and Gatekeeper acceptance, and for none of the entitlements that allow debugging or loading unsigned code. - The token-directory guard for
upload_file,drop_file,navigateandtabs_createhad three gaps, now closed./System/Volumes/Data/Users/...names the same files as/Users/...but resolves to a different string, so the data volume prefix is now ignored when paths are compared. Safari reads a backslash in afile:URL as a slash while Foundation does not, so afile:URL with a backslash or%5Cin its path is refused. And a hard link to a token file opens under its own name, which the descriptor's path check cannot connect to the token, so a file with more than one link is now compared by device and inode with the files in the protected directories. - The extension forwards a token file only if it is one. It used to read anything named like a port, of any type and size, and pass the text to the background script, so a FIFO could hang the open and a symlink could aim the read at an unrelated file. Each file is now opened without following a symlink, must be a regular file of at most 256 bytes, and must parse as a UUID; port filenames must be canonical, so
+80and0080no longer alias port 80. A directory that is itself a symlink still works. - The native message handler no longer echoes unknown messages back, and no longer puts the home directory in its error. An unrecognised message gets
{"error": "unsupported_message"}, a missing token gets{"error": "no_token_files"}, and the log records a fixed word rather than the message. - The sandbox grants are narrower. The extension's read exception covers
~/Library/Application Support/MCPSafari/tokens/instead of the wholeMCPSafarifolder, andcom.apple.security.files.user-selected.read-onlyis dropped from both the app and the extension, since neither opens a file panel. The two.entitlementsfiles are now the only source: the app target names its file explicitly and theENABLE_*build settings that used to synthesise a second copy are gone, so a local build and the release signing carry the same entitlements. - The bridge refuses WebSocket upgrades from web pages. Browsers do not apply same-origin to WebSockets, so a page on any site could open a socket against a loopback port and occupy one of the few handshake slots until its deadline, in the way that kept Safari from connecting before the cap was fixed. Safari sends
Origin: safari-web-extension://<per-profile UUID>for the extension, measured on a real run, so an upgrade carrying any otherOriginis refused at the upgrade and its connection closes at once. A request with noOrigin, which is every client that is not a browser, is admitted as before, and the token handshake is still what authenticates. Resolves #121. - The bridge token no longer crosses the WebSocket, and the server has to prove it holds it before the extension acts on anything. The extension used to send the token in its first frame and to treat any
{"auth":"ok"}as proof of the server, so a local process that had taken a port the extension was configured for was handed the token and could then answer requests as if it were the server. The handshake is now mutual challenge-response: the extension sends a random nonce, the server answers with its own nonce and an HMAC-SHA256 proof keyed with the token, the extension verifies that proof with WebCrypto before sending its own, and the server verifies the extension's in constant time. The proofs have distinct labels and nonce orders, so neither can be reflected as the other, and they include the port and both nonces, so a captured exchange cannot be replayed. Out-of-order frames close the connection, and the handshake slot cap and deadline cover the whole exchange. SECURITY.md describes it step by step. - The server writes the bridge token to one place instead of three. Dropping the
~/.config/mcp-safari/copies and the sharedtokenfile removes two readable copies of the secret that nothing could use, one of which another process could replace between a check and a use. - The bridge compares the handshake token byte by byte without stopping at the first difference.
String ==returns early, so a wrong guess took longer the more of it was right. - An unauthenticated connection has less room to occupy the bridge. The time a socket may sit before completing its handshake drops from 10 seconds to 2, since the real extension sends it within milliseconds of opening, and a first frame larger than 4 KiB is closed without being decoded. The listener-wide limit of 32 MiB, which tool responses need, previously applied to a peer that had not yet proved it held the token. SECURITY.md also said a ninth waiting connection evicts the oldest; since the flood fix it refuses the newest, and the text now says so.
- Token files no longer outlive the server that wrote them. The server removed its tokens only when its stdio loop ended, so SIGTERM, SIGINT, SIGHUP or a crash left a live-looking token on disk for a port nothing served, or that another program had since taken. The server now handles those three signals by stopping the bridge before it exits, and ignores SIGPIPE. Each token file also has a
<port>.pidfile beside it naming its owner, and a starting server deletes the tokens whose owner is no longer running. The token file's own contents are unchanged. - The extension dials the bridge at
127.0.0.1rather thanlocalhost. The server binds the IPv4 loopback address only, but the namelocalhostcan resolve to::1first, where a different local user could be listening and would receive the handshake, token included. - A caller can no longer ask for unbounded output.
maxChars,maxNodesandmaxResultstook any positive integer, soread_page {maxChars: 2000000000}orsnapshot {maxNodes: 1000000}asked the page for as much as it had. They are now brought down to documented maxima (1,000,000 characters, 10,000 nodes and 1,000 results, against defaults of 100,000, 2,000 and the buffer size) rather than refused, and the tool descriptions state them. run_stepsnow validates every step's arguments before it runs the first one. The header of the plan said the batch was checked up front, but only the tool names, reserved keys and tab handles were; a step's URL scheme, navigation action, wait length and wait options, native key combination, native text length and file arguments were checked when that step ran, so a bad URL in step 3 was reported after steps 1 and 2 had already acted on the page and could not be taken back. The plan now runs the same validation each step's handler runs over every step, and names the step and tool in the refusal.- A bad
waitForSelector,waitForText,waitTimeoutor trace option can no longer be reported after the action it belonged to has already run. They were validated only in the post-action step, soclick {waitForSelector: ""}clicked and then failed, and a caller who fixed the argument and retried submitted the form twice.traceDurationwas likewise checked only afterstart_tracehad been sent, leaving a trace running that nothing stopped. Every option is now read, with its type, before the action or the trace is sent, for every tool that accepts them.includeSnapshotis held to a boolean in the same step. - The URL scheme check and the filter pattern check now hold on the server instead of resting on how Foundation and the page happen to behave.
navigateandtabs_createjudged the scheme fromURL(string:), which is not how Safari reads a URL: WebKit drops leading and trailing control characters and spaces and deletes tabs and newlines before looking for the scheme, so a string such asjav<tab>ascript:is ajavascript:URL to the browser. The scheme is now taken from the normalized string, and the normalized string is what is sent.read_consoleandread_networkchecked only length and compilability on the server and left the bounded subset (no repetition, groups or backreferences) to the page-world filter, which a page can rewrite; the server now enforces the same rule, counting the 200-unit limit in UTF-16 code units as the page does, so(a+)+$is refused before the extension sees it. - A wrong-typed optional argument is refused instead of being read as absent. The handlers read
args["x"]?.stringValueand friends, which cannot tell a missing key from one of the wrong type, soselect_tab {bringToFront: "false"}activated the tab,read_console {pattern: 5, clear: true}cleared the buffer without filtering it,read_network {status: "500"}returned every request despite the documented promise that a rejected filter never returns unfiltered data, andresize_window {width: 800.0}sent no width at all. Shared helpers now throwinvalid_inputnaming the key when it is present with the wrong type, and accept whole-valued doubles such as800.0where an integer is wanted.resize_windownow requires bothwidthandheightas positive integers of at most 10,000. The parameter checks of the non-interaction tools moved into one place that both the handlers and a new pre-dispatch step use, andnavigate/tabs_createandread_console/read_networknow share one URL check and one pattern check instead of two copies each. Their refusals are now structuredinvalid_inputfailures rather than bare error text. - A call that names no tab now keeps to one tab across its own follow-ups. The action, its post-action wait, its
includeSnapshotsnapshot and the end of its trace were separate requests that each resolved "the selected tab" for themselves, so a tab switch between them (by the user, or by a parallelselect_tab) sent the wait and the snapshot to a different page than the one acted on. The extension now reports the tab it resolved on every reply asresolvedTabId, and the server addresses the follow-ups to it. Arun_stepsbatch with notabIdpins the first step's tab for every later step, its final snapshot and its trace. An extension that does not send the field behaves as before. - A tab on a site Safari has not granted is reported as such rather than left for the next read to discover.
tabs_context,tabs_createandselect_tabmark each tabaccess: "granted"or"not_granted"with anaccessHint, andselect_tabon an ungranted tab succeeds. The server pins the tab's profile as for any other selection and adds one sentence to the result, once for a wholetabs_contextlisting rather than per tab, saying that reading or acting on those tabs will fail withpermission_requireduntil the user grants the site, followed by the extension's hint. - Parallel tool calls can no longer steal focus from each other mid-action. Native input,
screenshotandselect_tabeach ask the extension to focus a tab or element and only then act, and the server awaits between the two steps. The MCP SDK runs every request in its own task, so another call could run in that gap, focus something else, and receive the first call's keystrokes or click. These tools now take a first-in-first-out lock that is held from the prepare step through the act step, and release it on every exit including cancellation.select_tabtakes it only when it brings the tab to the front, and the rest of the tool surface is not queued behind it. - Native
hoveranddragno longer click through to another app. The only guard was that Safari was the active application, which says nothing about what is drawn at the target: a Finder window, the Dock or the menu bar over part of the page took the real pointer event instead. The server now walks the on-screen windows front to back and refuses, withnative_input_focus_lostand nothing sent, unless the topmost one at each target point belongs to Safari. A drag checks both ends before the button goes down. Only fully transparent windows and the window server's cursor window are ignored; every other layer counts, because the Dock and menu bar take clicks like any window. - Native
press_keyno longer sends shortcuts that quit or leave Safari. It accepted any modifier combination, so a prompt-injected page or a confused agent could post Command-Q, Command-W, Command-Tab, Control-Command-Q (lock) or Command-Option-Shift-Q (log out) as a real key event, which nothing in the page can contain. A short named list is refused withinvalid_inputbefore anything is sent: Command with Q, W, H, M, Tab or Space, Control-Space, Command-Option-Escape, and Command-Shift-Delete, with any extra modifiers. The check follows the character the caller named rather than the resolved keycode, so AZERTY's remappedqis caught too. The list is in docs/tools.md. - Native
type_textno longer runs unbounded on the server. It had no length limit, checked that Safari had focus only before and after the whole text, and posted every keystroke synchronously on the server actor, so a long text stalled every other tool call and kept typing into whatever app had taken focus. Text over 1,000 characters is now refused withinvalid_inputpointing at the non-nativetype_text; focus is re-checked every 16 characters, and losing it stops the call with an error saying how many characters were delivered. A cancelled call stops typing, and the keystrokes are posted off the actor with a suspension between them rather than holding it. Typed characters also no longer inherit modifier keys the user is physically holding, which turned a typedqinto Command-Q. - Native
type_textwithclearFirstno longer quits Safari on a French or Belgian keyboard. It selected the field's text with Command plus the fixed keycode 0, which isaon QWERTY andqon AZERTY, so the "select all" was Command-Q. The key is now looked up on the active layout the waypress_keyalready did, and a layout with no plainakey is refused withinvalid_inputbefore anything is sent. Nothing falls back to keycode 0. screenshotwithfilePathcan no longer overwrite arbitrary files. It wrote the capture to any path the account could write, so a prompt-injected agent could replace~/.zshrc, an SSHauthorized_keysor a LaunchAgent with a PNG. The path must now end in.png(case-insensitively), an existing target must be a regular file that already begins with the PNG signature (a symlink, a directory or any other file is refused and left alone), and the bridge token directories are refused. New files are created with mode0600, since a page can show anything, and an existing PNG keeps its mode. The write goes to a temporary file in the same directory that is renamed into place, so a failed save leaves the previous file untouched, and the destination is checked before the extension scrolls anything into view.upload_file,drop_fileandfile:navigation can no longer read the bridge token. They read any path the caller named, and the token files under~/Library/Application Support/MCPSafari/and~/.config/mcp-safari/are readable by the same account, so an agent steered by a page could attach the token to a form or open it in Safari and read it back, and the token authenticates anything that can reach the bridge. Both roots are refused now, and are named explicitly rather than taken from what the bridge currently writes, so a token left behind in~/.config/mcp-safaristays off limits after the bridge stops writing there. The file tools check the resolved path of the open descriptor, so symlinks, a~/.configsymlinked into a dotfiles repository,..segments and a different spelling of the case all land on the same answer;navigateandtabs_createapply the same rule tofile:URLs after resolving symlinks. A hard link made elsewhere to a token file is not covered, since a file carries no record of its other names.tabs_contextno longer reports the URL and title of tabs on sites you have not granted (#150). Safari's tabs API returns both for every open tab, which made the tool a window onto your browsing history. A tab on a site MCPSafari has not reached still appears with its handle, window and state, so it stays usable, but carries"access": "not_granted"and a hint that the user can grant the site from the MCPSafari toolbar button; tabs it can describe carry"access": "granted".tabs_createandnavigatewithhold the page title the same way. A site counts as reached once a call has run on it, because checking ahead would raise Safari's permission dialog for each site, so a site you have just granted reads as not granted until something touches it. Sites a call has succeeded on are remembered across Safari restarts (up to 500, the one confirmed longest ago dropped first) and forgotten the moment a call to them is refused, so a site revoked in Safari Settings keeps showing its URL and title until then.- A hostile page can no longer take the bridge down through a tool result. The extension returned whatever the page world answered a console, network or trace read with, and the page shares that channel: it can answer first, or replace
window.__mcpGetConsoleMessages, with data far past the documented 8192, 2048 and 4096 caps. One oversized frame exceeds the bridge's 32 MiB limit and drops the connection for every Safari profile. Replies are now re-validated in the isolated world: they must be plain data of the right shape, lists are cut to 1,000 messages, 500 records or 1,001 events, strings to their caps, and the total to a fixed size, withtruncated: truewhere something was cut. Request ids are random rather than derived from the clock. - URL credential redaction is broader and no longer stops at tab listings. It matched a hand-kept list of whole parameter names, so
auth_token,oauth_verifier,csrf_tokenandX-Goog-Signaturecame back verbatim, and it ran only on tab URLs. Names are now percent-decoded, split into words and matched on those (token,secret,key,sig,password,auth,session,otp,ticket,verifier,credentialand more), with descriptive names such astoken_typeandpassword_hintstill readable. Userinfo (https://user:pw@host) is replaced, and the same redaction now coversread_networkURLs, trace event URLs, and thehrefof links in a snapshot. - A trace no longer records what a user types. The DOM mutation capture wrote the old and new value of every attribute change, and frameworks mirror a typed password into the
valueattribute, so a tracedtype_textinto a login form returned the password in the trace.valueandcheckedare never recorded now, nor any attribute of a fieldsnapshotwould redact; those events sayvalueOmitted: true. Other attribute values are cut to 512 characters withtruncated: true. The page-world interceptor cannot read the snapshot's rule, so it carries a copy, and a test fails if the two drift apart. - A tab on a site you have not granted no longer shows where it went.
navigate(reloadandgotoneed no access to the page),back,forwardand thePage navigated tonote after a click withheld the landing page's title but still printed its redacted URL, including a redirect or a history entry nobody asked for, andtabs_createwith no URL returned the browser's homepage. They now name the origin only, with a note that the URL and title are withheld, astabs_contextdoes. read_network'surlPatterncan no longer be used to read a redacted secret. The filter ran in the page against the URL as requested, credentials included, so a caller could narrow a pattern one character at a time and watch which entries came back. It is now applied in the extension to the URL as reported, after redaction, with the same bounded pattern rules;maxResultsandclearapply to the entries that matched.- A trace redacts the URL values in DOM mutations. The old and new value of an
href,srcoractionattribute, or of any attribute holding an absolute URL, went out with its credentials. - URL credential redaction covers more spellings. Userinfo in
//user:pw@hostandhttps:\\user:pw@host; parameters separated by;; a path parameter such as;jsessionid=; a token percent-encoded inside another parameter's value; and the namespass,SAMLResponse,client_assertion,bearerandPHPSESSID. snapshotredacts more of what a form holds. It relied ontype="password"or anautocompletetoken, so a password revealed by a show-password toggle (the type flips totext), a field namedpin,otp,cvv,ssn,secret,tokenor2fa, and any sensitive<textarea>came back verbatim. A field that was ever a password on the page stays redacted, andname,id,aria-label,inputmodeandautocompleteare now read for secret words. Whole words are matched for the short ones, soshippingandpassengerstay readable. A sensitive textarea also no longer repeats its default text.- The extension now asks Safari for the
cookiespermission, whichclear_cookiesneeds. With it, MCPSafari can see the cookies of the sites you've allowed it on, sign-in cookies included. It only ever deletes them, and only forclear_cookies. To tell a site from a domain that many sites share, the extension carries a copy of the Public Suffix List; SECURITY.md says how it's kept up to date.
Installation
brew trust --formula epistates/tap/mcp-safari-server
brew install --cask epistates/tap/mcp-safariTo upgrade, name both parts in full, server first:
brew upgrade epistates/tap/mcp-safari-server
brew upgrade --cask epistates/tap/mcp-safariSee setup instructions for manual installation and client configuration.