xctools-mcp-server
Provides structured access to Xcode development tools including xcrun, xcodebuild, and xctrace for building, testing, and analyzing projects.
README
XCTools MCP Server
A Model Context Protocol (MCP) server that provides structured access to Xcode development tools including xcrun, xcodebuild, and xctrace.
Installation
Method 1: Using uvx
-
Prerequisites:
- Python 3.13+
- Xcode with Command Line Tools installed
- uvx:
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Run directly with uvx:
uvx xctools-mcp-server
Method 2: Local Development Installation
-
Prerequisites:
- Python 3.13+
- Xcode with Command Line Tools installed
-
Clone and install:
git clone https://github.com/nzrsky/xctools-mcp-server cd xctools-mcp-server pip install . -
Run the server:
xctools-mcp-server
Method 3: Build from Source
- Build the wheel:
python -m build --wheel pip install dist/xctools_mcp_server-0.1.0-py3-none-any.whl
Configuration
For Claude Desktop
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": {}
}
}
}
For VS Code with MCP Extension
- Install the MCP Extension from the VS Code marketplace
- Add server configuration to your VS Code settings (
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": {}
}
}
}
- Restart VS Code to load the MCP server
- Use the Command Palette (
Cmd+Shift+P) and search for "MCP" commands to interact with the Xcode development tools
For Other MCP Clients
The server runs on stdio, so you can invoke it directly:
With installed package:
xctools-mcp-server
With uvx:
uvx xctools-mcp-server
Features
- Complete Xcode toolchain access through
xcrun - Project building and testing with
xcodebuild - Performance analysis using
xctrace(Instruments) - SDK and destination management
- Comprehensive error handling with detailed messages
- Cross-platform compatibility (macOS with Xcode installed)
Available Tools
XCRUN Tools
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 xcrun
XCODEBUILD Tools
xcodebuild_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 destinations
XCTRACE Tools (Instruments)
xctrace_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
Usage Examples
Finding Development Tools
# 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"
Building Projects
# 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"
Performance Analysis with Instruments
# 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"
SDK and Destination Management
# 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"
Error Handling
The server includes comprehensive error handling:
- Command failures: Returns detailed error messages from xcrun, xcodebuild, and xctrace
- Missing Xcode: Detects when Xcode Command Line Tools are not available
- Invalid parameters: Validates tool arguments and provides helpful error messages
- Tool availability: Checks for required tools before execution
Troubleshooting
Common Issues
-
"xcrun: error: unable to find utility"
- Ensure Xcode Command Line Tools are installed:
xcode-select --install - Verify Xcode is properly configured:
xcode-select -p
- Ensure Xcode Command Line Tools are installed:
-
"No developer directory found"
- Install Xcode from the Mac App Store
- Accept Xcode license:
sudo xcodebuild -license accept
-
Permission errors
- Ensure the user has necessary permissions to access Xcode tools
- Try running with proper macOS development permissions
-
Tool not found errors
- Verify the specific tool is available in your Xcode installation
- Some tools may require specific Xcode versions or additional components
Requirements
- macOS: Required (Xcode development tools are macOS-only)
- Xcode: Xcode Command Line Tools or full Xcode installation
- Python: 3.13 or higher
- MCP Client: Claude Desktop, VS Code with MCP extension, or any MCP-compatible client
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
- Invalid parameters: Validates input parameters before execution
- File operations: Handles temporary files for push notifications safely
Security Considerations
- The server only exposes read and simulator management operations
- No access to host file system beyond specified app paths
- Push notification payloads are validated for structure
- Privacy permission changes are explicit and logged
Development Notes
- Built specifically for iOS development workflows
- Optimized for common simulator management tasks
- Structured output parsing for JSON responses
- Support for both individual and batch operations
- Compatible with Xcode 15+ simulator features
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。