pc-control-agent

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.

Category
Visit Server

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 set TESSERACT_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 tesseract is on PATH, or set TESSERACT_CMD to 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.

  1. Copy the example file:
cp .env.example .env

On Windows Command Prompt:

copy .env.example .env

Or PowerShell:

Copy-Item .env.example .env
  1. Open the .env file.

  2. Replace the placeholder values with your own credentials.

Example:

MISTRAL_API_KEY=hf_xxxxxxxxxxxxxxxxxxxxxxxxx

Test

  1. Open the project folder in Cursor (File → Open Folder).
  2. Install deps in that environment (e.g. pip install -r requirements.txt or use a venv and ensure Cursor uses it).
  3. Reload Cursor (e.g. Ctrl+Shift+P → “Developer: Reload Window”) so it picks up .cursor/mcp.json.
  4. Open Chat (or Composer). Under Tools, confirm pc-control-agent appears and its tools are listed.
  5. 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.

If the server fails to start:

  • ModuleNotFoundError: No module named 'mcp' — Dependencies aren’t installed for the Python Cursor uses. Run setup.bat (or pip install -r requirements.txt in your venv), and ensure .cursor/mcp.json uses that Python (e.g. .venv\Scripts\python.exe).
  • spawn python ENOENT — Cursor can’t find python. Use the full path to your Python in mcp.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.server runs from the project root in a terminal.

Usage

  1. Enable MCP Server in Cursor (MCP server pc-control-agent connected).
  2. In Cursor chat, give a high-level goal (e.g. Show battery usage, Open File Explorer at Downloads).
  3. 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured