# Android Viewer MCP server

> Allows an AI agent to control Android emulators through real-time video streaming, screen interactions, and foldable posture adjustments.

- Repository: https://github.com/acertijosapps/android-viewer
- Page: https://hostedmcp.org/servers/acertijosapps/android-viewer
- Transport: stdio
- Stars: 0
- License: MIT
- Latest version: 1.0.2

## Install

### Claude Code

```sh
claude mcp add android-viewer -- npx -y @acertijosapps/android-viewer
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "android-viewer": {
      "command": "npx",
      "args": [
        "-y",
        "@acertijosapps/android-viewer"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "android-viewer": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@acertijosapps/android-viewer"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"android-viewer","type":"stdio","command":"npx","args":["-y","@acertijosapps/android-viewer"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "android-viewer": {
      "command": "npx",
      "args": [
        "-y",
        "@acertijosapps/android-viewer"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add android-viewer -- npx -y @acertijosapps/android-viewer
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.android-viewer]
command = "npx"
args = ["-y", "@acertijosapps/android-viewer"]
```

### Gemini CLI

```sh
gemini mcp add -s user android-viewer npx -- -y @acertijosapps/android-viewer
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "android-viewer": {
      "command": "npx",
      "args": [
        "-y",
        "@acertijosapps/android-viewer"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `ANDROID_HOME` | no | no | Android SDK location, if adb and emulator are not found automatically |
| `ANDROID_VIEWER_URL` | no | no | Viewer to show actions live (default http://localhost:8093); without it, adb is used directly |

## Tools (10)

- `list_devices`: Lists the AVDs on this machine (with serial and booted when the emulator is running) and the adb devices that are not AVDs. An AVD with serial null is stopped: start it with launch_avd. (read-only)
- `get_state`: Size and rotation of the active display, current posture and available postures (foldables). Includes the viewer URL to watch the device in a browser pane. (read-only)
- `screenshot`: Captures the active display (PNG). For tap/swipe use normalized coordinates: x = pixel_x / image width, y = pixel_y / image height. (read-only)
- `tap`: Taps a point on the screen (input tap).
- `swipe`: Swipes from one point to another (input swipe). With the same start and end point and a duration ≥ 500 ms it is a long press.
- `press_key`: Presses a system key (input keyevent).
- `type_text`: Types ASCII text into the focused field (input text). For Enter use press_key.
- `launch_avd`: Starts an emulator by AVD name (see list_devices). Returns right away: wait until list_devices shows it with booted=true before using it.
- `rotate`: Rotates the emulator 90° (like the emulator's rotate button). Emulators only.
- `set_posture`: Changes the posture of a foldable. On emulators it moves the simulated hinge (`emu posture`); on physical devices or for REAR_DISPLAY it uses `cmd device_state state`. Accepts the name (closed, half_opened, opened, rear_display), the numeric id or "reset" to go back to the sensor posture. Returns the new state.

## FAQ

### What are the system requirements for running the viewer?

You need Node.js 18 or later, Android SDK platform tools (adb), and a browser with WebCodecs support.
