Labsco
MCP SERVER

Xcode MCP

by r-huijts

Point it at an Xcode project and it will read and write the source, build it, run the tests, and boot a simulator to try the result.

Build Systems & CI/CDVerified
Summary
The edit-build-test-simulator loop happens in one place instead of four.

Because build_project, run_tests and the simulator tools all run against the same active project, a failing test can be read, patched and re-run without anyone switching windows, and run_xcrun keeps the rest of the toolchain one call away. Two things to check before you plan around it: the docs describe a wider catalogue — CocoaPods, directory stacks, archiving, screenshots — than the tool list a client is actually handed, and PROJECTS_BASE_DIR is the security boundary, so anything outside it has to be named in ALLOWED_PATHS before a read or write will succeed.

What it is

A local bridge to Xcode's own command-line tooling. One project is active at a time; file access is confined to the projects base directory plus any extra paths you allow, and builds, tests and simulator control run through xcodebuild and xcrun.

What you get
  • An active project set by .xcodeproj path, with its details read back and its files listed by type
  • Source read and written inside the project, with write_file creating the file when createIfMissing is set
  • build_project against a named scheme and configuration, and run_tests with an optional test plan
  • analyze_file runs Xcode's static analyzer over a single source file
  • list_simulators returns what xcrun simctl list --json reports, and boot_simulator and shutdown_simulator drive one by UDID
  • run_xcrun passes a tool name and arguments through to xcrun, which is the escape hatch when no dedicated tool exists
  • run_lldb launches the debugger with your own arguments, and trace_app captures an xctrace performance trace of an app bundle for a duration you set
  • compile_asset_catalog runs actool over a catalog into an output directory
  • swift_package_update runs swift package update for Swift Package Manager dependencies
Requirements

macOS with Xcode 14.0 or higher and the Command Line Tools, plus Node.js 16 or higher; Swift 5.5+ for the Swift Package Manager tools and CocoaPods only if you use the pod commands. No account or key. PROJECTS_BASE_DIR is required and decides which directories the file tools may touch — ALLOWED_PATHS adds more, comma-separated — and both have command-line equivalents (--projects-dir, --allowed-paths). PORT defaults to 3000; DEBUG and LOG_LEVEL control logging. Published as xcode-mcp-server with the binary xcode-server.

Setup effort

One command — npx -y xcode-mcp-server