Run End-to-End Tests from Your Terminal with Kane CLI

Author and Run Tests Right from the Terminal in Natural Language, with an Evidence-Backed Pass or Fail from a Real Browser.

npm install -g @testmuai/kane-cli

AppiumMobile TestingAI Testing

Appium MCP Server: Setup and AI Mobile Testing

Appium MCP server guide: install appium-mcp, connect it to Claude Code or Kiro, run AI-driven Appium tests on real devices, and generate TestNG test code.

Last Updated on:

Appium MCP server for AI-powered mobile test automation

Appium MCP is the official Model Context Protocol server for Appium, and it lets an AI assistant drive Android and iOS apps from a plain-language prompt. The repository calls it "Appium MCP on Steroids!", and the server turns Appium actions into tools an agent can call for AI mobile testing.

This guide installs the Appium MCP server, connects it to Claude Code and Kiro, runs one test on two real devices in parallel on a cloud testing platform, and generates TestNG code from the same session.

TL;DR

Appium MCP is the official MCP server for Appium, published on npm as appium-mcp. It gives AI assistants such as Claude Code, Cursor, and Cline tools to create Appium sessions, find elements, perform gestures, take screenshots, and generate Java/TestNG tests, so you can run Android and iOS tests from a prompt.

What Do You Need Before Using It?

  • Installation: Run npx -y appium-mcp@latest, or add it to Claude Code with claude mcp add appium-mcp -- npx -y appium-mcp@latest. The appium-mcp package needs Node.js 22 or higher, plus the Android SDK or Xcode.
  • Embedded drivers: Local Android and iOS sessions run on the UiAutomator2 and XCUITest drivers bundled with appium-mcp, so a global Appium server is optional for local runs.
  • appium_ai vision tool: Vision-based element finding in Appium MCP is opt-in. Set AI_VISION_ENABLED to true with AI_VISION_API_BASE_URL and AI_VISION_API_KEY before the appium_ai tool registers.
  • appium_generate_tests: Appium MCP's built-in generator writes Java/TestNG code, including Page Object Model classes, from the locators the agent found during the session.

Where Do Appium MCP Tests Run?

Appium MCP tests run on local emulators, simulators, and devices, or on cloud real devices when the session is created with a remote hub URL. TestMu AI runs these Appium sessions on 50,000+ real Android and iOS devices.

What Is MCP (Model Context Protocol)?

The Model Context Protocol (MCP) is an open standard for connecting AI applications to external tools and data, which Anthropic announced on November 25, 2024. An MCP server exposes tools, and any MCP client, such as Claude Code, Cursor, VS Code, or Kiro, can call them without a custom integration per tool.

Appium is one of several ways to automate mobile tests; this comparison of automation testing tools covers the others.

Youtube thumbnail

For a deeper look, read The MCP Standard by Srinivasan Sekar on the protocol, and Appium Insights by Sai Krishna on Appium itself.

What Is Appium MCP?

Appium MCP (also searched as MCP Appium) is an MCP server built on Appium that wraps Appium commands as agent-callable tools. An AI agent uses them to start Android (UiAutomator2) or iOS (XCUITest) sessions, launch apps, find elements, perform gestures, take screenshots, and read the UI hierarchy, which covers the locator work you would otherwise do in Appium Inspector.

The tools you will call most often for mobile app testing are listed below, with names taken from the project README:

ToolWhat It Does
appium_session_managementCreates, attaches to, or ends a session; a remoteServerUrl points it at a cloud grid
select_devicePicks a local ADB device or iOS simulator for development runs
appium_find_elementFinds an element by accessibility id, id, platform-native locator, or XPath
generate_locatorsSuggests locators for the current screen in ranked order
appium_gestureTaps, swipes, long-presses, and scrolls, including scroll_to_element
appium_screenshot / appium_get_page_sourceCaptures the screen and the UI hierarchy for the agent to reason over
appium_aiFinds elements from a natural-language description using a vision model (opt-in)
appium_generate_testsGenerates Java/TestNG test code from the session

The features that set it apart from plain Appium scripting:

