XcodeMCP

by lapfelix

57 234 downloads Not rated yet Apache-2.0
GitHub

About

MCP server for Xcode that wraps its AppleScript interface & uses XCLogParser to return clear build results

Details

License
Apache-2.0

Explore

XcodeMCP provides comprehensive tools for analyzing Xcode test results (.xcresult files), making it easy to debug test failures and extract valuable information:

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name XcodeMCP
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- macOS with Xcode installed
- Node.js 18+
- XCLogParser (recommended): brew install xclogparser

Install in VS Code
Install in VS Code Insiders
Install MCP Server

XCLogParser is recommended but optional:

brew install xclogparser

Run directly with npx:

npx -y xcodemcp@latest

Or install globally:

npm install -g xcodemcp

Add to your MCP configuration:

{
"mcpServers": {
"xcodemcp": {
"command": "npx",
"args": ["-y", "xcodemcp@latest"],
"env": {
}
}
}
}

To add XcodeMCP to Claude Code using the command line:

claude mcp add-json XcodeMCP '{
"command": "npx",
"args": ["-y", "xcodemcp@latest"],
"env": {
}
}'

First, enable Xcode Tools in Xcode > Settings > Intelligence > Model Context Protocol.

Then add both Apple's Xcode MCP and XcodeMCP in sidekick mode:


json
{
"mcpServers": {
"xcode": {
"command": "xcrun",
"args": ["mcpbridge"]
},
"xcodemcp": {
"command": "npx",
"args": ["-y", "xcodemcp@latest", "--sidekick-only"]
}
}
}

> Future direction: In a future version, XcodeMCP will transition to sidekick-only mode by default, focusing exclusively on tools that complement Apple's official Xcode MCP rather than duplicating functionality.

For local development:

bash
git clone https://github.com/lapfelix/XcodeMCP.git
cd XcodeMCP
npm install

XcodeMCP includes a powerful CLI that provides 100% feature parity with the MCP server, allowing you to run any tool as a one-shot command:


bash

``bash

XcodeMCP supports configurable logging to help with debugging and monitoring:

- LOG_LEVEL: Controls logging verbosity (default: INFO)
-
SILENT: No logging output
-
ERROR: Only error messages
-
WARN: Warnings and errors
-
INFO: General operational information (recommended)
-
DEBUG: Detailed diagnostic information

- XCODEMCP_LOG_FILE: Optional file path for logging
- Logs are written to the specified file in addition to stderr
- Parent directories are created automatically
- Example:
/tmp/xcodemcp.log or ~/Library/Logs/xcodemcp.log

