A Model Context Protocol (MCP) server that allows controlling Mac OS X through SwiftAutoGUI. This server provides tools for programmatically controlling the mouse and keyboard through MCP clients.
- macOS 15.0 or later
- Swift 6.0 or later
- Xcode 16.0 or later
- Clone this repository:
git clone https://github.com/NakaokaRei/swift-mcp-gui.git
cd swift-mcp-gui
- Install
swift package experimental-install
- Add command to your MCP client.
{
"mcpServers" : {
"swift-mcp-gui" : {
"command" : "/Users/USERNAME/.swiftpm/bin/swift-mcp-gui"
}
}
}
The server provides the following tools for controlling macOS:
- Tool name:
moveMouse
- Input:
x
: double (x-coordinate)y
: double (y-coordinate)
- Moves the mouse cursor to the specified coordinates
- Tool name:
mouseClick
- Input:
button
: String ("left" or "right")
- Performs a mouse click at the current cursor position
- Tool name:
sendKeys
- Input:
keys
: Array of strings (key names)
- Sends keyboard shortcuts or key combinations
- Example keys: "command", "control", "option", "shift", "return", "space", "a", "1", etc.
- Tool name:
scroll
- Input:
direction
: String ("up", "down", "left", "right")clicks
: Integer (number of scroll clicks)
- Performs scrolling in the specified direction
This server has full control over your mouse and keyboard. Be careful when running it and only connect trusted MCP clients.
MIT License