For any Xcode project or Swift Package Manager package, use this order — pick the first option that fits the situation, do not skip down the list.
-
Xcode MCP Tools — use these when Xcode has the project open. They reuse the running Xcode's build state (no duplicate DerivedData / build caches piling up), and open the door to workflows the CLI cannot reach — running screenshot / snapshot tests through the running IDE, driving simulators the user is already using, etc.
-
xcodebuild— for CLI builds and tests. Compiles bundled resources correctly:.xcstringsstring catalogs become per-locale.stringsinside the bundle,.xcassetsare compiled, etc. Use this when Xcode is not open or when a headless build is needed.