xcode-mcp
Provides tools to control Xcode projects, builds, simulators, testing, and debugging.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@xcode-mcpbuild the project for iOS simulator"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
xcode-mcp
MCP (Model Context Protocol) server that bridges AI assistants with Xcode, enabling full control over Xcode projects, builds, simulators, testing, and debugging — all without touching Xcode manually.
macOS only. Xcode 14+ required. Node 18+ required.
Quick Install
macOS / Linux:
curl -sL https://raw.githubusercontent.com/Raunaksplanet/xcode-mcp-server/main/install.sh | bash
# or locally:
./install.shWindows (PowerShell):
.\install.ps1The installer: checks prerequisites, installs deps, builds, prompts for your Xcode project path, and registers with OpenCode automatically.
Manual Setup
npm install
npm run build
export XCODE_PROJECT_PATH=/path/to/YourApp.xcodeproj
npm startOpenCode Integration
Clone the repo and add to ~/.config/opencode/opencode.json:
{
"mcpServers": {
"xcode": {
"command": "node",
"args": ["path/to/xcode-mcp/dist/index.js"],
"env": {
"XCODE_PROJECT_PATH": "/path/to/YourApp.xcodeproj",
"XCODE_DEFAULT_SCHEME": "YourApp"
}
}
}
}Environment Variables
Variable | Required | Description |
| Yes | Path to |
| No | Default scheme for build/test operations |
| No | Default simulator UDID or name |
| No | Custom DerivedData path |
| No | Log level: debug/info/warn/error (default: info) |
| No | Build timeout in seconds (default: 300) |
| No | Test timeout in seconds (default: 600) |
Configuration File
Place .xcode-mcp.json next to your .xcodeproj:
{
"default_scheme": "MyApp",
"default_simulator": "iPhone 16 Pro",
"excluded_paths": ["Pods", "vendor"],
"build_pre_hooks": ["echo 'Starting build...'"],
"build_post_hooks": ["echo 'Build complete!'"],
"custom_destinations": ["platform=iOS Simulator,name=iPhone 16,OS=latest"]
}Available Tools
Project Management
xcode_open_project— Open project in Xcodexcode_get_project_info— Get project info (targets, schemes, configs)xcode_list_targets— List all targetsxcode_list_schemes— List all schemesxcode_list_files— List project filesxcode_add_file— Add file to projectxcode_remove_file— Remove file from projectxcode_get_build_settings— Get resolved build settingsxcode_set_build_setting— Modify build settingsxcode_resolve_packages— Resolve SPM dependencies
Build Tools
xcode_build— Build the projectxcode_build_for_testing— Build for testingxcode_archive— Archive for distributionxcode_clean— Clean build artifactsxcode_get_build_errors— Parse build errors/warningsxcode_get_analyzer_results— Run static analyzer
Simulator Control
xcode_list_simulators— List available simulatorsxcode_boot_simulator— Boot a simulatorxcode_shutdown_simulator— Shutdown simulatorxcode_install_app— Install app on simulatorxcode_launch_app— Launch app on simulatorxcode_terminate_app— Terminate appxcode_get_simulator_logs— Fetch simulator logsxcode_screenshot_simulator— Take screenshotxcode_record_simulator— Record videoxcode_open_url_simulator— Open URL (deep link testing)xcode_set_simulator_location— Set locationxcode_push_notification_simulator— Simulate push notificationxcode_reset_simulator— Reset to factory state
Testing
xcode_run_tests— Run all testsxcode_run_single_test— Run specific testxcode_get_test_results— Parse xcresult bundlexcode_get_code_coverage— Get coverage report
Code Management
xcode_read_file— Read file contentxcode_write_file— Write file contentxcode_edit_file— Find and replace in filexcode_get_swift_symbols— Extract Swift symbolsxcode_format_file— Format with swift-formatxcode_search_in_project— Search across project files
Code Signing
xcode_list_certificates— List signing certificatesxcode_list_provisioning_profiles— List provisioning profilesxcode_set_signing— Configure signing settingsxcode_validate_signing— Verify code signature
Diagnostics
xcode_get_warnings— Get build warningsxcode_profile_app— Profile with Instrumentsxcode_add_spm_package— Add SPM dependency
Resources
xcode://project/structure— Project file treexcode://project/settings— All build settingsxcode://build/latest_log— Latest build logxcode://build/errors— Parsed build errorsxcode://simulators/list— Available simulators
Prompts
fix_build_error— Fix a build error with contextcreate_swift_feature— Implement a Swift featurewrite_xctest— Generate XCTest casesreview_swift_code— Swift best practices review
Architecture
xcode-mcp/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server setup
│ ├── tools/ # Tool implementations
│ ├── lib/ # Core libraries
│ │ ├── xcode_runner.ts # xcodebuild/xcrun wrappers
│ │ ├── pbxproj_parser.ts # PBXProject parser
│ │ ├── pbxproj_writer.ts # PBXProject writer
│ │ ├── simulator_manager.ts # simctl wrapper
│ │ ├── process_manager.ts # Process lifecycle
│ │ ├── logger.ts # Structured logging
│ │ ├── error_handler.ts # Error mapping
│ │ └── config.ts # Configuration
│ ├── types/ # TypeScript type definitions
│ ├── resources/ # MCP resource providers
│ └── prompts/ # MCP prompt templates
├── package.json
└── tsconfig.jsonSecurity
All file paths are validated against the project root
Command injection prevented via
execFilewith args arraysSensitive data (certificates, keys) never logged
Concurrent xcodebuild calls are queued (max 2)
Path traversal detection on all file operations
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Raunaksplanet/xcode-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server