Token导航 LogoToken导航TokenDH.com
Iossim MCP logo
开发工具未说明官方级别未说明来源级核验

Iossim MCP

MCP Server

iossim-mcp是一个通过XCUITest控制iOS模拟器应用的MCP(Model Context Protocol)服务器,提供模拟器控制、应用管理、UI自动化等功能。

工具数

0

提示词数

0

GitHub Stars

4

资源数

0
Swift自动化测试ClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

hiragram

提供方

hiragram

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

iossim mcp

一个MCP(模型上下文协议)服务器,用于通过XCUITest控制iOS模拟器应用程序。

特性

  • 模拟器控制:启动、关闭和管理iOS模拟器
  • 应用程序管理:在模拟器上启动和终止应用程序
  • UI自动化:在引擎盖下使用XCUITest点击、滑动、键入文本
  • 截图:捕获模拟器屏幕截图
  • 无需修改应用程序:使用可以控制任何应用程序的通用XCUITest驱动程序

需求

  • macOS 14.0+
  • Xcode 26.0+(带iOS模拟器)
  • Swift 6.2+

安装

使用swx(推荐)

添加到MCP配置中:

{
  "mcpServers": {
    "iossim": {
      "command": "swx",
      "args": ["hiragram/iossim-mcp"]
    }
  }
}

可用工具

模拟器控制

工具说明
list_simulators列出所有可用的iOS模拟器
boot_simulator通过UDID启动iOS模拟器
shutdown_simulator通过UDID关闭iOS模拟器

应用程序管理

工具说明
launch_app在模拟器上启动应用程序
terminate_app在模拟器上终止应用程序

UI自动化

工具说明
tap通过可访问性标识符或标签点击元素
type_text在元素或焦点字段中键入文本
swipe向上/下/左/右方向滑动
run_ui_script运行一系列UI操作

截图

工具说明
take_screenshot截取模拟器的屏幕截图

使用示例

列出可用模拟器

{
  "tool": "list_simulators"
}

启动模拟器并启动应用程序

{
  "tool": "boot_simulator",
  "arguments": {
    "udid": "DF27CC78-36A5-44D0-AF24-60555158BDB8"
  }
}
{
  "tool": "launch_app",
  "arguments": {
    "bundleId": "com.example.myapp"
  }
}

点击按钮

{
  "tool": "tap",
  "arguments": {
    "bundleId": "com.example.myapp",
    "identifier": "login_button"
  }
}

在字段中键入文本

{
  "tool": "type_text",
  "arguments": {
    "bundleId": "com.example.myapp",
    "text": "hello@example.com",
    "identifier": "email_field"
  }
}

执行一系列操作

{
  "tool": "run_ui_script",
  "arguments": {
    "bundleId": "com.example.myapp",
    "actions": [
      { "type": "tap", "target": { "type": "identifier", "value": "email_field" } },
      { "type": "typeText", "text": "user@example.com" },
      { "type": "tap", "target": { "type": "identifier", "value": "password_field" } },
      { "type": "typeText", "text": "secretpassword" },
      { "type": "tap", "target": { "type": "identifier", "value": "login_button" } },
      { "type": "waitForElement", "target": { "type": "identifier", "value": "home_screen" }, "timeout": 10 }
    ]
  }
}

动作类型 run_ui_script

操作属性
taptarget (必填)
typeTexttext (必填), target (可选)
swipedirection (必填:上/下/左/右), target (可选)
longPresstarget (必填), duration (可选,秒)
waitForElementtarget (必填), timeout (可选,秒)
assertExiststarget (必填)
screenshotoutputPath (可选)

目标规范

// By accessibility identifier
{ "type": "identifier", "value": "my_button" }

// By label text
{ "type": "label", "value": "Submit" }

// By screen coordinates
{ "type": "coordinate", "x": 100, "y": 200 }

建筑

┌─────────────────────────────────────────────────────────────┐
│                      MCP Client (Claude, etc.)              │
└─────────────────────────────────────────────────────────────┘
                              │ stdio
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     iossim-mcp (executable)                  │
│  - MCP Server (modelcontextprotocol/swift-sdk)              │
│  - Tool handlers                                             │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     Core (library)                           │
│  - SimulatorController: simctl wrapper                       │
│  - UITestDriver: xcodebuild test-without-building            │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│              SimDriverUITests (bundled XCUITest)             │
│  - Generic test driver                                       │
│  - Reads JSON script, executes XCUITest actions              │
│  - Writes results to JSON                                    │
└─────────────────────────────────────────────────────────────┘

发展

运行测试

swift test

重建UITest驱动程序

如果你修改 SimDriverHost/SimDriverUITests/DriverTests.swift:

cd SimDriverHost
xcodebuild -project SimDriverHost.xcodeproj \
  -scheme SimDriverUITests \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
  build-for-testing

# Copy the built artifacts
cp -R ~/Library/Developer/Xcode/DerivedData/SimDriverHost-*/Build/Products/Debug-iphonesimulator/SimDriverUITests-Runner.app \
  ../Sources/iossim-mcp/Resources/

cp ~/Library/Developer/Xcode/DerivedData/SimDriverHost-*/Build/Products/*.xctestrun \
  ../Sources/iossim-mcp/Resources/

许可证

麻省理工学院

贡献

欢迎投稿!请打开问题或提交拉取请求。

目录标签

目录标签

Swift自动化测试Claude本地部署iOS模拟器XCUITestUI自动化应用管理

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP