Control iOS simulators through the Model Context Protocol (MCP).
NOTE: This is AI Slop, there are dragons all over the place. I think the majority of the tests are fake or otherwise nonsensical, I have manually tested everything and the only bug I've found is in the complex gestures Claude made.
- Click Actions: Click on UI elements by text or coordinates using OCR
- App Control: Launch and terminate iOS applications
- Screenshots: Capture simulator screenshots with OCR support
- Text Finding: Find and interact with text elements using OCR
- Deep Linking: Open URLs in the simulator
- Hardware Buttons: Simulate hardware button presses
- Window Management: List and control simulator windows
- macOS with Xcode installed
- Python 3.10 or higher
- iOS Simulator
- MCP-compatible client (e.g., Claude Desktop)
pip install ios-interact-mcpgit clone https://github.com/AFDudley/ios-interact-mcp.git
cd ios-interact-mcp
pip install -e .Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"ios-interact": {
"command": "ios-interact-mcp"
}
}
}# Run with stdio transport (default)
ios-interact-mcp
# Run with SSE transport for debugging
ios-interact-mcp --transport sseTo use the MCP server with Claude Code, you need to start it with SSE transport and then connect Claude Code to it:
-
Start the SSE server:
# Start the server on port 8000 (default) ios-interact-mcp --transport sse # Or specify a custom port ios-interact-mcp --transport sse --port 37849
-
Connect Claude Code to the server:
# Add the MCP server to Claude Code claude mcp add -t sse ios-interact http://localhost:8000/sse # Or if using a custom port claude mcp add -t sse ios-interact http://localhost:37849/sse
-
Verify the connection:
# List configured MCP servers claude mcp list # Get details about the ios-interact server claude mcp get ios-interact
-
Remove the server (when done):
claude mcp remove ios-interact -s local
Click on text found in the simulator using OCR.
click_text(text: string, occurrence?: number, simulator_name?: string)Click at specific screen coordinates.
click_at_coordinates(x: number, y: number, coordinate_space?: "screen")Launch an iOS application.
launch_app(bundle_id: string)Terminate a running iOS application.
terminate_app(bundle_id: string)Take a screenshot of the simulator.
screenshot(filename?: string, return_path?: boolean)Find text elements in the simulator using OCR.
find_text_in_simulator(search_text?: string, simulator_name?: string)List all installed applications.
list_apps()Open a URL in the simulator (for deep linking).
open_url(url: string)Press a hardware button.
press_button(button_name: "home" | "lock" | "volume_up" | "volume_down")List all simulator windows with their positions and sizes.
list_simulator_windows()# Click on Settings app
await click_text("Settings")
# Navigate to General
await click_text("General")
# Take a screenshot
await screenshot("general_settings.png")# Launch your app
await launch_app("com.yourcompany.yourapp")
# Click on UI elements
await click_text("Login")
# Enter deep link
await open_url("yourapp://profile")
# Capture state
await screenshot("profile_screen.png")For OCR functionality to work properly, you need to grant accessibility permissions:
- Go to System Preferences > Security & Privacy > Accessibility
- Add Terminal (or your IDE) to the allowed applications
- Restart the application if needed
# Clone the repository
git clone https://github.com/AFDudley/ios-interact-mcp.git
cd ios-interact-mcp
# Install in development mode with dev dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install# Run all tests
python -m pytest tests/
# Run specific test
python -m pytest tests/test_ocr_controller.pyThe project uses:
- Black for code formatting
- Flake8 for linting
- Pyright for type checking
These are automatically run on commit via pre-commit hooks.
- Ensure you have granted accessibility permissions to Terminal/your IDE
- Check that the simulator window is visible and not minimized
- Verify ocrmac is installed:
pip install ocrmac
- Verify the simulator is in focus
- Ensure the target text is visible on screen
- Try using
find_text_in_simulatorfirst to verify OCR is working
Make sure iOS Simulator is running:
open -a SimulatorGrant necessary permissions in System Preferences > Security & Privacy > Accessibility
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on the Model Context Protocol
- Uses ocrmac for OCR functionality
- Powered by Apple's Vision framework and xcrun tools