
macOS (osascript)
io.github.zaosoula由 GitHub 帳號 zaosoula 發布v0.1.0更新於 Nov 8, 2026
Control 19 macOS apps with safe actions, approved AppleScript/JXA, and reusable workflows.
概覽
讓助理透過 osascript 控制 19 個 macOS 應用程式,提供 81 個具名動作,並可在你核准後執行 AppleScript。
- 可以做什麼
- 調整系統設定:深色模式、音量、靜音、Wi-Fi、剪貼板、通知、朗讀、螢幕保護程式、電池與系統資訊
- 開啟、切換至前景與結束應用程式;在 Finder 中顯示、開啟與列出資料夾
- 在 Safari、Chrome 與 Brave 中開啟網址、列出與切換分頁、搜尋網頁、管理閱讀列表
- 控制 Spotify、音樂、TV、VLC 與 QuickTime 的播放並讀取目前曲目;列出照片相簿並播放幻燈片;控制 Keynote 簡報
- 列出、讀取與建立行事曆事件、提醒事項與備忘錄;讀取聯絡人與郵件,並開啟郵件草稿但不寄出
- 讀取應用程式的腳本字典,經核准後執行 AppleScript,並儲存為可重複使用的工作流程工具
- 適用情境
- 適合希望助理直接操作 Mac 桌面、而不只是討論的場合:切換系統設定、管理瀏覽器分頁、控制媒體播放,或讀取與建立行事曆、提醒與備忘錄項目。也適合沒有現成具名動作的任務——你核准一次產生的 AppleScript 後即可作為工作流程重複使用。
- 執行需求
- 以 npm 套件 mcp-osx 透過 stdio 在本機執行,需要 macOS 14+ 與 Node.js 20+。需為宿主終端機或 MCP 用戶端授予每個受控應用程式的 macOS 自動化權限,以及行事曆、提醒事項與聯絡人存取權;僅在腳本透過介面點擊時才需要輔助使用權限。選用環境變數 MCP_OSX_MODE、MCP_OSX_APPS 與 MCP_OSX_HOME;Spotify 我的最愛播放需在設定檔填入播放清單 URI。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 macOS (osascript),將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-osx
Let AI agents control your Mac, safely.
An MCP server that drives macOS through osascript. It has 81 ready-made actions across 19 apps, and the agent can write its own AppleScript when those aren't enough. Nothing arbitrary runs until you approve the exact script.
Highlights
- 81 named actions across 19 apps: system settings, Finder, Safari, Chrome, Brave, Spotify, Music, TV, VLC, QuickTime, Photos, Keynote, Calendar, Reminders, Notes, Contacts, Mail and more. Named actions only read, play, open or create. They never send, delete or run code, so they run without prompting you.
- Any app with a scripting dictionary: the agent reads the app's dictionary (
sdef), writes a script, and you approve the exact script in the chat or in a native macOS dialog. - Workflows: an approved script can be saved as a new tool,
workflow_<name>, so you only approve it once. - Small context footprint: works with tool search (Claude Code defers its 87 tools automatically). A compact mode cuts the up-front cost to about 1.2k tokens for clients that load every tool.
- Typed results: list actions return
structuredContentwith anoutputSchema, not just text. - Bundled skills: one teaches agents to write AppleScript that works on the first try, the other gives ready-made routines (focus mode, start of the workday…).
- Built on MCP SDK v2: serves both 2025-era and 2026-07-28 protocol clients over stdio.
Quick start
Requires macOS 14+ and Node.js 20+.
Claude Code
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Compact mode is recommended for clients that load every tool definition up front.
Cursor
Add to ~/.cursor/mcp.json:
VS Code (Copilot)
From source
The first time the server controls an app, macOS asks whether your terminal or MCP client may control it. Click OK. See Permissions.
Things you can ask
How it works
Every script the server runs is a constant. Inputs from the agent reach it only as argv (on run argv), never inserted into the script text, so a value like "; do shell script "rm -rf ~ stays a plain string.
Approvals
run_applescript, deleting a workflow, and running a workflow whose file was edited all need your approval:
- In the chat, if your client supports elicitation. The tool returns an MCP
input_requiredresult showing the full script. The round-trip state is HMAC-signed and tied to a hash of exactly what you saw, so an approval can't be reused for a different script. - In a native macOS dialog otherwise. It shows the full, scrollable script. Deny is the default button, and the dialog denies automatically after 120 seconds.
Anything else, such as an error, a timeout or a closed dialog, counts as deny.
Workflows
After you approve, workflow_open_github({ path }) is a new tool and runs without asking. The approval prompt warns you that later runs may pass any value for the declared params. Workflows are stored as readable JSON in ~/.mcp-osx/workflows/. Each one holds a SHA-256 hash of the approved script, and if the file is edited the next run asks you again.
Discover any app
The summaries are compact: Spotify's 7 KB sdef becomes about 1.2 KB. They also include Apple's standard suites that sdef leaves out, and they parse the Keynote, Pages and Numbers dictionaries.
Tools
Always available: run_applescript, list_scriptable_apps, get_app_dictionary, list_workflows, run_workflow, delete_workflow, and search_actions / run_action in compact mode.
Deliberately missing: anything that sends (Mail, Messages), deletes, empties, erases, runs code (browser JavaScript, Terminal do script, Shortcuts), writes files, or records. The agent can still do these through run_applescript, which asks you first. A test enforces this rule for every named action, and an osacompile test checks that every action script compiles.
Full reference
81 named actions, generated from the source by npm run docs.
system — 15 actions
settings — 2 actions
app — 5 actions
finder — 5 actions
safari — 6 actions
chromium — 6 actions
spotify — 4 actions
music — 7 actions
tv — 2 actions
vlc — 3 actions
quicktime — 2 actions
photos — 2 actions
keynote — 2 actions
calendar — 4 actions
reminders — 4 actions
notes — 4 actions
contacts — 1 action
mail — 6 actions
lookaway — 1 action
Typed results
List and "current item" actions declare an outputSchema and return structuredContent:
notes holds lines that aren't records, such as truncation notices or "Safari is not running".
Skills
The server publishes two MCP skills. The client loads them only when needed:
applescript-authoring: how to script an app with no named action. It covers reading the dictionary, passing inputs through argv, getting approval and saving a workflow, with a reference of common AppleScript errors and their fixes.macos-routines: focus mode, presentation mode, start of the workday, end of day, and "what's on my plate", built from named actions.
Context size
Every MCP tool definition takes up context.
In compact mode, search_actions("pause song") returns the matching actions with their full JSON input and output schemas, and run_action validates the arguments before anything runs.
Using the Claude API with the MCP connector? The API caller decides which tools are deferred, not the server. Defer everything except the core tools:
Add tool_search_tool_bm25_20251119 to the same request. Tool names are prefixed by app and descriptions use everyday task words, so searches like "spotify" or "calendar event" find the right tools.
Configuration
~/.mcp-osx/config.json:
Spotify's AppleScript interface can't read your library, so spotify_play_favorites plays this URI. To get it, right-click a playlist in Spotify and choose Share › Copy link.
macOS permissions
Permissions apply to the host process, i.e. your terminal or MCP client, not to mcp-osx itself.
Security model
- Named actions are non-destructive, use constant scripts, and receive input only through argv.
- Arbitrary code runs only after you approve that exact script. Approvals fail closed, and chat approvals are cryptographically tied to what you were shown.
- The workflow hash catches accidental or out-of-band edits. It does not protect against a malicious agent that can write files, which could edit a workflow and recompute its hash.
- More generally, any agent with shell access can run
osascriptitself. This server only controls access through its own interface.
Troubleshooting
Development
Releasing: releases are automatic. On every push to main, .github/workflows/release.yml tests on macOS (Node 20, 22 and 24). If conventional commits of type feat, fix or perf landed since the last tag, it then bumps the version with changelogen, updates CHANGELOG.md and server.json, and tags the release. It builds and smoke-tests the package once and publishes that exact artifact to npm through Trusted Publishing (OIDC, with provenance) and to the MCP Registry, then creates the GitHub release. You can also run it manually with a forced patch, minor or major bump. Publishing from a local machine is blocked.
Adding an app: create src/actions/<group>.ts, prefix every action with <group>_, register it in actionGroups (src/actions/index.ts), and run npm test && npm run docs. The tests reject scripts that insert inputs into the script text, use destructive commands, or don't compile.
License
MIT © Zao Soula
來源:README.md,提交 16f0504
工具
0版本歷史
1- v0.1.0最新Nov 8, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分