Back to MCP directory
publicPublicdnsLocal runtime

PyMCPAutoGUI

PyMCPAutoGUI是一个通过MCP协议为AI代理提供图形用户界面(GUI)自动化能力的工具,支持鼠标键盘控制、屏幕截图、窗口管理等操作,可无缝集成Cursor编辑器等MCP兼容环境。

article

README

🚀 PyMCPAutoGUI 🖱️⌨️🖼️ - 基于MCP的图形用户界面自动化工具

PyMCPAutoGUI 能够在你的 AI 代理(如 Cursor 或其他兼容 MCP 的环境)与计算机图形用户界面(GUI)之间搭建桥梁。它赋予 AI 代理观察屏幕 👁️、操控鼠标 🖱️ 和键盘 ⌨️ 以及与窗口进行交互 🪟 的能力,如同人类用户一般。借助它,你可以告别繁琐的手动 GUI 任务,让 AI 承担繁重工作 💪。该工具非常适合自动化重复操作、进行 GUI 测试或构建强大的 AI 助手 🤖。

🚀 快速开始

安装

pip install pymcpautogui

配置

PyMCPAutoGUI 提供以下可配置参数: | 参数名 | 类型 | 默认值 | 描述 | |--------|------|-------|------| | pause | float | 0.1 | 每次动作之间的暂停时间 | | failsafe | bool | True | 是否启用紧急逃脱模式(左上角拖拽) | | log_level | str | 'info' | 日志记录级别(debug, info, warning, error, critical) | | mouse_speed | float | 1.0 | 鼠标移动速度因子 | | keyboard_delay | float | 0.05 | 键盘按键延迟 |

使用示例

在支持 MCP 的客户端中使用:

基础用法

# 基本鼠标操作
@PyMCPAutoGUI move_to(x=100, y=200)
@PyMCPAutoGUI click(button='left')
@PyMCPAutoGUI drag_to(x=300, y=400)

# 键盘输入示例
@PyMCPAutoGUI write(text='Hello AI!', interval=0.1)
@PyMCPAutoGUI hotkey('ctrl', 'c')

# 窗口管理
@PyMCPAutoGUI get_all_titles
@PyMCPAutoGUI activate_window(title='Notepad')
@PyMCPAutoGUI minimize_window()

# 截图功能
@PyMCPAutoGUI screenshot(filename='snapshot.png')

✨ 主要特性

  • 增强代理能力:让你的 AI 代理能够直接与桌面应用程序交互。
  • 简单集成:与 Cursor 编辑器等支持 MCP 客户端无缝集成,即插即用。
  • 易于使用:从简单的服务器命令开始,操作简便。
  • 全面控制:提供来自经过验证的 PyAutoGUIPyGetWindow 的大部分功能。
  • 支持协议调用:支持代理通过 MCP 协议直接调用 PyAutoGUI 和 PyGetWindow 的功能。
  • 非侵入式设计:完全非侵入式设计,不修改底层库。
  • 多线程处理:支持多线程处理,确保稳定运行。
  • 日志与错误处理:提供详细日志记录和错误处理机制。
  • 自定义配置:支持自定义配置以适应不同需求。

📄 许可证

本项目在 MIT License 下许可。有关详细信息,请参阅 LICENSE 文件。

通过 PyMCPAutoGUI,让你的 AI 代理更智能地与计算机交互吧! 😄

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client