Skip to main content
Glama
kevinswint

Xcode-Studio-MCP

by kevinswint

xcode-studio-mcp

用于 Xcode + iOS 模拟器的统一 MCP 服务器 —— 可从 Claude CodeCodexCursor 或任何 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 交互工具(taptypedescribe):

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).

ParametersJSON Schema
NameRequiredDescriptionDefault
simulator_udidNoSimulator UDID. Default: first booted simulator

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It successfully discloses the external dependency (idb) and output format (JSON), but lacks disclosure of read-only safety, error conditions (e.g., simulator not running), or the structure of the returned accessibility tree.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with zero waste: first defines the core function, second explains the value proposition, third states the hard prerequisite. Perfectly front-loaded and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a single-parameter inspection tool, but lacks description of the JSON output structure since no output schema exists. Given the domain-specific nature of 'accessibility tree,' some description of the returned hierarchy or element properties would strengthen agent effectiveness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, fully documenting the simulator_udid parameter including its default behavior. The description does not explicitly discuss parameters, but the schema is self-sufficient, making the baseline score of 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action (Get), resource (accessibility tree), format (JSON), and scope (current iOS Simulator screen). It effectively distinguishes from siblings like simulator_screenshot (visual) and simulator_tap/type (interaction) by emphasizing UI element discovery.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides valuable prerequisite information ('Requires idb') and contextual usage guidance ('Useful for finding UI elements to interact with'), implying it should be used before tap/type operations. Could be improved by explicitly contrasting with simulator_screenshot for debugging strategies.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

simulator_screenshotA

Capture a screenshot of the iOS Simulator screen. Returns the image as base64-encoded PNG.