FeatureDescription
Cross-Platform SupportAutomate tests for both Android (UiAutomator2) and iOS (XCUITest) on real devices, emulators, and simulators
Locate Elements with AIAI-assisted element location using natural language descriptions and vision models
Locator generation using priority-based strategiesRanks locator strategies in the order accessibility id, id, platform-native, then XPath, so the most stable locator is tried first
Device Session ManagementCreates and ends Appium sessions on local and cloud-based Android and iOS devices, emulators, and simulators
AI-Assisted Test GenerationPair Appium MCP with AI assistants like Claude for generating Appium test code using natural language
AI-Assisted Page Object Model SupportPair Appium MCP with AI assistants like Claude to generate Page Object Model-based automation code using application context discovered during runtime
Multilingual SupportWrite prompts in your own language; the README lists English, Spanish, Chinese, Japanese, and Korean as examples

The source code is on GitHub. As of October 2026, the latest npm release of appium-mcp is 1.97.1.

Appium MCP Architecture

Appium MCP sits between an AI assistant (Claude, Cline, Cursor, Kiro) and the Appium automation framework, exposing Appium capabilities as tools over the Model Context Protocol.

Like any MCP server, it follows a layered flow: AI Client, then MCP Protocol (JSON-RPC 2.0), then MCP Server, then the Underlying Service. Figure 1 shows the five layers.

1. AI Client Layer

The AI client layer is the assistant or AI-native IDE you type into, such as Claude, Gemini, Cursor, or Kiro. It interprets your prompt and turns it into actions performed through Appium MCP.

Appium MCP Architecture

Figure 1: Appium MCP Architecture [image generated using AI]

2. MCP Client

The MCP client is embedded in the AI assistant or IDE. It picks the right Appium MCP tool, sends the call, and passes the server's response back to the model, which reports the result to you.

3. Appium MCP Server

The Appium MCP server exposes mobile actions as MCP tools, such as appium_find_element, appium_gesture, and appium_screenshot. It converts each tool call into WebDriver commands for the Appium layer and routes the device's response back to the MCP client.

4. Appium Server

The Appium layer translates WebDriver commands into platform-specific instructions for the Device Under Test (DUT) and handles session management. For local Android and iOS sessions, appium-mcp uses its bundled UiAutomator2 and XCUITest drivers; with a remoteServerUrl, the remote Appium server or cloud grid does this work.

5. Device Layer

The device layer is where commands run: a physical device, emulator, or simulator. Emulators are a good starting point, and a real device cloud adds the hardware coverage a local lab lacks, which the setup section below uses.

The configs, capabilities, and agent instruction file used in this guide are in the demo repository:

Appium MCP demo GitHub repository

How to Set Up the Appium MCP Server

Install these prerequisites first:

  • Node.js (v22 or higher)
  • npm or yarn
  • Java Development Kit (JDK 8 or higher)
  • Android SDK for Android testing
  • Xcode for iOS testing (macOS only)

For a quick visual walkthrough of this concept, watch the video below from TestMu AI.

Youtube thumbnail

Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.

The Appium MCP setup guide covers the platform toolchains in detail. Xcode is only available on macOS, so local iOS testing needs a Mac.

Installing the Appium MCP Server

appium-mcp bundles the UiAutomator2 and XCUITest drivers, so a local Android or iOS session can start without a global Appium server. Install Appium with npm install -g appium (version 3.8.0 as of October 2026) when you want to run your own server, as the local entries in the configs below do on port 4723.

Install the Appium MCP server globally with npm install -g appium-mcp, so it can be invoked from any directory.

Installing Appium MCP Server

Run appium-mcp --help to confirm the installation, or skip the global install and run the server with npx -y appium-mcp@latest.

Verify Appium MCP installation

Configuring Appium MCP with AI Assistants

Your AI assistant reaches the Appium MCP server through its MCP configuration. In Claude Code, one command registers it without editing any file:

claude mcp add appium-mcp -- npx -y appium-mcp@latest
Configure Appium MCP with Claude Code CLI

The walkthroughs below use Claude Code and Kiro; other MCP clients take the same server entries.

How to configure Appium MCP with Claude Code CLI

You need a Claude account and the Claude Code CLI, which installs with npm install -g @anthropic-ai/claude-code.

