scrcpy-mcp

v0.5.0
io.github.JuanCF/scrcpy-mcp Checked 6 hours ago Published 3 months ago

MCP server for Android device control via ADB and scrcpy

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

start_session

Start a scrcpy session for fast input control and screenshots. When a session is active, tap/swipe/text/screenshot are 10-50x faster. Requires scrcpy-server to be installed.

ParameterTypeDescription
maxFpsintegerMax frames per second (default 30)
maxSizeintegerMax screen dimension in pixels (default 1024)
serialstringDevice serial number

stop_session

Stop the active scrcpy session. Tools will fall back to ADB commands.

ParameterTypeDescription
serialstringDevice serial number

version

Report which scrcpy version is being used by the MCP server. The version always describes the scrcpy-server file the session pushes: it comes from the SCRCPY_SERVER_VERSION environment variable, or from the scrcpy client belonging to the same install as that server, or a built-in default.

device_list

List all connected Android devices with their serial numbers, state, and model

device_info

Get detailed info about a device: model, Android version, screen size, SDK level, battery level

ParameterTypeDescription
serialstringDevice serial number. If omitted, uses the only connected device.

screen_on

Wake the device screen (turn screen on)

ParameterTypeDescription
serialstringDevice serial number

screen_off

Turn the device screen off

ParameterTypeDescription
serialstringDevice serial number

connect_wifi

Enable WiFi ADB and connect to the device wirelessly. Returns the connection address.

ParameterTypeDescription
portintegerTCP port for ADB connection (default: 5555)
serialstringDevice serial number

disconnect_wifi

Disconnect from a wireless ADB device

ParameterTypeDescription
address *stringDevice address (e.g., 192.168.1.100:5555)

rotate_device

Rotate the device screen (requires active scrcpy session)

ParameterTypeDescription
serialstringDevice serial number

expand_notifications

Expand the notification panel (requires active scrcpy session)

ParameterTypeDescription
serialstringDevice serial number

expand_settings

Expand the quick settings panel (requires active scrcpy session)

ParameterTypeDescription
serialstringDevice serial number

collapse_panels

Collapse all open panels (notification, settings) (requires active scrcpy session)

ParameterTypeDescription
serialstringDevice serial number

screenshot

Take a screenshot of the Android device screen. Returns the image as base64.

ParameterTypeDescription
serialstringDevice serial number

screen_record_start

Start recording the screen. Recording continues until screen_record_stop is called.

ParameterTypeDescription
durationnumberMax recording duration in seconds (optional, device limit usually 180s)
remotePathstringPath on device to save recording
serialstringDevice serial number

screen_record_stop

Stop screen recording and optionally pull the file to the host.

ParameterTypeDescription
localPathstringLocal path to save recording (only if pullToHost is true)
pullToHostbooleanPull the recording to the host machine
serialstringDevice serial number

tap

Tap at the specified screen coordinates

ParameterTypeDescription
x *integerX coordinate
y *integerY coordinate
serialstringDevice serial number

swipe

Perform a swipe gesture from one point to another

ParameterTypeDescription
x1 *integerStart X coordinate
x2 *integerEnd X coordinate
y1 *integerStart Y coordinate
y2 *integerEnd Y coordinate
durationintegerDuration in milliseconds
serialstringDevice serial number

long_press

Perform a long press at the specified coordinates

ParameterTypeDescription
x *integerX coordinate
y *integerY coordinate
durationintegerDuration in milliseconds
serialstringDevice serial number

drag_drop

Perform a drag and drop gesture from one point to another. Uses input draganddrop on Android 8.0+ (API 26), falls back to swipe on older versions.

ParameterTypeDescription
endX *integerEnd X coordinate
endY *integerEnd Y coordinate
startX *integerStart X coordinate
startY *integerStart Y coordinate
durationintegerDuration in milliseconds
serialstringDevice serial number

input_text

Type text into the currently focused input field

ParameterTypeDescription
text *stringText to type
serialstringDevice serial number

key_event

Send a key event to the device. Supports keycodes like HOME, BACK, ENTER, VOLUME_UP, etc.

ParameterTypeDescription
keycode *string | numberKeycode name (e.g., 'HOME', 'BACK') or numeric value
serialstringDevice serial number

