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.

feat: add mobile_clear_app_data to clear an app's data (#524)

Mobile Kevin Bot!af6cef12859c
diff --git a/README.md b/README.md
index f19da1a..17055fe 100644
--- a/README.md
+++ b/README.md
@@ -118,6 +118,7 @@ How we help to scale mobile automation:
- **`mobile_terminate_app`** - Stop and terminate a running app
- **`mobile_install_app`** - Install an app from file (.apk, .ipa, .app, .zip)
- **`mobile_uninstall_app`** - Uninstall an app by its package name or bundle ID
+- **`mobile_clear_app_data`** - Clear an app's data so it starts fresh (Android and iOS Simulator)
### Screen Interaction
- **`mobile_take_screenshot`** - Take a screenshot to understand what's on screen
diff --git a/ROADMAP.md b/ROADMAP.md
index e1bfd60..68b916e 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -11,7 +11,6 @@ This is a living document of planned and in-progress features. Items are roughly
| **Flutter UI support** | Dump Flutter widget trees with semantics and element types, so agents see Flutter apps like native ones. | Planned |
| **Browser support** | Drive the on-device browser, Safari on iOS and Chrome on Android, alongside native apps. | Planned |
| **Device settings** | Toggle dark mode, override the timezone, and switch wifi and airplane mode to test offline behaviour. | Planned |
-| **Clear app storage** | Clear an app's cache and documents between runs. | Planned |
## Done Done
@@ -19,6 +18,7 @@ Shipped in 2026, most recent first.
| Feature | Description | Date |
|---|---|---|
+| **Clear app storage** | Clear an app's cache and documents between runs (Android and iOS Simulator). | 2026-10-18 |
| **Streamable HTTP support** | `--listen` serves MCP Streamable HTTP on `/mcp` (stateless). Replaces deprecated SSE on `/mcp`. | 2026-09-11 |
| **Device logs** | Read device system logs — syslog, console, and logcat. | 2026-09-08 |
| **Background daemon for speedup** | A long-lived background process that keeps device connections, agents and tunnels warm between tool calls, so each call skips discovery and setup and returns in milliseconds instead of seconds. | 2026-09-08 |
diff --git a/src/mobile-device.ts b/src/mobile-device.ts
index 6b99fd6..3ffe593 100644
--- a/src/mobile-device.ts
+++ b/src/mobile-device.ts
@@ -243,6 +243,10 @@ export class MobileDevice implements Robot {
this.runCommand(["apps", "terminate", packageName]);
}
+ public async clearAppData(packageName: string): Promise<void> {
+ this.runCommand(["apps", "clear", packageName]);
+ }
+
public async installApp(path: string): Promise<void> {
this.runCommand(["apps", "install", path]);
}
diff --git a/src/robot.ts b/src/robot.ts
index b494ede..fc67d3f 100644
--- a/src/robot.ts
+++ b/src/robot.ts
@@ -99,6 +99,11 @@ export interface Robot {
*/
getForegroundApp?(): Promise<ForegroundApp>;
+ /**
+ * Clear an app's data and stop it, so the next launch starts fresh. Optional, not all robots support it.
+ */
+ clearAppData?(packageName: string): Promise<void>;
+
/**
* Override the GPS location reported by the device. Optional, not all robots support it.
*/
diff --git a/src/server.ts b/src/server.ts
index db4a643..8541414 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -624,6 +624,26 @@ export const createMcpServer = (): McpServer => {
}
);
+ tool(
+ "mobile_clear_app_data",
+ "Clear App Data",
+ "Clear an app's data, such as its cache, documents, preferences and databases, and stop the app, so the next launch starts as if freshly installed. The app stays installed. Supported on Android devices and emulators and on iOS simulators, not on real iOS devices.",
+ {
+ device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
+ packageName: z.string().describe("The package name (Android) or bundle id (iOS) of the app to clear"),
+ },
+ { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
+ async ({ device, packageName }) => {
+ const robot = getRobotFromDevice(device);
+ if (!robot.clearAppData) {
+ throw new ActionableError("Clearing app data is not supported in legacy robot mode");
+ }
+
+ await robot.clearAppData(packageName);
+ return `Cleared app data for ${packageName}`;
+ }
+ );
+
tool(
"mobile_install_app",
"Install App",
diff --git a/test/mobile-device.test.ts b/test/mobile-device.test.ts
index b7b242b..d482137 100644
--- a/test/mobile-device.test.ts
+++ b/test/mobile-device.test.ts
@@ -189,6 +189,16 @@ test.describe("MobileDevice", () => {
});
});
+ test.describe("clear app data", () => {
+
+ test("clearAppData should call mobilecli apps clear with the package", async () => {
+ const { device, calls } = createMockMobileDevice("");
+ await device.clearAppData("com.example.app");
+
+ expect(calls[0]).toEqual(["apps", "clear", "com.example.app", "--device", "test-device"]);
+ });
+ });
+
test.describe("location", () => {
test("setLocation should call mobilecli device location set with lat,lng", async () => {
diff --git a/test/server-annotations.test.ts b/test/server-annotations.test.ts
index 2505da4..8ceb090 100644
--- a/test/server-annotations.test.ts
+++ b/test/server-annotations.test.ts
@@ -16,6 +16,7 @@ const expectedAnnotations: ToolAnnotationMatrix = {
mobile_terminate_app: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
mobile_install_app: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
mobile_uninstall_app: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
+ mobile_clear_app_data: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
mobile_get_screen_size: { readOnlyHint: true, openWorldHint: false },
mobile_click_on_screen_at_coordinates: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
mobile_double_tap_on_screen: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
diff --git a/test/server-tool-descriptions.test.ts b/test/server-tool-descriptions.test.ts
index 82dcbeb..0aa2dab 100644
--- a/test/server-tool-descriptions.test.ts
+++ b/test/server-tool-descriptions.test.ts
@@ -62,7 +62,7 @@ test("only mentions tools that exist", async () => {
test("names the app with packageName in every app tool", async () => {
const tools = await listToolDefinitions();
- for (const name of ["mobile_launch_app", "mobile_terminate_app", "mobile_uninstall_app"]) {
+ for (const name of ["mobile_launch_app", "mobile_terminate_app", "mobile_uninstall_app", "mobile_clear_app_data"]) {
expect(requiredParametersOf(findTool(tools, name)), name).toEqual(["device", "packageName"]);
}
});