Skip to main content
Glama
Akira-Papa

macOS GUI Control MCP

by Akira-Papa
README.md
# macOS GUI Control MCP - Full Power Edition

macOS のマウス、キーボード、画面キャプチャをフル制御できる MCP サーバー。
**削除系コマンドのみブロック、それ以外は全機能使用可能**。

## 機能一覧

| カテゴリ | 機能 | 詳細 |
|---------|------|------|
| 🖱️ マウス | `mouse_click` | 指定座標をクリック |
| | `mouse_double_click` | ダブルクリック |
| | `mouse_right_click` | 右クリック |
| | `mouse_move` | カーソル移動 |
| | `mouse_drag` | ドラッグ操作 |
| | `mouse_scroll` | スクロール (上下左右) |
| | `mouse_get_position` | 現在のカーソル位置取得 |
| ⌨️ キーボード | `keyboard_type` | テキスト入力 |
| | `keyboard_press` | キー押下 (修飾キー対応) |
| | `keyboard_shortcut` | 共通ショートカット実行 |
| 📸 画面 | `screen_capture` | スクリーンショット (全画面/領域) |
| | `screen_get_size` | 画面サイズ取得 |
| | `screen_get_color` | ピクセル色取得 |
| 🪟 ウィンドウ | `window_list` | 開いているウィンドウ一覧 |
| | `window_focus` | アプリをアクティブ化 |
| | `window_move` | ウィンドウ移動 |
| | `window_resize` | ウィンドウリサイズ |
| 🚀 フルパワー | `run_applescript` | AppleScript 実行 |
| | `run_shell` | シェルコマンド実行 |

## 前提条件

### 1. cliclick インストール (必須)

```bash
brew install cliclick

# 確認
cliclick -V
```

### 2. macOS 権限設定

1. **システム設定** を開く
2. **プライバシーとセキュリティ** → **アクセシビリティ**
3. **+** ボタンで **Claude** を追加
4. 同様に **画面収録** にも **Claude** を追加

### 3. Node.js 18+

```bash
node --version  # v18.0.0 以上
```

## ビルド

```bash
cd macOS-GUI-Control-MCP

# 依存関係インストール
npm install

# MCPB CLI インストール
npm install -g @anthropic-ai/mcpb

# パッケージ化
mcpb pack .
# → macos-control-1.0.0.mcpb が生成される
```

## インストール方法

### 方法 A: Claude Desktop にインストール (推奨)

#### A-1. ダブルクリック (最も簡単)

1. `macos-control-1.0.0.mcpb` をダブルクリック
2. Claude Desktop が開いてインストールダイアログ表示
3. **インストール** をクリック

#### A-2. 設定画面から

1. Claude Desktop → **設定** → **デスクトップアプリ** → **拡張機能**
2. **展開済み拡張機能をインストール** をクリック
3. `.mcpb` ファイルを選択

### 方法 B: Claude Code で直接使用

`~/.claude.json` に以下を追加:

```json
{
  "mcpServers": {
    "macos-control": {
      "command": "node",
      "args": ["/path/to/macOS-GUI-Control-MCP/server/index.js"],
      "env": {
        "TIMEOUT": "30000",
        "LOG_OPERATIONS": "true"
      }
    }
  }
}
```

## 動作確認

新しいチャットで以下を試してみてください:

```
スクリーンショット撮って
マウスの現在位置教えて
Safari を開いて
```

## 使用例

### マウス操作

```
「座標 500, 300 をクリックして」
「マウスを 100, 100 から 500, 500 にドラッグして」
「現在のカーソル位置を教えて」
「下に3回スクロールして」
```

### キーボード操作

```
「Hello World とタイプして」
「Cmd+C を押して」
「コピーのショートカットを実行して」
「Enter キーを押して」
```

### 画面操作

```
「スクリーンショット撮って」
「画面サイズ教えて」
「座標 100, 100 のピクセル色を取得して」
```

### ウィンドウ操作

```
「開いてるウィンドウ一覧見せて」
「Safari をアクティブにして」
「Terminal を座標 0, 0 に移動して」
「Finder のウィンドウを 800x600 にリサイズして」
```

### フルパワー機能

```
「シェルで ls -la を実行して」
「AppleScript で Music アプリの現在の曲を取得して」
「シェルで pwd を実行して」
```

## ブロックされるコマンド (削除のみ)

以下のパターンは安全のためブロックされます:

### シェルコマンド
- `rm`, `rm -rf`, `rm -r`
- `rmdir`
- `unlink`

### AppleScript
- `delete file`, `delete folder`, `delete item`
- `move ... to trash`
- `empty trash`

## キーボードショートカット一覧

`keyboard_shortcut` で使用可能なショートカット:

| ショートカット名 | キー |
|-----------------|------|
| `copy` | Cmd+C |
| `paste` | Cmd+V |
| `cut` | Cmd+X |
| `undo` | Cmd+Z |
| `redo` | Cmd+Shift+Z |
| `save` | Cmd+S |
| `select_all` | Cmd+A |
| `find` | Cmd+F |
| `new` | Cmd+N |
| `open` | Cmd+O |
| `close` | Cmd+W |
| `quit` | Cmd+Q |
| `tab` | Cmd+T |
| `refresh` | Cmd+R |

## 環境変数

| 変数名 | 説明 | デフォルト |
|--------|------|----------|
| `TIMEOUT` | コマンドタイムアウト (ms) | 30000 |
| `LOG_OPERATIONS` | 操作ログ出力 | true |

## トラブルシューティング

### cliclick が見つからない

```bash
brew install cliclick
```

### アクセシビリティ権限エラー

1. システム設定 → プライバシーとセキュリティ → アクセシビリティ
2. Claude (またはターミナル) を追加
3. アプリを再起動

### 画面収録権限エラー

1. システム設定 → プライバシーとセキュリティ → 画面収録
2. Claude (またはターミナル) を追加
3. アプリを再起動

### AppleScript エラー

一部の AppleScript 操作には追加の権限が必要な場合があります。
システム設定 → プライバシーとセキュリティ → オートメーション で許可を確認してください。

## ライセンス

MIT

TDQS

A3.5/5.0

Scored across 19 tools

Disambiguation5/5

Every tool has a clearly distinct purpose with no ambiguity. The tools are organized into logical categories (keyboard, mouse, screen, window, execution), and even within categories like mouse operations, each tool performs a specific, non-overlapping action (click, double-click, drag, move, etc.).

Naming Consistency5/5

Tool names follow a consistent verb_noun pattern throughout (e.g., keyboard_press, mouse_click, screen_capture, window_list). All names use snake_case consistently, and verbs are appropriately descriptive for their actions, making the set highly predictable and readable.

Tool Count5/5

With 19 tools, this is well-scoped for macOS GUI control, covering input (keyboard, mouse), output (screen), window management, and execution (AppleScript, shell). Each tool earns its place by addressing a specific aspect of GUI automation without redundancy, making the count appropriate for the domain.

Completeness5/5

The tool surface provides complete coverage for macOS GUI control, including input simulation (keyboard and mouse actions), screen interaction (capture, color, size), window management (list, focus, move, resize), and execution capabilities (AppleScript, shell). There are no obvious gaps, and agents can perform comprehensive GUI automation tasks without dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues