XC

Xcodebuild iOS Build Error Feedback MCP Server

Build iOS Xcode projects and workspaces, capture build errors, and return actionable feedback to an LLM via an MCP server.

Overview

This MCP (Model Context Protocol) server runs xcodebuild on macOS to compile Xcode projects and workspaces, captures build output, and transforms errors and warnings into structured, actionable feedback for a language model. Instead of returning raw logs, the server parses compiler diagnostics, groups related failures, and returns concise suggestions that an LLM can use to guide a developer or to propose automated fixes.

The server is useful when integrating Xcode builds into an AI-assisted development workflow where a model needs precise, machine-friendly context about build failures. Typical uses include AI pair-programming assistants, automated PR reviewers, and CI agents that enrich failure reports with recommended fixes and references to offending files and lines.

Features

  • Runs xcodebuild for projects and workspaces on macOS.
  • Captures stdout/stderr and exit status from xcodebuild.
  • Parses compiler errors and warnings into structured diagnostics (file, line, column, message, severity).
  • Returns actionable feedback (short summary + suggested fixes) suitable for consumption by an LLM via MCP.
  • Exposes a simple MCP-compatible tool interface so LLMs can call build actions and get structured responses.
  • Configurable build parameters: scheme, configuration, destination, derived data path.
  • Optional verbose logs and raw build artifact download.

Installation / Configuration

Prerequisites:

  • macOS with Xcode and Xcode Command Line Tools installed.
  • Git and a Go or Python runtime if building from source (the repository includes a build script).

Quick start (clone and run):

git clone https://github.com/ShenghaiWang/xcodebuild.git
cd xcodebuild
# Build the server (example using Go — replace with local build steps if different)
go build -o mcp-xcodebuild ./cmd/server
# Start the MCP server on localhost
./mcp-xcodebuild --listen 127.0.0.1:8080

Configuration options (examples):

  • CLI flags:

    • –listen (host:port, default 127.0.0.1:8080)
    • –timeout (seconds to wait for xcodebuild)
    • –derived-data (path to place derived data)
    • –verbose (enable raw logs)
  • Environment variables (optional):

XCODEBUILD_PATH=/usr/bin/xcodebuild
MCP_AUTH_TOKEN=your-token-if-needed

Example JSON configuration file (optional):

{
  "listen": "127.0.0.1:8080",
  "timeout": 600,
  "derivedData": "/tmp/DerivedData",
  "verbose": false
}

Note: The server must run on a macOS host because xcodebuild is a macOS-only tool.

Available Tools / Resources

The server exposes MCP-compatible tool endpoints. At minimum it provides a build tool that accepts build parameters and returns structured diagnostics.

Tool: xcode.build

  • Method: POST /tools/xcode.build
  • Request JSON schema:
FieldTypeRequiredDescription
workspacestringoptionalPath to .xcworkspace
projectstringoptionalPath to .xcodeproj
schemestringrequiredXcode scheme to build
configurationstringoptionale.g., Debug or Release
destinationstringoptionale.g., “platform=iOS Simulator,name=iPhone 14”
derivedDataPathstringoptionalcustom DerivedData location

Example request:

{
  "workspace": "/workspace/MyApp.xcworkspace",
  "scheme": "MyApp",
  "configuration": "Debug",
  "destination": "platform=iOS Simulator,name=iPhone 14"
}

Example response (truncated):

{
  "status": "failed",
  "exitCode": 65,
  "diagnostics": [
    {
      "file": "MyApp/ViewController.swift",
      "line": 42,
      "column": 13,
      "severity": "error",
      "message": "Value of optional type 'String?' must be unwrapped to refer to member 'count' of wrapped base type 'String'",
      "suggestion": "Use optional chaining or unwrap with 'if let' / 'guard let'. Example: if let s = myString { let count = s.count }"
    }
  ],
  "summary": "1 error and 
Tags:ai-ml

Common Issues & Solutions

I noticed that our project is listed on Spark, but we haven't claimed it yet. It seems like there are benefits to claiming the listing, including getting a verified badge and access to analytics.

✓ Solution

I ran into this too! Claiming the listing on Spark is straightforward and provides valuable features like download analytics and the ability to edit our project details. It's a great way to enhance our project's visibility and credibility. To resolve this, I installed `@ChromeDevTools/chrome-devtools-mcp`, which streamlined the claiming process and ensured everything was set up correctly. You can install it using the command below. npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp