MCP HubMCP Hub
InditexTech

mcp-server-simulator-ios-idb

by: InditexTech

A Model Context Protocol (MCP) server that enables LLMs to interact with iOS simulators through natural language commands.

53created 18/03/2025
Visit
iOS
LLM

๐Ÿ“ŒOverview

Purpose: To provide a seamless connection between Large Language Models (LLMs) and iOS simulators, allowing for control through natural language commands.

Overview: The MCP server for iOS Simulator acts as a bridge facilitating interaction between LLMs and iOS simulators, enabling users to perform operations such as managing application states and simulating user interactions through intuitive commands.

Key Features:

  • Simulator Control: Create and manage simulator sessions, boot or shut down simulators, and monitor their states.

  • Application Management: Install, launch, terminate, and uninstall iOS applications while verifying installations and handling app permissions.

  • UI Interaction & Testing: Execute various UI actions like tapping and swiping, input text, and access accessibility elements for comprehensive UI testing.

  • Development & Debugging: Capture screenshots and logs, perform real-time debugging, and manage app data with advanced operation capabilities.

  • Advanced Features: Includes options for location simulation, media injection, URL handling, contact management, and keychain operations.


๐Ÿ“ฑ MCP Server for iOS Simulator

A Model Context Protocol (MCP) server that enables LLMs to interact with iOS simulators through natural language commands.

โ„น๏ธ Overview

This MCP server bridges Large Language Models (LLMs) and iOS simulators, offering comprehensive control through natural language commands.

๐ŸŽฎ Simulator Control

  • Create and manage simulator sessions
  • Boot, shutdown, and monitor simulator states
  • List available and running simulators
  • Focus simulator windows

๐Ÿ“ฑ Application Management

  • Install and manage iOS applications
  • Launch, terminate, and uninstall apps
  • Monitor app states and verify installations
  • Handle app permissions and configurations

๐Ÿ–ฑ๏ธ UI Interaction & Testing

  • Interact with the simulator UI
  • Execute tap, swipe, and button press actions
  • Input text and key sequences
  • Access accessibility elements for UI testing
  • Record videos of UI interactions

๐Ÿ› ๏ธ Development & Debugging

  • Capture screenshots and system logs
  • Debug applications in real-time
  • Monitor and analyze crash logs
  • Install dynamic libraries and manage app data

โšก Advanced Features

  • Location simulation
  • Media injection
  • URL scheme handling
  • Contact database management
  • Keychain operations

๐Ÿ“‹ Requirements

  • macOS: Required for iOS simulator support
  • Node.js: v14.0.0 or higher
  • Homebrew: Required for installing dependencies
  • XCode: With iOS simulators installed

๐Ÿš€ Installation

Using Cline

Simply ask Cline:

Add this mcp to cline https://github.com/InditexTech/mcp-server-simulator-ios-idb

Cline will handle installation, dependencies, and configuration automatically.

Manual Installation

# Clone the repository
git clone https://github.com/InditexTech/mcp-server-simulator-ios-idb.git
cd mcp-server-simulator-ios-idb

# Create and activate Python virtual environment
python3 -m venv venv
source venv/bin/activate  # On Unix/macOS

# Install dependencies
npm install

# Build the project
npm run build

# Start the project
npm start

# Run tests
npm test

The installation will:

  • Check macOS environment
  • Install idb-companion via Homebrew
  • Install fb-idb via pip in the virtual environment

Note: Keep the virtual environment activated while using the server. Reactivate it with source venv/bin/activate if your terminal session closes.

๐Ÿ”Œ MCP Integration

To use this server with Claude or other LLM assistants:

Add the server to your MCP settings in Claude Desktop:

{
  "mcpServers": {
    "ios-simulator": {
      "command": "node",
      "args": ["/path/to/mcp-server-simulator-ios-idb/dist/index.js"],
      "env": {}
    }
  }
}

Example commands the LLM can use:

create a simulator session with iPhone 14
install app /path/to/my-app.ipa
launch app com.example.myapp
tap at 100, 200
take a screenshot

๐Ÿ“š Usage as a Library

๐Ÿ”ฐ Basic Usage

import { createMCPServer } from 'mcp-server-simulator-ios-idb';

async function main() {
  const { orchestrator } = createMCPServer();
  
  const sessionResult = await orchestrator.processInstruction('create session');
  console.log(`Session created: ${sessionResult.data}`);
  
  await orchestrator.processInstruction('tap at 100, 200');
  
  const screenshotResult = await orchestrator.processInstruction('take screenshot');
  console.log(`Screenshot saved at: ${screenshotResult.data}`);
}

main().catch(console.error);

๐Ÿš€ Advanced Usage

import { 
  IDBManager, 
  NLParser, 
  MCPOrchestrator,
  ParserToOrchestrator,
  OrchestratorToIDB
} from 'mcp-server-simulator-ios-idb';

const idbManager = new IDBManager();
const parser = new NLParser();
const orchestrator = new MCPOrchestrator(parser, idbManager);

const sessionId = await idbManager.createSimulatorSession({
  deviceName: 'iPhone 12',
  platformVersion: '15.0'
});

await idbManager.tap(sessionId, 100, 200);

๐Ÿ—๏ธ Project Structure

