pc-control-agent
This MCP server enables an AI agent to control a Windows PC through human-like interactions such as screen capture, OCR, mouse, keyboard, and navigation, without using shortcut APIs.
README
An MCP based AI Agent for PC Control
An MCP based AI Agent for PC Control is an Interactive System Control AI Agent that operates a real Windows desktop using human-like primitives only: perception (screen capture, OCR), mouse, keyboard, gestures, and navigation. No shortcut APIs — plan → act → observe → explain.
Why It Impresses
- Human-like interaction: Uses only MCP tools (capture, click, type, open Settings, etc.).
- True agent loop: Plan → Act → Observe → Adapt → Explain.
- Screen-grounded reasoning: OCR + UI detection to verify state.
- Explainable actions: Plain-language summaries of what changed and why.
- Safe by design: Confirmation for destructive actions; all steps logged.
Architecture
User intent → Planning → Perception → UI navigation → Execution → Verification → Explanation
| Layer | Role |
|---|---|
| Frontend | Chat UI (demo). Primary interface: Cursor chat with MCP. |
| Agent | Cursor AI + system prompt + MCP tools. Plan → Execute → Observe. |
| Perception | Screen capture (mss/PyAutoGUI), OCR (Tesseract/EasyOCR), UI detection. |
| Execution | Mouse, keyboard, gestures, navigation (Start, Settings, Search, File Explorer). |
| Safety | log_action, ask_user_confirmation, pause/cancel. |
| Memory | Last screen context, last action, user preferences. |
Requirements
- OS: Windows 10/11
- Python: 3.10+
- RAM: 8 GB min (16 GB recommended)
- Tesseract: Install Tesseract OCR and add it to
PATH(or setTESSERACT_CMD). - Cursor: Latest Cursor IDE with MCP support.
Setup
1. Clone and install
Option A — venv (recommended for MCP)
setup.bat
This creates .venv, activates it, and runs pip install -r requirements.txt. The project’s .cursor/mcp.json is set up to use .venv\Scripts\python.exe, so Cursor will use this environment for the MCP server.
Option B — manual
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
If you use a global Python instead of a venv, edit .cursor/mcp.json and set "command": "python" (or "py" on Windows) instead of the .venv path.
2. Tesseract (OCR)
- Download and install Tesseract for Windows.
- Ensure
tesseractis onPATH, or setTESSERACT_CMDto the executable path.
3. Configure MCP Server
Project config (recommended for testing)
This repo includes .cursor/mcp.json. When you open the project folder in Cursor, the pc-control-agent MCP server is used automatically. Ensure your python (or py) has the project deps installed and is on PATH.
If python doesn’t work on Windows, edit .cursor/mcp.json and set "command": "py" instead of "command": "python".
Optional — uv
{
"mcpServers": {
"pc-control-agent": {
"command": "uv",
"args": ["run", "python", "-m", "mcp_server.server"]
}
}
}
Optional — global config
Use ~/.cursor/mcp.json and add the same pc-control-agent entry if you want it available outside this project. Use full paths in args if needed.
Reload Cursor (or restart) after changing MCP config.
Environment Variables
This project requires environment variables that are not included in the repository for security reasons.
- Copy the example file:
cp .env.example .env
On Windows Command Prompt:
copy .env.example .env
Or PowerShell:
Copy-Item .env.example .env
-
Open the
.envfile. -
Replace the placeholder values with your own credentials.
Example:
MISTRAL_API_KEY=hf_xxxxxxxxxxxxxxxxxxxxxxxxx
Test
- Open the project folder in Cursor (
File → Open Folder). - Install deps in that environment (e.g.
pip install -r requirements.txtor use a venv and ensure Cursor uses it). - Reload Cursor (e.g.
Ctrl+Shift+P→ “Developer: Reload Window”) so it picks up.cursor/mcp.json. - Open Chat (or Composer). Under Tools, confirm pc-control-agent appears and its tools are listed.
- Try a command, e.g.:
- “Get screen resolution” → agent uses
get_screen_resolution. - “Open Settings” → agent uses
open_settings. - “Capture the screen” → agent uses
capture_screen.
- “Get screen resolution” → agent uses
If the server fails to start:
ModuleNotFoundError: No module named 'mcp'— Dependencies aren’t installed for the Python Cursor uses. Runsetup.bat(orpip install -r requirements.txtin your venv), and ensure.cursor/mcp.jsonuses that Python (e.g..venv\Scripts\python.exe).spawn python ENOENT— Cursor can’t findpython. Use the full path to your Python inmcp.json(e.g."${workspaceFolder}/.venv/Scripts/python.exe"when using the project venv).- Check the Cursor MCP logs (Output → “MCP”) and confirm
python -m mcp_server.serverruns from the project root in a terminal.
Usage
- Enable MCP Server in Cursor (MCP server
pc-control-agentconnected). - In Cursor chat, give a high-level goal (e.g. Show battery usage, Open File Explorer at Downloads).
- The agent will:
- Plan steps (e.g. Open Settings → Search “battery” → Navigate to usage).
- Execute them one-by-one via MCP tools.
- Observe with
extract_text_from_screen/capture_screen/detect_ui_elements. - Explain what you’re seeing and what changed.
MCP Tools (overview)
- Perception:
capture_screen,capture_active_window,extract_text_from_screen,detect_ui_elements,get_cursor_position,get_screen_resolution - Mouse:
move_cursor,click,double_click,right_click,click_and_hold,release_click - Keyboard:
type_text,press_key,press_key_combination,hold_key,release_key - Gestures:
swipe,swipe_from_to,two_finger_scroll,tap,long_press,pinch_in,pinch_out - Navigation:
open_start_menu,open_settings,open_search,alt_tab,switch_window,maximize_window,minimize_window,close_window,open_file_explorer,navigate_to_path - Safety:
ask_user_confirmation,log_action,pause_execution,resume_execution,cancel_execution - Memory:
store_last_screen_context,recall_last_screen_context,recall_last_action,store_user_preference,recall_user_preference,clear_context
Project layout
.
├── backend/ # Perception, execution, safety, memory
├── mcp_server/ # MCP server (FastMCP) exposing tools
├── frontend/ # Demo chat UI
├── agent/ # System prompt and agent docs
├── .cursor/rules/ # Cursor rules for agent behaviour
├── requirements.txt
└── README.md
License
MIT.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。