Skip to main content
Glama
Xcode-Studio-MCP

Xcode-Studio-MCP

by kevinswint

xcode-studio-mcp

用于 Xcode + iOS 模拟器的统一 MCP 服务器 —— 可从 Claude Code、Codex、Cursor 或任何 MCP 客户端构建、部署、截图并与您的 iOS 应用进行交互。

使用 Swift 构建。单一二进制文件。无需 Node/Python 运行时。

License: MIT Swift 6.0+ MCP

为什么存在这个项目

目前,您需要 2-3 个独立的工具才能与 AI 代理完成完整的 iOS 开发循环。xcode-studio-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)

Related MCP server: xcforge

工具参数

xcode_build

参数

必需

描述

project_path

是

Xcode 项目目录、.xcodeproj 或 .xcworkspace 的路径

scheme

否

构建方案(如果省略则自动检测)

configuration

否

Debug(默认)或 Release

destination

否

构建目标(默认为已启动的模拟器)

xcode_run

参数

必需

描述

project_path

是

Xcode 项目路径

bundle_identifier

是

应用 Bundle 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 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 预览捕获

相关项目

项目

功能

区别

XcodeBuildMCP

仅构建 + 测试

无模拟器 UI 交互

mobile-mcp

跨平台模拟器 UI

无 Xcode 构建支持

ios-simulator-mcp

通过 IDB 控制模拟器

无构建功能,所有操作依赖 IDB

xcode-studio-mcp 将构建和交互整合到了一个服务器中。

贡献

欢迎提交 PR。代码库约为 750 行 Swift 代码,组织为 Tools、Services 和 Models。

许可证

MIT

Available Tools

6 tools
simulator_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

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    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.

    Naming Consistency3/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      High-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.
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server for iOS Simulator automation. Enables AI assistants to visually interact with iOS apps running in the simulator.
      36 npm
      1
      MIT