iOS Simulator MCP Server

iOS Simulator MCP Server

site icon
2025.04.18 193
JavaScriptiOS模拟器质量保证UI测试开发效率
iOS Simulator MCP Server 是一个用于与iOS模拟器交互的Model Context Protocol (MCP)服务器。它允许用户获取模拟器信息、控制UI交互以及检查UI元素。该工具特别适用于质量保证(QA)步骤,确保UI一致性和正确行为。
View on GitHub

Overview

基本能力

产品定位

iOS Simulator MCP Server 是一个用于与iOS模拟器交互的工具,主要用于开发和质量保证(QA)场景。

核心功能

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

适用场景

  • 质量保证(QA)步骤,用于验证UI一致性和正确行为
  • 开发过程中快速验证UI交互
  • 自动化测试

工具列表

  • screenshot: 截取模拟器屏幕截图
  • record_video: 录制模拟器屏幕视频
  • stop_recording: 停止录制

常见问题解答

  1. 如何过滤特定工具?
  2. 使用环境变量 IOS_SIMULATOR_MCP_FILTERED_TOOLS,例如:screenshot,record_video,stop_recording

  3. 如何验证UI元素?

  4. 使用命令 Verify all accessibility elements on the current screen

  5. 如何输入文本?

  6. 使用命令 Enter "QA Test" into the text input field and confirm the input is correct

使用教程

使用依赖

  • Node.js
  • macOS(iOS模拟器仅在macOS上可用)
  • Xcode 和 iOS模拟器
  • Facebook IDB 工具

安装IDB工具的命令:

brew tap facebook/fb
brew install facebook/fb/idb-companion

安装教程

选项1:使用NPX(推荐)

  1. 编辑Cursor MCP配置:
cursor ~/.cursor/mcp.json
  1. 添加iOS模拟器服务器配置:
{
  "mcpServers": {
    "ios-simulator": {
      "command": "npx",
      "args": ["-y", "ios-simulator-mcp"]
    }
  }
}
  1. 重启Cursor。

选项2:本地开发

  1. 克隆仓库:
git clone https://github.com/joshuayoes/ios-simulator-mcp
cd ios-simulator-mcp
  1. 安装依赖:
npm install
  1. 构建项目:
npm run build
  1. 编辑Cursor MCP配置:
cursor ~/.cursor/mcp.json
  1. 添加iOS模拟器服务器配置:
{
  "mcpServers": {
    "ios-simulator": {
      "command": "node",
      "args": ["/path/to/your/ios-simulator-mcp/build/index.js"]
    }
  }
}
  1. 重启Cursor。

调试方式

  1. 验证模拟器是否启动:
xcrun simctl list
  1. 验证IDB工具是否安装:
idb --version
  1. 验证MCP服务器是否运行:
ps aux | grep ios-simulator-mcp

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。