When using the Appium MCP, please refer to the following documentation for comprehensive guidelines and best practices:
These documents provide essential information about using the Appium tools effectively and understanding their capabilities.
This MCP server provides integration with Appium for mobile app testing and automation. It allows you to control and interact with mobile applications on Android and iOS devices through the Model Context Protocol.
- Start and manage Appium server
- Create and control Appium driver sessions for Android and iOS
- Find and interact with UI elements
- Perform gestures like tap, swipe, scroll, pinch, and zoom
- Navigate through the app
- Take screenshots
- Get device information
- Switch between native and webview contexts
- Execute comprehensive mobile app testing
- Python 3.8 or higher
- Appium server installed (
npm install -g appium) - Android SDK or iOS development tools depending on your testing needs
- Mobile device or emulator/simulator
- Clone this repository
- Install dependencies:
pip install -e .
This project includes a comprehensive test suite to ensure the functionality of the Appium MCP server. The tests are located in the tests directory.
To run the tests:
-
Install the package with development dependencies:
pip install -e ".[dev]" -
Run the tests using the provided script:
./run_tests.shThe script supports several options:
--cov: Generate a coverage report--help: Show help message
You can also run specific test files or tests:
./run_tests.sh tests/test_main.py ./run_tests.sh tests/test_main.py::TestAppiumMCP::test_find_element_success -
Alternatively, you can run the tests directly with pytest:
pytest pytest --cov=main # With coverage report
For more information about the tests, see the tests/README.md file.
The Appium MCP server exposes a set of tools that can be used to interact with mobile applications. Here's a typical workflow:
- Start the Appium server
- Create an Appium driver for Android or iOS
- Find and interact with elements
- Perform actions like tapping, swiping, or entering text
- Close the driver when done
start_appium_server: Start the Appium server on the host machine
create_android_driver: Create an Appium driver instance for Androidcreate_ios_driver: Create an Appium driver instance for iOS
find_element: Find the first element that matches the given criteriafind_elements: Find all elements that match the given criteriawait_for_element: Wait for an element to be presentwait_for_element_to_be_clickable: Wait for an element to be clickable
tap_element: Tap on an elementlong_press_element: Long press on an elementget_text: Get text from an elementset_text: Set text on an elementget_attribute: Get an attribute from an element
go_back: Press the back buttongo_home: Press the home buttonlaunch_app: Launch the app under testclose_app: Close the app under testreset_app: Reset the app under testget_page_source: Get the XML representation of the current page
swipe: Perform a swipe gesturescroll_to_element: Scroll until an element is foundpinch: Perform a pinch gesture on an element or the screenzoom: Perform a zoom gesture on an element or the screen
take_screenshot: Take a screenshot of the device screenget_device_time: Get the device timeget_device_orientation: Get the device orientationset_device_orientation: Set the device orientationget_current_context: Get the current context (NATIVE_APP or WEBVIEW)get_contexts: Get all available contextsswitch_to_context: Switch to a different contextstop_appium_driver: Stop the Appium driver and clean up resourcesset_test_name: Set the name of the current test for reporting purposes