To switch between a local device and the TestMu AI cloud, register two server entries instead of one. Per the Claude Code MCP docs, put them in a .mcp.json file at the project root (project scope, which expands ${VAR} environment variables); claude mcp add writes user and local entries to ~/.claude.json instead. The demo repository's config holds these two entries:

  • appium-mcp-local - points to localhost:4723 over HTTP, with no credentials.
  • appium-mcp-cloud - points to the TestMu AI mobile hub (mobile-hub.lambdatest.com) over HTTPS and reads credentials from the LT_USERNAME and LT_ACCESS_KEY environment variables.

appium-mcp itself takes the grid address through the remoteServerUrl parameter of appium_session_management; the APPIUM_* values are this demo's convention for giving the agent the right endpoint per entry. Export your TestMu AI Username and Access Key, found in your TestMu AI profile, as environment variables:

export LT_USERNAME="YOUR_LT_USERNAME"
export LT_ACCESS_KEY="YOUR_LT_ACCESS_KEY"

Here is the complete server configuration for Claude Code (save it as .mcp.json in the project root):

{
  "mcpServers": {
    "appium-mcp-local": {
      "command": "npx",
      "args": [
        "-y",
        "appium-mcp@latest"
      ],
      "env": {
        "APPIUM_HOST": "localhost",
        "APPIUM_PORT": "4723",
        "APPIUM_PATH": "/",
        "APPIUM_PROTOCOL": "http"
      }
    },
    "appium-mcp-cloud": {
      "command": "npx",
      "args": [
        "-y",
        "appium-mcp@latest"
      ],
      "env": {
        "APPIUM_HOST": "mobile-hub.lambdatest.com",
        "APPIUM_PORT": "443",
        "APPIUM_PATH": "/wd/hub",
        "APPIUM_PROTOCOL": "https",
        "LT_USERNAME": "${LT_USERNAME}",
        "LT_ACCESS_KEY": "${LT_ACCESS_KEY}"
      }
    }
  }
}

