Skip to main content
Glama

Simulator MCP

Ermöglicht es der KI, iOS-Simulatoren über das MCP-Protokoll zu steuern – Geräte starten, Screenshots erstellen, tippen, Text eingeben, Netzwerkverkehr abfangen und Schnittstellen mocken.

Funktionsübersicht

Kategorie

Werkzeug

Beschreibung

Geräteverwaltung

list_devices

Listet alle Simulatoren auf (Status, UDID, Runtime)

boot_device / shutdown_device

Startet / Stoppt den Simulator

install_app

Installiert ein .app-Paket

launch_app

Startet eine APP (unterstützt proxy=true für Netzwerk-Interzeption)

open_url

Öffnet eine URL oder einen Deep Link (wählt automatisch den gestarteten Simulator aus)

Screenshots

take_screenshot

Erstellt einen Screenshot und sendet ihn als Base64-Bild an die KI (unterstützt visuelle Analyse)

UI-Interaktion

tap

Tippt auf bestimmte iOS-Koordinaten (unterstützt langes Drücken via duration)

swipe

Wischt vom Start- zum Endpunkt

input_text

Gibt Text in das aktuell fokussierte Eingabefeld ein

press_button

Drückt Hardware-Tasten (home / lock / siri)

get_ui_hierarchy

Ruft den UI-Accessibility-Baum ab (JSON-Format)

tap_element

Sucht Elemente anhand von Text und tippt auf deren Mittelpunkt

Netzwerk-Interzeption

start_network_proxy

Startet den mitmproxy (Standard-Port 8080)

stop_network_proxy

Stoppt den Proxy

get_network_log

Zeigt aufgezeichnete Netzwerkprotokolle an (unterstützt Filterung nach URL, Methode)

add_mock_rule

Fügt eine Mock-Regel hinzu (URL-Regex-Matching)

remove_mock_rule

Entfernt eine Mock-Regel

Insgesamt 18 Werkzeuge, die die drei Bereiche Geräteverwaltung, UI-Automatisierung und Netzwerk-Interzeption abdecken.

Related MCP server: Shotter

Voraussetzungen

Abhängigkeit

Zweck

Installationsmethode

Xcode

Stellt den Befehl xcrun simctl bereit

Mac App Store

idb-companion

Native Daemon für fb-idb (UI-Automatisierung)

brew install idb-companion

Python >= 3.11

Laufzeitumgebung

brew install python@3.11 oder höher

uv (empfohlen)

Paketverwaltung

brew install uv

Das im Repository enthaltene proxy-dylib/libproxy_inject.dylib ist ein arm64-Prebuild; für Intel-Macs muss es selbst für x86_64 oder als Universal-Binary neu kompiliert werden.

Installation

cd simulator-mcp

# 方式一:uv(推荐)
uv venv && uv pip install -e .

# 方式二:pip
python -m venv .venv && source .venv/bin/activate && pip install -e .

Python-Abhängigkeiten (automatische Installation):

  • mcp >= 1.0 — MCP-Protokoll-SDK (stdio JSON-RPC)

  • mitmproxy >= 10.0 — HTTP(S)-Proxy

  • fb-idb — iOS-Simulator-UI-Automatisierung

Konfiguration für Claude Code

Fügen Sie dies in ~/.claude.json unter mcpServers hinzu:

{
  "mcpServers": {
    "simulator": {
      "command": "/path/to/simulator-mcp/.venv/bin/simulator-mcp"
    }
  }
}

Konfiguration für Claude Desktop

Fügen Sie dies in ~/Library/Application Support/Claude/claude_desktop_config.json hinzu:

{
  "mcpServers": {
    "simulator": {
      "command": "/path/to/simulator-mcp/.venv/bin/simulator-mcp"
    }
  }
}

Ersetzen Sie /path/to/simulator-mcp durch den absoluten Pfad zum Projekt.

Anwendungsbeispiel

Nach der Konfiguration kann die KI den Simulator direkt steuern:

用户: 打开模拟器,截图看看当前页面
AI:  调用 list_devices → boot_device → take_screenshot
     "当前页面显示的是 iOS 主屏幕..."

用户: 打开微博,点击注册按钮
AI:  调用 launch_app → take_screenshot → tap_element(text="注册")
     "已点击注册按钮,进入了注册页面"

用户: 抓包看看注册接口返回了什么
AI:  调用 start_network_proxy → launch_app(proxy=true) → get_network_log(url_pattern="register")
     "注册接口返回了 200,响应体是..."

