
Apple Safari
io.github.mgcrea由 GitHub 账号 mgcrea 发布v1.41.0更新于 Nov 17, 2026
Read and act on Safari — history, tabs and reading list, writes off by default
概览
面向 macOS Safari 的本地 MCP 服务器,让助手搜索历史记录、列出标签页、书签和阅读列表、读取页面,并在开启写入后操作页面。
- 可以做什么
- 搜索和读取浏览历史、书签、阅读列表条目以及当前打开的标签页
- 以文本或 HTML 读取页面,列出可点击和可输入的元素,并等待某段文字出现
- 可选开启:查找页面上的验证码、录制并查看页面的网络请求、列出允许站点的 Cookie
- 可选写入:打开网址、加入阅读列表、关闭它打开的标签页,以及点击、填写、滚动和提交表单
- 报告哪些通道可用,以及某条通道不可用的原因
- 适用场景
- 适合需要助手操作用户 Mac 上真实 Safari 会话的场景:查询访问过什么、查看当前打开了哪些标签页、读取用户眼前的页面,或在用户已允许扩展的站点上驱动页面。
- 运行要求
- 在 macOS 上通过 npx(Node.js)本地运行。标签页通道需要 Safari 正在运行;页面工具需要启用 Safari 扩展并按站点授权。历史、书签和阅读列表需要完全磁盘访问权限,打开的标签页需要自动化授权。可选功能通过环境变量开启,例如 APPLE_SAFARI_ALLOW_WRITES、APPLE_SAFARI_ALLOW_CODES、APPLE_SAFARI_ALLOW_NETWORK、APPLE_SAFARI_ALLOW_COOKIES 和 APPLE_SAFARI_COOKIE_HOSTS。
安装
在 SourceWeft 中
- 打开 控制台中的 Apple Safari,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@mgcrea/mcp-apple-safari
MCP server for the macOS Safari browser: what you have visited, what is open now, and what is on the page in front of you.
Three lanes that are not fallbacks for each other
This is the thing to understand before anything else. Every other surface in this bundle has two routes to the same data and the choice is about speed. Safari's lanes see almost disjoint things, and each needs a different permission — so an ungranted Safari server is not a slower Safari server, it is a different and much smaller one.
The extension lane needs no TCC grant of any kind. Safari consents to it one website at a time, which the user can see and revoke per site.
Tools
Read
Opt-in read — APPLE_SAFARI_ALLOW_CODES
Opt-in read — APPLE_SAFARI_ALLOW_NETWORK
Opt-in read — APPLE_SAFARI_ALLOW_COOKIES, and only for sites in APPLE_SAFARI_COOKIE_HOSTS
Write — APPLE_SAFARI_ALLOW_WRITES
Configuration
APPLE_SAFARI_ALLOW_CODES
Two things move together when it is on: find_codes is registered, and page_elements returns the
value of a one-time-code field. It is a read, and deliberately not folded into
ALLOW_WRITES — reaching a read through the write gate would mean granting the right to click a
button in order to see a number.
A credential field is withheld either way. A password, a card number or a CVC comes back
redacted: "credential" with no value and no setting that returns it. This flag is named for codes
and does not widen past them. In both cases hasValue still says whether the field is filled, which
is usually what you needed.
It is weaker than the Messages gate of the same name, and worth knowing which. There, off means
the tool does not exist and the alternative is sifting whole threads. Here read_page stays ungated,
so off removes the targeted field read and the live DOM scan — not every byte of a page.
See docs/passwords.md in the repo for why the Passwords app itself is unreachable by any lane, and
why reading a code a website shows is a different question from reading the vault.
APPLE_SAFARI_ALLOW_NETWORK
Registers network_record, network_list and network_get, which show what a page you have
allowed the extension on fetched: fetch and XMLHttpRequest calls from the top frame, console
errors, and resource-timing entries. It is a read gate and is not folded into ALLOW_WRITES,
for the reason ALLOW_CODES is not: the traffic of a signed-in page is session material, and that
is a different exposure from a one-time code.
- Bodies are not redacted, and neither are URLs. Headers named
authorization,proxy-authorization,cookieorset-cookie, or containingtoken,secret,api-keyorapikey, come back as<redacted: N chars>. A body has no names to match, so it is returned as the page saw it, and URLs are returned in full, query strings included, so a token in one comes back too. Turn the gate on knowing that. - Opt-in per tab, and it expires. Nothing is wrapped until
network_recordstarts, recording survives a reload for 15 minutes by default (120 at most), andstopends it at once. - Two things need
ALLOW_WRITESas well:reload: trueonnetwork_record, which re-runs the page, andsaveAsonnetwork_get, which writes intoAPPLE_SAFARI_DOWNLOAD_DIR(a bare filename, and never over an existing file unlessoverwrite: true). Each fails with an error namingAPPLE_SAFARI_ALLOW_WRITES. - What it cannot see: subframes, web and service workers,
<img>/<script>bodies and WebSockets. Request ids die when the page reloads or navigates. On a page whose Content-Security-Policy refuses inline scripts there is a fallback that loads the recorder by URL instead. It has not been verified in Safari; if it works it arrives late, so the page's first requests can be missing, and if it does not,hook.injectionsays"blocked". - A file inside an API response:
network_getwithjsonPathto the field,decode: "base64"andsaveAs. The bytes go to disk, not into the conversation.
APPLE_SAFARI_ALLOW_COOKIES and APPLE_SAFARI_COOKIE_HOSTS
Registers cookies, which lists the cookies Safari would send to an open page, HttpOnly ones
included, so a signed-in session can be handed to a local tool without copying it out of Safari by
hand. It reads through browser.cookies in the extension's background worker, so the values never
enter the page's own process.
- Gated twice. The flag decides whether the tool exists;
APPLE_SAFARI_COOKIE_HOSTSdecides which sites it may read. A login cookie is the login, so the flag alone would hand any agent any session in the browser. The list is comma-separated registrable domains (yahoo.com), each covering the domain and its subdomains on a label boundary (nevernotyahoo.com). Empty, the default, refuses every page, and a refusal names the setting. An entry with no dot is ignored; there is no public-suffix list, so do not list one likeco.uk. - No value inline, ever. The result gives each cookie's name, domain, path,
secure,httpOnly,sameSiteandexpires(null for a session cookie). - To get values out:
namesplussaveAswrites the named cookies intoAPPLE_SAFARI_DOWNLOAD_DIRas oneCookieheader value —A3=…; T=…; Y=…, with noCookie:prefix and no trailing newline, so a tool that takes a cookie string reads the file as is — mode 0600. A bare filename, never over an existing file unlessoverwrite: true, and it needsALLOW_WRITES. A name the page lacks writes nothing and says which. - The extension asks for the
cookiespermission. On the install measured, Safari did not ask for approval again and the API worked at once; if yours shows the extension switched off, enable it in Safari › Settings › Extensions, and until then the tool saysbrowser.cookiesis not available. It still reads only on sites you have allowed the extension on: there is no new all-sites grant. - In the Cupertino app both are one control: Safari › Read cookies, with the sites in the Sites field under it, passed only while the box is ticked. Started yourself, the server needs both variables set and Full Disk Access, so it can reach the extension's container.
Buffer limits: 1,000 records and 50 MiB of bodies per page; bodies are kept up to maxBodyBytes
(10 MiB by default, 50 MiB at most). See docs/safari.md.
Notes that will bite you
- An unmatched tab is normal, not an error. The only join key between a live tab and history is
the URL, and it is trivially lossy: measured match rates were 60.7%, 55.3% and 8.3% across
three runs. A single-page app reached by
pushStatecommits no history row at all, so the page was genuinely visited and genuinely is not in the store. Treathistory: nullas NOT FOUND, never as "never visited". - An exact URL match is not proof the row is about that page. One measured tab on
http://localhost:4321/matched a history row for an entirely different project. Any local address carries this. read_pageis live when the tab can answer, and a snapshot when it cannot. It asks the open tab first and waitsAPPLE_SAFARI_LIVE_READ_TIMEOUT_MS; a visible tab answers within a second. A hidden tab checks in only every ten, so it — like a closed one — gets the capture the extension stored at load and as the page settled, withsource: "capture",ageSeconds, andliveReadsaying why. The acting tools always go to the live page, which is why they cost about a second on a visible tab and up to ten on a hidden one.- Read a form with
page_elements, notread_page. Field values are not page text. Elements carryvalue(a select's shown option too),checkedon checkboxes and radios, anddisabled: trueon greyed-out controls, which are listed rather than dropped. Values are cut at 200 characters unlessmaxValueCharsraises it, and a cut one says so withvalueTruncated. - Set a form with
fillandclick.fillwrites through the element's native setter, which is what makes React register the change — a plainel.value =shows the text and leaves React's state on the old value. On a select it takes the option textpage_elementsreports. Checkboxes and radios are clicked, not filled, and a click toggles, so readcheckedfirst. File inputs cannot be set: a content script has no way to reach a file on disk. - A timeout from an action means nothing was listening — the extension off, not allowed on that site, or the page closed. It never means the page refused. Commands are at-most-once: one that is handed out and lost is not retried, because a click that MIGHT have landed must not be repeated.
- Element ids die on navigation. They come from a
page_elementscall and are valid for that page only. Never construct one, and re-enumerate after any click that loaded something. - A Reading List add hits the network. Safari fetches the URL in the background to build the
entry, and overwrites any
withTitleyou pass with the page's own title.verifiedhas three states and is neverfalse: the file lags the add by about 2 s, and reporting an unconfirmed write as a failed one makes callers retry — into a list with no remove verb. - The write lane needs no Full Disk Access. Both Apple Events writes work on a machine where the
read lane does not.
APPLE_SAFARI_LIVE_TABS=falseoutranks the write gate, because that flag promises a server that sends no Apple Event at all. open_urlacceptshttpandhttpsonly. Ajavascript:URL would bedo JavaScriptthrough the front door — measured: Safari accepts one through the navigation verb — andfile:is a navigation verb that reads local files.
Licence
MIT.
来源:packages/safari/README.md,提交 6022637
工具
0版本历史
21- v1.41.0最新Nov 17, 2026
- v1.39.0Nov 12, 2026
- v1.38.0Nov 11, 2026
- v1.37.1Nov 8, 2026
- v1.37.0Nov 7, 2026
- v1.36.2Nov 4, 2026
- v1.36.1Nov 3, 2026
- v1.35.0Oct 30, 2026
- v1.34.0Oct 29, 2026
- v1.31.0Oct 26, 2026
- v1.30.0Oct 22, 2026
- v1.29.1Oct 21, 2026
- v1.28.0Oct 13, 2026
- v1.27.0Oct 13, 2026
- v1.26.0Oct 6, 2026
- v1.25.0Oct 3, 2026
- v1.24.1Sep 29, 2026
- v1.24.0Sep 27, 2026
- v1.23.0Sep 19, 2026
- v1.22.1Sep 16, 2026
- v1.21.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分