diff --git a/docs/ai/ios-xcodebuildmcp.md b/docs/ai/ios-xcodebuildmcp.md index ac4b0ed..aab7bcb 100644 --- a/docs/ai/ios-xcodebuildmcp.md +++ b/docs/ai/ios-xcodebuildmcp.md @@ -8,14 +8,14 @@ XcodeBuildMCP can run build and test tasks without you switching into Xcode for Think of it as a remote control for Xcode build actions. Instead of clicking around in Xcode, you ask the assistant to run the action and report the result. Common uses include: -+- Run a build for a target or scheme -+- Run tests and return failures -+- Capture build output so the assistant can summarize errors +- Run a build for a target or scheme +- Run tests and return failures +- Capture build output so the assistant can summarize errors ### Example Requests -+- "Use XcodeBuildMCP to build the app and summarize any errors." -+- "Run tests with XcodeBuildMCP and list the failing tests." -+- "Build with XcodeBuildMCP and extract the first error message." +- "Use XcodeBuildMCP to build the app and summarize any errors." +- "Run tests with XcodeBuildMCP and list the failing tests." +- "Build with XcodeBuildMCP and extract the first error message." ## What It Can Do (Detailed Examples) Below are common tasks and how to ask for them. Adjust the wording to match your project. @@ -54,68 +54,68 @@ Example: These steps reflect a common setup as of February 2026. Wording may vary slightly in release candidates. ### Prerequisites -+- Xcode 26.3 (RC or full release), opened at least once with your project -+- VS Code installed (stable or Insiders) -+- GitHub Copilot extension installed and signed in -+- Node.js and npm installed (for XcodeBuildMCP) +- Xcode 26.3 (RC or full release), opened at least once with your project +- VS Code installed (stable or Insiders) +- GitHub Copilot extension installed and signed in +- Node.js and npm installed (for XcodeBuildMCP) ### Step 1: Enable Xcode MCP Server -+1. Open Xcode. -+2. Go to Settings. -+3. Open the Intelligence tab. -+4. Find the Model Context Protocol section. -+5. Toggle on Xcode Tools (or Allow external connections). +1. Open Xcode. +2. Go to Settings. +3. Open the Intelligence tab. +4. Find the Model Context Protocol section. +5. Toggle on Xcode Tools (or Allow external connections). ### Step 2: Install And Configure XcodeBuildMCP (Recommended Bridge) -+Install: -+ -+```bash -+npm install -g xcodebuildmcp@latest -+``` -+ -+Add to VS Code (create or edit .vscode/mcp.json): -+ -+```json -+{ -+ "servers": { -+ "XcodeBuildMCP": { -+ "command": "npx", -+ "args": ["-y", "xcodebuildmcp@latest", "mcp"] -+ } -+ } -+} -+``` -+ -+Restart VS Code or reload the window. Copilot should discover the tools. +Install: + +```bash +npm install -g xcodebuildmcp@latest +``` + +Add to VS Code (create or edit .vscode/mcp.json): + +```json +{ + "servers": { + "XcodeBuildMCP": { + "command": "npx", + "args": ["-y", "xcodebuildmcp@latest", "mcp"] + } + } +} +``` + +Restart VS Code or reload the window. Copilot should discover the tools. ### Step 3: Optional Native Xcode MCP Bridge -+Xcode 26.3 includes a native MCP bridge. This exposes Xcode tools directly. -+ -+Add to VS Code: -+ -+```json -+{ -+ "servers": { -+ "XcodeNative": { -+ "command": "xcrun", -+ "args": ["mcpbridge"] -+ } -+ } -+} -+``` -+ -+### Using MCP In VS Code With Copilot -+1. Open your iOS project in VS Code. -+2. Use Copilot Chat in agent mode for multi-step tasks. -+3. MCP tools appear as slash commands once discovered. -+ -+Example: -+"Use XcodeBuildMCP to build and summarize errors. Then suggest fixes." +Xcode 26.3 includes a native MCP bridge. This exposes Xcode tools directly. + +Add to VS Code: + +```json +{ + "servers": { + "XcodeNative": { + "command": "xcrun", + "args": ["mcpbridge"] + } + } +} +``` + +### Using MCP In VS Code With Copilot +1. Open your iOS project in VS Code. +2. Use Copilot Chat in agent mode for multi-step tasks. +3. MCP tools appear as slash commands once discovered. + +Example: +"Use XcodeBuildMCP to build and summarize errors. Then suggest fixes." ### Tips And Caveats -+- Xcode must be running (or launchable) for MCP tools to respond. -+- Native Xcode MCP is often best for previews. -+- XcodeBuildMCP is often best for heavy builds and automation. +- Xcode must be running (or launchable) for MCP tools to respond. +- Native Xcode MCP is often best for previews. +- XcodeBuildMCP is often best for heavy builds and automation. ## Standardize The Simulator (Avoid Back-And-Forth) Pin a simulator name and OS version in your project guidance so the assistant always uses the same target. @@ -133,25 +133,25 @@ When running iOS builds or tests, always use XcodeBuildMCP with the iOS simulato - Keeps build outputs consistent across developers ### Install And Setup (Official) -+Follow the official instructions: https://github.com/getsentry/XcodeBuildMCP +Follow the official instructions: https://github.com/getsentry/XcodeBuildMCP ### References -+- https://www.apple.com/newsroom/2026/02/xcode-26-point-3-unlocks-the-power-of-agentic-coding/ -+- https://github.com/cameroncooke/XcodeBuildMCP -+- https://github.com/getsentry/XcodeBuildMCP -+- https://code.visualstudio.com/docs/copilot/customization/mcp-servers +- https://www.apple.com/newsroom/2026/02/xcode-26-point-3-unlocks-the-power-of-agentic-coding/ +- https://github.com/cameroncooke/XcodeBuildMCP +- https://github.com/getsentry/XcodeBuildMCP +- https://code.visualstudio.com/docs/copilot/customization/mcp-servers ## Xcode 26.3 And MCP Integration -+Apple announced that Xcode 26.3 exposes Xcode capabilities through the Model Context Protocol (MCP), which enables compatible agents and tools to interact with Xcode features directly. +Apple announced that Xcode 26.3 exposes Xcode capabilities through the Model Context Protocol (MCP), which enables compatible agents and tools to interact with Xcode features directly. ### What This Means (Plain Language) -+- Xcode can be controlled by MCP-enabled tools. -+- Agents can access more of Xcode's capabilities without you manually clicking through the UI. +- Xcode can be controlled by MCP-enabled tools. +- Agents can access more of Xcode's capabilities without you manually clicking through the UI. ### Example Workflow -+1. You ask an agent to build the project. -+2. The agent uses MCP to run the build inside Xcode. -+3. The agent summarizes errors and suggests fixes. +1. You ask an agent to build the project. +2. The agent uses MCP to run the build inside Xcode. +3. The agent summarizes errors and suggests fixes. ### Source -+https://www.apple.com/newsroom/2026/02/xcode-26-point-3-unlocks-the-power-of-agentic-coding/ +https://www.apple.com/newsroom/2026/02/xcode-26-point-3-unlocks-the-power-of-agentic-coding/