Skip to main content
Glama
computer-use-mcp

computer-use-mcp

by lifemate-ai
README.md
# computer-use-mcp

MCP server for PC control — screenshot, mouse, and keyboard operations.

Designed for AI agents to interact with desktop applications, especially visual novels and other turn-based games.

> **Windows only** — uses PyAutoGUI which requires a display server.

## Features

- **Screenshot** — Capture the screen (full or partial region)
- **Mouse** — Click, move, scroll with automatic screenshot feedback
- **Keyboard** — Type text, press keys, hotkey combinations
- **Visual feedback** — All actions return a screenshot by default so the AI can see what happened

## Installation

```bash
# Clone
git clone https://github.com/lifemate-ai/computer-use-mcp.git
cd computer-use-mcp

# Install with uv
uv sync
```

## Usage

### As an MCP server (stdio)

```bash
uv run computer-use-mcp
```

### Claude Code configuration

Add to your `.mcp.json`:

```json
{
  "mcpServers": {
    "computer-use": {
      "command": "uv",
      "args": ["--directory", "C:\\path\\to\\computer-use-mcp", "run", "computer-use-mcp"]
    }
  }
}
```

## Tools

| Tool | Description | Returns screenshot |
|------|-------------|-------------------|
| `screenshot` | Capture the screen (full or partial) | Yes |
| `click` | Click at (x, y) coordinates | Yes (default) |
| `type_text` | Type text via keyboard | Yes (default) |
| `key_press` | Press a key or combination (e.g., `enter`, `ctrl+c`) | Yes (default) |
| `mouse_move` | Move cursor to (x, y) | Yes (default) |
| `scroll` | Scroll at (x, y) position | Yes (default) |
| `get_screen_size` | Get screen resolution | No |
| `get_mouse_position` | Get current cursor position | No |

All action tools have a `return_screenshot` parameter (default: `true`). This ensures the AI always sees the result of its actions — just like a human sees the screen change after clicking.

## Example: Playing a visual novel

```
1. screenshot()           → See the current game screen
2. click(500, 400)        → Click to advance text (+ screenshot returned)
3. click(300, 350)        → Select a dialogue choice (+ screenshot returned)
4. key_press("space")     → Advance text with spacebar (+ screenshot returned)
```

## Safety

PyAutoGUI's fail-safe is enabled by default — move the mouse to any corner of the screen to abort operations.

## License

MIT

---

# computer-use-mcp (日本語)

PCを操作するためのMCPサーバー — スクリーンショット、マウス、キーボード操作。

AIエージェントがデスクトップアプリケーション(特にノベルゲームなどのターン制ゲーム)を操作するために設計されています。

> **Windows専用** — PyAutoGUIを使用するためディスプレイサーバーが必要です。

## 特徴

- **スクリーンショット** — 画面キャプチャ(全画面または部分指定)
- **マウス** — クリック、移動、スクロール(自動スクリーンショット付き)
- **キーボード** — テキスト入力、キー押下、ホットキー
- **視覚フィードバック** — 全操作がデフォルトでスクリーンショットを返すため、AIが結果を確認可能

## インストール

```bash
# クローン
git clone https://github.com/lifemate-ai/computer-use-mcp.git
cd computer-use-mcp

# uvでインストール
uv sync
```

## 使い方

### MCPサーバーとして起動(stdio)

```bash
uv run computer-use-mcp
```

### Claude Code 設定

`.mcp.json` に追加:

```json
{
  "mcpServers": {
    "computer-use": {
      "command": "uv",
      "args": ["--directory", "C:\\path\\to\\computer-use-mcp", "run", "computer-use-mcp"]
    }
  }
}
```

## ツール一覧

| ツール | 説明 | スクリーンショット |
|--------|------|-------------------|
| `screenshot` | 画面キャプチャ(全画面/部分) | あり |
| `click` | 座標(x, y)をクリック | あり(デフォルト) |
| `type_text` | キーボードでテキスト入力 | あり(デフォルト) |
| `key_press` | キーまたはキーの組み合わせを押下(例: `enter`, `ctrl+c`) | あり(デフォルト) |
| `mouse_move` | カーソルを(x, y)に移動 | あり(デフォルト) |
| `scroll` | (x, y)の位置でスクロール | あり(デフォルト) |
| `get_screen_size` | 画面解像度を取得 | なし |
| `get_mouse_position` | 現在のカーソル位置を取得 | なし |

操作系ツールには `return_screenshot` パラメータがあり、デフォルトで `true` です。人間がクリック後に画面の変化を見るように、AIも操作の結果を常に確認できます。

## 例:ノベルゲームをプレイする

```
1. screenshot()           → 現在のゲーム画面を確認
2. click(500, 400)        → クリックしてテキストを進める(+ スクショ)
3. click(300, 350)        → 選択肢を選ぶ(+ スクショ)
4. key_press("space")     → スペースキーでテキスト送り(+ スクショ)
```

## 安全性

PyAutoGUIのフェイルセーフがデフォルトで有効です — マウスを画面の角に移動すると操作が中断されます。

## ライセンス

MIT