home / mcp / iphone mcp server
A Model Context Protocol (MCP) server for automating iPhone tasks with Appium. Supports app control, UI interactions, and screenshot capture via streamable HTTP.
Configuration
View docs{
"mcpServers": {
"lakr233-iphone-mcp": {
"url": "http://127.0.0.1:8765/mcp",
"headers": {
"LOG_LEVEL": "info",
"APPIUM_HOST": "127.0.0.1",
"APPIUM_PORT": "4723",
"DEVICE_UDID": "YOUR_DEVICE_UDID",
"SERVER_HOST": "127.0.0.1",
"SERVER_PATH": "/mcp",
"SERVER_PORT": "8765"
}
}
}
}You can automate iPhone tasks with this MCP server, which exposes device information, UI interactions, and screenshot capture through a streamlined HTTP interface. It’s designed to work with Appium and provides convenient endpoints to control apps, simulate touches, and retrieve UI structure, helping you build reliable automation flows for iPhone tasks.
Start the MCP server and connect through the local HTTP endpoint. Use your MCP client to send requests to the server to retrieve device info, list installed apps, capture UI snapshots, and perform touch operations. You can launch or switch apps using bundle IDs and capture a streamable interface snapshot that includes both the screenshot and structured XML representation of the UI.
Prerequisites you need before installing the MCP server are as follows.
Proceed with the following steps to set up the MCP server and its environment.
git clone https://github.com/Lakr233/iphone-mcp.git && cd iphone-mcp
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
npm install -g appium
appium driver install xcuitest
# Set up WebDriver Agent according to your environment
# Configure your device UDID in the startup script belowConfigure the startup script to use your iPhone UDID and desired host/port settings. You will run the startup script to launch Appium and the MCP server together.
# Edit start.sh to set your device UDID and any host/port overrides
# Example environment variable setup in the script
export DEVICE_UDID=YOUR_DEVICE_UDID
export APPIUM_HOST=127.0.0.1
export APPIUM_PORT=4723
export SERVER_HOST=127.0.0.1
export SERVER_PORT=8765
export SERVER_PATH=/mcp
export LOG_LEVEL=info
# Start the server (the exact command may vary by setup)
./start.shOnce the server starts, you can access the MCP endpoint at the following URL using your MCP client: http://127.0.0.1:8765/mcp. From there, you can issue requests to obtain device info, list apps, capture UI snapshots, enumerate elements, and perform actions like taps, swipes, text input, and app launches.
The server exposes a set of tools you can invoke via the MCP client to interact with the iPhone. You can obtain device details, list installed apps, capture interface snapshots, enumerate UI elements, and perform common interactions such as tapping, swiping, and entering text. You can also launch apps by bundle ID and retrieve the current bundle ID of the active app.
Environment variables to configure for the MCP server are defined in the startup script. You will typically set the device UDID, Appium host/port, server host/port/path, and log level. Use these to tailor the runtime to your local machine and network.
If the server fails to start, verify that the UDID is correct, ensure Appium and WebDriver Agent are properly configured, and confirm that the port 8765 (or your chosen port) is not blocked by a firewall. Check logs for error messages related to device connection, WebDriver Agent setup, or Appium driver initialization.
Get device details such as model, OS version, and UDID.
List installed apps on the iPhone.
Capture a screenshot and associated XML representation of the UI.
List UI elements available in the current interface.
Perform a tap on a specified UI element or coordinate.
Perform a swipe gesture in a specified direction or area.
Input text into a focused field or element.
Launch an app by bundle ID or bring it to foreground.
Return the bundle ID of the currently active app.