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: added terminate_app

gmegidish5e2b4aec7ec1
diff --git a/src/server.ts b/src/server.ts
index 1888cc0..4d51a75 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -50,14 +50,6 @@ export const createMcpServer = (): McpServer => {
"List all apps on device",
{},
async ({}) => {
- /*
- const result = execSync(`adb shell pm list packages`)
- .toString()
- .split("\n")
- .filter(line => line.startsWith("package:"))
- .map(line => line.substring("package:".length));
- */
-
const result = listApps();
return `Found these packages on device: ${result.join(",")}`;
}
@@ -75,6 +67,18 @@ export const createMcpServer = (): McpServer => {
}
);
+ tool(
+ "terminate_app",
+ "Stop and terminate an app on mobile device",
+ {
+ packageName: z.string().describe("The package name of the app to terminate"),
+ },
+ async ({ packageName }) => {
+ execSync(`adb shell am force-stop "${packageName}"`);
+ return `Terminated app ${packageName}`;
+ }
+ );
+
tool(
"get_screen_size",
"Get the screen size of the mobile device in pixels",
@@ -103,7 +107,7 @@ export const createMcpServer = (): McpServer => {
tool(
"list_elements_on_screen",
- "List elements on screen and their coordinates, based on text or accessibility label",
+ "List elements on screen and their coordinates, with display text or accessibility label. Do not cache this result.",
{
},
async ({}) => {
@@ -163,7 +167,7 @@ export const createMcpServer = (): McpServer => {
server.tool(
"take_device_screenshot",
- "Take a screenshot of the mobile device",
+ "Take a screenshot of the mobile device. Use this to understand what's on screen, if you need to press an element that is available through view hierarchy then you must list elements on screen instead. Do not cache this result.",
{},
async ({}) => {
try {