Skip to content

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.

add support for adb under ANDROID_HOME

Vjosaea756e8134ca
diff --git a/src/android.ts b/src/android.ts
index e5f55fa..b3a140c 100644
--- a/src/android.ts
+++ b/src/android.ts
@@ -1,6 +1,7 @@
import { execFileSync, execSync } from "child_process";
import * as xml from "fast-xml-parser";
import { Bounds, Button, Dimensions, ElementCoordinates, Robot, SwipeDirection } from "./robot";
+import path from "path";
interface UiAutomatorXmlNode {
node: UiAutomatorXmlNode[];
@@ -32,7 +33,13 @@ export class AndroidRobot implements Robot {
}
public adb(args: string[]): Buffer {
- return execFileSync("adb", args, {
+
+ let executable = "adb";
+ if (process.env.ANDROID_HOME) {
+ executable = path.join(process.env.ANDROID_HOME, "platform-tools", "adb");
+ }
+
+ return execFileSync(executable, args, {
maxBuffer: 1024 * 1024 * 4,
timeout: 30000,
});