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: raise maxBuffer for executeCommand so large UI dumps don't fail with ENOBUFS (#518)
Gil Megidishcd3cb571cb0d
diff --git a/src/mobilecli.ts b/src/mobilecli.tsindex 077b397..a178b61 100644--- a/src/mobilecli.ts+++ b/src/mobilecli.ts@@ -83,7 +83,7 @@ export class Mobilecli {public executeCommand(args: string[], timeoutMs?: number): string {const path = this.getPath();- const options: { encoding: "utf8"; timeout?: number } = { encoding: "utf8" };+ const options: { encoding: "utf8"; maxBuffer: number; timeout?: number } = { encoding: "utf8", maxBuffer: MAX_BUFFER_SIZE };if (timeoutMs !== undefined) {options.timeout = timeoutMs;}diff --git a/test/mobilecli.test.ts b/test/mobilecli.test.tsindex b867fe9..735126c 100644--- a/test/mobilecli.test.ts+++ b/test/mobilecli.test.ts@@ -117,6 +117,21 @@ test.describe("mobilecli", () => {});});+ test.describe("executeCommand", () => {+ test("should return output larger than node's default 1MB maxBuffer", () => {+ // run node itself as the "mobilecli" binary so the test works on every platform+ const outputSize = 2 * 1024 * 1024;+ try {+ process.env.MOBILECLI_PATH = process.execPath;+ const mobilecli = new Mobilecli();+ const output = mobilecli.executeCommand(["-e", `process.stdout.write("a".repeat(${outputSize}))`]);+ expect(output.length).toBe(outputSize);+ } finally {+ delete process.env.MOBILECLI_PATH;+ }+ });+ });+test.describe("agentStatus", () => {test("should return fail status when agent is not installed and mobilecli exits non-zero", () => {const mobilecli = new Mobilecli();