ParametersJSON Schema
NameRequiredDescriptionDefault
simulator_udidNoSimulator UDID. Default: first booted simulator

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It successfully discloses the critical behavioral trait of return format ('base64-encoded PNG') compensating for the missing output schema. Could mention whether this affects simulator state (it shouldn't) or requires specific permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero waste. First sentence states the action, second discloses return format. Perfectly front-loaded with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriately complete for a simple single-parameter tool. The description compensates for missing output schema by specifying the base64 PNG return format. Minor gap: doesn't specify error behavior if no simulator is booted.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. The description does not add parameter-specific semantics beyond the schema, but the schema already adequately documents the optional simulator_udid parameter with its default behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb ('Capture') + resource ('screenshot of the iOS Simulator screen'). Unambiguously distinguishes from siblings: unlike simulator_describe (metadata), simulator_tap/type (interactions), or xcode_build/run (compilation/execution), this tool specifically captures visual state.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the action (use when visual verification needed), but lacks explicit when-to-use guidance versus alternatives like simulator_describe, or prerequisites such as requiring a booted simulator.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

simulator_tapA

Tap at specific coordinates on the iOS Simulator screen. Requires idb (pip3 install fb-idb).

ParametersJSON Schema
NameRequiredDescriptionDefault
durationNoTap duration in seconds (for long press)
simulator_udidNoSimulator UDID. Default: first booted simulator
xYesX coordinate to tap
yYesY coordinate to tap

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It successfully discloses the external dependency (idb) and implies coordinate-based interaction, but fails to describe return values, error behaviors (e.g., out-of-bounds coordinates), or whether the operation is synchronous.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste: the first states the action immediately, and the second provides essential prerequisite information. Perfectly front-loaded and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter interaction tool with no output schema or annotations, the description covers the core function and dependency but lacks completeness regarding the coordinate system origin (0,0 location), return value structure, and error scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage, establishing a baseline of 3. The description mentions 'specific coordinates' which aligns with the x/y parameters, but adds no semantic detail beyond what the schema already provides regarding the duration or simulator_udid parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Tap') and target resource ('iOS Simulator screen'), distinguishing it effectively from siblings like simulator_screenshot (capture), simulator_type (text input), and xcode_build (compilation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides critical prerequisite information ('Requires idb') but lacks explicit guidance on when to use this tool versus alternatives like simulator_type, or when tapping is preferable to other interaction methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

simulator_typeA

Type text into the currently focused field on the iOS Simulator. Requires idb (pip3 install fb-idb).

ParametersJSON Schema
NameRequiredDescriptionDefault
simulator_udidNoSimulator UDID. Default: first booted simulator
textYesText to type

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the external idb dependency and implies statefulness ('currently focused field'), but omits error handling, idempotency, or timing behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste: first states the action, second states the prerequisite. Information is front-loaded and appropriately scoped.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a 2-parameter tool with no output schema, covering the core action and dependency. However, gaps remain regarding failure modes (what if no field is focused?) and synchronous/asynchronous behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage ('Simulator UDID', 'Text to type'), establishing baseline 3. The description adds no parameter-specific semantics beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Type text') and target ('currently focused field on the iOS Simulator'), distinguishing it from sibling tools like simulator_tap (gestures) and simulator_screenshot (visual capture).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides critical prerequisite information ('Requires idb') but lacks explicit guidance on when to use this versus simulator_tap (e.g., 'use after focusing a field') or error conditions if no field is focused.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

xcode_buildB

Build an Xcode project or workspace. Returns structured diagnostics with file, line, column, severity, and message for each error/warning.

ParametersJSON Schema
NameRequiredDescriptionDefault
configurationNoBuild configuration (Debug or Release). Default: Debug
destinationNoBuild destination. Default: booted iOS Simulator
project_pathYesPath to the Xcode project directory, .xcodeproj, or .xcworkspace
schemeNoBuild scheme name. Auto-detected if omitted.

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It successfully discloses the return structure (file, line, column, severity, message) since no output schema exists. However, it omits other critical behavioral traits: whether builds are destructive to previous artifacts, execution time expectations, or prerequisite requirements (Xcode installation).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two efficient sentences with zero waste. It is front-loaded with the core action ('Build...') followed by return value details. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters (1 required), no annotations, and no output schema, the description adequately covers the core function and return format. However, gaps remain in usage guidelines (vs. xcode_run) and behavioral transparency (side effects, idempotency), preventing a higher score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description reinforces the project_path semantics by mentioning 'project or workspace,' but adds no further syntax details, format examples, or constraints beyond what the schema already provides for the four parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Build[s] an Xcode project or workspace' with a specific verb and resource. It implicitly distinguishes from simulator_* siblings (which interact with simulators) and xcode_run (execution vs. compilation), though it does not explicitly name siblings to differentiate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by noting it returns diagnostics for errors/warnings, suggesting use for compilation verification. However, it lacks explicit when-to-use guidance or comparison with xcode_run (e.g., 'use this to compile before running').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
bundle_identifierYesApp bundle identifier to launch (e.g. com.example.MyApp)
configurationNoBuild configuration. Default: Debug
project_pathYesPath to the Xcode project directory, .xcodeproj, or .xcworkspace
schemeNoBuild scheme name. Auto-detected if omitted.
simulator_udidNoSimulator UDID. Default: first booted simulator

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses output behavior (build errors vs. success message with process ID) and the dual build-then-launch sequence. However, it omits operational details like whether the call blocks until completion, simulator boot behavior, or timeout characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste: first states the action (build + launch), second states the return values. Every word earns its place, and critical information is front-loaded. Appropriate length for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter tool with no output schema, the description compensates by explaining return values (build errors, process ID) and clarifying the compound operation. It adequately covers the tool's behavior, though it could improve by mentioning whether the simulator is auto-booted or if the operation is synchronous.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, documenting all five parameters including defaults. The description mentions 'iOS Simulator' and 'build' which contextually anchors the parameters, but adds no specific syntax, format details, or parameter interdependencies beyond what the schema already provides. Baseline 3 is appropriate given the comprehensive schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the dual action ('Build... and launch') and identifies the specific resources (Xcode project, iOS Simulator). It effectively distinguishes from sibling tool 'xcode_build' (build-only) and simulator interaction tools by specifying it both compiles and deploys the app.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains what happens on success or failure (returns build errors or process ID), providing implicit usage context. However, it lacks explicit guidance on when to use this versus 'xcode_build' (e.g., 'use this when you need to test the app interactively') or prerequisites like requiring Xcode command line tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.1.0
    • First observedsimulator_describe
    • First observedsimulator_screenshot
    • First observedsimulator_tap
    • First observedsimulator_type
    • First observedxcode_build
    • First observedxcode_run

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
ResponsivenessUnresponsive

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.
    8
    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.
    22 npm
    1
    MIT