swift-mcp-gui
CLAUDE.md61 starsChanged 6 months agoMITView on GitHub
This is a Swift Package Manager project for macOS GUI automation via MCP (Model Context Protocol). This project implements an MCP server that provides GUI automation capabilities for macOS through these tools: - moveMouse: Move cursor to x,y coordinates - mouseClick: Perform mouse clicks (left/right) - scroll: Scroll in any direction - sendKeys: Send keyboard shortcuts - getScreenSize: Get the display dimensions - getPixelColor: Get color of a pixel at x,y - captureScreen: Capture full screen as base64 PNG -…
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 75
After implementing new features or fixing bugs, always reinstall the package to ensure the latest changes are available:
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build and Development Commands
This is a Swift Package Manager project for macOS GUI automation via MCP (Model Context Protocol).
# Build the project
swift build
# Build for release (optimized)
swift build -c release
# Run the executable
swift run swift-mcp-gui
# Install the executable system-wide (experimental)
swift package experimental-install
# Uninstall the executable
swift package experimental-uninstall swift-mcp-gui
# Reinstall (uninstall then install) - Run this after implementing new features
swift package experimental-uninstall swift-mcp-gui && swift package experimental-install
# Clean build artifacts
swift package clean
# Update dependencies
swift package updateArchitecture Overview
This project implements an MCP server that provides GUI automation capabilities for macOS through these tools:
moveMouse: Move cursor to x,y coordinatesmouseClick: Perform mouse clicks (left/right)scroll: Scroll in any directionsendKeys: Send keyboard shortcutsgetScreenSize: Get the display dimensionsgetPixelColor: Get color of a pixel at x,ycaptureScreen: Capture full screen as base64 PNGcaptureRegion: Capture a region as base64 PNGsaveScreenshot: Save screenshot to file
Key Components
- main.swift: MCP server initialization and startup
- Server+Extension.swift: Extends MCP Server with
waitForDisconnection()to keep the server running - ToolRegistry.swift: Manages tool registration and execution
- Tools/:
- Mouse/: Mouse control tools (moveMouse, mouseClick)
- Screen/: Screen capture and scroll tools
- Keyboard/: Keyboard input tools (sendKeys)
Dependencies
- mcp-swift-sdk: MCP protocol implementation
- SwiftAutoGUI (v1.0.0+): macOS automation library
Important Notes
- Platform Requirements: macOS 27.0+, Swift 6.2+, Xcode 27.0+
- Security: Requires full accessibility permissions in System Preferences
- Communication: Uses stdio transport (stdin/stdout)
- Test suite: Unit tests for tools are in Tests/swift-mcp-guiTests/
Development Workflow
After implementing new features or fixing bugs, always reinstall the package to ensure the latest changes are available:
swift package experimental-uninstall swift-mcp-gui && swift package experimental-installDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

