Xcode MCP Integration
Table of Contents
1. MCP Tools
xcode_list_schemes
List all schemes in project.
- •Input: None (auto-detect)
- •Output: Scheme list, default scheme
- •Use: First setup, before build
xcode_build
Build project or workspace.
- •Input: scheme (required), configuration (Debug/Release), clean (true/false)
- •Output: Build status, errors, warnings, build time
- •Use: After implementing tasks, before commit
xcode_test
Run unit and UI tests.
- •Input: scheme (required), testPlan (optional), only (specific test)
- •Output: Test results, failed details, coverage
- •Use: After writing tests, before commit
xcode_clean
Clean build folder.
- •Input: scheme (required)
- •Output: Clean status
- •Use: Unclear build errors, after dependency changes
xcode_get_build_settings
Get project build settings.
- •Input: scheme, configuration
- •Output: All build settings
- •Use: Debug build issues
2. Workflows
Setup Project (First Time)
- •
xcode_list_schemes→ Save scheme name - •
xcode_buildwith scheme, Debug config - •Fix errors if any
After Task Implementation
- •
xcode_buildwith scheme - •Success → Continue
- •Failed → Fix errors → Rebuild
After Phase Completion
- •
xcode_clean - •
xcode_buildwith clean: true - •
xcode_test - •All pass → git commit
Pre-Commit
- •xcode_clean
- •xcode_build (clean: true)
- •xcode_test
- •All pass → commit
3. Error Handling
Common Build Errors
| Error | Fix |
|---|---|
| Syntax error | Read file, fix syntax |
| Type mismatch | Check types, convert if needed |
| Missing import | Add import statement |
| Unresolved identifier | Check declaration, DI |
Common Test Errors
| Error | Fix |
|---|---|
| Test timeout | Increase timeout or check async |
| Assertion failed | Check logic, update test/code |
| Missing test target | Check scheme includes tests |
4. Build Configurations
Debug vs Release
| Setting | Debug | Release |
|---|---|---|
| Optimization | None | Aggressive |
| Debug Symbols | Yes | No |
| Build Time | Fast | Slow |
| App Size | Large | Small |
Destinations
- •Simulator:
platform=iOS Simulator,name=iPhone 15 Pro - •Device:
platform=iOS,id=[UDID] - •Generic:
generic/platform=iOS
5. Checklist
Each Build
- • Correct scheme name
- • Appropriate configuration
- • Read errors if any
- • Fix errors top to bottom
Each Test Run
- • Build passes first
- • Scheme includes test targets
- • Read failed test details
Pre-Commit
- • Clean build
- • All tests pass
- • No warnings (or acceptable)