
Mcp Osascript
io.github.m0rvayne由 GitHub 帳號 m0rvayne 發布v1.1.3更新於 Nov 3, 2026
macOS automation: 17 typed tools for windows, menus, keyboard, clipboard, tabs, screenshots
概覽
僅限 macOS 的 MCP 伺服器,讓助理控制 Mac:視窗、選單、鍵盤、剪貼簿、瀏覽器分頁、截圖與捷徑。
- 可以做什麼
- 控制應用程式與視窗:啟動或將應用程式帶到前景,列出、移動、調整大小、最小化、全螢幕或關閉視窗,隱藏、取消隱藏或結束應用程式,讀取最前景應用程式與螢幕配置
- 操作選單與輸入:列出或點擊選單項目、輸入文字、按下組合鍵,以及執行任意 AppleScript 或 JXA 腳本
- 讀寫剪貼簿、顯示系統通知、開啟網址與檔案或資料夾
- 檢視 Safari、Chrome 或 Arc 的分頁,擷取全螢幕、區域或視窗截圖,列出或執行 Apple 捷徑
- 檢查已授予哪些 macOS 權限以及各自解鎖的功能
- 適用情境
- 適合希望助理直接操作 Mac 的情況,例如調整視窗配置、逐層點擊應用程式選單、填寫輸入欄位、擷取截圖或觸發捷徑,而不只是提供說明。僅在 macOS 桌面環境中有意義。
- 執行需求
- 在 macOS 13 或更新版本上本機執行,需要 Node.js 18 或更新版本,可透過 npx 或 Claude Desktop 擴充套件安裝。部分工具需要在系統設定中授予自動化、輔助使用與螢幕錄製權限。未宣告任何 API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Osascript,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Let Claude control your Mac. Move windows, click menus, type text, read clipboard, manage browser tabs, take screenshots, run Shortcuts — 18 typed tools with input validation and security guardrails.
[npm version] [macOS 13+] [Node 18+] [License: MIT] [Tests: 84 passed] [Tests] [m0rvayne/mcp-osascript MCP server]
Listed in the official MCP Registry as io.github.m0rvayne/mcp-osascript
Quick Start
Claude Desktop — one click. Download mcp-osascript-1.1.3.mcpb from the latest release and double-click it. Claude Desktop installs the extension itself.
Or add it to the config manually:
Add this to your Claude Desktop config (Settings → Developer → Edit Config), restart Claude, and you're ready.
Config for other clients (Cursor, VS Code, Claude Code)
Cursor / VS Code (Copilot)
Claude Code
From source (development)
Try These Prompts
Once installed, ask Claude:
Tools
18 typed tools, each with input validation, error classification, and permission-aware error messages.
Self-Correcting Menus
When Claude tries to click a menu item that doesn't exist, the server automatically returns the list of available items at that level — so Claude can retry with the correct name. No other MCP server does this.
Why mcp-osascript?
Star counts are a popularity measure, not a quality one — both alternatives predate this project by months. The rows above are the things that differ in practice.
Security audits
Four red-team audit passes (adversarial agents run against the source, commissioned by the author — not a third-party certification), the most recent against v1.1.2 with three parallel agents
covering the shell surface, AppleScript escaping, and information disclosure. It found six real
defects, including a tool that silently annulled another tool's scheme allowlist and a
concurrency slot that could leak until the server deadlocked. Every finding is fixed and carries
a regression test. escapeAS was verified against 13 string-breakout candidates through real
osascript — none escape.
Permissions
Tools work in three tiers:
- No permission needed — clipboard, notifications, URLs, apps, files, displays, Shortcuts. Works immediately.
- Automation — browser tabs, frontmost app. macOS prompts once per browser.
- Accessibility — keyboard, windows, menus, hide/unhide. Grant once in System Settings → Privacy & Security → Accessibility.
- Screen Recording — screenshots only. Grant in System Settings → Privacy & Security → Screen Recording.
Ask Claude to run check_permissions and it will tell you which of these are already
granted, which tools each one unlocks, and exactly which settings pane to open for the
rest. The probes are read-only and never trigger a permission prompt.
When a permission is missing, the server tells you exactly what to do:
Testing
84 integration tests covering all 18 tools — input validation, security boundaries (URL scheme blocking, prototype pollution, script size limits), timeout enforcement, permission error handling, and regressions for every finding of the security audit.
Security & Architecture
Security
run_osascriptexecutes arbitrary code — this is by design. The MCP client (Claude) is the trust boundary.- Scripts piped via stdin to
/usr/bin/osascript— no temp files, no TOCTOU race conditions. - Script size: 50 KB max. Output: 50K chars max, truncated on a UTF-8 character boundary (no mojibake in non-Latin output).
- Error messages sanitized — filesystem paths, tokens, and passwords are stripped.
- Child processes get minimal env:
PATH,HOME,LANGonly — no API keys or secrets leak. - URL scheme allowlist —
file://,smb://,vnc://,javascript:all blocked. - Handler dispatch uses
Object.create(null)— no prototype pollution. - Externally-sourced text (browser tab titles, window titles, menu items, clipboard) is returned inside an explicit
<untrusted-data>envelope, so a web page that renames itself cannot smuggle instructions into the model's context. file_openrefuses anything that parses as a URL —open(1)resolves URLs as well as paths, so without that check it would quietly annulopen_url's scheme allowlist.screenshotnever overwrites an existing file unlessoverwrite: true, and the extension must match the format.- Every list-building tool strips
|, CR and LF from app-supplied names, so a crafted window or tab title cannot forge a record.
Reliability
- Process group kill on timeout — SIGTERM → 2s grace → SIGKILL. No orphaned processes.
- Concurrency semaphore — max 5 simultaneous osascript processes.
- Graceful shutdown —
server.close()with 10s force-exit safety net. - Error classification — parses macOS error codes (-1728, -1743, -25211) into actionable messages. Supports English and Russian locales.
Requirements
- macOS 13+ (Ventura or later)
- Node.js 18+
License
MIT
來源:README.md,提交 8eb0731
工具
0版本歷史
1- v1.1.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分