Integrations

Xcode

View as Markdown

Xcode 26.3+ exposes a built-in MCP server that gives the Agents Window direct access to your Xcode projects. The agent can read and edit files, trigger builds, run tests, capture SwiftUI previews, and search Apple's documentation; all without leaving your editor.

This works through xcrun mcpbridge, a binary Apple ships with Xcode that translates MCP protocol messages into Xcode's internal XPC layer. You configure it once, and the Agents Window treats Xcode's 20 built-in tools like any other MCP server.

Prerequisites

  • macOS with Xcode 26.3 or later installed
  • A paid Grok Build plan
  • An Xcode project open in Xcode (Xcode must be running)

Enable MCP in Xcode

Before the Agents Window can connect, turn on Xcode's MCP bridge:

Open Xcode settings

Go to Xcode > Settings > Intelligence.

Enable MCP

Under Model Context Protocol, toggle Xcode Tools on.

Set up the Agents Window

Pick whichever method suits your workflow.

Option 1: MCP settings UI

Open MCP settings

Go to Customize > MCPs.

Add the server

Click Add New MCP Server. Set the transport to stdio, name it xcode-tools, and enter xcrun mcpbridge as the command.

Option 2: mcp.json

Add an entry to your MCP config file:

~/.cursor/mcp.json:

JSON

{
  "mcpServers": {
    "xcode-tools": {
      "command": "xcrun",
      "args": ["mcpbridge"]
    }
  }
}

Option 3: Grok Build TUI

If you also use grok, the Grok Build TUI, register the server from your terminal with grok mcp add:

Bash

grok mcp add xcode-tools -- xcrun mcpbridge

This writes the server to ~/.grok/config.toml. The Grok Build TUI also reads ~/.cursor/mcp.json, so a server added with Option 1 or 2 already appears there.

Available tools

Xcode exposes 20 MCP tools across five categories:

File operations

  • XcodeRead - Read file contents (up to 600 lines per call, with offset/limit for larger files)
  • XcodeWrite - Create or overwrite files
  • XcodeUpdate - Apply targeted edits to existing files
  • XcodeGrep - Search file contents with regex
  • XcodeGlob - Find files by pattern
  • XcodeLS - List directory contents
  • XcodeMakeDir - Create directories
  • XcodeRM - Remove files or directories
  • XcodeMV - Move or rename files

Build and test

  • BuildProject - Build the active scheme
  • GetBuildLog - Retrieve build logs, filterable by severity, regex, or file glob
  • RunAllTests - Run the full test suite
  • RunSomeTests - Run specific test classes or methods
  • GetTestList - List available tests

Diagnostics

  • XcodeListNavigatorIssues - Show warnings and errors from the Issue Navigator
  • XcodeRefreshCodeIssuesInFile - Re-check a file for code issues

Intelligence

  • RenderPreview - Capture a screenshot of a SwiftUI preview
  • DocumentationSearch - Semantic search across Apple's documentation and WWDC transcripts
  • ExecuteSnippet - Run a Swift code snippet

Workspace

  • XcodeListWindows - List open Xcode windows and tabs

Example workflow

A typical Agents Window and Xcode workflow looks like this:

  1. Open your project in both the Agents Window and Xcode
  2. Ask the agent to add a feature or fix a bug
  3. The agent uses XcodeRead and XcodeGrep to understand your code
  4. It edits files with XcodeWrite or XcodeUpdate
  5. It runs BuildProject to check for errors, reads results with GetBuildLog
  6. It runs tests with RunSomeTests to verify the change
  7. It captures a SwiftUI preview with RenderPreview to confirm the UI

You stay in the Agents Window the whole time. Xcode handles compilation, testing, and previews in the background.

Grok Build TUI with Xcode

The Grok Build TUI works with Xcode's MCP tools too, which suits headless workflows, CI pipelines, and terminal-first developers. Run it in headless mode:

Bash

grok -p "Add unit tests for the NetworkManager class"

It picks up the xcode-tools server from its config, or from ~/.cursor/mcp.json, and uses the same tools as the Agents Window.

Troubleshooting

The agent can't find the xcode-tools server

Make sure Xcode is running with a project open. The xcrun mcpbridge process needs an active Xcode session to communicate with.

Tools show errors about missing tabIdentifier

Some Xcode MCP tools need a workspace context. Confirm you have a project or workspace open in Xcode, not an empty window.

Build or test tools time out

Large projects take longer to build. Check Xcode's build progress directly. The MCP bridge waits for Xcode's response, so timeouts usually mean the underlying operation is still running.

MCP toggle missing in Xcode settings

You need Xcode 26.3 or later. Check your version under Xcode > About Xcode and update through the Mac App Store or Apple Developer downloads.

xcrun: error: unable to find utility "mcpbridge"

Your system is pointed at Command Line Tools instead of the full Xcode installation. Fix this by running:

Bash

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

Then confirm the bridge is available:

Bash

xcrun --find mcpbridge

This should return a file path, not an error. Once it does, open Xcode with your project, go to Settings > Intelligence > Model Context Protocol, and enable Allow external agents. Then toggle the Xcode MCP server back on in Grok Build Settings. You should see a permission dialog in Xcode confirming the connection.


Last updated: November 23, 2026