### Example Prompt: Download, Register, and Rate App Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Guide your AI assistant to find, download, register for, and rate a specific type of application. ```plaintext Find and Download a free "Pomodoro" app that has more than 1k stars. Launch the app, register with my email, after registration find how to start a pomodoro timer. When the pomodoro timer started, go back to the app store and rate the app 5 stars, and leave a comment how useful the app is. ``` -------------------------------- ### Example Prompt: Reserve Workout Class and Set Timer Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Guide your AI assistant to find and book a workout class, and then set a reminder for it. ```plaintext Open ClassPass, search for yoga classes tomorrow morning within 2 miles, book the highest-rated class at 7 AM, confirm reservation, setup a timer for the booked slot in the phone ``` -------------------------------- ### Example Prompt: Find Local Event and Setup Calendar Event Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Instruct your AI assistant to find a local event and create a calendar reminder for it. ```plaintext Open Eventbrite, search for AI startup meetup events happening this weekend in "Austin, TX", select the most popular one, register and RSVP yes to the event, setup a calendar event as a reminder. ``` -------------------------------- ### Install go-ios Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-iOS-Real-Device Install the go-ios command-line tool globally using npm. ```bash npm install -g go-ios ``` -------------------------------- ### Cursor Manual Installation Command Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Manual command for installing the Mobile MCP server in Cursor. ```bash npx -y @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Install devicekit on Android Source: https://github.com/mobile-next/mobile-mcp/wiki/Sending-UTF‐8-Keys-in-Android Install the devicekit APK on your Android device to enable UTF-8 text input via clipboard. This involves downloading the APK and then installing it using adb. ```bash curl -s -O -J -L https://github.com/mobile-next/devicekit-android/releases/download/0.0.10/mobilenext-devicekit.apk adb install -r mobilenext-devicekit.apk ``` -------------------------------- ### Example Prompt: Check Weather and Send Message Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Guide your AI assistant to check the weather forecast and send a summary via a messaging app. ```plaintext Open Weather app, check tomorrow's weather forecast for "Berlin", and send the summary via Whatsapp/Telegram/Slack to contact "Lauren Trown", thumbs up their response. ``` -------------------------------- ### Internal SSE Server Startup Logic Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Illustrates the internal logic for starting the SSE server, including optional Bearer token authentication and request handling. ```typescript // Internal SSE server startup (src/index.ts) const startSseServer = async (host: string, port: number) => { const app = express(); const server = createMcpServer(); // Optional Bearer token middleware const authToken = process.env.MOBILEMCP_AUTH; if (authToken) { app.use((req, res, next) => { if (req.headers.authorization !== `Bearer ${authToken}`) { res.status(401).json({ error: "Unauthorized" }); return; } next(); }); } let transport: SSEServerTransport | null = null; app.get("/mcp", (req, res) => { if (transport) { res.status(409).json({ error: "Another client is already connected." }); return; } transport = new SSEServerTransport("/mcp", res); transport.onclose = () => { transport = null; }; server.connect(transport); }); app.post("/mcp", (req, res) => { if (transport) transport.handlePostMessage(req, res); }); app.listen(port, host); }; ``` -------------------------------- ### Example Prompt: Search, Comment, Like, and Share Video Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Instruct your AI assistant to find a specific video, interact with it by liking and commenting, and then share it. ```plaintext Find the video called " Beginner Recipe for Tonkotsu Ramen" by Way of Ramen, click on like video, after liking write a comment " this was delicious, will make it next Friday", share the video with the first contact in your whatsapp list. ``` -------------------------------- ### Example Prompt: Schedule Meeting and Share Invite Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Instruct your AI assistant to schedule a Zoom meeting and share the invitation via email. ```plaintext Open Zoom app, schedule a meeting titled "AI Hackathon" for tomorrow at 10AM with a duration of 1 hour, copy the invitation link, and send it via Gmail to contacts "team@example.com". ``` -------------------------------- ### Install App with mobile_install_app Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Installs an application from a local file path. Supports `.apk` for Android, and `.ipa`, `.app` directory, or `.zip` containing a `.app` bundle for iOS. ```json { "tool": "mobile_install_app", "arguments": { "device": "emulator-5554", "path": "/tmp/myapp-release.apk" } } ``` ```json { "tool": "mobile_install_app", "arguments": { "device": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890", "path": "/tmp/MyApp.zip" } } ``` -------------------------------- ### Start mobile-mcp with SSE Transport Source: https://github.com/mobile-next/mobile-mcp/wiki/Using-SSE-Transport Execute this command to start the mobile-mcp server using the SSE transport. Replace '10000' with your desired port number. ```bash npx -y @mobilenext/mobile-mcp --port 10000 ``` -------------------------------- ### Start Mobile MCP SSE Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Start the Mobile MCP server in SSE mode and bind it to a specific port. This command binds to localhost:3000. ```bash npx @mobilenext/mobile-mcp@latest --listen 3000 ``` -------------------------------- ### Start Mobile MCP SSE Server with Authorization Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Start the Mobile MCP server in SSE mode with Bearer token authorization. Set the MOBILEMCP_AUTH environment variable. ```bash MOBILEMCP_AUTH=my-secret-token npx @mobilenext/mobile-mcp@latest --listen 3000 ``` -------------------------------- ### Example Prompt: Search, Highlight, Comment, and Save Article Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Instruct your AI assistant to search for an article on Substack, highlight a section, save it, and add a comment. ```plaintext Open Substack website, search for "Latest trends in AI automation 2025", open the first article, highlight the section titled "Emerging AI trends", and save article to reading list for later review, comment a random paragraph summary. ``` -------------------------------- ### Start Mobile MCP SSE Server on Specific Interface Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Start the Mobile MCP server in SSE mode and bind it to a specific IP address and port. This command binds to 0.0.0.0:3000. ```bash npx @mobilenext/mobile-mcp@latest --listen 0.0.0.0:3000 ``` -------------------------------- ### List Installed Apps on Device Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Use `mobile_list_apps` to get a list of installed applications on a device that have a launcher activity. Returns app name and package name pairs. ```json { "tool": "mobile_list_apps", "arguments": { "device": "emulator-5554" } } ``` -------------------------------- ### Run WebDriverAgent as XCUITest Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-iOS-Real-Device Start WebDriverAgent as an XCUITest from the command line. Replace '000000000000000000000000' with your device's unique identifier (UDID). ```bash xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS,id=000000000000000000000000' test ``` -------------------------------- ### mobile_install_app Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Installs an application onto the device from a local file path. Supports various formats including .apk, .ipa, and .app bundles within zip archives. ```APIDOC ## mobile_install_app ### Description Installs an app from a local file path. Accepted formats: `.apk` (Android), `.ipa` (iOS real device), `.app` directory or `.zip` containing a `.app` bundle (iOS simulator). For `.zip` files, the server validates against zip-slip attacks before extraction. ### Arguments - **device** (string) - Required - The device ID to perform the action on. - **path** (string) - Required - The local file path to the application package. ### Request Example ```json { "tool": "mobile_install_app", "arguments": { "device": "emulator-5554", "path": "/tmp/myapp-release.apk" } } ``` ### Response Example ``` "Installed app from /tmp/myapp-release.apk" ``` ``` -------------------------------- ### Start and Stop Screen Recording Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Initiate background screen recording with `mobile_start_screen_recording` and stop it with `mobile_stop_screen_recording`. Recordings can have an optional `timeLimit`. The output is a `.mp4` file, and the stop command returns its path, size, and duration. ```json // Start recording with a 60-second limit { "tool": "mobile_start_screen_recording", "arguments": { "device": "emulator-5554", "output": "/tmp/test-run.mp4", "timeLimit": 60 } } ``` ```json // Stop recording { "tool": "mobile_stop_screen_recording", "arguments": { "device": "emulator-5554" } } ``` -------------------------------- ### mobile_list_apps Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Lists all installed apps on the device that have a launcher activity or are returned by simctl listapps / ios apps. Returns app name and package name pairs. ```APIDOC ## mobile_list_apps ### Description Lists all installed apps on the device that have a launcher activity (Android) or are returned by `simctl listapps` / `ios apps` (iOS). Returns app name and package name pairs. ### Method POST ### Endpoint /mobile_list_apps ### Request Body - **tool** (string) - Required - The name of the tool to use, which is `mobile_list_apps`. - **arguments** (object) - Required - Contains the arguments for the tool. - **device** (string) - Required - The identifier of the device. ### Request Example ```json { "tool": "mobile_list_apps", "arguments": { "device": "emulator-5554" } } ``` ### Response #### Success Response (200) - **body** (string) - A string listing found apps, e.g., "Found these apps on device: Chrome (com.android.chrome), Gmail (com.google.android.gm), Twitter (com.twitter.android)" ### Response Example ``` "Found these apps on device: Chrome (com.android.chrome), Gmail (com.google.android.gm), Twitter (com.twitter.android)" ``` ``` -------------------------------- ### List Available Mobile Devices Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Call this tool to get a unified JSON array of all available Android and iOS devices (emulators and real devices). The 'id' returned is crucial for subsequent tool calls. ```json { "tool": "mobile_list_available_devices" } ``` ```json { "devices": [ { "id": "emulator-5554", "name": "Pixel 9 Pro", "platform": "android", "type": "emulator", "version": "15", "state": "online" }, { "id": "00008110-001234ABCDEF", "name": "iPhone 16", "platform": "ios", "type": "real", "version": "18.3.1", "state": "online" }, { "id": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890", "name": "iPhone 16 Pro", "platform": "ios", "type": "simulator", "version": "18.4", "state": "online" } ] } ``` -------------------------------- ### Successful MCP Server Message Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-Claude-Code This message indicates that the mobile-mcp server has started successfully and is running on stdio. ```text MCP server "mobile" Server stderr: mobile-mcp server running on stdio ``` -------------------------------- ### Enable Debugging Logs in Claude Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-Claude-Code Use this command to enable additional logs for troubleshooting installation issues. Note that many logs are informational despite being marked as 'error'. ```bash claude --mcp-debug ``` -------------------------------- ### mobile_start_screen_recording / mobile_stop_screen_recording Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Starts a background screen recording via mobilecli screenrecord. The recording runs until explicitly stopped or until the optional timeLimit (in seconds) expires. Output defaults to a temporary .mp4 file. On stop, returns the file path, size in MB, and approximate duration. ```APIDOC ## mobile_start_screen_recording ### Description Starts a background screen recording. ### Method POST ### Endpoint /mobile_start_screen_recording ### Request Body - **tool** (string) - Required - The name of the tool to use, which is `mobile_start_screen_recording`. - **arguments** (object) - Required - Contains the arguments for the tool. - **device** (string) - Required - The identifier of the device. - **output** (string) - Optional - The path to save the recording file. Defaults to a temporary file. - **timeLimit** (integer) - Optional - The maximum duration of the recording in seconds. ### Request Example ```json { "tool": "mobile_start_screen_recording", "arguments": { "device": "emulator-5554", "output": "/tmp/test-run.mp4", "timeLimit": 60 } } ``` ### Response #### Success Response (200) - **body** (string) - A confirmation message including the output file path, e.g., "Screen recording started. Output will be saved to: /tmp/test-run.mp4" ### Response Example ``` "Screen recording started. Output will be saved to: /tmp/test-run.mp4" ``` ## mobile_stop_screen_recording ### Description Stops the background screen recording and returns details about the recording. ### Method POST ### Endpoint /mobile_stop_screen_recording ### Request Body - **tool** (string) - Required - The name of the tool to use, which is `mobile_stop_screen_recording`. - **arguments** (object) - Required - Contains the arguments for the tool. - **device** (string) - Required - The identifier of the device. ### Request Example ```json { "tool": "mobile_stop_screen_recording", "arguments": { "device": "emulator-5554" } } ``` ### Response #### Success Response (200) - **body** (string) - Information about the stopped recording, including file path, size, and duration, e.g., "Recording stopped. File: /tmp/test-run.mp4 (4.23 MB, ~38s)" ### Response Example ``` "Recording stopped. File: /tmp/test-run.mp4 (4.23 MB, ~38s)" ``` ``` -------------------------------- ### Add mobile-mcp Server to Cursor Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-Cursor Paste this JSON configuration into Cursor's MCP server settings to add the mobile-mcp server. This command uses npx to install and run the latest version of @mobilenext/mobile-mcp. ```json { "mcpServers": { "mobile-mcp": { "command": "npx", "args": ["-y", "@mobilenext/mobile-mcp@latest"] } } } ``` -------------------------------- ### Android Robot Interface (TypeScript) Source: https://context7.com/mobile-next/mobile-mcp/llms.txt The `AndroidRobot` class provides direct ADB control for Android devices. It allows programmatic interaction for tasks like getting screen size, taking screenshots, tapping, sending keys, and listing apps. ```typescript import { AndroidRobot } from "./android"; import { MobileDevice } from "./mobile-device"; // Android robot (direct ADB control) const android = new AndroidRobot("emulator-5554"); const size = await android.getScreenSize(); // { width: 1080, height: 2400, scale: 1 } const screenshot = await android.getScreenshot(); // Buffer (PNG) await android.tap(540, 960); await android.sendKeys("hello world"); await android.pressButton("HOME"); const apps = await android.listApps(); // [{ packageName, appName }] ``` -------------------------------- ### List and Get Crash Reports Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Use `mobile_list_crashes` to see available crash reports on a device and `mobile_get_crash` to retrieve the full content of a specific crash report by its ID. These tools are useful for debugging after automated test runs. ```json // List crash reports { "tool": "mobile_list_crashes", "arguments": { "device": "emulator-5554" } } ``` ```json // Get full crash report { "tool": "mobile_get_crash", "arguments": { "device": "emulator-5554", "id": "crash-abc123" } } ``` -------------------------------- ### Boot iOS Simulators using xcrun simctl Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Commands to list and boot iOS simulators using `xcrun simctl`. After booting, the MCP server can auto-detect the simulator. ```bash # List available simulators xcrun simctl list # Boot a simulator by name xcrun simctl boot "iPhone 16" # Then run the MCP server — it will auto-detect the booted simulator npx @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Configure Client with SSE Transport (Command Line) Source: https://github.com/mobile-next/mobile-mcp/wiki/Using-SSE-Transport Use this command to add the mobile-mcp server with SSE transport to your client configuration. Ensure the URL matches the address where mobile-mcp is listening. ```bash claude mcp add --transport sse mobile-mcp http://localhost:10000/mcp ``` -------------------------------- ### mobile_get_orientation / mobile_set_orientation Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Gets or sets the device orientation to 'portrait' or 'landscape'. On Android, disables auto-rotation before applying. On iOS, uses the WebDriverAgent orientation endpoint. ```APIDOC ## mobile_get_orientation ### Description Gets the current device orientation. ### Method POST ### Endpoint /mobile_get_orientation ### Request Body - **tool** (string) - Required - The name of the tool to use, which is `mobile_get_orientation`. - **arguments** (object) - Required - Contains the arguments for the tool. - **device** (string) - Required - The identifier of the device. ### Request Example ```json { "tool": "mobile_get_orientation", "arguments": { "device": "emulator-5554" } } ``` ### Response #### Success Response (200) - **body** (string) - A string indicating the current orientation, e.g., "Current device orientation is portrait" ### Response Example ``` "Current device orientation is portrait" ``` ## mobile_set_orientation ### Description Sets the device orientation to 'portrait' or 'landscape'. ### Method POST ### Endpoint /mobile_set_orientation ### Request Body - **tool** (string) - Required - The name of the tool to use, which is `mobile_set_orientation`. - **arguments** (object) - Required - Contains the arguments for the tool. - **device** (string) - Required - The identifier of the device. - **orientation** (string) - Required - The desired orientation, either `portrait` or `landscape`. ### Request Example ```json { "tool": "mobile_set_orientation", "arguments": { "device": "emulator-5554", "orientation": "landscape" } } ``` ### Response #### Success Response (200) - **body** (string) - A confirmation message, e.g., "Changed device orientation to landscape" ### Response Example ``` "Changed device orientation to landscape" ``` ``` -------------------------------- ### Configure opencode MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Add this configuration to your ~/.config/opencode/opencode.json file to integrate Mobile MCP with opencode. ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "mobile-mcp": { "type": "local", "command": [ "npx", "@mobilenext/mobile-mcp@latest" ], "enabled": true } } } ``` -------------------------------- ### Get Device Screen Size Source: https://context7.com/mobile-next/mobile-mcp/llms.txt The `mobile_get_screen_size` tool retrieves the physical pixel dimensions of the device's screen. This is used internally for calculations related to swipe gestures and screenshot scaling. ```json { "tool": "mobile_get_screen_size", "arguments": { "device": "emulator-5554" } } ``` -------------------------------- ### Copilot JSON Configuration for Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md JSON configuration for setting up the mobile-mcp server in Copilot. ```json { "mcpServers": { "mobile-mcp": { "type": "local", "command": "npx", "tools": [ "*" ], "args": [ "@mobilenext/mobile-mcp@latest" ] } } } ``` -------------------------------- ### Gemini CLI Command to Add Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Command to add the mobile-mcp server using the Gemini CLI. ```bash gemini mcp add mobile-mcp npx -y @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Amp CLI Command to Add Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Command to add the mobile-mcp server using the Amp CLI. ```bash amp mcp add mobile-mcp -- npx @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Get and Set Device Orientation Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Use `mobile_get_orientation` to check the current device orientation (`portrait` or `landscape`) and `mobile_set_orientation` to change it. On Android, auto-rotation is disabled before setting the orientation. iOS uses the WebDriverAgent orientation endpoint. ```json // Get current orientation { "tool": "mobile_get_orientation", "arguments": { "device": "emulator-5554" } } ``` ```json // Switch to landscape { "tool": "mobile_set_orientation", "arguments": { "device": "emulator-5554", "orientation": "landscape" } } ``` -------------------------------- ### Launch WebDriverAgent on iOS Simulator Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-iOS-Simulators Use this command to clone WebDriverAgent, navigate to its directory, and launch it as an XCUITest on a specified simulator. Replace 'iPhone 16' with your target simulator's name. ```bash git clone --depth 1 https://github.com/appium/WebDriverAgent.git cd WebDriverAgent xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 16' test ``` -------------------------------- ### mobile_list_available_devices Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Lists all available devices (Android emulators/real devices, iOS real devices/simulators) and returns a unified JSON array. The device `id` is crucial for subsequent tool calls. ```APIDOC ## MCP Tool: `mobile_list_available_devices` Lists all available devices — Android emulators and real devices via ADB, iOS real devices via go-ios, and iOS simulators via mobilecli — returning a unified JSON array. This is the starting point for every automation flow; the device `id` returned here is passed as the `device` parameter to all other tools. ### Tool Call ```json { "tool": "mobile_list_available_devices" } ``` ### Response Example ```json { "devices": [ { "id": "emulator-5554", "name": "Pixel 9 Pro", "platform": "android", "type": "emulator", "version": "15", "state": "online" }, { "id": "00008110-001234ABCDEF", "name": "iPhone 16", "platform": "ios", "type": "real", "version": "18.3.1", "state": "online" }, { "id": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890", "name": "iPhone 16 Pro", "platform": "ios", "type": "simulator", "version": "18.4", "state": "online" } ] } ``` ``` -------------------------------- ### Configure Windsurf MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Use this command to add Mobile MCP as a custom extension in Windsurf, or add the standard config to your settings. ```bash npx @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Codex TOML Configuration for Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md TOML configuration for setting up the mobile-mcp server in Codex. ```toml [mcp_servers.mobile-mcp] command = "npx" args = ["@mobilenext/mobile-mcp@latest"] ``` -------------------------------- ### Launch App with mobile_launch_app Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Launches an application using its package name (Android) or bundle identifier (iOS). An optional `locale` parameter can set the app's language at launch. ```json { "tool": "mobile_launch_app", "arguments": { "device": "emulator-5554", "packageName": "com.twitter.android" } } ``` ```json { "tool": "mobile_launch_app", "arguments": { "device": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890", "packageName": "com.apple.mobilesafari", "locale": "ja-JP" } } ``` -------------------------------- ### Configure Kiro MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Add this configuration to your .kiro/settings/mcp.json file to integrate Mobile MCP with Kiro. ```json { "mcpServers": { "mobile-mcp": { "command": "npx", "args": [ "@mobilenext/mobile-mcp@latest" ] } } } ``` -------------------------------- ### Mobilecli Wrapper Methods Source: https://context7.com/mobile-next/mobile-mcp/llms.txt The Mobilecli class provides methods to interact with the platform-native mobilecli binary for various mobile automation tasks. ```APIDOC ## Mobilecli Wrapper (internal TypeScript API) The `Mobilecli` class (`src/mobilecli.ts`) wraps the platform-native `mobilecli` binary, auto-detected from `node_modules/mobilecli/bin/` for the current platform/architecture. Custom binary path via `MOBILECLI_PATH`. ```typescript import { Mobilecli } from "./mobilecli"; const cli = new Mobilecli(); // Check version const version = cli.getVersion(); // e.g. "0.3.70" // List iOS simulators only const response = cli.getDevices({ platform: "ios", type: "simulator", includeOffline: false }); // response.data.devices = [{ id, name, platform, type, version }] // Check if mobilecli agent is installed on a simulator const status = cli.agentStatus("A1B2C3D4-..."); if (status.status === "fail") { cli.agentInstall("A1B2C3D4-..."); } // List crash reports const crashes = cli.crashesList("emulator-5554"); // crashes.data = [{ processName, timestamp, id }] // Get a specific crash const crash = cli.crashesGet("emulator-5554", "crash-abc123"); console.log(crash.data.content); // full crash log // Remote fleet (requires MOBILEFLEET_ENABLE=1) const devices = cli.remoteListDevices(); const allocated = cli.remoteAllocate("android"); cli.remoteRelease("fleet-device-id"); // Spawn a background process (e.g., screen recording) const child = cli.spawnCommand(["screenrecord", "--device", "emulator-5554", "--output", "/tmp/rec.mp4", "--silent"]); // child is a ChildProcess; send SIGINT to stop ``` ``` -------------------------------- ### mobile_launch_app Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Launches a specified application on the device, identified by its package name (Android) or bundle identifier (iOS). Optionally sets the app's locale. ```APIDOC ## mobile_launch_app ### Description Launches an app by its package name (Android) or bundle identifier (iOS). An optional BCP 47 `locale` parameter (comma-separated for multiple, e.g., `fr-FR,en-GB`) sets the app's language at launch. On Android, requires API 33+ for locale support (silently ignored on older versions). Package names are validated against `^[a-zA-Z0-9._]+$`. ### Arguments - **device** (string) - Required - The device ID to perform the action on. - **packageName** (string) - Required - The package name (Android) or bundle identifier (iOS) of the app to launch. - **locale** (string) - Optional - The desired locale for the app (e.g., 'ja-JP'). ### Request Example ```json { "tool": "mobile_launch_app", "arguments": { "device": "emulator-5554", "packageName": "com.twitter.android" } } ``` ### Response Example ``` "Launched app com.twitter.android" ``` ``` -------------------------------- ### Codex CLI Command to Add Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Command to add the mobile-mcp server using the Codex CLI. ```bash codex mcp add mobile-mcp npx "@mobilenext/mobile-mcp@latest" ``` -------------------------------- ### Interact with Mobilecli Binary using TypeScript Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Use the Mobilecli class to wrap the platform-native mobilecli binary. Auto-detected from node_modules/mobilecli/bin/. Custom binary path via MOBILECLI_PATH. ```typescript import { Mobilecli } from "./mobilecli"; const cli = new Mobilecli(); // Check version const version = cli.getVersion(); // e.g. "0.3.70" // List iOS simulators only const response = cli.getDevices({ platform: "ios", type: "simulator", includeOffline: false }); // response.data.devices = [{ id, name, platform, type, version }] // Check if mobilecli agent is installed on a simulator const status = cli.agentStatus("A1B2C3D4-..."); if (status.status === "fail") { cli.agentInstall("A1B2C3D4-..."); } // List crash reports const crashes = cli.crashesList("emulator-5554"); // crashes.data = [{ processName, timestamp, id }] // Get a specific crash const crash = cli.crashesGet("emulator-5554", "crash-abc123"); console.log(crash.data.content); // full crash log // Remote fleet (requires MOBILEFLEET_ENABLE=1) const devices = cli.remoteListDevices(); const allocated = cli.remoteAllocate("android"); cli.remoteRelease("fleet-device-id"); // Spawn a background process (e.g., screen recording) const child = cli.spawnCommand(["screenrecord", "--device", "emulator-5554", "--output", "/tmp/rec.mp4", "--silent"]); // child is a ChildProcess; send SIGINT to stop ``` -------------------------------- ### iOS Robot Interface (TypeScript) Source: https://context7.com/mobile-next/mobile-mcp/llms.txt The `IosRobot` class facilitates control of iOS real devices using go-ios and WebDriverAgent. It supports launching apps, opening URLs, interacting with screen elements, performing swipes, and long presses. ```typescript import { IosRobot } from "./ios"; // iOS real device robot (requires go-ios + WDA) const ios = new IosRobot("00008110-001234ABCDEF"); await ios.launchApp("com.apple.mobilesafari"); await ios.openUrl("https://example.com"); const elements = await ios.getElementsOnScreen(); await ios.swipe("up"); await ios.longPress(200, 400, 1000); ``` -------------------------------- ### Perform Screen Swipe with mobile_swipe_on_screen Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Use this tool to simulate swipes on the screen. Specify direction, and optionally coordinates and distance. Defaults to screen center and standard distances if not provided. ```json { "tool": "mobile_swipe_on_screen", "arguments": { "device": "emulator-5554", "direction": "up" } } ``` ```json { "tool": "mobile_swipe_on_screen", "arguments": { "device": "emulator-5554", "direction": "left", "x": 800, "y": 600, "distance": 600 } } ``` -------------------------------- ### Configure Client with SSE Transport (JSON) Source: https://github.com/mobile-next/mobile-mcp/wiki/Using-SSE-Transport Add this configuration to your JSON settings to connect to mobile-mcp via SSE. The 'type' should be 'sse' and 'url' should point to the mobile-mcp server's SSE endpoint. ```json "mcpServers": { "mobile-mcp": { "type": "sse", "url": "http://localhost:10000/mcp" } }, ``` -------------------------------- ### Add mobile-mcp to Claude Code Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-Claude-Code Run this command to configure mobile-mcp with Claude Code. Ensure you are using the latest version. ```bash claude mcp add mobile -- npx -y @mobilenext/mobile-mcp@latest ⁠ ``` -------------------------------- ### Mobilecli-backed Device Robot (TypeScript) Source: https://context7.com/mobile-next/mobile-mcp/llms.txt The `MobileDevice` class, when used with iOS simulators, leverages mobilecli for device interactions. It enables launching apps, sending keys, pressing buttons, and managing device orientation. ```typescript import { MobileDevice } from "./mobile-device"; // Mobilecli-backed device (iOS simulators) const sim = new MobileDevice("A1B2C3D4-E5F6-7890-ABCD-EF1234567890"); await sim.launchApp("com.apple.Maps"); await sim.sendKeys("Tokyo"); await sim.pressButton("HOME"); await sim.setOrientation("landscape"); const orientation = await sim.getOrientation(); // "landscape" ``` -------------------------------- ### Clone WebDriverAgent Repository Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-iOS-Real-Device Clone the WebDriverAgent repository and navigate into its directory. This is necessary to set up the agent on your iOS device. ```bash git clone --depth 1 https://github.com/appium/WebDriverAgent.git cd WebDriverAgent ``` -------------------------------- ### Open WebDriverAgent Project in Xcode Source: https://github.com/mobile-next/mobile-mcp/wiki/Getting-Started-with-iOS-Real-Device Open the WebDriverAgent project in Xcode. You will need to replace the Bundle Identifier with a unique one associated with your Apple Developer account. ```bash open WebDriverAgent.xcodeproj ``` -------------------------------- ### List Elements on Screen Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Retrieves the accessibility tree of the current screen as a JSON array. This enables precise coordinate-based interactions by providing element details like type, text, and coordinates. ```json { "tool": "mobile_list_elements_on_screen", "arguments": { "device": "emulator-5554" } } ``` ```json { "elements": [ { "type": "android.widget.EditText", "text": "", "label": "Email address", "identifier": "com.example.app:id/email_input", "coordinates": { "x": 40, "y": 320, "width": 700, "height": 80 } }, { "type": "android.widget.Button", "text": "Sign In", "label": "Sign In", "coordinates": { "x": 100, "y": 500, "width": 500, "height": 60 } } ] } ``` -------------------------------- ### Claude Code CLI Command to Add Mobile MCP Server Source: https://github.com/mobile-next/mobile-mcp/blob/main/README.md Command to add the mobile-mcp server using the Claude Code CLI. ```bash claude mcp add mobile-mcp -- npx -y @mobilenext/mobile-mcp@latest ``` -------------------------------- ### Open URL with mobile_open_url Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Opens a specified URL in the device's default browser or deep-links into an application. By default, only `http://` and `https://` schemes are permitted. ```json { "tool": "mobile_open_url", "arguments": { "device": "emulator-5554", "url": "https://example.com/login" } } ``` -------------------------------- ### Take Screenshot of Device Screen Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Captures the current screen of a specified device and returns a base64-encoded image. The image is automatically downscaled and re-encoded as JPEG if image scaling utilities are available. ```json { "tool": "mobile_take_screenshot", "arguments": { "device": "emulator-5554" } } ``` ```json { "content": [ { "type": "image", "data": "", "mimeType": "image/jpeg" } ] } ``` -------------------------------- ### Simulate Button Press with mobile_press_button Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Triggers a hardware button press on the device. Supported buttons include HOME, BACK (Android only), VOLUME_UP, VOLUME_DOWN, ENTER, and Android TV D-pad buttons. ```json { "tool": "mobile_press_button", "arguments": { "device": "emulator-5554", "button": "BACK" } } ``` ```json { "tool": "mobile_press_button", "arguments": { "device": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890", "button": "HOME" } } ``` -------------------------------- ### Validate Package Name and Locale Source: https://context7.com/mobile-next/mobile-mcp/llms.txt Validate package names and locales using provided utilities. These are used by launchApp and terminateApp functions to ensure valid inputs. ```typescript import { validatePackageName, validateLocale } from "./utils"; validatePackageName("com.example.app"); // OK validatePackageName("../evil"); // throws ActionableError validateLocale("fr-FR,en-GB"); // OK validateLocale("