ios-sim-mcp

ios-sim-mcp

A Model Context Protocol (MCP) server for iOS Simulator automation. Enables AI assistants to visually interact with iOS apps running in the simulator.

Category
访问服务器

README

ios-sim-mcp

A Model Context Protocol (MCP) server for iOS Simulator automation. Enables AI assistants to visually interact with iOS apps running in the simulator.

How It Works

This MCP server wraps Facebook's idb (iOS Development Bridge) to provide isolated, headless control of iOS simulators. Unlike approaches that control your mouse/keyboard, idb injects touch events directly into the simulator:

  • Runs in the background - doesn't take over your screen
  • Isolated - you can use your computer while it runs
  • Reliable - uses the same infrastructure Facebook uses for testing

Requirements

  • macOS (iOS Simulator only runs on Mac)
  • Xcode with iOS Simulator installed
  • Node.js 18+
  • idb (install via steps below)

Installing idb

# Install idb-companion (the daemon)
brew tap facebook/fb
brew install idb-companion

# Install idb (the Python CLI client)
pip3 install fb-idb

Installation

Option 1: Install from npm (recommended)

npm install -g ios-sim-mcp

Option 2: Clone and build

git clone https://github.com/artmamedov/ios-sim-mcp.git
cd ios-sim-mcp
npm install
npm run build

Usage with Claude Code

claude mcp add ios-sim -s user -- npx ios-sim-mcp

Or if installed from source:

claude mcp add ios-sim -s user -- node /path/to/ios-sim-mcp/dist/index.js

Coordinate System

All coordinates are in POINTS, not pixels.

  • Points are device-independent units used by iOS
  • Use get_screen_size to get both pixel and point dimensions
  • Use describe_screen to get element coordinates in points
  • Common sizes: iPhone 17 Pro is 393x852 points

Common Workflows

1. Getting Started

list_simulators              → Find available simulators and their UDIDs
boot_simulator(udid)         → Boot the simulator you want
screenshot                   → Verify it's running, see the screen

2. Finding and Tapping UI Elements

# Option A: Search by label (recommended)
find_elements(label: "Sign In")  → Returns elements with matching labels
tap_element(label: "Sign In")    → Find and tap in one step

# Option B: Use coordinates from accessibility tree
describe_screen              → Get all elements with their frame coordinates
tap(x: 196, y: 425)          → Tap at the element's center

3. Filling Out Forms

tap_element(label: "Email")      → Focus the email field
type_text(text: "user@test.com") → Type the email
press_key(key: "tab")            → Move to next field
type_text(text: "password123")   → Type the password
tap_element(label: "Submit")     → Submit the form

4. Scrolling and Navigation

# Scroll down (swipe up)
swipe(startX: 200, startY: 600, endX: 200, endY: 200)

# Scroll up (swipe down)
swipe(startX: 200, startY: 200, endX: 200, endY: 600)

# Go back to home screen
press_button(button: "home")

5. Testing Deep Links

open_url(url: "myapp://profile/settings")  → Open custom URL scheme
screenshot                                  → Verify the right screen loaded

Available Tools

Simulator Management

Tool Description Returns
list_simulators List all iOS simulators with state Array: [{name, udid, state, type, os_version}]
boot_simulator Boot simulator by UDID Confirmation string
shutdown_simulator Shutdown simulator Confirmation string

Visual Feedback

Tool Description Returns
screenshot Capture simulator screen Base64 PNG image
get_screen_size Get dimensions {pixels: {w,h}, points: {w,h}, scale}

UI Discovery

Tool Description Returns
describe_screen Get all UI elements Array: [{type, label, value, frame, enabled}]
describe_point Get element at coordinates Element info string
find_elements Search elements by label Array of matching elements

Interactions

Tool Description Returns
tap Tap at x,y coordinates (points) Confirmation string
tap_element Find element by label and tap it Confirmation with coordinates
swipe Swipe between two points Confirmation string
type_text Type into focused field Confirmation string
press_key Press keyboard key (enter, delete, tab, escape) Confirmation string
press_button Press device button (home, lock, siri, apple_pay) Confirmation string

App Management

Tool Description Returns
list_apps List installed apps App list with bundle IDs
launch_app Launch app by bundle ID Confirmation string
terminate_app Terminate running app Confirmation string
open_url Open URL (http or custom scheme) Confirmation string

Element Discovery

The describe_screen tool returns UI elements in this format:

[
  {
    "type": "Button",
    "label": "Sign In",
    "value": null,
    "frame": {"x": 147, "y": 400, "width": 100, "height": 50},
    "enabled": true
  },
  {
    "type": "TextField",
    "label": "Email",
    "value": "",
    "frame": {"x": 20, "y": 200, "width": 353, "height": 44},
    "enabled": true
  }
]

To tap an element, calculate its center:

  • centerX = frame.x + frame.width / 2
  • centerY = frame.y + frame.height / 2

Or use tap_element which does this automatically.

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   Claude/LLM    │────▶│  ios-sim-mcp    │────▶│  idb companion  │
│                 │ MCP │  (this server)  │ CLI │  (Facebook's)   │
└─────────────────┘     └─────────────────┘     └────────┬────────┘
                                                         │
                                                         ▼
                                                ┌─────────────────┐
                                                │  iOS Simulator  │
                                                │  (Xcode)        │
                                                └─────────────────┘

Configuration

The server looks for idb in these locations:

  1. IDB_PATH environment variable (if set)
  2. ~/Library/Python/3.9/bin/idb
  3. /opt/homebrew/bin/idb
  4. /usr/local/bin/idb
  5. System PATH

Troubleshooting

"No booted simulator found"

Use list_simulators to find available simulators, then boot_simulator with the UDID.

"idb not found"

Install idb: pip3 install fb-idb

"No Companion Connected"

The idb companion usually starts automatically. If issues persist:

idb_companion --udid <simulator-udid>

Tap not hitting the right element

  1. Coordinates must be in points, not pixels
  2. Use describe_screen to get exact element frames
  3. Use tap_element with the element's label for more reliable tapping

Element not found by label

  1. Use describe_screen to see all available labels
  2. Labels are case-insensitive partial matches
  3. Some elements may not have accessibility labels set

License

MIT

Credits

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选