- XCODEMCP_CONSOLE_LOGGING: Enable/disable console output (default: true)
- Set to
false` to disable stderr logging (useful when using file logging only)

xcode_open_project

Open projects and workspaces

xcode_get_workspace_info

Get workspace status and details

xcode_get_projects

List projects in workspace

xcode_open_file

Open files with optional line number

xcode_build

Build with detailed error parsing

xcode_clean

Clean build artifacts

xcode_test

Run tests with optional arguments

xcode_build_and_run

Build and run the active scheme

xcode_debug

Start debugging session

xcode_stop

Stop current operation

xcode_get_schemes

List available schemes

xcode_set_active_scheme

Switch active scheme

xcode_get_run_destinations

List simulators and devices

xcresult_browse

Browse test results and analyze failures

xcresult_browser_get_console

Get console output for specific tests

xcresult_summary

Quick overview of test results

xcresult_get_screenshot

Extract screenshots from test failures

xcresult_get_ui_hierarchy

Get UI hierarchy as AI-readable JSON with timestamp selection

xcresult_get_ui_element

Get detailed properties of specific UI elements by index

xcresult_list_attachments

List all attachments for a test

xcresult_export_attachment

Export specific attachments from test results

xcode_health_check

Environment validation and troubleshooting

Project Management:
- xcode_open_project - Open projects and workspaces
- xcode_get_workspace_info - Get workspace status and details
- xcode_get_projects - List projects in workspace
- xcode_open_file - Open files with optional line number

Build Operations:
- xcode_build - Build with detailed error parsing
- xcode_clean - Clean build artifacts
- xcode_test - Run tests with optional arguments
- xcode_build_and_run - Build and run the active scheme
- xcode_debug - Start debugging session
- xcode_stop - Stop current operation

Configuration:
- xcode_get_schemes - List available schemes
- xcode_set_active_scheme - Switch active scheme
- xcode_get_run_destinations - List simulators and devices

XCResult Analysis:
- xcresult_browse - Browse test results and analyze failures
- xcresult_browser_get_console - Get console output for specific tests
- xcresult_summary - Quick overview of test results
- xcresult_get_screenshot - Extract screenshots from test failures
- xcresult_get_ui_hierarchy - Get UI hierarchy as AI-readable JSON with timestamp selection
- xcresult_get_ui_element - Get detailed properties of specific UI elements by index
- xcresult_list_attachments - List all attachments for a test
- xcresult_export_attachment - Export specific attachments from test results

Diagnostics:
- xcode_health_check - Environment validation and troubleshooting

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "xcodemcp": {
            "XcodeMCP": {
                "command": "npx",
                "args": [
                    "-y",
                    "xcodemcp@latest"
                ]
            }
        }
    }
}

McpServers

{
    "XcodeMCP": {
        "command": "npx",
        "args": [
            "-y",
            "xcodemcp@latest"
        ]
    }
}

npm version
Test Status

Model Context Protocol (MCP) server that controls Xcode directly through JavaScript for Automation (JXA). Available as both an MCP server and a standalone CLI.

What it does

- Controls Xcode directly through JavaScript for Automation (not xcodebuild CLI)
- Opens projects, builds, runs, tests, and debugs from within Xcode
- Parses build logs with precise error locations using XCLogParser
- Provides comprehensive environment validation and health checks
- Supports graceful degradation when optional dependencies are missing
- NEW: Includes a full-featured CLI with 100% MCP server feature parity

Requirements

- macOS with Xcode installed
- Node.js 18+
- XCLogParser (recommended): brew install xclogparser

Usage

XcodeMCP can be used in two ways:
1. MCP Server: Integrate with Claude Desktop, VS Code, or other MCP clients
2. CLI Tool: Run commands directly from the terminal with xcodecontrol

Quick Install

Install in VS Code
Install in VS Code Insiders
Install MCP Server

XCLogParser is recommended but optional:

brew install xclogparser

Install from npm

Run directly with npx:

npx -y xcodemcp@latest

Or install globally:

npm install -g xcodemcp

MCP Configuration

Add to your MCP configuration:

{
"mcpServers": {
"xcodemcp": {
"command": "npx",
"args": ["-y", "xcodemcp@latest"],
"env": {
}
}
}
}

Claude Code CLI Setup

To add XcodeMCP to Claude Code using the command line:

claude mcp add-json XcodeMCP '{
"command": "npx",
"args": ["-y", "xcodemcp@latest"],
"env": {
}
}'

Without the clean build folder tool

To add XcodeMCP to Claude Code using the command line:

claude mcp add-json XcodeMCP '{
"command": "npx",
"args": ["-y", "xcodemcp@latest", "--no-clean"],
"env": {
}
}'

Using Preferred Values for Single Project Workflows

For projects where you're working with a single xcodeproj and scheme, you can configure preferred values to make tool parameters optional:

claude mcp add-json XcodeMCP '{
  "command": "npx",
  "args": ["-y", "xcodemcp@latest"],
  "env": {
    "XCODE_MCP_PREFERRED_SCHEME": "MyApp",
    "XCODE_MCP_PREFERRED_XCODEPROJ": "MyApp.xcodeproj"
  }
}'

With preferred values configured:
- Tool parameters become optional instead of required
- Tool descriptions show default values (e.g., "defaults to MyApp.xcodeproj")
- You can still override defaults by providing explicit parameters
- Reduces repetition when working with a single project

Troubleshooting

If /mcp in Claude Code indicates the MCP failed, try running it from the project folder manually to see what the output is: npx -y xcodemcp@latest

Sidekick Mode

When using XcodeMCP alongside Apple's official Xcode MCP server, enable sidekick mode to only include complementary tools:

- Project management: Open/close projects, manage schemes, workspace info
- XCResult analysis: Browse test results, extract screenshots, inspect UI hierarchies

This excludes build/run/test/debug tools that Apple's MCP handles natively.

Claude Code CLI Setup (Both Servers)

First, enable Xcode Tools in Xcode > Settings > Intelligence > Model Context Protocol.

Then add both Apple's Xcode MCP and XcodeMCP in sidekick mode:
```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about XcodeMCP

Relevant YouTube tutorials, setups, and demos