Enables automated mobile app testing and interaction through Appium WebDriver, providing tools for UI element inspection, navigation, action execution, and LLM-guided automation workflows for mobile applications.
Provides tools for building and executing Dockerized mobile automation workflows through containerized test execution environments.
Integrates Azure OpenAI to power LLM-guided mobile automation, enabling intelligent reasoning about app navigation steps and automated test case generation.
Appium MCP Server
An MCP (Model Context Protocol) server powered by FastMCP that exposes the AppCrawler automation capabilities as callable tools. The crawler uses Appium to interact with mobile applications and Azure OpenAI to reason about navigation steps. The project also includes OpenAI Agents SDK integration for AI-powered agent workflows.
Project Structure
Features
MCP Server: Expose AppCrawler tools via Model Context Protocol
OpenAI Agent Integration: Connect MCP server to OpenAI Agents SDK
Mobile Automation: Automated mobile app testing using Appium
LLM-Guided Navigation: Use Azure OpenAI to reason about app navigation
Configuration Management: Environment-based configuration with Pydantic
Getting Started
1. Install Dependencies
Using requirements.txt:
Or using pyproject.toml:
Note: If using
uv, substituteuv pip installforpip install.
2. Configure Environment Variables
Create a .env file in the project root:
3. Run the MCP Server
Standalone MCP Server (STDIO transport)
This runs the server using STDIO transport, which is compatible with most MCP clients.
Note: For OpenAI Agents SDK integration, the server needs to be configured to use SSE (Server-Sent Events) transport. The current implementation uses STDIO by default. To enable SSE transport, modify
src/server.pyto use SSE transport when running.
4. Initialize the Crawler
Invoke the initialize_crawler tool with:
Appium desired capabilities (JSON object)
Output directory path
Azure OpenAI credentials (API key and endpoint)
Optional: platform, wait time, test example, and Appium server URL
5. Use Available Tools
Every public method of AppCrawler is available as an MCP tool:
initialize_crawler- Initialize the crawler with configurationget_screen_hash- Generate a unique hash for the current screen's XMLsave_screen_xml- Persist the current screen XML (and screenshot) to diskquery_llm_for_next_action- Query the LLM for the next action given a screen XMLget_mobile_by- Map a locator strategy string to Appium's MobileBy constantperform_click- Perform a click action on a UI elementperform_send_keys- Send keys to a UI elementsave_test_case- Generate and save the test case using the recorded stepsprocess_flow- Run the LLM-guided automation loop (uses bundled prompts if none supplied)get_example_test_case- Get the bundled calculator example test caseget_task_prompt- Get the default task automation promptget_generate_test_case_prompt- Get the default test case generation promptget_default_prompts- Get both default prompt templatesget_ui_dump- Retrieve the UiAutomator hierarchy from the connected devicerun_docker_automation- Build and execute the Dockerized automation workflowcleanup- Terminate the Appium session and release resources
OpenAI Agent Integration
The project includes OpenAI Agents SDK integration for AI-powered workflows:
Run the agent example:
Note: The
openai-agentspackage may not be publicly available on PyPI yet. If you encounter import errors, you may need to install it from a different source or wait for official release. The agent integration is optional and the MCP server works independently without it.
Configuration
Settings (src/settings.py)
Configuration is managed via environment variables using Pydantic Settings:
MCP_PORT: MCP server port (default: 8000)MCP_HOST: MCP server host (default: 0.0.0.0)MCP_SERVER_URL: MCP server URL (default: http://localhost:8000)AZURE_OPENAI_API_KEY: Azure OpenAI API key (required for agent integration)AZURE_OPENAI_ENDPOINT: Azure OpenAI endpoint (required for agent integration)AZURE_OPENAI_DEPLOYMENT: Azure OpenAI deployment name (required for agent integration)
Settings are automatically loaded from the .env file in the project root.
Models (appcrawler/config.py)
Data models for crawler configuration (using dataclasses):
AzureConfig: Azure OpenAI client configuration with API key, endpoint, and versionAppiumConfig: Appium server configuration with desired capabilities and server URLCrawlerSettings: Top-level crawler configuration combining Appium and Azure settings
These models are part of the appcrawler domain and define the configuration structure for the AppCrawler service.
Notes
Logging is configured through Python's standard logging module; adjust log levels as needed.
The server holds a single crawler instance. Call
cleanupbefore re-initializing with new settings.initialize_crawlerseeds the crawler with the bundled calculator example test case. Request it explicitly viaget_example_test_caseif you need the raw content.Default task and test-generation prompts are available through
get_task_prompt,get_generate_test_case_prompt, orget_default_prompts;process_flowautomatically falls back to them when prompts are omitted.Use
get_ui_dumpto capture the current UiAutomator hierarchy from a connected Android device via Appium.run_docker_automationbuilds and executes the bundled Docker workflow; ensure Docker is available on the host machine.Ensure the Appium server is running and reachable from the MCP server host.
Configuration models (
AppiumConfig,AzureConfig,CrawlerSettings) are defined inappcrawler/config.pyand are part of the crawler domain.The MCP server imports configuration models from
appcrawler.config, maintaining proper separation of concerns.For OpenAI Agents SDK integration, the MCP server must be configured to use SSE transport (not currently implemented in the default server).
The
openai-agentspackage may not be publicly available on PyPI yet; agent integration is optional.
Dependencies
Core Dependencies (requirements.txt)
fastmcp>=0.1.0- FastMCP framework for MCP serversappium-python-client==2.11.1- Appium client for Pythonselenium>=4.0.0- Selenium WebDriveropenai>=1.77.0- OpenAI Python clientloguru>=0.7.3- Advanced loggingpydantic>=2.0.0- Data validation and settingspydantic-settings>=2.11.0- Environment variables with Pydanticpython-dotenv>=1.0.0- Environment variable managementopenai-agents>=0.5.0- OpenAI Agents SDK (optional, may not be available on PyPI yet)
Additional Dependencies (pyproject.toml)
mcp[cli]>=1.21.0- MCP Framework with CLI tools (if using pyproject.toml installation)
License
[Add your license information here]
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables AI-powered mobile app testing and automation through Appium, using Azure OpenAI to intelligently navigate mobile applications and generate test cases.