Provides low-level control of macOS input and display, including mouse movements and clicks, keyboard actions, text input, and full-screen screenshot capture for AI agents to interact with the macOS GUI.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@macinputtake a screenshot and open the Calculator app"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
macinput
macinput is a macOS keyboard, mouse, and screenshot control tool for AI agents. This repository is now structured as an installable Python project and an MCP server so desktop agents can control a macOS GUI through standard MCP tool calls.
The project has two goals:
Provide stable low-level macOS input and screenshot primitives.
Provide an MCP server with a practical tool surface, runtime safety limits, and deployment guidance.
Features
Mouse move, left click, right click, and double click
Current mouse position lookup
Key press, key down, key up, and modifier combinations
Unicode text input
Clipboard-backed paste input
Full-screen screenshots with automatic cleanup
MCP resources and prompt templates for agent guidance
Use cases
Desktop AI agents controlling macOS applications
UI automation prototypes
Human-in-the-loop desktop workflows
Screenshot-observe plus keyboard/mouse-act agent loops
Requirements
macOS
Python 3.10+
The launching host app must have:
Accessibility permission
Screen Recording permission
Important: permissions apply to the program that launches the MCP server, not only to Python. If you launch through Claude Desktop, Terminal, iTerm2, Cursor, or VS Code, that host app must be granted permission.
Installation
uv
uv syncpip
python -m pip install -e .Run the MCP server
stdio is the recommended default for desktop AI clients:
macinput-mcpIf your MCP host requires HTTP transport:
macinput-mcp --transport streamable-http --host 127.0.0.1 --port 8000 --path /mcpExample MCP client config
Generic stdio configuration:
{
"mcpServers": {
"macinput": {
"command": "uv",
"args": [
"--directory",
"/path/to/macinput",
"run",
"macinput-mcp"
]
}
}
}If the package is already installed into the current environment:
{
"mcpServers": {
"macinput": {
"command": "macinput-mcp",
"args": []
}
}
}Available tools
get_server_settingsget_mouse_positionmove_mouseclick_mousescroll_mousepress_keyboard_keykeyboard_key_downkeyboard_key_uptype_text_inputpaste_text_inputcapture_screenshotcleanup_screenshot_file
Available resources and prompt
Resources:
macinput://overviewmacinput://best-practicesmacinput://permissions
Prompt:
ui_action_protocol(goal, current_context="")
These are part of the product surface, not decoration. They let hosts ship usage guidance together with the server instead of rewriting it in every system prompt.
Recommended usage
For users:
Prefer
stdiofor desktop agent integrations.Verify macOS permissions before the first real run.
Prefer a dedicated macOS account, test machine, or VM for automation.
Keep screenshot TTLs short to reduce data residue.
For agents:
Capture a screenshot before acting.
Make one state-changing action at a time.
Capture a fresh screenshot after clicks, shortcuts, or text submission.
Do not reuse old coordinates after the UI changes.
Keep typed text short and task-specific.
Clean up screenshots when they are no longer needed.
Environment variables
MACINPUT_DEFAULT_SCREENSHOT_TTLDefault screenshot cleanup timeout in seconds. Default:
30
MACINPUT_MAX_SCREENSHOT_TTLMaximum allowed screenshot retention in seconds. Default:
300
MACINPUT_MAX_TYPING_LENGTHMaximum characters per typing action. Default:
2000
MACINPUT_MIN_ACTION_DELAYMinimum delay after each tool action. Default:
0.05
MACINPUT_DEFAULT_TYPING_INTERVALDefault per-character typing interval. Default:
0.02
Use as a Python library
from macinput import click, move_to, press_key, type_text, capture_screen
move_to(400, 300)
click()
type_text("hello macOS")
press_key("a", modifiers=["command"])
path = capture_screen(cleanup_after=10)
print(path)Development
Project layout
src/macinput/
__init__.py
__main__.py
cli.py
keyboard.py
mouse.py
screenshot.py
server.py
settings.py
docs/
mcp-engineering.md
tests/Local workflow
uv sync --extra dev
uv run pytest
uv run ruff check .GitHub Actions
CI workflow:
.github/workflows/ci.ymlRelease workflow:
.github/workflows/release.yml
The CI workflow runs lint and tests on push and pull_request. The release workflow builds distributions on workflow_dispatch and on version tags such as v0.1.0, then uploads artifacts and publishes to PyPI if your repository is configured for trusted publishing.
Project rules
Keep low-level automation separate from the MCP server layer.
Keep MCP tools small and stable.
Prefer
stdioby default.Keep state-changing actions explainable and composable.
Document both user integration and developer maintenance workflows.
Documentation
Engineering notes: docs/mcp-engineering.md
User guide: docs/user-guide.md
Agent best practices: docs/agent-best-practices.md
Developer guide: docs/developer-guide.md
Limitations
macOS only
Requires a real GUI session
CI can validate imports and configuration, but real machine validation is still necessary for UI injection
paste_text_inputuses the system clipboard and currently preserves/restores plain-text clipboard content onlypress_keyboard_key,keyboard_key_down, andkeyboard_key_upaccept either string keys like"3"or numeric digit inputs like3Does not include OCR, UI element detection, or semantic window understanding
Recommended follow-up work
Add
LICENSE.Add release automation.
Add smoke tests on a real macOS runner.
Add an
examples/directory for common MCP hosts.Add optional region screenshots, output directories, and audit logging.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.