mcp-server-macos-use
mediar-ai/mcp-server-macos-use
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 205c8880e8c0
- Files read
- 17
This MCP server lets AI agents view and control any macOS application by reading accessibility trees, taking window screenshots, and sending synthetic mouse and keyboard input. Beyond the broad risk that a prompt-injected agent can drive sensitive apps or terminals, the server stores screenshots and UI text dumps in a world-readable /tmp/macos-use folder and has a focus-restoration bug that can unintentionally capture the user's previously active window.
What it can reach
- System
- Opens or activates any macOS application, reads UI elements and text via Accessibility APIs, captures window screenshots, temporarily blocks physical mouse and keyboard input during actions, and sends synthetic clicks, scrolls, and keystrokes.
- Browser
- Can inspect page text and interact with open web browsers on macOS through accessibility trees, screenshots, clicks, and keystrokes.
- Files
- Writes full accessibility tree dumps, PNG window screenshots, and input-guard status files to /tmp/macos-use/.
- Network
- Fetches Swift package dependencies from GitHub when compiling during installation or first launch; the running server communicates only over standard input/output.
Findings
-
MediumScreenshots and UI text dumps are stored world-readable in /tmp/macos-use
Sources/MCPServer/main.swift:1962
Every tool call saves the target application's full accessibility text dump (.txt) and a window screenshot (.png) into /tmp/macos-use without setting restrictive directory or file permissions and without deleting old captures. On macOS, any other local user account or any unprivileged local process that lacks Accessibility or Screen Recording permissions can read everything the server views, and because ownership and symlinks on /tmp/macos-use are not verified (and screenshot-helper writes non-atomically), a local attacker can pre-create symlinks to redirect file writes.
Fix: Store captures in a per-user private directory (such as a 0700 directory inside FileManager.default.temporaryDirectory), verify directory ownership and that it is not a symlink, write files atomically with 0600 permissions, and delete old files.
-
LowFocus restoration runs before app-switch detection and captures the user's previous foreground window
Sources/MCPServer/main.swift:1929
During click, type, key-press, scroll, and AX-mutation calls, the server records the user's active application (savedFrontmostApp), performs the action on the target PID, and restores focus to savedFrontmostApp before checking whether a different application became frontmost. Whenever the user was working in another app (such as a terminal, editor, chat app, or password manager) rather than the target PID, frontmostApplication resolves to the user's restored app, causing the server to treat it as a cross-app switch, dump its accessibility tree, take a screenshot of that window, and return its visible elements to the AI agent without being asked.
Fix: Check for cross-app handoff before restoring focus to savedFrontmostApp, and ignore savedFrontmostApp's PID when deciding whether the action opened or switched to another app.
-
LowRelative lookup of screenshot-helper via argv[0] can execute a binary from the working directory
Sources/MCPServer/main.swift:438
captureWindowScreenshot locates the screenshot-helper subprocess by stripping the last path component from CommandLine.arguments[0]. While the npm wrapper script passes an absolute path, if a user places the compiled Swift binary in a PATH directory and configures their MCP client to run mcp-server-macos-use by bare name, deletingLastPathComponent returns an empty string and helperPath resolves to ./screenshot-helper inside the current working directory, allowing an untrusted workspace repository to run arbitrary code when any tool is called.
Fix: Resolve the running executable's real path via Bundle.main.executableURL or _NSGetExecutablePath instead of CommandLine.arguments[0].
-
LowInputGuard logs raw hardware keycodes of blocked keystrokes to stderr
Sources/MCPServer/InputGuard.swift:336
While InputGuard blocks physical input during an automation step, its system-wide CGEventTap callback intercepts every hardware keyDown and keyUp event and writes the macOS virtual keyCode to stderr for debugging. Because MCP clients commonly save server stderr to plaintext log files on disk, keystrokes a user was actively typing in non-secure fields when a tool call started are recorded as keycodes in logs.
Fix: Remove the per-keystroke keyCode debug log statement from inputGuardCallback.
-
LowCore SDK dependency tracks a mutable Git branch and builds at launch if missing
Package.swift pulls MacosUseSDK from the mutable main branch rather than a fixed version tag or commit, and bin/mcp-server-macos-use automatically runs swift build on launch if the release binary was skipped during installation (for example when using npm install --ignore-scripts). Although Package.resolved currently records a commit hash, updating or re-resolving packages will fetch unreviewed code from main.
Fix: Pin MacosUseSDK in Package.swift to a specific version tag or immutable commit revision, and avoid compiling code automatically at runtime.
