XcodeMCP server provides programmatic control over Xcode operations through JavaScript for Automation (JXA). It enables:
- Project Management: Open projects/workspaces, get workspace information, list projects, manage schemes 
- Build Operations: Build projects, clean artifacts, parse errors (integrates with XCLogParser) 
- Testing & Execution: Run tests with optional arguments, execute projects 
- Debugging: Start and control debugging sessions 
- Navigation: Open specific files with optional line number targeting 
- Environment: Perform health checks, validate configuration 
- Process Control: Stop operations or pause execution 
The server exposes these capabilities through various API endpoints that can be used for automation workflows.
Runs on macOS to interface with Xcode, allowing for interaction with Xcode projects, workspaces, schemes, and simulators within the macOS environment.
Provides tools for Xcode build automation and log parsing, enabling opening projects, triggering builds directly in Xcode, cleaning build artifacts, running tests, debugging, switching between schemes, and extracting build errors and warnings.
XcodeMCP
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:
- MCP Server: Integrate with Claude Desktop, VS Code, or other MCP clients 
- CLI Tool: Run commands directly from the terminal with - xcodecontrol
Quick Install
XCLogParser is recommended but optional:
Install from npm
Run directly with npx:
Or install globally:
MCP Configuration
Add to your MCP configuration:
Claude Code CLI Setup
To add XcodeMCP to Claude Code using the command line:
Without the clean build folder tool
To add XcodeMCP to Claude Code using the command line:
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:
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
Development Setup
For local development:
CLI Usage
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:
Installation
Install globally to use the CLI:
Basic Usage
Path Resolution
The CLI supports both absolute and relative paths for convenience:
Relative paths are resolved from your current working directory, making the CLI much more convenient to use when working within project directories.
Verbosity Control
Control logging output with verbosity flags:
Quick Examples
Tool Name Mapping
CLI commands use kebab-case instead of underscores:
- xcode_build→- build
- xcode_test→- test
- xcode_build_and_run→- build-and-run
- xcode_health_check→- health-check
- xcresult_browse→- xcresult-browse
- find_xcresults→- find-xcresults
Available Tools
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
XCResult Analysis Features
XcodeMCP provides comprehensive tools for analyzing Xcode test results (.xcresult files), making it easy to debug test failures and extract valuable information:
Test Result Analysis
- Browse Results: Navigate through test hierarchies, view pass/fail status, and examine detailed test information 
- Console Logs: Extract console output and test activities with precise timestamps for debugging 
- Quick Summaries: Get overview statistics including pass rates, failure counts, and duration 
Visual Debugging
- Screenshot Extraction: Extract PNG screenshots from test failures using ffmpeg frame extraction from video attachments 
- Timestamp Precision: Specify exact timestamps to capture UI state at specific moments during test execution 
UI Hierarchy Analysis
- AI-Readable Format: Extract UI hierarchies as compressed JSON with single-letter properties ( - t=type,- l=label,- f=frame,- c=children,- j=index)
- Timestamp Selection: Automatically find the closest UI hierarchy capture to any specified timestamp 
- Element Deep-Dive: Use index references to get full details of any UI element, including accessibility properties and frame information 
- Size Optimization: 75%+ size reduction compared to full hierarchy data while maintaining all essential information 
Attachment Management
- Complete Inventory: List all attachments (screenshots, videos, debug descriptions, UI hierarchies) for any test 
- Selective Export: Export specific attachments by index or type 
- Smart Detection: Automatically identify and categorize different attachment types 
Usage Examples
Configuration
Logging Configuration
XcodeMCP supports configurable logging to help with debugging and monitoring:
Environment Variables
- 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.logor- ~/Library/Logs/xcodemcp.log
 
- XCODEMCP_CONSOLE_LOGGING: Enable/disable console output (default:- true)- Set to - falseto disable stderr logging (useful when using file logging only)
 
Examples
Debug logging with file output:
Silent mode (no logging):
File-only logging:
All logs are properly formatted with timestamps and log levels, and stderr output maintains compatibility with the MCP protocol.
Troubleshooting
XCLogParser Not Found
If you see a warning that XCLogParser is not found even though it's installed:
- Verify installation: which xclogparser xclogparser version
- Common issues and solutions: - PATH issue: If - which xclogparserreturns nothing, add the installation directory to your PATH:# For Homebrew on Intel Macs export PATH="/usr/local/bin:$PATH" # For Homebrew on Apple Silicon Macs export PATH="/opt/homebrew/bin:$PATH"
- Wrong command: Older documentation may reference - xclogparser --version, but the correct command is- xclogparser version(without dashes)
- Permission issue: Ensure xclogparser is executable: chmod +x $(which xclogparser)
 
- Environment validation: Run the health check to get detailed diagnostics: echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "xcode_health_check", "arguments": {}}}' | npx xcodemcp
Note: XcodeMCP can operate without XCLogParser, but build error parsing will be limited.
Example Output
Build with errors:
Health check:
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
MCP server for Xcode build automation and log parsing that opens Xcode projects, triggers builds directly in Xcode, and parses build logs to extract errors and warnings.
Related MCP Servers
- Asecurity-licenseAqualityMCP server for collecting code from files and directories into a single markdown document.Last updated -9MIT License
- Asecurity-licenseAqualityAn MCP server that provides access to project files and their contents, allowing users to retrieve file data from specified project directories with error handling and configuration options.Last updated -16MIT License
- -security-license-qualityThis is an MCP server that facilitates building tools for interacting with various APIs and workflows, supporting Python-based development with potential for customizable prompts and user configurations.Last updated -
- -security-license-qualityAn MCP server that assists with the orchestration of new software projects by applying standardized templates and best practices in design patterns and software architecture.Last updated -15MIT License