MCP server that can execute commands such as keyboard input and mouse movement
A Model Context Protocol (MCP) server that allows controlling macOS through SwiftAutoGUI. This server provides tools for programmatically controlling the mouse and keyboard through MCP clients.
git clone https://github.com/NakaokaRei/swift-mcp-gui.git
cd swift-mcp-gui
swift package experimental-install
{
"mcpServers" : {
"swift-mcp-gui" : {
"command" : "/Users/USERNAME/.swiftpm/bin/swift-mcp-gui"
}
}
}
The server provides the following tools for controlling macOS:
moveMouse
x
: number (x-coordinate) - accepts integers, doubles, or string representationsy
: number (y-coordinate) - accepts integers, doubles, or string representationsmouseClick
button
: string ("left" or "right")sendKeys
keys
: array of strings (key names)scroll
direction
: string ("up", "down", "left", "right")clicks
: number (number of scroll clicks)getScreenSize
getPixelColor
x
: number (x-coordinate) - accepts integers, doubles, or string representationsy
: number (y-coordinate) - accepts integers, doubles, or string representationscaptureScreen
quality
: number (optional, 0.0-1.0, default: 0.1) - JPEG compression qualityscale
: number (optional, 0.1-1.0, default: 0.25) - Scale factor for image sizecaptureRegion
x
: number (x-coordinate of the region)y
: number (y-coordinate of the region)width
: number (width of the region)height
: number (height of the region)quality
: number (optional, 0.0-1.0, default: 0.1) - JPEG compression qualityscale
: number (optional, 0.1-1.0, default: 0.25) - Scale factor for image sizesaveScreenshot
filename
: string (path to save the screenshot)x
: number (optional, x-coordinate of the region)y
: number (optional, y-coordinate of the region)width
: number (optional, width of the region)height
: number (optional, height of the region)quality
: number (optional, 0.0-1.0, default: 0.1) - JPEG compression qualityscale
: number (optional, 0.1-1.0, default: 0.25) - Scale factor for image sizeexecuteAppleScript
script
: string (AppleScript code to execute)executeAppleScriptFile
path
: string (path to the AppleScript file)This server requires full accessibility permissions in System Preferences to control your mouse and keyboard. Be careful when running it and only connect trusted MCP clients.
MIT License