iOS Simulator MCP

by joshuayoes
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Integrates with Facebook's IDB tool to communicate with and control iOS simulators, enabling the MCP server to perform UI automation tasks.

  • Provides tools for interacting with iOS simulators, including getting simulator information, controlling UI interactions (tapping, swiping, text input), and inspecting UI elements for accessibility testing and automation.

  • Enables operation on macOS systems where iOS simulators run, providing simulator access and control capabilities specific to the macOS environment.

iOS 模拟器 MCP 服务器

用于与 iOS 模拟器交互的模型上下文协议 (MCP) 服务器。此服务器允许您通过获取 iOS 模拟器信息、控制 UI 交互以及检查 UI 元素来与它们交互。

https://github.com/user-attachments/assets/453ebe7b-cc93-4ac2-b08d-0f8ac8339ad3

特征

  • 获取当前启动的iOS模拟器的ID
  • 与模拟器 UI 交互:
    • 描述屏幕上的所有无障碍元素
    • 点击屏幕坐标
    • 输入文本
    • 在坐标之间滑动
    • 获取特定坐标处的 UI 元素的信息
    • 截取模拟器屏幕的屏幕截图
  • 使用环境变量过滤特定工具

配置

环境变量

  • IOS_SIMULATOR_MCP_FILTERED_TOOLS :以逗号分隔的工具名称列表,用于过滤已注册的工具。例如: screenshot,record_video,stop_recording

💡 用例:代理模式下的 QA 步骤

此 MCP 可在代理模式下有效使用,作为实现功能后立即执行的质量保证步骤,确保 UI 一致性和正确行为。

如何使用

功能实现后:

  1. 在 Cursor 中激活代理模式。
  2. 使用以下提示快速验证和记录 UI 交互。

示例提示

  • 验证 UI 元素:
    Verify all accessibility elements on the current screen
  • 确认文本输入:
    Enter "QA Test" into the text input field and confirm the input is correct
  • 检查点击响应:
    Tap on coordinates x=250, y=400 and verify the expected element is triggered
  • 验证滑动操作:
    Swipe from x=150, y=600 to x=150, y=100 and confirm correct behavior
  • 详细元素检查:
    Describe the UI element at position x=300, y=350 to ensure proper labeling and functionality
  • 截屏:
    Take a screenshot of the current simulator screen and save it to my_screenshot.png
  • 录制视频:
    Start recording a video of the simulator screen (saves to ~/Downloads/simulator_recording_$DATE.mp4 by default)
  • 停止录制:
    Stop the current simulator screen recording

先决条件

安装

选项 1:使用 NPX(推荐)

  1. 编辑您的 Cursor MCP 配置:
    cursor ~/.cursor/mcp.json
  2. 将 iOS 模拟器服务器添加到您的配置中:
    { "mcpServers": { "ios-simulator": { "command": "npx", "args": ["-y", "ios-simulator-mcp"] } } }
  3. 重新启动光标。

选项 2:本地开发

  1. 克隆此存储库:
    git clone https://github.com/joshuayoes/ios-simulator-mcp cd ios-simulator-mcp
  2. 安装依赖项:
    npm install
  3. 构建项目:
    npm run build
  4. 编辑您的 Cursor MCP 配置:
    cursor ~/.cursor/mcp.json
  5. 将 iOS 模拟器服务器添加到您的配置中:
    { "mcpServers": { "ios-simulator": { "command": "node", "args": ["/path/to/your/ios-simulator-mcp/build/index.js"] } } }
    "/path/to/your"替换为项目目录的实际路径。
  6. 重新启动光标。

执照

麻省理工学院

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

通过提供检查 UI 元素、控制 UI 交互以及通过自然语言命令管理模拟器的工具,实现与 iOS 模拟器的交互。

  1. Features
    1. Configuration
      1. Environment Variables
    2. 💡 Use Case: QA Step in Agent Mode
      1. How to Use
      2. Example Prompts
    3. Prerequisites
      1. Installation
        1. Option 1: Using NPX (Recommended)
        2. Option 2: Local Development
      2. License
        ID: 3478yhfp24