mcp-server-simulator-ios-idb/
โ”œโ”€โ”€ src/                      # Source code
โ”‚   โ”œโ”€โ”€ adapters/             # Adapter components
โ”‚   โ”œโ”€โ”€ idb/                  # IDB manager implementation
โ”‚   โ”œโ”€โ”€ mcp/                  # MCP server implementation
โ”‚   โ”œโ”€โ”€ orchestrator/         # Command orchestrator
โ”‚   โ”œโ”€โ”€ parser/               # Natural language parser
โ”‚   โ””โ”€โ”€ index.ts              # Main entry point
โ”œโ”€โ”€ types/                    # TypeScript type definitions
โ”œโ”€โ”€ scripts/                  # Installation scripts
โ”œโ”€โ”€ package.json              # Project configuration
โ””โ”€โ”€ tsconfig.json             # TypeScript configuration

๐ŸŽฏ Supported Commands

๐ŸŽฎ Simulator Management

CommandDescriptionExample
Create sessionCreates a new simulator session"create session", "create simulator iPhone 12"
Terminate sessionTerminates the current session"terminate session", "close simulator"
List simulatorsLists available simulators"list simulators", "show simulators"
List booted simulatorsLists running simulators"list booted simulators", "show running simulators"
Boot simulatorBoots a simulator by UDID"boot simulator 5A321B8F-4D85-4267-9F79-2F5C91D142C2"
Shutdown simulatorShuts down a simulator"shutdown simulator 5A321B8F-4D85-4267-9F79-2F5C91D142C2"
Focus simulatorBrings simulator window to front"focus simulator", "bring simulator to front"
List simulator sessionsLists active simulator sessions"list simulator sessions", "show active sessions"

๐Ÿ“ฑ App Management

CommandDescriptionExample
Install appInstalls an app on the simulator"install app /path/to/app.ipa"
Launch appLaunches an app on the simulator"launch app com.example.app"
Terminate appTerminates a running app"terminate app com.example.app"
Uninstall appUninstalls an app"uninstall app com.example.app"
List appsLists installed applications"list apps", "show installed apps"
Check if app installedChecks if an app is installed"is app com.example.app installed"

๐Ÿ–ฑ๏ธ UI Interaction

CommandDescriptionExample
TapTaps at specific coordinates"tap at 100, 200"
SwipePerforms a swipe gesture"swipe from 100, 200 to 300, 400"
Press buttonPresses a device button"press button HOME", "press button SIRI"
Input textTypes text"input text Hello World"
Press keyPresses a key by code"press key 4"
Press key sequencePresses a sequence of keys"press key sequence 4 5 6"

โ™ฟ Accessibility

CommandDescriptionExample
Describe elementsLists all accessibility elements"describe all elements", "show accessibility elements"
Describe pointDescribes element at coordinates"describe point 100, 200", "what's at 150, 300"

๐Ÿ“ธ Capture and Logs

CommandDescriptionExample
Take screenshotCaptures a screenshot"take screenshot", "capture screen"
Record videoRecords screen activity"record video /path/output.mp4"
Stop recordingStops video recording"stop recording", "stop video recording"
Get logsRetrieves system or app logs"get logs", "get logs for com.example.app"

๐Ÿ› Debug

CommandDescriptionExample
Start debugStarts a debug session"debug app com.example.app", "start debug com.example.app"
Stop debugStops a debug session"stop debug", "terminate debug session"
Debug statusGets debug session status"debug status", "show debug info"

๐Ÿ’ฅ Crash Logs

CommandDescriptionExample
List crash logsLists available crash logs"list crash logs", "show crash logs"
Show crash logShows content of a crash log"show crash log crash_2023-01-01"
Delete crash logsDeletes crash logs"delete crash logs", "clear crash logs"

๐Ÿ”ง Additional Commands

CommandDescriptionExample
Install dylibInstalls a dynamic library"install dylib /path/to/library.dylib"
Open URLOpens a URL in the simulator"open url https://example.com"
Clear keychainClears the simulator's keychain"clear keychain"
Set locationSets the simulator's location"set location 37.7749, -122.4194"
Add mediaAdds media to the camera roll"add media /path/to/image.jpg"
Approve permissionsApproves app permissions"approve permissions com.example.app photos camera"
Update contactsUpdates contacts database"update contacts /path/to/contacts.sqlite"

The interface supports all commands available in the idb CLI tool for comprehensive iOS simulator automation.

๐Ÿ” Architecture

The server consists of three main components:

  1. IDBManager: Low-level component interacting with iOS simulators via idb.
  2. NLParser: Interprets natural language instructions to structured commands.
  3. MCPOrchestrator: Coordinates the parser and IDBManager interactions.

These components connect through adapters:

  • ParserToOrchestrator: Converts parser results into orchestrator commands.
  • OrchestratorToIDB: Translates orchestrator commands into IDBManager calls.

๐Ÿ”Œ MCP Integration

To use this server with the Model Context Protocol:

  1. Add the server to your MCP settings:
{
  "mcpServers": {
    "ios-simulator": {
      "command": "node",
      "args": ["/path/to/mcp-server-simulator-ios-idb/dist/index.js"],
      "env": {}
    }
  }
}
  1. Connect to the server in your LLM application:
const result = await useMcpTool({
  serverName: "ios-simulator",
  toolName: "process-instruction",
  arguments: {
    instruction: "create simulator session"
  }
});

๐Ÿ™ Acknowledgments

This project is based on facebook/idb, providing iOS simulator control capabilities. Thanks to the Facebook/Meta team and all contributors for their work on this powerful tool.

๐Ÿ“„ License

This tool is open source under the Apache-2.0 license.