Control Computer Mouse, Keyboard, and Screen
A zero-dependency computer-use MCP server for mouse, keyboard, screenshots, and OCR via PyAutoGUI and RapidOCR.
1.0.0Add to Favorites
Why it matters
Automate desktop tasks by programmatically controlling your mouse, keyboard, and screen. This asset enables sophisticated OS-level automation for repetitive or complex user interactions.
Outcomes
What it gets done
Control mouse clicks and movements.
Simulate keyboard input and key presses.
Capture screenshots and extract text via OCR.
Manage and activate application windows.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-computer-control-mcp | bash Capabilities
Tools your agent gets
Click at specified screen coordinates
Move mouse cursor to specified coordinates
Drag mouse from one position to another
Hold down a mouse button (left, right, middle)
Release a mouse button (left, right, middle)
Type specified text at current cursor position
Press specified key
Hold down a specific key until release
Overview
computer-control-mcp MCP Server
A zero-dependency computer-use MCP server for mouse, keyboard, screenshot, and OCR control, with Windows Graphics Capture for GPU-accelerated windows that otherwise screenshot as black. Use when an AI assistant needs direct desktop mouse/keyboard/screen control; run once via uvx before first MCP use to pre-download ~70MB of dependencies.
What it does
This MCP server provides computer control capabilities similar to Anthropic's "computer-use" - mouse, keyboard, screenshots, and OCR - built on PyAutoGUI, RapidOCR, and ONNXRuntime with zero external dependencies. Mouse control tools are click_screen(x, y), move_mouse(x, y), drag_mouse(from_x, from_y, to_x, to_y, duration=0.5), and mouse_down/mouse_up(button="left") for holding and releasing left/right/middle buttons. Keyboard tools are type_text(text), press_key(key), key_down/key_up(key) for holding a key until released, and press_keys(keys), which accepts single keys, sequences, or combinations. Screen and window tools include take_screenshot(...) (capture the full screen or a window matched by title pattern, with optional regex matching, OCR scaling, and saving to a downloads directory), take_screenshot_with_ocr(...) (the same capture, but also extracts and returns text with coordinates via OCR), get_screen_size(), list_windows(), activate_window(title_pattern, use_regex=False, threshold=60) to bring a matched window to the foreground, and wait_milliseconds(milliseconds).
Traditional screenshot methods (GDI/PrintWindow) fail on GPU-accelerated windows, producing black screens - this affects games, media players, Electron apps, GPU-accelerated browsers, streaming software, and CAD tools. The server addresses this with Windows Graphics Capture (WGC), triggerable via a flag on take_screenshot or automatically for windows matching configured title patterns.
When to use - and when NOT to
Use this when an AI assistant needs to directly control mouse, keyboard, and screen interactions on a desktop - clicking, typing, dragging, reading on-screen text via OCR, or managing windows.
The first run of uvx computer-control-mcp@latest downloads roughly 70MB of Python dependencies, which can take some time - running it once in a terminal before using it as an MCP server is recommended so that initial download doesn't happen mid-session. WGC-based screenshot capture is a Windows-specific feature; the black-screen GPU-window issue it solves is also Windows-specific (GDI/PrintWindow limitations).
Capabilities
Full mouse and keyboard control, screen/window screenshot capture (with optional OCR text-and-coordinate extraction), window listing and activation, and GPU-accelerated window capture via WGC on Windows - either invoked explicitly per call or automatically for windows matching configured title patterns.
How to install
Run directly via uvx computer-control-mcp@latest in an MCP client config, or install globally with pip install computer-control-mcp and run computer-control-mcp. The screenshot save location defaults to the OS downloads directory, customizable via the COMPUTER_CONTROL_MCP_SCREENSHOT_DIR environment variable (falling back to the default if the specified directory doesn't exist). Automatic WGC capture for specific windows is configured via COMPUTER_CONTROL_MCP_WGC_PATTERNS, a comma-separated list of window-title substrings (e.g. "obs, discord, game, steam") that trigger WGC automatically. The project is MIT-licensed.
Who it's for
Developers building AI agents that need direct desktop automation - clicking, typing, screenshot-based OCR, and window management - including reliable screenshot capture of GPU-accelerated applications on Windows.
{
"mcpServers": {
"computer-control-mcp": {
"command": "uvx",
"args": ["computer-control-mcp@latest"]
}
}
}
Source README
Computer Control MCP
MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. Similar to 'computer-use' by Anthropic. With Zero External Dependencies.

Quick Usage (MCP Setup Using uvx)
Note: Running uvx computer-control-mcp@latest for the first time will download python dependencies (around 70MB) which may take some time. Recommended to run this in a terminal before using it as MCP. Subsequent runs will be instant.
{
"mcpServers": {
"computer-control-mcp": {
"command": "uvx",
"args": ["computer-control-mcp@latest"]
}
}
}
OR install globally with pip:
pip install computer-control-mcp
Then run the server with:
computer-control-mcp # instead of uvx computer-control-mcp, so you can use the latest version, also you can `uv cache clean` to clear the cache and `uvx` again to use latest version.
Features
- Control mouse movements and clicks
- Type text at the current cursor position
- Take screenshots of the entire screen or specific windows with optional saving to downloads directory
- Extract text from screenshots using OCR (Optical Character Recognition)
- List and activate windows
- Press keyboard keys
- Drag and drop operations
- Enhanced screenshot capture for GPU-accelerated windows (Windows only)
Note on GPU-accelerated Windows
Traditional screenshot methods like GDI/PrintWindow fail to capture GPU-accelerated windows, resulting in black screens. This impacts games, media players, Electron apps, browsers with GPU acceleration, streaming software, and CAD tools. Use WGC through take_screenshot tool's flag or ENV variable
Configuration
Custom Screenshot Directory
By default, screenshots are saved to the OS downloads directory. You can customize this by setting the COMPUTER_CONTROL_MCP_SCREENSHOT_DIR environment variable:
{
"mcpServers": {
"computer-control-mcp": {
"command": "uvx",
"args": ["computer-control-mcp@latest"],
"env": {
"COMPUTER_CONTROL_MCP_SCREENSHOT_DIR": "C:\\Users\\YourName\\Pictures\\Screenshots"
}
}
}
}
Or set it system-wide:
# Windows (PowerShell)
$env:COMPUTER_CONTROL_MCP_SCREENSHOT_DIR = "C:\Users\YourName\Pictures\Screenshots"
# macOS/Linux
export COMPUTER_CONTROL_MCP_SCREENSHOT_DIR="/home/yourname/Pictures/Screenshots"
If the specified directory doesn't exist, the server will fall back to the default downloads directory.
Automatic WGC for Specific Windows
You can configure the system to automatically use Windows Graphics Capture (WGC) for specific windows by setting the COMPUTER_CONTROL_MCP_WGC_PATTERNS environment variable. This variable should contain comma-separated patterns that match window titles:
{
"mcpServers": {
"computer-control-mcp": {
"command": "uvx",
"args": ["computer-control-mcp@latest"],
"env": {
"COMPUTER_CONTROL_MCP_WGC_PATTERNS": "obs, discord, game, steam"
}
}
}
}
Or set it system-wide:
# Windows (PowerShell)
$env:COMPUTER_CONTROL_MCP_WGC_PATTERNS = "obs, discord, game, steam"
# macOS/Linux
export COMPUTER_CONTROL_MCP_WGC_PATTERNS="obs, discord, game, steam"
When this variable is set, any window whose title contains any of the specified patterns will automatically use WGC for screenshot capture, eliminating black screens for GPU-accelerated applications.
Available Tools
Mouse Control
click_screen(x: int, y: int): Click at specified screen coordinatesmove_mouse(x: int, y: int): Move mouse cursor to specified coordinatesdrag_mouse(from_x: int, from_y: int, to_x: int, to_y: int, duration: float = 0.5): Drag mouse from one position to anothermouse_down(button: str = "left"): Hold down a mouse button ('left', 'right', 'middle')mouse_up(button: str = "left"): Release a mouse button ('left', 'right', 'middle')
Keyboard Control
type_text(text: str): Type the specified text at current cursor positionpress_key(key: str): Press a specified keyboard keykey_down(key: str): Hold down a specific keyboard key until releasedkey_up(key: str): Release a specific keyboard keypress_keys(keys: Union[str, List[Union[str, List[str]]]]): Press keyboard keys (supports single keys, sequences, and combinations)
Screen and Window Management
take_screenshot(title_pattern: str = None, use_regex: bool = False, threshold: int = 60, scale_percent_for_ocr: int = None, save_to_downloads: bool = False, use_wgc: bool = False): Capture screen or windowtake_screenshot_with_ocr(title_pattern: str = None, use_regex: bool = False, threshold: int = 10, scale_percent_for_ocr: int = None, save_to_downloads: bool = False): Extract adn return text with coordinates using OCR from screen or windowget_screen_size(): Get current screen resolutionlist_windows(): List all open windowsactivate_window(title_pattern: str, use_regex: bool = False, threshold: int = 60): Bring specified window to foregroundwait_milliseconds(milliseconds: int): Wait for a specified number of milliseconds
Development
Setting up the Development Environment
# Clone the repository
git clone https://github.com/AB498/computer-control-mcp.git
cd computer-control-mcp
# Build/Run:
# 1. Install in development mode | Meaning that your edits to source code will be reflected in the installed package.
pip install -e .
# Then Start server | This is equivalent to `uvx computer-control-mcp@latest` just the local code is used
computer-control-mcp
# -- OR --
# 2. Build after `pip install hatch` | This needs version increment in orer to reflect code changes
hatch build
# Windows
$latest = Get-ChildItem .\dist\*.whl | Sort-Object LastWriteTime -Descending | Select-Object -First 1
pip install $latest.FullName --upgrade
# Non-windows
pip install dist/*.whl --upgrade
# Run
computer-control-mcp
Running Tests
python -m pytest
API Reference
See the API Reference for detailed information about the available functions and classes.
For more information or help
FAQ
Common questions
Trust
How it checks out
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.