xcode工作室mcp
Xcode+iOS模拟器的统一MCP服务器 --从构建、部署、截图和与iOS应用程序交互 克劳德代码, 法典, 光标或任何MCP客户端。
内置Swift。单二进制。不需要Node/Python运行时。
  
为什么存在
今天,你需要2-3个单独的工具来使用AI代理完成完整的iOS开发循环。 xcode工作室mcp 将它们组合成一个:
Write code → Build → Deploy to Simulator → Screenshot → Tap/Type → Verify工具
| 工具 | 说明 |
|---|---|
xcode_build | 构建一个带有结构化错误输出(文件、行、列、严重性、消息)的Xcode项目 |
xcode_run | 在iOS模拟器中构建并启动应用程序 |
simulator_screenshot | 将模拟器屏幕捕获为PNG图像 |
simulator_tap | 在模拟器屏幕上点击x、y坐标 |
simulator_type | 在当前关注的字段中键入文本 |
simulator_describe | 获取当前屏幕的可访问性树(JSON) |
刀具参数
xcode_build
| 参数 | 必填 | 说明 |
|---|---|---|
project_path | Yes | Xcode项目目录路径, .xcodeproj,或 .xcworkspace |
scheme | 否 | 构建方案(如果省略,则自动检测) |
configuration | 没有 | Debug (默认)或 Release |
destination | 否 | 构建目标(默认为已启动的模拟器) |
xcode_run
| 参数 | 必填 | 说明 |
|---|---|---|
project_path | 是 | Xcode项目的路径 |
bundle_identifier | 是 | 应用包ID(例如。 com.example.MyApp) |
scheme | 否 | 构建方案(自动检测) |
simulator_udid | 否 | 目标模拟器(默认启动) |
simulator_screenshot
| 参数 | 必填 | 说明 |
|---|---|---|
simulator_udid | 否 | 目标模拟器(默认启动) |
simulator_tap
| 参数 | 必填 | 说明 |
|---|---|---|
x | 是 | X坐标 |
y | 是 | Y坐标 |
duration | 否 | 保持时间(秒)(长按) |
simulator_udid | 否 | 目标模拟器 |
simulator_type
| 参数 | 必填 | 说明 |
|---|---|---|
text | 是 | 要键入的文本 |
simulator_udid | 否 | 目标模拟器 |
simulator_describe
| 参数 | 必填 | 说明 |
|---|---|---|
simulator_udid | 否 | 目标模拟器 |
快速开始
先决条件
- 安装了Xcode的macOS
- 用于UI交互工具(
tap,type,describe):
brew tap facebook/fb && brew install idb-companion
pip3 install fb-idb构建
git clone https://github.com/kevinswint/xcode-studio-mcp.git
cd xcode-studio-mcp
swift build -c release配置Claude代码
添加到您的Claude Code MCP设置中:
{
"mcpServers": {
"xcode-studio-mcp": {
"command": "/path/to/xcode-studio-mcp/.build/release/XcodeStudioMCP"
}
}
}示例工作流程
You: Build and run my app at ~/Projects/MyApp
Claude: [calls xcode_build] Build succeeded with 0 errors
[calls xcode_run] App launched (PID 12345)
[calls simulator_screenshot] Here's what the app looks like...
[calls simulator_describe] I can see a "Sign In" button and email/password fields
[calls simulator_tap] Tapped the email field
[calls simulator_type] Typed "test@example.com"
[calls simulator_screenshot] Here's the current state...建筑
┌─────────────────────────────┐
│ MCP Protocol Layer │ stdio transport (Swift MCP SDK)
├─────────────────────────────┤
│ Tool Implementations │ 6 tools, structured error output
├──────────┬──────────────────┤
│ xcodebuild│ simctl │ idb │ native process calls
│ wrapper │ wrapper │ CLI │
└──────────┴──────────┴──────┘内置Swift,无Node/Python运行时依赖关系(仅UI交互工具需要idb CLI)。
路线图
- v0.1 (当前):核心构建+模拟器工具
- v1.0:语义UI导航(“点击登录按钮”)、视觉差异、Xcode项目文件操作、复合操作、SwiftUI预览捕获
相关项目
| 项目 | 它做什么 | 区别 |
|---|---|---|
| XcodeBuildMCP | 仅构建+测试 | 无模拟器UI交互 |
| 移动mcp | 跨平台模拟器UI | 不支持Xcode构建 |
| ios模拟器mcp | 通过IDB进行模拟器 | 无需构建,一切都依赖于IDB |
xcode工作室mcp 组合构建 _和_ 与单个服务器交互。
贡献
PR欢迎。代码库是大约750行Swift代码,分为工具、服务和模型。
许可证
麻省理工学院
