npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@screenmcp/sdk

v2.1.0

Published

TypeScript SDK for controlling phones via ScreenMCP

Downloads

308

Readme

@screenmcp/sdk

TypeScript SDK for controlling Android phones remotely via ScreenMCP.

Installation

npm install @screenmcp/sdk

Quick Start

import { ScreenMCPClient } from "@screenmcp/sdk";

// 1. Create API client
const client = new ScreenMCPClient({ apiKey: "pk_your_api_key_here" });

// 2. List available devices
const devices = await client.listDevices();
console.log(devices);

// 3. Connect to a device — returns a DeviceConnection
const phone = await client.connect({ deviceId: "a1b2c3d4e5f67890abcdef1234567890" });

// 4. Send commands
const { image } = await phone.screenshot();
// image is a base64-encoded WebP string

await phone.click(540, 1200);
await phone.type("Hello world");

// 5. Disconnect
await phone.disconnect();

API Reference

ScreenMCPClient (API-level)

new ScreenMCPClient(options: {
  apiKey: string;         // Required. Your API key (pk_... format).
  apiUrl?: string;        // API server URL. Defaults to https://screenmcp.com
  commandTimeout?: number; // Per-command timeout in ms. Defaults to 30000.
  autoReconnect?: boolean; // Auto-reconnect on disconnect. Defaults to true.
})

Methods

await client.listDevices();                    // Returns DeviceInfo[]
await client.connect({ deviceId: "..." });     // Returns DeviceConnection

DeviceConnection (device-level)

All command methods and events live on the connection returned by client.connect().

Commands

| Method | Description | |--------|-------------| | screenshot() | Returns { image: string } (base64 WebP) | | click(x, y) | Tap at screen coordinates | | longClick(x, y) | Long-press at coordinates | | drag(startX, startY, endX, endY) | Drag gesture | | scroll(direction, amount?) | Scroll "up", "down", "left", or "right" | | type(text) | Type text into the focused input | | getText() | Returns { text: string } from focused element | | selectAll() | Select all text | | copy() | Copy selection to clipboard | | paste() | Paste from clipboard | | back() | Press Back button | | home() | Press Home button | | recents() | Open app switcher | | uiTree() | Returns { tree: any[] } accessibility tree | | camera(facing?) | Returns { image: string }. Facing: "front" or "rear" | | sendCommand(cmd, params?) | Send any command (for future/custom commands) |

Events

phone.on("connected", () => { /* WebSocket connected */ });
phone.on("disconnected", () => { /* WebSocket closed */ });
phone.on("error", (err: Error) => { /* connection or protocol error */ });
phone.on("phone_status", (online: boolean) => { /* phone came online/offline */ });
phone.on("reconnecting", () => { /* attempting reconnect */ });
phone.on("reconnected", (workerUrl: string) => { /* reconnected successfully */ });

Properties

phone.connected       // boolean - is WebSocket connected
phone.phoneConnected  // boolean - is the phone online
phone.workerUrl       // string | null - current worker URL

Example: Save a Screenshot to Disk

import { ScreenMCPClient } from "@screenmcp/sdk";
import { writeFileSync } from "fs";

const client = new ScreenMCPClient({ apiKey: "pk_..." });
const phone = await client.connect({ deviceId: "..." });

const { image } = await phone.screenshot();
writeFileSync("screenshot.webp", Buffer.from(image, "base64"));

await phone.disconnect();

Example: Monitor Phone Connection

const client = new ScreenMCPClient({ apiKey: "pk_..." });
const phone = await client.connect({ deviceId: "..." });

phone.on("phone_status", (online) => {
  console.log(`Phone is ${online ? "online" : "offline"}`);
});

phone.on("error", (err) => {
  console.error("Connection error:", err.message);
});

License

MIT