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.1.0.tar.gz (93.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.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: screen_buffer_mcp-2.1.0.tar.gz
  • Upload date:
  • Size: 93.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.1.0.tar.gz
Algorithm Hash digest
SHA256 d0fa4b26bb22bc796e88f503621104e5ad9ac6e0d8ba878f5eb7fd36125d255d
MD5 4fec9d25e6416cda652c4f011b54d843
BLAKE2b-256 b709f4af30efb79319ab8fcc7adb884089bfb333835fd63a7bde0560dd4ac129

See more details on using hashes here.

Provenance

The following attestation bundles were made for screen_buffer_mcp-2.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for screen_buffer_mcp-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 933aec0648007cc201bfd5aa8ae2f6e4fbe7a7c32fe4abd50ceb927db726dddd
MD5 ab2dd2e9b09ed560dee6ec5017129cb2
BLAKE2b-256 29038b49f6cd76ade2363fcf1ae799b612627b1f22fa09e0c54b5e9c0f9beb35

See more details on using hashes here.

Provenance

The following attestation bundles were made for screen_buffer_mcp-2.1.0-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