Skip to main content

MCP server for fast Android screenshots via scrcpy frame buffer

Project description

screen-buffer-mcp

MCP server for fast Android screenshots via scrcpy frame buffer (~50ms latency).

Features

  • Fast screenshots via scrcpy frame buffer (~50ms vs ~500ms with adb)
  • 10-frame circular buffer for instant access to recent frames
  • Historical frame access via device_get_frame for debugging/recording
  • Automatic fallback to adb when scrcpy unavailable
  • Works with Claude Code and any MCP-compatible client

Requirements

  • macOS 12+ or Linux
  • Python 3.11+
  • adb (Android Debug Bridge)
  • scrcpy 3.x installed
  • Android device connected via USB

Usage with Claude Code

Add to your .mcp.json:

{
  "mcpServers": {
    "screen-buffer": {
      "command": "uvx",
      "args": ["screen-buffer-mcp"]
    }
  }
}

Or add globally:

claude mcp add screen-buffer -s user -- uvx screen-buffer-mcp

Available Tools

Tool Description Latency
device_screenshot Capture latest frame from buffer ~50ms (scrcpy) / ~500ms (adb)
device_get_frame Get historical frame at offset ~10ms
device_list List connected devices ~100ms
device_screen_size Get screen dimensions ~10ms
device_backend_status Check active backend instant

How It Works

The server maintains a 10-frame circular buffer from the scrcpy video stream:

  1. scrcpy backend (preferred): Connects to scrcpy server on device in video-only mode. Continuously captures frames at ~60fps into a circular buffer. Screenshots return the latest buffered frame instantly.

  2. adb backend (fallback): Uses adb exec-out screencap -p for screenshots. Works everywhere but slower (~500ms per screenshot).

Frame Buffer

The frame buffer stores the last 10 frames (~160ms at 60fps), enabling:

  • Instant screenshots: Latest frame always ready, no capture delay
  • Historical access: Get frames from before an action for debugging
  • Recording support: Extract frames at specific offsets
# Get latest screenshot
device_screenshot()

# Get frame from 100ms ago (offset 6 at 60fps)
device_get_frame(offset=6)

Configuration

Environment Variables

  • SCREEN_BUFFER_LOG_LEVEL: Set logging level (DEBUG, INFO, WARNING, ERROR)

Multiple Devices

Specify device ID for multi-device setups:

device_screenshot(device="RFCW318P7NV")

Use with mobile-mcp

For full device control (taps, swipes, typing), combine with mobile-mcp:

{
  "mcpServers": {
    "screen-buffer": {
      "command": "uvx",
      "args": ["screen-buffer-mcp"]
    },
    "mobile-mcp": {
      "command": "npx",
      "args": ["-y", "@mobilenext/mobile-mcp@latest"]
    }
  }
}
  • screen-buffer-mcp: Fast screenshots (~50ms)
  • mobile-mcp: Device input (tap, swipe, type)

Development

git clone https://github.com/vladkarpman/screen-buffer-mcp
cd screen-buffer-mcp
pip install -e ".[dev]"
pytest

License

MIT License - see LICENSE for details.

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

screen_buffer_mcp-2.0.1.tar.gz (91.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

screen_buffer_mcp-2.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file screen_buffer_mcp-2.0.1.tar.gz.

File metadata

  • Download URL: screen_buffer_mcp-2.0.1.tar.gz
  • Upload date:
  • Size: 91.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for screen_buffer_mcp-2.0.1.tar.gz
Algorithm Hash digest
SHA256 5bf4799c66d8d366b9ec810197f49c6c6d047a872faf8d4ea54c6f7f419a792d
MD5 1eb210b48eeba80fd449cabb18609d0a
BLAKE2b-256 ecdd135e475a99905960e0a07fb6aae445a3784bb9eeb835d70061b56b613147

See more details on using hashes here.

Provenance

The following attestation bundles were made for screen_buffer_mcp-2.0.1.tar.gz:

Publisher: release.yml on vladkarpman/screen-buffer-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file screen_buffer_mcp-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for screen_buffer_mcp-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da18c85c22693a9a7276c3c85bc7d22dcc971c0a570c76105edc62da429d08a3
MD5 0492cbcb8922e23862ecfc7441d27a41
BLAKE2b-256 ab8c560e9e734b207b407bc547153b74260c0bca1b36738cca59cda00a0b8b3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for screen_buffer_mcp-2.0.1-py3-none-any.whl:

Publisher: release.yml on vladkarpman/screen-buffer-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page