Computer Control MCP
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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.*
OR install globally with pip:
Then run the server with:
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:
Or set it system-wide:
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:
Or set it system-wide:
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 coordinates
- move_mouse(x: int, y: int): Move mouse cursor to specified coordinates
- drag_mouse(from_x: int, from_y: int, to_x: int, to_y: int, duration: float = 0.5): Drag mouse from one position to another
- mouse_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 position
- key_down(key: str): Hold down a specific keyboard key until released
- key_up(key: str): Release a specific keyboard key
- press_keys(keys: Union[str, List[Union[str, List[str]]]]): Press keyboard keys (supports single keys, sequences, and combinations)