
XcodeBuild
STDIOMCP server providing Xcode tools integration for AI assistants and development workflows.
MCP server providing Xcode tools integration for AI assistants and development workflows.
A Model Context Protocol (MCP) server that provides Xcode-related tools for integration with AI assistants and other MCP clients.
XcodeBuildMCP is a Model Context Protocol (MCP) server that exposes Xcode operations as tools and resources for AI assistants and other MCP clients. Built with a modern plugin architecture, it provides a comprehensive set of self-contained tools organized into workflow-based directories, plus MCP resources for efficient data access, enabling programmatic interaction with Xcode projects, simulators, devices, and Swift packages through a standardized interface.
The XcodeBuild MCP tool exists primarily to streamline and standardise interaction between AI agents and Xcode projects. By providing dedicated tools for common Xcode operations, it removes reliance on manual or potentially incorrect command-line invocations.
This ensures a reliable and efficient development process, allowing agents to seamlessly leverage Xcode's capabilities while reducing the risk of configuration errors.
Critically, this MCP enables AI agents to independently validate code changes by building projects, inspecting errors, and iterating autonomously. In contrast to user-driven tools like Sweetpad, XcodeBuild MCP empowers agents to automate these workflows effectively.
The XcodeBuildMCP server provides the following tool capabilities:
For clients that support MCP resources XcodeBuildMCP provides efficient URI-based data access:
xcodebuildmcp://simulators
): Direct access to available iOS simulators with UUIDs and statesxcodebuildmcp://devices
): Direct access to connected physical Apple devices with UDIDs and statesxcodebuildmcp://doctor
): Direct access to environment information such as Xcode version, macOS version, and Node.js versionFor a quick install, you can use the following links:
Most MCP clients (Cursor, VS Code, Windsurf, Claude Desktop etc) have standardised on the following JSON configuration format, just add the the following to your client's JSON configuration's mcpServers
object:
"XcodeBuildMCP": { "command": "npx", "args": [ "-y", "xcodebuildmcp@latest" ] }
Codex uses a toml configuration file to configure MCP servers. To configure XcodeBuildMCP with OpenAI's Codex CLI, add the following configuration to your Codex CLI config file:
[mcp_servers.XcodeBuildMCP] command = "npx" args = ["-y", "xcodebuildmcp@latest"] env = { "INCREMENTAL_BUILDS_ENABLED" = "false", "XCODEBUILDMCP_SENTRY_DISABLED" = "false" }
For more information see OpenAI Codex MCP Server Configuration documentation.
To use XcodeBuildMCP with Claude Code, you can add it via the command line:
# Add XcodeBuildMCP server to Claude Code claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest # Or with environment variables claude mcp add XcodeBuildMCP npx xcodebuildmcp@latest -H INCREMENTAL_BUILDS_ENABLED=false -H XCODEBUILDMCP_SENTRY_DISABLED=false
To install XcodeBuildMCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @cameroncooke/XcodeBuildMCP --client claude
[!IMPORTANT] Please note that XcodeBuildMCP will request xcodebuild to skip macro validation. This is to avoid errors when building projects that use Swift Macros.
XcodeBuildMCP supports both MCP tools, resources and sampling. At time of writing the following editors have varying levels of MCP feature support:
Editor | Tools | Resources | Samplng |
---|---|---|---|
VS Code | ✅ | ✅ | ✅ |
Cursor | ✅ | ❌ | ❌ |
Windsurf | ✅ | ❌ | ❌ |
Claude Code | ✅ | ✅ | ❌ |
Claude Desktop | ✅ | ✅ | ❌ |
XcodeBuildMCP includes experimental support for incremental builds. This feature is disabled by default and can be enabled by setting the INCREMENTAL_BUILDS_ENABLED
environment variable to true
:
To enable incremental builds, set the INCREMENTAL_BUILDS_ENABLED
environment variable to true
:
Example MCP configuration:
"XcodeBuildMCP": { ... "env": { "INCREMENTAL_BUILDS_ENABLED": "true" } }
[!IMPORTANT] Please note that incremental builds support is currently highly experimental and your mileage may vary. Please report any issues you encounter to the issue tracker.
XcodeBuildMCP supports dynamic tool loading to optimize context window usage in AI assistants. This feature is particularly useful for managing the extensive toolset that XcodeBuildMCP provides.
By default, XcodeBuildMCP loads all available tools at startup (Static Mode), which provides immediate access to the complete toolset but uses a larger context window. Dynamic Tools mode solves this by:
discover_tools
and discover_projs
are available initiallydiscover_tools
toolTo enable dynamic tools, set the XCODEBUILDMCP_DYNAMIC_TOOLS
environment variable to true
:
Example MCP client configuration:
"XcodeBuildMCP": { ... "env": { "XCODEBUILDMCP_DYNAMIC_TOOLS": "true" } }
Once enabled, AI agents automatically discover and load relevant tools based on context. For example, when you mention working on an iOS app or the agent detects iOS development tasks in your workspace, it will automatically use the discover_tools
tool to load the appropriate simulator and project tools needed for your workflow.
Dynamic Tools requires MCP clients that support MCP Sampling for the AI-powered tool discovery to function:
Editor | Dynamic Tools Support |
---|---|
VS Code | ✅ |
Cursor | ❌ (No MCP Sampling) |
Windsurf | ❌ (No MCP Sampling) |
Claude Code | ❌ (No MCP Sampling) |
Claude Desktop | ❌ (No MCP Sampling) |
[!NOTE] For clients that don't support MCP Sampling, XcodeBuildMCP will automatically fall back to Static Mode, loading all tools at startup regardless of the
XCODEBUILDMCP_DYNAMIC_TOOLS
setting.
For clients that don't support MCP Sampling but still want to reduce context window usage, you can selectively load only specific workflows using the XCODEBUILDMCP_ENABLED_WORKFLOWS
environment variable:
"XcodeBuildMCP": { ... "env": { "XCODEBUILDMCP_ENABLED_WORKFLOWS": "simulator,device,project-discovery" } }
Available Workflows:
device
(14 tools) - iOS Device Developmentsimulator
(18 tools) - iOS Simulator Developmentsimulator-management
(7 tools) - Simulator Managementswift-package
(6 tools) - Swift Package Managerproject-discovery
(5 tools) - Project Discoverymacos
(11 tools) - macOS Developmentui-testing
(11 tools) - UI Testing & Automationlogging
(4 tools) - Log Capture & Managementproject-scaffolding
(2 tools) - Project Scaffoldingutilities
(1 tool) - Project Utilitiesdoctor
(1 tool) - System Doctordiscovery
(1 tool) - Dynamic Tool Discovery[!NOTE] The
XCODEBUILDMCP_ENABLED_WORKFLOWS
setting only works in Static Mode. IfXCODEBUILDMCP_DYNAMIC_TOOLS=true
is set, the selective workflow setting will be ignored.
For device deployment features to work, code signing must be properly configured in Xcode before using XcodeBuildMCP device tools:
Note: XcodeBuildMCP cannot configure code signing automatically. This initial setup must be done once in Xcode, after which the MCP device tools can build, install, and test apps on physical devices.
If you encounter issues with XcodeBuildMCP, the doctor tool can help identify the problem by providing detailed information about your environment and dependencies.
The doctor tool is a standalone utility that checks your system configuration and reports on the status of all dependencies required by XcodeBuildMCP. It's particularly useful when reporting issues.
# Run the doctor tool using npx npx --package xcodebuildmcp@latest xcodebuildmcp-doctor
The doctor tool will output comprehensive information about:
When reporting issues on GitHub, please include the full output from the doctor tool to help with troubleshooting.
This project uses Sentry for error monitoring and diagnostics. Sentry helps us track issues, crashes, and unexpected errors to improve the reliability and stability of XcodeBuildMCP.
XCODEBUILDMCP_SENTRY_DISABLED=true
.Example MCP client configuration:
"XcodeBuildMCP": { ... "env": { "XCODEBUILDMCP_SENTRY_DISABLED": "true" } }
https://github.com/user-attachments/assets/e3c08d75-8be6-4857-b4d0-9350b26ef086
Contributions are welcome! Here's how you can help improve XcodeBuildMCP.
See our documentation for development:
This project is licensed under the MIT License - see the LICENSE file for details.