Skip to main content
Glama
desamtralized

ADB Screenshot MCP Server

adb_screenshot

Capture screenshots from connected Android devices over WiFi using ADB commands. Save screenshots locally for debugging, documentation, or remote monitoring purposes.

Instructions

Take a screenshot of the connected Android device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_pathNoLocal path to save the screenshot (default: screenshot.png)screenshot.png
device_idNoDevice ID/serial (optional, uses first device if not specified)

Implementation Reference

  • Handler function for the 'adb_screenshot' tool. It takes a screenshot using ADB shell screencap on the device (optionally specified by device_id), pulls it to the local output_path (default 'screenshot.png'), cleans up the temp file on device, and returns a success message.
    case "adb_screenshot": {
      const { output_path = "screenshot.png", device_id } = args as {
        output_path?: string;
        device_id?: string;
      };
    
      const deviceArg = device_id ? `-s ${device_id}` : "";
      const tempPath = "/sdcard/screenshot.png";
    
      // Take screenshot on device
      await execAsync(`adb ${deviceArg} shell screencap -p ${tempPath}`);
      
      // Pull screenshot to local machine
      const { stdout, stderr } = await execAsync(`adb ${deviceArg} pull ${tempPath} ${output_path}`);
      
      // Clean up temp file on device
      await execAsync(`adb ${deviceArg} shell rm ${tempPath}`);
    
      if (stderr && stderr.includes("error")) {
        throw new McpError(ErrorCode.InternalError, `Screenshot failed: ${stderr}`);
      }
    
      return {
        content: [
          {
            type: "text",
            text: `Screenshot saved to ${output_path}`,
          },
        ],
      };
    }
  • Input schema definition for the 'adb_screenshot' tool, defining optional parameters output_path and device_id.
    inputSchema: {
      type: "object",
      properties: {
        output_path: {
          type: "string",
          description: "Local path to save the screenshot (default: screenshot.png)",
          default: "screenshot.png",
        },
        device_id: {
          type: "string",
          description: "Device ID/serial (optional, uses first device if not specified)",
        },
      },
      required: [],
    },
  • src/index.ts:51-70 (registration)
    Registration of the 'adb_screenshot' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "adb_screenshot",
      description: "Take a screenshot of the connected Android device",
      inputSchema: {
        type: "object",
        properties: {
          output_path: {
            type: "string",
            description: "Local path to save the screenshot (default: screenshot.png)",
            default: "screenshot.png",
          },
          device_id: {
            type: "string",
            description: "Device ID/serial (optional, uses first device if not specified)",
          },
        },
        required: [],
      },
    },
    {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/desamtralized/adb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server