Skip to main content
Glama

iOS 模拟器 MCP 服务器

NPM 版本

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

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

特征

  • 获取当前启动的iOS模拟器的ID

  • 与模拟器 UI 交互:

    • 描述屏幕上的所有无障碍元素

    • 点击屏幕坐标

    • 输入文本

    • 在坐标之间滑动

    • 获取特定坐标处的 UI 元素的信息

    • 截取模拟器屏幕的屏幕截图

  • 使用环境变量过滤特定工具

Related MCP server: iOS simulators MCP

配置

环境变量

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

💡 用例:通过 MCP 工具调用进行 QA 步骤

此 MCP 服务器允许集成模型上下文协议 (MCP) 客户端的 AI 助手通过调用工具来执行质量保证任务。此功能在功能实现后立即可用,有助于确保 UI 一致性和正确行为。

如何使用

功能实现后,请在 MCP 客户端环境中指导您的 AI 助手使用可用的工具。例如,在 Cursor 的代理模式下,您可以使用以下提示快速验证和记录 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

先决条件

安装

本节提供将 iOS 模拟器 MCP 服务器与不同的模型上下文协议 (MCP) 客户端集成的说明。

使用光标安装

Cursor 通过位于~/.cursor/mcp.json配置文件来管理 MCP 服务器。

选项 1:使用 NPX(推荐)

  1. 编辑 Cursor MCP 配置文件。您可以直接从 Cursor 打开它,或者使用以下命令:

    # Open with your default editor (or use 'code', 'vim', etc.) open ~/.cursor/mcp.json # Or use Cursor's command if available # cursor ~/.cursor/mcp.json
  2. 使用 iOS 模拟器服务器配置添加或更新mcpServers部分:

    { "mcpServers": { // ... other servers might be listed here ... "ios-simulator": { "command": "npx", "args": ["-y", "ios-simulator-mcp"] } } }

    确保 JSON 结构有效,尤其是当mcpServers已经存在时。

  3. 重新启动 Cursor 以使更改生效。

选项 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 配置文件(如选项 1 所示)。

  5. 添加或更新mcpServers部分,指向您的本地构建:

    { "mcpServers": { // ... other servers might be listed here ... "ios-simulator": { "command": "node", "args": ["/full/path/to/your/ios-simulator-mcp/build/index.js"] } } }

    **重要提示:**将/full/path/to/your/替换为您克隆ios-simulator-mcp存储库的绝对路径。

  6. 重新启动 Cursor 以使更改生效。

与 Claude Code 一起安装

Claude Code CLI 可以使用claude mcp命令或直接编辑其配置文件来管理 MCP 服务器。有关 Claude Code MCP 配置的更多详细信息,请参阅官方文档

选项 1:使用 NPX(推荐)

  1. 使用claude mcp add命令添加服务器:

    claude mcp add ios-simulator --command npx --args "-y,ios-simulator-mcp"

    注意:

  2. 如有必要,重新启动任何正在运行的 Claude Code 会话。

选项 2:本地开发

  1. 克隆此存储库,安装依赖项,并按照 Cursor“本地开发”步骤 1-3 中所述构建项目。

  2. 使用claude mcp add命令添加服务器,指向您的本地构建:

    claude mcp add ios-simulator --command node --args "/full/path/to/your/ios-simulator-mcp/build/index.js"

    **重要提示:**将/full/path/to/your/替换为您克隆ios-simulator-mcp存储库的绝对路径。

  3. 如有必要,重新启动任何正在运行的 Claude Code 会话。

执照

麻省理工学院

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/joshuayoes/ios-simulator-mcp'

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