scroll

Scroll at the specified position. dx and dy are scroll amounts (-1 to 1 range approximated for ADB).

ParameterTypeDescription
dx *numberHorizontal scroll amount (negative=left, positive=right)
dy *numberVertical scroll amount (negative=up, positive=down)
x *integerX coordinate to scroll at
y *integerY coordinate to scroll at
serialstringDevice serial number

app_start

Launch an app on the device. Uses scrcpy START_APP when a session is active for faster launch, falls back to ADB `am start`. Supports force-stop prefix (+) to stop the app before launching.

ParameterTypeDescription
packageName *stringPackage name to launch (e.g., 'com.example.app'). Prefix with '+' to force-stop the app first (e.g., '+com.example.app')
serialstringDevice serial number

app_stop

Force-stop an app on the device.

ParameterTypeDescription
packageName *stringPackage name to force-stop (e.g., 'com.example.app')
serialstringDevice serial number

app_install

Install an APK file on the device from the host machine.

ParameterTypeDescription
apkPath *stringAbsolute path to the APK file on the host machine
serialstringDevice serial number

app_uninstall

Uninstall an app from the device.

ParameterTypeDescription
packageName *stringPackage name to uninstall (e.g., 'com.example.app')
serialstringDevice serial number

app_list

List installed packages on the device. Optionally filter by name or restrict to system/third-party apps.

ParameterTypeDescription
filterstringFilter packages by name (partial match, case-insensitive)
serialstringDevice serial number
systembooleantrue = system apps only, false = third-party only, omit = all

app_current

Get the currently foregrounded app package name and activity.

ParameterTypeDescription
serialstringDevice serial number

clipboard_get

Get the current clipboard content from the device. Uses scrcpy GET_CLIPBOARD when a session is active (works on Android 10+), falls back to ADB clipboard commands.

ParameterTypeDescription
serialstringDevice serial number

clipboard_set

Set the clipboard content on the device. Uses scrcpy SET_CLIPBOARD when a session is active (with optional paste flag), falls back to ADB clipboard commands.

ParameterTypeDescription
text *stringText to set in the clipboard
pastebooleanAlso simulate paste action (scrcpy only)
serialstringDevice serial number

ui_dump

Dump the full UI hierarchy of the current screen as XML. Useful for understanding screen structure before using ui_find_element.

ParameterTypeDescription
serialstringDevice serial number

ui_find_element

Find UI elements on screen by text, resource ID, class name, or content description. Returns matching elements with their tap coordinates. At least one search criterion must be provided.

ParameterTypeDescription
classNamestringClass name to match exactly (e.g., 'android.widget.Button')
contentDescstringContent description to search for (partial match, case-insensitive)
resourceIdstringResource ID to match exactly (e.g., 'com.app:id/button')
serialstringDevice serial number
textstringText content to search for (partial match, case-insensitive)

shell_exec

Execute an arbitrary ADB shell command on the device and return the output. Use this for any device operation not covered by other tools.

ParameterTypeDescription
command *stringShell command to execute on the device
serialstringDevice serial number

file_push

Push a file from the host machine to the device.

ParameterTypeDescription
localPath *stringAbsolute path to the file on the host machine
remotePath *stringDestination path on the device (e.g., /sdcard/myfile.txt)
serialstringDevice serial number

file_pull

Pull a file from the device to the host machine.

ParameterTypeDescription
localPath *stringDestination absolute path on the host machine
remotePath *stringPath to the file on the device (e.g., /sdcard/myfile.txt)
serialstringDevice serial number

file_list

List directory contents on the device.

ParameterTypeDescription
path *stringAbsolute path to the directory on the device (e.g., /sdcard/)
serialstringDevice serial number

start_video_stream

Start an HTTP MJPEG video stream of the device screen and open a viewer window (ffplay). Starts a scrcpy session automatically if needed.

ParameterTypeDescription
portintegerHTTP port for the MJPEG stream (default 7183)
serialstringDevice serial number

stop_video_stream

Stop the HTTP MJPEG video stream and close the viewer window for a device.

ParameterTypeDescription
serialstringDevice serial number