Xcode-Studio-MCP
xcode-studio-mcp
用于 Xcode + iOS 模拟器的统一 MCP 服务器 —— 可从 Claude Code、Codex、Cursor 或任何 MCP 客户端构建、部署、截图并与您的 iOS 应用进行交互。
使用 Swift 构建。单一二进制文件。无需 Node/Python 运行时。
为什么存在这个项目
目前,您需要 2-3 个独立的工具才能与 AI 代理完成完整的 iOS 开发循环。xcode-studio-mcp 将它们合而为一:
Write code → Build → Deploy to Simulator → Screenshot → Tap/Type → Verify工具
工具 | 描述 |
| 构建 Xcode 项目并输出结构化错误信息(文件、行、列、严重性、消息) |
| 在 iOS 模拟器中构建并启动应用 |
| 将模拟器屏幕捕获为 PNG 图像 |
| 在模拟器屏幕的 x,y 坐标处点击 |
| 在当前聚焦的字段中输入文本 |
| 获取当前屏幕的辅助功能树 (JSON) |
Related MCP server: xcforge
工具参数
xcode_build
参数 | 必需 | 描述 |
| 是 | Xcode 项目目录、 |
| 否 | 构建方案(如果省略则自动检测) |
| 否 |
|
| 否 | 构建目标(默认为已启动的模拟器) |
xcode_run
参数 | 必需 | 描述 |
| 是 | Xcode 项目路径 |
| 是 | 应用 Bundle ID(例如 |
| 否 | 构建方案(自动检测) |
| 否 | 目标模拟器(默认为已启动的) |
simulator_screenshot
参数 | 必需 | 描述 |
| 否 | 目标模拟器(默认为已启动的) |
simulator_tap
参数 | 必需 | 描述 |
| 是 | X 坐标 |
| 是 | Y 坐标 |
| 否 | 按住时长(秒,用于长按) |
| 否 | 目标模拟器 |
simulator_type
参数 | 必需 | 描述 |
| 是 | 要输入的文本 |
| 否 | 目标模拟器 |
simulator_describe
参数 | 必需 | 描述 |
| 否 | 目标模拟器 |
快速入门
先决条件
安装了 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 Code
添加到您的 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 预览捕获
相关项目
项目 | 功能 | 区别 |
仅构建 + 测试 | 无模拟器 UI 交互 | |
跨平台模拟器 UI | 无 Xcode 构建支持 | |
通过 IDB 控制模拟器 | 无构建功能,所有操作依赖 IDB |
xcode-studio-mcp 将构建和交互整合到了一个服务器中。
贡献
欢迎提交 PR。代码库约为 750 行 Swift 代码,组织为 Tools、Services 和 Models。
许可证
MIT
Available Tools
6 toolssimulator_describeA
Get the accessibility tree of the current iOS Simulator screen as JSON. Useful for finding UI elements to interact with. Requires idb (pip3 install fb-idb).
Inputs: simulator_udid.
simulator_screenshotA
Capture a screenshot of the iOS Simulator screen. Returns the image as base64-encoded PNG.
Inputs: simulator_udid.
simulator_tapA
Tap at specific coordinates on the iOS Simulator screen. Requires idb (pip3 install fb-idb).
Inputs: x (required), y (required), duration, simulator_udid.
simulator_typeA
Type text into the currently focused field on the iOS Simulator. Requires idb (pip3 install fb-idb).
Inputs: text (required), simulator_udid.
xcode_buildB
Build an Xcode project or workspace. Returns structured diagnostics with file, line, column, severity, and message for each error/warning.
Inputs: project_path (required), configuration, destination, scheme.
xcode_runA
Build an Xcode project and launch the app in the iOS Simulator. Returns build errors if the build fails, or a success message with the launched process ID.
Inputs: bundle_identifier (required), project_path (required), configuration, scheme, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct action: building, running, and simulator interactions (screenshot, tap, type, describe) are clearly separated. There is no overlap in purpose, making it easy for an agent to select the correct tool.
Tools are grouped into two clear namespaces: 'xcode_' for build/run and 'simulator_' for simulator interactions. However, the same verb 'run' is used for xcode_run (launch app) while the simulator tools use direct action verbs (tap, type, describe). The pattern is readable but not perfectly uniform.
With only 6 tools, the set is well-scoped for core Xcode build/run and simulator interaction workflows. Each tool serves a distinct purpose, and no tool feels redundant or missing at this scale.
The set covers building, running, and basic UI interaction (via describe/tap/type). A minor gap is the lack of a tool to terminate the running app, and no way to list available simulators, but agents can work around this for common tasks.
Maintenance
Related MCP Connectors
Cloud iPhones and Macs with Xcode for AI agents: build, run and test iOS apps, use the screen.
Cloud iPhone Simulators for AI agents: build the Xcode project, read the screen, tap by label, test.
The cloud Mac alone, with Xcode, for AI agents: run commands, build and test, use the screen.
Build, run, and inspect iOS apps in disposable hosted Simulators from cloud coding agents.
Related MCP Servers
AlicenseNot gradedqualityBmaintenanceHigh-performance MCP server for iOS development and test automation. Gives AI coding assistants direct access to iOS simulators with sub-20ms screenshots, UI interaction, building, testing, and an intelligent operator mode.10MIT- AlicenseNot gradedqualityBmaintenanceMCP server and CLI for iOS development — build, test, automate, and diagnose from any AI agent or terminal.2MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server for iOS Simulator automation. Enables AI assistants to visually interact with iOS apps running in the simulator.36 npm1MIT
- AlicenseBqualityCmaintenanceA comprehensive MCP server for iOS/macOS development that gives AI assistants full control over Xcode build, test, simulator management, and app deployment.6522 npm2MIT