Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-pyautogui-server

MCP.Pizza Chef: hetaoBackend

The mcp-pyautogui-server is an MCP server enabling automated GUI testing and control using PyAutoGUI. It supports mouse and keyboard simulation, screen capture, image recognition on screen, and pixel color detection. Compatible across Windows, macOS, and Linux, it facilitates programmatic interaction with graphical interfaces for testing, automation, and monitoring workflows.

Use This MCP server To

Automate mouse movements and clicks for GUI testing Simulate keyboard input and hotkey combinations Capture screenshots for visual verification Locate images on screen for UI element detection Retrieve screen size and pixel color information Perform drag-and-drop operations programmatically Monitor GUI state changes via screen captures Integrate GUI automation into AI-driven workflows

README

mcp-pyautogui-server

smithery badge

A MCP (Model Context Protocol) server that provides automated GUI testing and control capabilities through PyAutoGUI.

Features

  • Control mouse movements and clicks
  • Simulate keyboard input
  • Take screenshots
  • Find images on screen
  • Get screen information
  • Cross-platform support (Windows, macOS, Linux)

Tools

The server implements the following tools:

Mouse Control

  • Move mouse to specific coordinates
  • Click at current or specified position
  • Drag and drop operations
  • Get current mouse position

Keyboard Control

  • Type text
  • Press individual keys
  • Hotkey combinations

Screen Operations

  • Take screenshots
  • Get screen size
  • Find image locations on screen
  • Get pixel colors

Installation

Prerequisites

  • Python 3.12+
  • PyAutoGUI
  • Other dependencies will be installed automatically

Install Steps

Install the package:

pip install mcp-pyautogui-server

Claude Desktop Configuration

On MacOS:

~/Library/Application\ Support/Claude/claude_desktop_config.json

On Windows:

%APPDATA%/Claude/claude_desktop_config.json

Development/Unpublished Servers Configuration:

{
  "mcpServers": {
    "mcp-pyautogui-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-pyautogui-server",
        "run",
        "mcp-pyautogui-server"
      ]
    }
  }
}

Published Servers Configuration:

{
  "mcpServers": {
    "mcp-pyautogui-server": {
      "command": "uvx",
      "args": [
        "mcp-pyautogui-server"
      ]
    }
  }
}

Development

Building and Publishing

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build
  1. Publish to PyPI:
uv publish

Note: Set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

For the best debugging experience, use the MCP Inspector.

Launch the MCP Inspector via npm:

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-pyautogui-server run mcp-pyautogui-server

The Inspector will display a URL that you can access in your browser to begin debugging.

License

This project is licensed under the MIT License - see the LICENSE file for details.

mcp-pyautogui-server FAQ

How do I install the mcp-pyautogui-server?
Install Python 3.12+, then install the server which auto-installs PyAutoGUI and dependencies.
Is mcp-pyautogui-server cross-platform?
Yes, it supports Windows, macOS, and Linux platforms.
Can I simulate complex keyboard shortcuts?
Yes, it supports typing text, pressing individual keys, and hotkey combinations.
How does the server find images on the screen?
It uses PyAutoGUI's image recognition to locate image positions on the screen.
Can I get real-time mouse position?
Yes, the server can report the current mouse coordinates.
What screen operations are supported?
Taking screenshots, getting screen size, finding images, and pixel color detection.
Does it support drag-and-drop actions?
Yes, you can perform drag and drop operations programmatically.
What are the prerequisites for running this server?
Python 3.12+ and PyAutoGUI are required; other dependencies install automatically.