SDK Documentation
Control your Android phone programmatically from TypeScript or Python applications.
Choose Your SDK
ScreenMCP provides official SDKs for TypeScript and Python. Both SDKs offer the same set of 15 phone-control commands, automatic worker discovery, WebSocket connection management, and reconnection logic. Pick the one that fits your stack.
TypeScript SDK
@screenmcp/sdk
Full-featured TypeScript/JavaScript SDK with async/await support, event emitters, and automatic reconnection. Works in Node.js and compatible runtimes.
npm install @screenmcp/sdkView full documentation →
Python SDK
screenmcp
Fully async Python SDK built on websockets and httpx. Supports context managers, automatic reconnection, and Python 3.10+.
pip install screenmcpView full documentation →
Common Concepts
Authentication
Both SDKs authenticate using an API key (starting with pk_). Create one from the Dashboard. The SDK handles worker discovery and WebSocket connection automatically.
Connection Flow
When you call connect(), the SDK calls the ScreenMCP API to discover the best worker server, then opens a WebSocket connection to that worker. Commands are sent over this connection and relayed to your phone. The phone executes the command and returns the result.
Available Commands
Both SDKs expose the same 15 phone-control commands: screenshot, click, long click, drag, scroll, type, get text, select all, copy, paste, back, home, recents, UI tree, and camera. Each command is an async method that returns the result from the phone.
Auto-Reconnection
Both SDKs support automatic reconnection when the WebSocket connection drops. This is enabled by default and can be disabled via the autoReconnect / auto_reconnect option. Pending commands are replayed on reconnection.