xcode-mcp
Bridges AI assistants with Xcode to control projects, builds, simulators, testing, and debugging without manual interaction.
README
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.sh
Windows (PowerShell):
.\install.ps1
The 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 start
OpenCode 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 |
|---|---|---|
XCODE_PROJECT_PATH |
Yes | Path to .xcodeproj or .xcworkspace |
XCODE_DEFAULT_SCHEME |
No | Default scheme for build/test operations |
XCODE_DEFAULT_SIMULATOR |
No | Default simulator UDID or name |
XCODE_DERIVED_DATA_PATH |
No | Custom DerivedData path |
XCODE_MCP_LOG_LEVEL |
No | Log level: debug/info/warn/error (default: info) |
XCODE_MCP_BUILD_TIMEOUT |
No | Build timeout in seconds (default: 300) |
XCODE_MCP_TEST_TIMEOUT |
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.json
Security
- All file paths are validated against the project root
- Command injection prevented via
execFilewith args arrays - Sensitive data (certificates, keys) never logged
- Concurrent xcodebuild calls are queued (max 2)
- Path traversal detection on all file operations
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.