用户: Mock 掉登录接口,返回自定义数据
AI:  调用 add_mock_rule(url_pattern="api/login", response_body='{"token":"fake"}')
     "已添加 Mock 规则 mock_1"

Hinweise zum Netzwerk-Sniffing

Ablauf

  1. Proxy starten: start_network_proxy(port=8080)

    • Startet mitmproxy automatisch in einem Hintergrund-Thread

    • Falls bereits ein Simulator gestartet ist, wird versucht, das mitmproxy-CA-Zertifikat zu installieren

  2. APP mit Proxy starten: launch_app(udid="xxx", bundle_id="com.example.app", proxy=true)

    • Injiziert libproxy_inject.dylib via DYLD_INSERT_LIBRARIES

    • Swizzelt NSURLSessionConfiguration, um den gesamten HTTP(S)-Verkehr an den Proxy weiterzuleiten

    • Installiert das CA-Zertifikat erneut auf dem Ziel-Simulator, um HTTPS-Fehler zu vermeiden, falls der Proxy nach dem Simulator gestartet wurde

  3. Anfragen anzeigen/mocken:

    • get_network_log(url_pattern="api/user") — Filterung nach URL-Teilstring

    • add_mock_rule(url_pattern="api/login", response_body="...") — URL-Regex-Matching

Technische Grundlagen

App 启动 → dylib 注入 → swizzle NSURLSessionConfiguration
  → 所有 NSURLSession 流量 → mitmproxy (127.0.0.1:8080)
    → MockEngine 检查规则 → 命中则返回假数据 / 未命中则转发真实服务器
    → NetworkLog 记录请求/响应(内存环形缓冲,最多 1000 条)
    → 同时落盘:
      - `/tmp/proxy_requests.log`:摘要日志
      - `/tmp/proxy_requests.jsonl`:结构化明细日志
      - `/tmp/proxy_request_bodies/`:超大 body 的分流文件

Projektstruktur

simulator-mcp/
├── pyproject.toml                 # 项目配置、依赖、入口定义
├── README.md                      # 本文件
├── ARCHITECTURE.md                # 技术架构详细文档
├── diagrams/                      # Mermaid 源文件 + PNG 架构图
├── proxy-dylib/
│   ├── proxy_inject.m             # DYLD 注入源码 (Objective-C, 95 行)
│   └── libproxy_inject.dylib      # 编译产物 (当前为 arm64)
└── src/simulator_mcp/
    ├── __init__.py                # 入口: main() → asyncio.run(server.main())
    ├── __main__.py                # python -m simulator_mcp 入口
    ├── server.py                  # MCP Server: 18 个工具注册 + call_tool 分发
    ├── simulator/
    │   ├── simctl.py              # xcrun simctl 异步封装 (设备管理 + 截图)
    │   └── idb_client.py          # fb-idb 异步封装 (UI 交互 + tap_element)
    ├── tools/
    │   ├── device.py              # 设备管理工具 (参数解析 + proxy 注入逻辑)
    │   ├── screenshot.py          # 截图工具 (PNG → base64)
    │   ├── ui.py                  # UI 交互工具 (参数解析 → idb_client)
    │   └── network.py             # 网络工具 (参数解析 → proxy_server)
    └── proxy/
        ├── proxy_server.py        # mitmproxy 生命周期 + ProxyAddon + CA 证书安装
        ├── network_log.py         # 请求日志: 内存环形缓冲 + 结构化落盘
        └── mock_engine.py         # Mock 规则引擎: 正则匹配, 首条命中

Dylib neu kompilieren (optional)

Falls proxy_inject.m geändert wurde:

cd proxy-dylib
clang -dynamiclib -framework Foundation \
  -arch arm64 -arch x86_64 \
  -o libproxy_inject.dylib \
  proxy_inject.m

Architektur-Dokumentation

Das detaillierte technische Architekturdesign finden Sie unter ARCHITECTURE.md.

F
license - not found
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to automate iOS Simulator interactions including device management, UI element interaction (tap, swipe, type), screenshot capture, and execution of YAML-defined navigation workflows.
    2
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    An MCP server that provides comprehensive tools for managing iOS simulators, including device control, app lifecycle management, and UI automation. It enables developers to boot devices, install apps, capture screenshots, and simulate user interactions through natural language commands.
    3
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent

  • Live browser debugging for AI assistants — DOM, console, network via MCP.

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/992429169/simulator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server