Desktop Control MCP
Lets an agent drive the Discord desktop app through screenshots, mouse clicks and keyboard input (and CDP DOM inspection when launched with remote debugging) — e.g. opening Discord, navigating servers and joining voice channels.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Desktop Control MCP
An MCP server that gives LLMs the ability to see and control a Windows desktop via screenshots, mouse, keyboard, and UI element detection.
How It Works
The server provides tools — the LLM client does all the reasoning:
Screenshot the desktop to see what's on screen
Identify UI elements via vision or Windows UI Automation
Act using mouse clicks, keyboard input, or hotkeys
Verify by taking another screenshot after each action
Three-Layer Element Detection
Layer | Method | Best For |
CDP | Chrome DevTools Protocol via WebSocket | Electron apps (Discord, VS Code, Slack) — requires |
UIA | Windows UI Automation COM API | Native apps (Notepad, Explorer, Settings, Office) |
Vision | Screenshot + LLM vision | Everything else — LLM estimates coordinates from the image |
Related MCP server: com-use-mcp
Installation
cd Desktop-Control-MCP
pip install -e .Register with an MCP Client
Add the server to your MCP client's configuration. Examples for popular clients:
Claude Desktop — %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"desktop-control": {
"command": "python",
"args": ["-m", "desktop_control.server"],
"cwd": "C:\\path\\to\\Desktop-Control-MCP"
}
}
}Claude Code — .claude/settings.json or via claude mcp add:
claude mcp add desktop-control -- python -m desktop_control.serverCursor — .cursor/mcp.json:
{
"mcpServers": {
"desktop-control": {
"command": "python",
"args": ["-m", "desktop_control.server"]
}
}
}OpenAI Agents SDK — via Python:
from agents import Agent
from agents.mcp import MCPServerStdio
server = MCPServerStdio(command="python", args=["-m", "desktop_control.server"])
agent = Agent(name="desktop", tools=server.tools())Any MCP-compatible client (Windsurf, Cline, Continue, etc.) can connect using the standard stdio transport with python -m desktop_control.server.
Then restart your client.
Tools (12)
Vision & Awareness
Tool | Description |
| Capture desktop as JPEG. Returns image + screen dimensions. Coordinates map 1:1 to mouse coordinates. |
| Get interactive UI elements with exact bounding boxes. Auto-selects CDP or UIA based on the app. |
| Monitor geometries, cursor position, DPI scale. |
| All visible windows with titles, process names, and positions. |
Mouse
Tool | Description |
| Click at (x, y). Supports left/right/middle, double-click, modifier keys. |
| Drag from one point to another. |
| Scroll vertically or horizontally at a position. |
Keyboard
Tool | Description |
| Type text. Handles Unicode via clipboard paste. |
| Press key combos like |
Convenience
Tool | Description |
| Open an app by name via Start menu search, Win+R, or direct path. |
| Find a UI element by name and click its center — no coordinate guessing. |
| Pause for loading screens (max 30s). |
Project Structure
src/desktop_control/
server.py # FastMCP server, all tool definitions, entry point
screen.py # DPI awareness init, screenshot capture via mss
mouse.py # Click, drag, scroll via pyautogui
keyboard.py # Text typing with Unicode clipboard fallback, hotkeys
ui_automation.py # Windows UI Automation (native app element detection)
cdp.py # Chrome DevTools Protocol (Electron app element detection)
element_detection.py # Unified facade — auto-selects CDP or UIA
windows.py # App launching, window enumeration, Electron app registryDependencies
mcp— MCP Python SDK (FastMCP)pyautogui— Mouse/keyboard controlPillow— Image processingmss— Fast multi-monitor screenshotscomtypes— Windows UI Automation COM accesswebsockets+aiohttp— CDP communication for Electron apps
Key Technical Details
DPI Awareness
screen.py calls SetProcessDpiAwareness(2) at module level before any GUI library imports. This ensures mss captures at physical pixel resolution and pyautogui coordinates match screen pixels. The server import order in server.py enforces this.
Screenshot Coordinates
Screenshots default to monitor_index=1 (primary monitor). Using monitor_index=0 captures the virtual combined monitor which has different dimensions — this caused a ~40% coordinate mismatch on systems where the virtual and primary monitor sizes differ.
Region screenshots include offset instructions so the LLM can map pixel positions back to screen coordinates.
Electron App Support
Electron apps (Discord, VS Code, Slack, etc.) expose limited UIA elements. For full DOM access, launch them with open_application(name, method="path") which adds --remote-debugging-port. Known apps and their debug ports are registered in windows.py:ELECTRON_APPS.
Safety
pyautogui.FAILSAFE = True— move mouse to top-left corner (0,0) to abortwaitcapped at 30 seconds to prevent hangsCannot interact with UAC prompts (secure desktop)
Example Usage
From any MCP client (after registering the server):
"Open Discord and join the General voice channel"
The LLM will:
open_application("Discord")or click the taskbar iconscreenshot()to see the Discord windowmouse_click()on the correct server iconscreenshot()to verify navigationmouse_click()on the voice channelscreenshot()to confirm joined
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Remote desktop MCP: let AI see, click, type and run terminal commands on your own Windows or Mac.
1Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Eyes and hands on real Windows PCs — observe, click, type via Glasswarp API.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to control Windows desktops via local OCR, optional YOLO icon detection, and mouse/keyboard actions.PolyForm Noncommercial 1.0.0
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to see and operate a Windows PC through mouse, keyboard, screenshots, OCR, window control, and shell commands.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to automate desktop operating systems and applications through UI automation, screenshots, and input simulation.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to natively control the Windows desktop—navigating files, launching and managing applications, simulating keyboard and mouse input, and interacting with UI elements for tasks like QA testing. Works with any LLM without specialized vision models, exposing tools for capturing window/UI state and driving web page content through a DOM-focused mode.MIT