MCP HubMCP Hub
atom2ueki

mcp-server-ios-simulator

by: atom2ueki

Model Context Protocol (MCP) implementation for iOS simulators

18created 07/03/2025
Visit
iOS
Protocol

πŸ“ŒOverview

Purpose: To provide a standardized communication layer between iOS simulators and the Model Context Protocol (MCP), enabling programmatic control of simulators.

Overview: This framework is designed to bridge the gap between iOS simulators and the MCP, utilizing the appium-ios-simulator and MCP TypeScript SDK. By leveraging stdio for communication, it allows seamless integration with MCP-compatible clients, such as Claude Desktop.

Key Features:

  • Simulator Management: Start, stop, and manage multiple iOS simulator instances easily.
  • Application Control: Install, launch, and terminate applications on simulators, with capabilities to take screenshots and perform user interactions.

πŸ“± MCP Server for iOS Simulator

A server that implements the Model Context Protocol (MCP) for iOS simulators, built on top of appium-ios-simulator and utilizing the MCP TypeScript SDK.

πŸ“‹ Overview

This project provides a bridge between iOS simulators and the Model Context Protocol, enabling standardized communication and programmatic control of iOS simulators. It uses stdio as its transport mechanism, making it ideal for integration with Claude Desktop and other MCP-compatible clients.

πŸ—οΈ Architecture

The server consists of three main components:

  1. Simulator Management Layer - Handles iOS simulator lifecycle and interactions
  2. MCP Protocol Implementation - Implements the Model Context Protocol using the TypeScript SDK with stdio transport
  3. Logger Component - Provides file-based logging without interfering with the stdio transport
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MCP Protocol   β”‚     β”‚     Stdio       β”‚     β”‚    Simulator    β”‚
β”‚  Implementation │◄─────    Transport    │◄─────   Management    β”‚
β”‚                 β”‚     β”‚                 β”‚     β”‚      Layer      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β–²                                                β–²
        β”‚                                                β”‚
        β–Ό                                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MCP Client    β”‚                             β”‚  iOS Simulator  β”‚
β”‚  (e.g. Claude)  β”‚                             β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

  • Start, stop, and manage iOS simulator instances
  • Boot and shutdown simulators
  • Install and launch applications on simulators
  • Take screenshots of simulator screens
  • Perform taps on coordinates
  • Support for multiple concurrent simulator sessions
  • Comprehensive file-based logging without console output
  • Error-resilient operation

πŸ“‹ Prerequisites

  • Node.js (v16 or later)
  • macOS (required for iOS simulators)
  • Xcode with iOS simulators installed
  • TypeScript 4.5+

πŸ”§ Installation

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

# Install dependencies
npm install

βš™οΈ Configuration

Configure via the src/config.ts file:

const config = {
  simulator: {
    defaultDevice: process.env.SIMULATOR_DEFAULT_DEVICE || 'iPhone 16',
    defaultOS: process.env.SIMULATOR_DEFAULT_OS || '18.2',
    timeout: parseInt(process.env.SIMULATOR_TIMEOUT || '30000', 10),
  }
};

Set environment variables to customize:

SIMULATOR_DEFAULT_DEVICE=iPhone 16
SIMULATOR_DEFAULT_OS=18.2
SIMULATOR_TIMEOUT=30000

πŸš€ Usage

Building and Starting the Server

# Build the project
npm run build

# Start the server
npm start

MCP Tools

The server offers two approaches for controlling iOS simulators:

Direct Simulator Management (Recommended)

Works directly with simulator UDIDs, no sessions needed:

  • list-available-simulators β€” List all available simulators with UDIDs
  • boot-simulator-by-udid β€” Boot a simulator using its UDID
  • shutdown-simulator-by-udid β€” Shutdown a simulator using its UDID
  • list-booted-simulators β€” List all currently booted simulators

Use this to boot, use, and shut down simulators directly.

Session-Based Management (Advanced)

Uses a session layer with custom session IDs:

  • list-simulator-sessions β€” List all active sessions
  • create-simulator-session β€” Create a new session
  • terminate-simulator-session β€” Terminate a session (shuts down and cleans up)
  • create-and-boot-simulator β€” Create session and boot it
  • boot-simulator β€” Boot simulator for a session
  • shutdown-simulator β€” Shutdown simulator for a session

Use this when tracking metadata or managing simulators by custom IDs.

Application Management

  • install-app β€” Install an app on a simulator
  • launch-app β€” Launch an app on a simulator
  • terminate-app β€” Terminate a running app on a simulator

Interaction Tools

  • take-screenshot β€” Take a screenshot of the simulator screen
  • tap-coordinate β€” Perform a tap at specified coordinates

Example Usage with Claude Desktop

  1. Configure Claude Desktop with this server as an MCP tool, specifying the command and path to dist/index.js.
  2. Control iOS simulators directly from Claude Desktop via:

Direct UDID Approach (Recommended):

  • "Show me all available iOS simulators"
  • "Boot the iOS simulator with UDID "
  • "Shut down the simulator with UDID "

Session-Based Approach (Advanced):

  • "Create a new simulator session for iPhone 16 Pro with iOS 18.2"
  • "Boot the simulator for session "
  • "Take a screenshot of the simulator for session "
  • "Terminate the simulator session "

πŸ‘¨β€πŸ’» Development

Project Structure

src/
β”œβ”€β”€ simulator/       # Simulator management layer
β”œβ”€β”€ mcp/             # MCP protocol implementation
β”œβ”€β”€ bridge/          # Bridge component
β”œβ”€β”€ utils/           # Utility functions including logger
β”œβ”€β”€ config.ts        # Configuration handling
└── index.ts         # Entry point

Building the Project

# Install dependencies
npm install

# Build
npm run build

πŸ“œ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments