Metadata-Version: 2.4
Name: windows-computer-use-mcp
Version: 0.3.0
Summary: Zero-disturbance Windows computer-use MCP server: virtual displays, hidden isolated desktops, occlusion-proof window capture, background input and UI Automation form filling. Works with Claude, Antigravity, Cursor and any MCP client.
Author: jeanluyac-sketch
License-Expression: MIT
Project-URL: Homepage, https://github.com/jeanluyac-sketch/antigravity-computer-use
Project-URL: Issues, https://github.com/jeanluyac-sketch/antigravity-computer-use/issues
Project-URL: Changelog, https://github.com/jeanluyac-sketch/antigravity-computer-use/blob/main/CHANGELOG.md
Keywords: mcp,model-context-protocol,computer-use,windows,automation,ui-automation,agents,claude
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Win32 (MS Windows)
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Desktop Environment
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp>=1.2.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: mss>=9.0.0
Requires-Dist: comtypes>=1.4.0
Requires-Dist: pywin32>=306
Provides-Extra: dev
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# Windows Computer Use MCP

[![CI](https://github.com/jeanluyac-sketch/antigravity-computer-use/actions/workflows/ci.yml/badge.svg)](https://github.com/jeanluyac-sketch/antigravity-computer-use/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

**Zero-disturbance computer use for Windows, as an MCP server.** Let an AI agent drive native Windows apps (Win32, WPF, WinUI, Electron, Java, Qt) *without* stealing your mouse, keyboard or focus while you keep working.

Works with any [Model Context Protocol](https://modelcontextprotocol.io) client: Claude Desktop, Claude Code, Google Antigravity, Cursor, VS Code and others.

> Português: veja [docs/README.pt-BR.md](docs/README.pt-BR.md).

<!-- mcp-name: io.github.jeanluyac-sketch/windows-computer-use-mcp -->

## Why

Most computer-use tools move the real cursor and type into whatever window has focus. If you touch the mouse at the wrong moment, the agent types into your browser. This server is built around the opposite default:

- **Background first.** Clicks and typing are posted to the target window (`WM_*` messages, UI Automation patterns) without taking OS focus.
- **User-Activity Guard.** Before any foreground input it checks `GetLastInputInfo`; if you moved the mouse or typed recently it aborts with `reason: "user_active"`.
- **Strict focus lock.** During `SendInput` the target is re-verified every 16 characters; if focus moves it aborts with `reason: "focus_lost"` and restores your cursor and window.
- **No blind global typing.** `type_text` and `press_keys` require a target window unless `allow_global=True`.
- **Somewhere else to work.** Apps can run on a virtual monitor (Virtual Display Driver) or on a hidden isolated desktop (`CreateDesktopW`, no admin rights).
- **Occlusion-proof capture.** `PrintWindow` + `PW_RENDERFULLCONTENT` captures a window even when it is covered or off-screen, with optional grid and Set-of-Mark badges for UI elements.

## Tools

| Tool | What it does |
|---|---|
| `display_status` | Physical/virtual monitors, VDD status, recommended agent monitor |
| `user_idle_status` | Milliseconds since last user input and the foreground window |
| `list_windows` | Windows with HWND, title, process, monitor and rects |
| `move_window_to_display`, `launch_app_on_display` | Put an app on a given (virtual) monitor |
| `launch_on_isolated_desktop`, `list_isolated_windows` | Run apps on a hidden desktop |
| `capture_window`, `capture_monitor` | Screenshots, with optional grid / element marks |
| `inspect_ui` | UI Automation tree of a window |
| `click`, `click_element`, `drag`, `scroll` | Pointer actions (background by default) |
| `type_text`, `press_keys` | Keyboard actions with guards |
| `fill_form` | Batch-fill Edit/CheckBox/Radio/ComboBox fields and submit |

## Install

Requires Windows 10/11 and Python 3.11+. The easiest way is [uv](https://docs.astral.sh/uv/).

Run it from PyPI:

```powershell
uvx windows-computer-use-mcp
```

Or straight from GitHub (latest `main`):

```powershell
uvx --from git+https://github.com/jeanluyac-sketch/antigravity-computer-use windows-computer-use-mcp
```

Or clone for development:

```powershell
git clone https://github.com/jeanluyac-sketch/antigravity-computer-use
cd antigravity-computer-use
uv venv
uv pip install -e ".[dev]"
```

### Claude Desktop

Add to `%APPDATA%\Claude\claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "windows-computer-use": {
      "command": "uvx",
      "args": ["windows-computer-use-mcp"]
    }
  }
}
```

### Claude Code

```powershell
claude mcp add windows-computer-use -- uvx windows-computer-use-mcp
```

### Google Antigravity

Copy `plugin-template\` to `%USERPROFILE%\.gemini\config\plugins\computer-use\` and set the paths in `mcp_config.json` to your clone. The plugin also ships a skill (`skills/computer-use/SKILL.md`) that teaches the agent the safe workflow.

### Cursor / other clients

Use the same `command` + `args` as the Claude Desktop example in your client's MCP config.

## Optional extras

- **Virtual Display Driver:** `scripts\install-vdd-admin.cmd` (asks for UAC) installs a virtual monitor; `scripts\manage-vdd.ps1` manages it. The agent then works on a screen you are not looking at.
- **Browser automation without focus:** `scripts\start-brave-cdp.cmd` opens Brave on a dedicated profile with `--remote-debugging-port=9222`, for use with `chrome-devtools-mcp`.

## Recommended agent workflow

1. `display_status` and `list_windows` (or `user_idle_status` before any foreground input).
2. Isolate the app: `launch_app_on_display`, `move_window_to_display` or `launch_on_isolated_desktop`.
3. Observe: `inspect_ui(hwnd=..., with_screenshot=true)` or `capture_window(hwnd=..., include_grid=true)`.
4. Act: `fill_form`, `click_element`, `type_text(..., mode="background")`, `click(..., mode="message")`.
5. Only if an app ignores background messages, use `mode="paste"` / `mode="sendinput"` with `wait_for_idle_seconds` and `restore_focus=True`.

## Tests

The end-to-end suite opens a real WinForms dialog, captures it, fills it and checks the guards. Run it on a Windows machine with an interactive desktop:

```powershell
python tests\test_computer_use.py
```

CI runs lint, a build and an import/tool-registration smoke test on `windows-latest`.

## Security

This server can click and type on your computer. Only connect it to clients and prompts you trust, and read [SECURITY.md](SECURITY.md) to report a vulnerability privately.

## Contributing

Contributions are welcome, including docs and translations. Start with [CONTRIBUTING.md](CONTRIBUTING.md) and issues labelled `good first issue`.

## License

[MIT](LICENSE)
