A Model Context Protocol server for different Xcode related tools
A Model Context Protocol (MCP) server that provides structured access to Xcode development tools including xcrun, xcodebuild, and xctrace.
Prerequisites:
curl -LsSf https://astral.sh/uv/install.sh | shRun directly with uvx:
uvx xctools-mcp-server
Prerequisites:
Clone and install:
git clone https://github.com/nzrsky/xctools-mcp-server
cd xctools-mcp-server
pip install .
Run the server:
xctools-mcp-server
python -m build --wheel
pip install dist/xctools_mcp_server-0.1.0-py3-none-any.whl
Add to your ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"xctools": {
"command": "xctools-mcp-server",
"args": [],
"env": {}
}
}
}
Or if using uvx:
{
"mcpServers": {
"xctools": {
"command": "uvx",
"args": ["xctools-mcp-server"],
"env": {}
}
}
}
settings.json):{
"mcp.servers": {
"xctools": {
"command": "xctools-mcp-server",
"args": [],
"env": {}
}
}
}
Or if using uvx:
{
"mcp.servers": {
"xctools": {
"command": "uvx",
"args": ["xctools-mcp-server"],
"env": {}
}
}
}
Cmd+Shift+P) and search for “MCP” commands to interact with the Xcode development toolsThe server runs on stdio, so you can invoke it directly:
With installed package:
xctools-mcp-server
With uvx:
uvx xctools-mcp-server
xcrunxcodebuildxctrace (Instruments)xcrun_find_tool - Find the path to development tools (clang, swift, etc.)xcrun_show_sdk_path - Show the path to SDKsxcrun_show_sdk_version - Show SDK versionsxcrun_run_tool - Run any development tool via xcrunxcodebuild_build - Build Xcode projects or workspacesxcodebuild_test - Run tests for projects/workspacesxcodebuild_archive - Archive projects for distributionxcodebuild_list - List targets, schemes, and configurationsxcodebuild_show_sdks - List all available SDKsxcodebuild_show_destinations - Show valid build destinationsxctrace_record - Record new Instruments tracesxctrace_import - Import supported files into trace formatxctrace_export - Export data from trace filesxctrace_list - List available devices, templates, or instrumentsxctrace_symbolicate - Symbolicate traces with debug symbols## Find the path to a specific tool
"Find the path to clang compiler"
## Show SDK path for iOS
"Show the path to the iOS SDK"
## Get SDK version information
"Show the version of the iOS SDK"
## Build an Xcode project
"Build the project MyApp.xcodeproj for iOS simulator"
## Run tests for a workspace
"Run tests for MyApp.xcworkspace on iPhone 15 Pro simulator"
## Archive for distribution
"Archive MyApp.xcworkspace for release"
## List project information
"List all schemes and targets in MyApp.xcodeproj"
## Record a trace for Time Profiler
"Record a Time Profiler trace for MyApp on iPhone 15 Pro for 30 seconds"
## List available instruments
"List all available Instruments templates"
## Export trace data
"Export data from trace file to XML format"
## Import a file for analysis
"Import a .dtps file into Instruments trace format"
## List all available SDKs
"Show all available SDKs for building"
## Show build destinations
"List all available destinations for iOS builds"
## Run a tool via xcrun
"Run swift command with version flag via xcrun"
The server includes comprehensive error handling:
“xcrun: error: unable to find utility”
xcode-select --installxcode-select -p“No developer directory found”
sudo xcodebuild -license acceptPermission errors
Tool not found errors
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.