Next, set the capabilities for local and cloud runs. For the TestMu AI cloud, first upload the sample Proverbial Android app (proverbial_android.apk, also in the demo repository's app folder) with the app upload API:

curl -u "$LT_USERNAME:$LT_ACCESS_KEY" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "appFile=@proverbial_android.apk" -F "name=proverbial_android" -F "type=android"
Upload Proverbial Android app to TestMu AI

The upload returns an app ID (lt://...). Put it in a JSON file, lt-rd-capabilities.json, that holds an array of Appium capabilities for two Android real devices running in parallel.

[
  {
    "platformName": "Android",
    "deviceName": "Galaxy S24",
    "platformVersion": "14",
    "app": "lt://APP1016025801781796939639692",
    "build": "[LT-MCP-Demo] Android Real Device on TestMu AI Cloud",
    "name": "[LT-MCP-Demo] Galaxy S24 Test",
    "isRealMobile": true,
    "region": "AP",
    "autoAcceptAlerts": true,
    "autoGrantPermissions": true
  },
  {
    "platformName": "Android",
    "deviceName": "Pixel 9",
    "platformVersion": "15",
    "app": "lt://APP1016025801781796939639692",
    "build": "[LT-MCP-Demo] Android Real Device on TestMu AI Cloud",
    "name": "[LT-MCP-Demo] Pixel 9 Test",
    "isRealMobile": true,
    "region": "AP",
    "autoAcceptAlerts": true,
    "autoGrantPermissions": true
  }
]

FileName - capabilities/lt-rd-capabilities.json

Then write an agent instruction file (agent.md) with the natural-language test plan: session setup, test steps, assertions, and teardown.

Agent instruction file - agent.md

FileName - instructions/agent.md

The same file works for a local device, emulator, or simulator. Enter this prompt in Claude Code to run the test through the Appium MCP server on the TestMu AI cloud grid:

Prompt: Read device capabilities from lt-rd-capabilities.json and trigger tests from instructions/agent.md

Claude Code starts one session per capability entry, so the single test runs in parallel on the Galaxy S24 and Pixel 9 real devices.

Running Appium tests on TestMu AI cloud

Both runs passed. The results appear on the TestMu AI App Automation dashboard, and Claude Code reports the same status.

Test execution on TestMu AI dashboardTest results on TestMu AI dashboardTest status on Claude Code CLI

For a local device, emulator, or simulator, create the capabilities in lt-local-capabilities.json:

{
  "platformName": "Android",
  "deviceName": "emulator-5554",
  "platformVersion": "14",
  "automationName": "UiAutomator2",
  "app": "app/proverbial_android.apk",
  "autoAcceptAlerts": true,
  "autoGrantPermissions": true
}

FileName - capabilities/lt-local-capabilities.json

Launch the emulator (for example, emulator -avd Pixel_7_Android_34 -wipe-data), match the device values in lt-local-capabilities.json to it, and reuse the same agent.md with this prompt:

Prompt: Read device capabilities from lt-local-capabilities.json and trigger tests from instructions/agent.md on local emulator

The same steps apply to iOS apps on real devices or simulators; change the capabilities to an iOS device and the XCUITest driver.

How to configure Appium MCP with Kiro

Kiro is an agentic AI IDE with built-in MCP support. This walkthrough runs Appium MCP through the Cline extension inside Kiro, and the same Cline setup applies in other editors that install VS Code extensions, such as Cursor.

Install the Cline extension in Kiro from View > Extensions by searching for Cline.

Install Cline extension in Kiro

Add the MCP servers to Cline's settings file. On macOS it was at ~/Library/Application Support/Kiro/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json (example file).

Keep the TestMu AI Username and Access Key out of this file, since anyone with access to it would see them. Export LT_USERNAME and LT_ACCESS_KEY in the Kiro terminal instead, and the MCP server inherits them from the shell environment.

{
  "mcpServers": {
    "appium-mcp-local": {
      "command": "npx",
      "args": ["-y", "appium-mcp@latest"],
      "env": {
        "APPIUM_HOST": "127.0.0.1",
        "APPIUM_PORT": "4723",
        "APPIUM_PATH": "/",
        "APPIUM_PROTOCOL": "http"
      }
    },
    "appium-mcp-cloud": {
      "command": "npx",
      "args": ["-y", "appium-mcp@latest"],
      "env": {
        "APPIUM_HOST": "mobile-hub.lambdatest.com",
        "APPIUM_PORT": "443",
        "APPIUM_PATH": "/wd/hub",
        "APPIUM_PROTOCOL": "https"
      }
    }
  }
}

FileName - cline_mcp_settings.json for Kiro & other AI-IDEs

To avoid spending Cline credits, pick a model from the Free tab in Cline's API configuration. This run used deepseek/deepseek-v4-flash, which Cline listed as free at the time.

Using DeepSeek free model in Cline

Run the same prompt, "Read device capabilities from lt-rd-capabilities.json and trigger tests from instructions/agent.md", and Cline executes every step in the instruction file.

Appium MCP test summary

The local-device prompt from the Claude Code section works here too. For other IDEs and CLIs, such as Cursor or Gemini CLI, follow the Appium MCP installation guide.

Test your website on the TestMu AI real device cloud

Code Generation with Appium MCP

The runs above executed tests straight from prompts. The Appium MCP server can also turn a natural-language scenario into test code, which removes the repetitive setup, locator discovery, and scaffolding work.

The appium_generate_tests tool interacts with the running app and writes the script from the element locators it actually found in the session.

This prompt generates Java/TestNG code that follows the Page Object Model (POM):

Generate a TestNG test script for the Proverbial Android app that clicks the COLOR, TEXT, and TOAST buttons and asserts the toast message. Use POM design Pattern and export the code in different files

The agent generates the code across multiple files:

  • A base test class for common setup and teardown logic
  • A Page Object class with identified locators and reusable methods
  • A test class that runs the scenarios through the Page Object
Code generation with Appium MCPPage Object Model code with Appium MCP

appium_generate_tests writes Java/TestNG only. For another language or framework, such as Python with pytest, ask Claude Code or Cline to write the code from the same session interactions.

Best Practices for Using Appium MCP

These practices come from the runs above and the appium-mcp README.

Optimize Appium Session Management

Create the Appium session with appium_session_management before any other tool call, since every element and gesture tool acts on an active session.

For grids and CI, the README recommends passing a remoteServerUrl and explicit capabilities rather than relying on select_device, which is meant for local picking. One session per capability entry, as in the two-device run above, runs a suite in parallel on TestMu AI App Automation, which executes Appium, Espresso, XCUITest, and Detox suites on 50,000+ real Android and iOS devices plus emulators and simulators.

Use AI-Powered Element Detection

When accessibility id, id, platform-native, and XPath locators are missing or unstable, describe the element in plain words and let a vision model find it.

AI vision element finding is opt-in: set AI_VISION_ENABLED to true and provide AI_VISION_API_BASE_URL and AI_VISION_API_KEY, or the appium_ai tool is not registered. Each call goes to a paid vision model, so keep appium_find_element for elements with stable locators and use appium_ai for the rest.

{
  "tool": "appium_ai",
  "arguments": {
    "action": "find_element",
    "instruction": "yellow search button at the bottom of the screen"
  }
}

A description such as "yellow search button" still matches after a redesign changes the element's id, which cuts locator maintenance on fast-changing screens.

MCP Server Configuration

Keep separate server entries for local and cloud testing, as both configs above do, so a prompt picks the target by name.

Never hard-code credentials in an MCP configuration file such as cline_mcp_settings.json or .mcp.json; pass them as environment variables.

Provide Clear Agent Instructions

Spell out the test flow, the expected validations, and execution constraints in the instruction file (agent.md), so the agent runs the same steps the same way every time. The teardown block from this guide's file shows the level of detail that works:

### Teardown

For each session:

- If executing on LambdaTest, immediately after the last assertion (while the session is still active) call the LambdaTest REST API to mark the test status:

  PATCH https://mobile-api.lambdatest.com/mobile-automation/api/v1/sessions/{sessionId}

  body: {"status_ind": "passed"} or {"status_ind": "failed"}

  Do this in the same step as ending the session - do NOT wait or do anything else in between.

- End the Appium session

- If executing on a local emulator, uninstall the app from the device after the session is ended

Always include teardown steps so sessions end cleanly and do not hold cloud devices as orphaned sessions.

Pair TestMu AI MCP with Appium MCP for Debugging

Appium MCP drives the device; the TestMu AI MCP server reads what happened on the grid. Its Automation tool returns test details and command, network, and console logs, and its upload_app tool uploads mobile apps, all from prompts in Claude Code, Cursor, Cline, or GitHub Copilot in VS Code.

The same server covers HyperExecute job details and YAML generation, SmartUI visual-diff summaries, and accessibility audits, so failed Appium MCP runs can be triaged without leaving the IDE.

In the TestMu Conf 2026 session Debug with Appium MCP, Srinivasan Sekar and Sai Krishna walk through this debugging workflow; the session recap summarizes the tool design and locator ranking they covered.

Youtube thumbnail
Note

Note: Run the same Appium MCP prompts on real Android and iOS devices instead of a local emulator. Sign up for TestMu AI for free and point the cloud server entry at your account.

Conclusion

Start by registering appium-mcp in your assistant with claude mcp add appium-mcp -- npx -y appium-mcp@latest and running one instruction file against a local emulator. When the flow passes, add the cloud server entry and the device capabilities from the Appium testing docs to run it in parallel on TestMu AI real devices.

Testing from the terminal? Kane CLI by TestMu AI lets SDETs and developers plan, write, run and debug tests from the command line.

To run your first test, start free, or
for a full walkthrough of the product.

Author

...

Himanshu Sheth

Blogs: 155

  • Twitter
  • Linkedin

Himanshu Sheth is the Director of Marketing (Technical Content) at TestMu AI, with over 8 years of hands-on experience in Selenium, Cypress, and other test automation frameworks. He has authored more than 130 technical blogs for TestMu AI, covering software testing, automation strategy, and CI/CD. At TestMu AI, he leads the technical content efforts across blogs, YouTube, and social media, while closely collaborating with contributors to enhance content quality and product feedback loops. He has done his graduation with a B.E. in Computer Engineering from Mumbai University. Before TestMu AI, Himanshu led engineering teams in embedded software domains at companies like Samsung Research, Motorola, and NXP Semiconductors. He is a core member of DZone and has been a speaker at several unconferences focused on technical writing and software quality.

Add to Google preferred sources

Summarise with AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Appium MCP FAQs

Did you find this page helpful?

More Related Blogs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests