PyMCPAutoGUI 🖱️⌨️🖼️ - 通过 MCP 进行 GUI 自动化
增强你的 AI 代理能力! ✨ PyMCPAutoGUI 在你的 AI 代理(例如 Cursor 或其他兼容 MCP 的环境中)和计算机的图形用户界面 (GUI) 之间架起了一座桥梁。它允许你的代理查看屏幕👁️、控制鼠标🖱️和键盘⌨️,并与窗口🪟交互,就像人类用户一样!
告别繁琐的手动 GUI 任务,让你的 AI 轻松搞定一切💪。非常适合自动化重复操作、测试 GUI 或构建强大的 AI 助手🤖。
🤔 为什么选择 PyMCPAutoGUI?
**🤖 增强您的代理的能力:**让您的 AI 代理能够直接与桌面应用程序交互。
**✅ 轻松集成:**与兼容 MCP 的客户端(例如 Cursor 编辑器)无缝协作。即插即用!
**🚀 易于使用:**只需一个简单的服务器命令即可开始使用。真的,就是这么简单。
**🖱️⌨️全面控制:**通过久经考验的PyAutoGUI和PyGetWindow提供广泛的 GUI 自动化功能。
**🖼️ 屏幕感知:**包括截取屏幕截图和在屏幕上定位图像的工具 - 让您的代理看到!
**🪟 窗口管理:**控制窗口位置、大小、状态(最小化、最大化)等。让桌面更整洁!
**💬 用户交互:**显示警报、确认和提示框以与用户进行交流。
🛠️ 支持的环境
操作系统: Windows、macOS、Linux(每个操作系统上都需要
pyautogui
的适当依赖项)Python: 3.11+🐍
**MCP 客户端:**光标编辑器,任何支持模型上下文协议 (MCP) 的客户端
🚀 入门 - 超级简单!
1.安装(推荐:使用虚拟环境!)
使用虚拟环境可以使您的项目依赖关系保持整洁。
(注意:
2. 运行 MCP 服务器
安装完成后,只需从终端运行服务器:
服务器将启动并监听连接(默认端口 6789)。查看以下输出:
当你需要 GUI 自动化魔法时,请保持此终端运行!✨
✨ 与光标编辑器无缝集成
将 PyMCPAutoGUI 连接到 Cursor(@ 符号),以便在编码工作流程中直接实现 GUI 自动化。
**打开 MCP 配置:**在 Cursor 中,使用命令面板(
Ctrl+Shift+P
或Cmd+Shift+P
)并找到“MCP:打开 mcp.json 配置文件”。**添加 PyMCPAutoGUI 配置:**将此配置添加或合并到你的
mcp.json
中。如有需要,请调整路径(尤其是当 Cursor 未从项目根目录运行时)。{ "mcpServers": { // ... other MCP server configs if any ... "PyMCPAutoGUI": { // Sets the working directory. ${workspaceFolder} is usually correct. "cwd": "${workspaceFolder}", // Command to run Python. 'python' works if the venv is active in the terminal // where Cursor was launched, or specify the full path. "command": "python", // Or ".venv/Scripts/python.exe" (Win) or ".venv/bin/python" (Mac/Linux) // Arguments to start the server module. "args": ["-m", "pymcpautogui.server"] } // ... other MCP server configs if any ... } }(提示:如果
保存 。 Cursor 将检测服务器。
**自动化!**在 Cursor 聊天中使用
@PyMCPAutoGUI
:例如:
@PyMCPAutoGUI move_to(x=100, y=200)``@PyMCPAutoGUI write(text='Automating with AI! 🎉', interval=0.1)``@PyMCPAutoGUI screenshot(filename='current_screen.png')``@PyMCPAutoGUI activate_window(title='Notepad')
🧰 可用工具
PyMCPAutoGUI 公开了pyautogui
和pygetwindow
的大部分功能。示例包括:
鼠标🖱️:
move_to
、click
、move_rel
、drag_to
、drag_rel
、scroll
、mouse_down
、mouse_up
、get_position
键盘⌨️:
write
,press
,key_down
,key_up
,hotkey
屏幕截图🖼️:
screenshot
、locate_on_screen
、locate_center_on_screen
Windows 🪟:
get_all_titles
、get_windows_with_title
、get_active_window``activate_window
窗口、激活窗口、minimize_window
、maximize_window
、restore_window
、move_window
、resize_window
、close_window
对话框💬:
alert
、confirm
、prompt
、password
配置⚙️:
set_pause
、set_failsafe
有关完整列表和详细信息,请检查pymcpautogui/server.py
文件或在 MCP 客户端中使用@PyMCPAutoGUI list_tools
。
📄 许可证
本项目采用 MIT 许可证 - 详情请参阅许可证文件。祝您自动化愉快!😄
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
MCP 服务器将 AI 代理与 GUI 自动化功能连接起来,允许它们控制鼠标、键盘、窗口并截取屏幕截图以与桌面应用程序进行交互。
Related MCP Servers
- -securityAlicense-qualityProvides automated GUI testing and control capabilities through an MCP server that enables mouse movements, keyboard input, screen captures, and image recognition across Windows, macOS, and Linux.Last updated -27MIT License
- -securityAlicense-qualityMCP server that provides computer control capabilities including mouse movements, keyboard actions, screenshot capture with OCR, and window management through a unified API.Last updated -48MIT License
- AsecurityAlicenseAqualityA powerful MCP server that provides interactive user feedback and command execution capabilities for AI-assisted development, featuring a graphical interface with text and image support.Last updated -139MIT License
- -securityAlicense-qualityAn MCP server that provides AI with real-time screen monitoring capabilities and UI element intelligence, allowing AI to observe, analyze, and interact with screen content through features like smart clicking and text extraction.Last updated -57MIT License