Skip to content

Environment Variables

When Xcode Pilot MCP starts, it automatically detects your development environment by running a series of checks:

┌─────────────────────────────────────┐
│ 1. xcode-select -p │
│ → /Applications/Xcode.app/... │
│ │
│ 2. which xcrun │
│ → /usr/bin/xcrun │
│ │
│ 3. which xcodebuild │
│ → /usr/bin/xcodebuild │
│ │
│ 4. xcrun simctl help │
│ → simctl available? ✓ │
│ │
│ 5. xcrun devicectl help │
│ → devicectl available? ✓ │
└─────────────────────────────────────┘

The detected environment is stored as:

PropertySourceDescription
xcodePathxcode-select -pPath to the active Xcode developer directory
xcrunPathwhich xcrunPath to the xcrun binary
xcodebuildPathwhich xcodebuildPath to the xcodebuild binary
simctlAvailablexcrun simctl helpWhether simulator control is available
devicectlAvailablexcrun devicectl helpWhether physical device control is available (Xcode 15+)

Override the Xcode developer directory. This takes precedence over xcode-select -p.

VariableTypeDefault
DEVELOPER_DIRstringAuto-detected via xcode-select -p

When to use:

  • You have multiple Xcode versions installed and want to target a specific one
  • You’re testing against an Xcode beta
  • Your CI environment needs to use a non-default Xcode

MCP client configuration:

{
"mcpServers": {
"xcode-pilot": {
"command": "npx",
"args": ["xcode-pilot-mcp"],
"env": {
"DEVELOPER_DIR": "/Applications/Xcode-16.1-beta.app/Contents/Developer"
}
}
}
}

Verify your current setting:

Terminal window
# Check active Xcode
xcode-select -p
# List all installed Xcode versions
ls /Applications/ | grep Xcode
# Switch system-wide (alternative to DEVELOPER_DIR)
sudo xcode-select -s /Applications/Xcode-16.1-beta.app/Contents/Developer

Some tools require specific software to be installed:

DependencyTools That Require ItHow to Install
XcodeAll toolsMac App Store
Xcode CLI ToolsAll toolsxcode-select --install
simctlAll simulator tools, app lifecycle, debug, environmentIncluded with Xcode
devicectlPhysical device toolsIncluded with Xcode 15+
SwiftLintswiftlint_run, swiftlint_fixbrew install swiftlint
swift-formatswift_format_runbrew install swift-format
CocoaPodspod_install, pod_update, pod_outdatedsudo gem install cocoapods

Commands have category-appropriate timeouts:

CategoryDefault TimeoutNotes
Build, Test, Archive600s (10 min)Large projects may need longer
Package resolution300s (5 min)Network-dependent
Export IPA300s (5 min)Depends on archive size
List, Settings, Info30sQuick metadata queries
All other commands120s (2 min)Standard operations
Log streamingConfigurableVia timeout parameter
Screen recordingConfigurableVia duration parameter

The server logs to stderr (stdout is reserved for MCP protocol communication).

Log levels: debug, info, warn, error

Example log output:

[2025-02-23T14:30:45.123Z] [INFO] Detecting Xcode environment...
[2025-02-23T14:30:45.456Z] [INFO] Environment detected {"xcodePath":"/Applications/Xcode.app/Contents/Developer","simctlAvailable":true,"devicectlAvailable":true}
[2025-02-23T14:30:45.789Z] [INFO] Xcode Pilot MCP server started