Mobile MCP: let AI agents drive your iOS and Android apps. MCP server for simulators, emulators and real devices. Works with Claude Code, Codex, Cursor and any MCP client.
TypeScript agentandroidandroid-automationappium-alternativeclaude-codecodexcursoremulatoriosios-automationmcpmcp-servermobilemobile-automationmobile-testingreal-devicesimulatorskills
fix: support screenshots from multi-display devices such as foldable phones
Gil Megidishad8434ae31d0
diff --git a/src/android.ts b/src/android.tsindex e5890a9..4d31e9a 100644--- a/src/android.ts+++ b/src/android.ts@@ -66,6 +66,12 @@ export class AndroidRobot implements Robot {});}+ public getFirstDisplayId(): string | null {+ const output = this.adb("shell", "dumpsys", "SurfaceFlinger", "--display-id").toString();+ const match = output.match(/Display (\d+) \(/);+ return match ? match[1] : null;+ }+public getSystemFeatures(): string[] {return this.adb("shell", "pm", "list", "features").toString()@@ -201,7 +207,15 @@ export class AndroidRobot implements Robot {}public async getScreenshot(): Promise<Buffer> {- return this.adb("exec-out", "screencap", "-p");+ const displayId = this.getFirstDisplayId();++ if (displayId !== null) {+ // always good to provide displayId. required for multi-display devices such as fold+ return this.adb("exec-out", "screencap", "-p", "-d", displayId);+ } else {+ // backward compatibility for android 10 and below+ return this.adb("exec-out", "screencap", "-p");+ }}private collectElements(node: UiAutomatorXmlNode): ScreenElement[] {