XcodeBazelMCP
Integrates with Apple's development ecosystem for building, testing, and deploying apps on simulators and physical devices across iOS, macOS, tvOS, watchOS, and visionOS platforms.
Provides tools to build, test, and manage Bazel-based projects, including target discovery, querying dependencies, and running build commands.
Enables building, running, testing iOS apps on simulators and devices, managing simulators, and automating UI interactions.
Supports building, running, and testing macOS applications within a Bazel workspace.
Integrates with Swift Package Manager for building, testing, running, cleaning, resolving, dumping, and initializing Swift packages.
Leverages Xcode tools for simulator management, device deployment, LLDB debugging, and UI automation via accessibility snapshots.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@XcodeBazelMCPbuild and run the iOS app on iPhone 16 simulator"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
What It Provides
Build & Run — Build, install, launch, and stop iOS/macOS apps on simulators and physical devices.
Test & Coverage — Run unit/UI/build tests with filtering, streaming output, and code coverage.
Simulator Management — Boot, shutdown, erase, configure location/appearance/status bar.
Physical Device — Full device lifecycle via
xcrun devicectl: list, pair, install, launch, terminate, screenshot, log capture.LLDB Debugging — Attach to simulator or device processes, set breakpoints, inspect variables, step through code.
UI Automation — Tap, swipe, type, drag, pinch, and inspect accessibility trees on simulators (via IDB or CGEvent fallback).
Multi-platform — tvOS, watchOS, visionOS build/run/test/discover targets.
Swift Package Manager — Build, test, run, clean, resolve, dump, and init Swift packages.
Project Discovery — Query the Bazel build graph, discover targets, inspect dependencies.
Scaffolding — Generate new Bazel projects from templates (ios_app, macos_app, etc.).
Session & Config — Workspace management, build profiles, defaults, health checks.
Background Daemon — Per-workspace daemon for stateful operations.
Self-update — Check for and install updates.
Related MCP server: MCP Xcode Server
Requirements
macOS with Xcode installed
Node.js 18+
Bazel or Bazelisk on
PATHA Bazel workspace (set via
BAZEL_IOS_WORKSPACE, config file, orset_workspacetool)
Optional (for device screenshots & logs on iOS 17+)
pymobiledevice3—pip3 install pymobiledevice3For screenshots:
sudo pymobiledevice3 remote tunneldrunning in backgroundFor logs: pymobiledevice3 is tried first automatically, falls back to
idevicesyslog
Installation
npm
npm install -g xcodebazelmcpThen use the installed CLI:
xcodebazelmcp mcpHomebrew
brew install XcodeBazelMCP/tap/xcodebazelmcpThen use the installed CLI:
xcodebazelmcp mcpOr run directly via npx (no install needed):
npx -y xcodebazelmcp mcpQuick start (interactive)
npx -y xcodebazelmcp setupInstall agent skills (Cursor / Codex)
npx -y xcodebazelmcp initMCP Configuration
{
"mcpServers": {
"XcodeBazelMCP": {
"command": "npx",
"args": ["-y", "xcodebazelmcp", "mcp"],
"env": {
"BAZEL_IOS_WORKSPACE": "/path/to/your/ios-workspace"
}
}
}
}If you installed the CLI globally with npm or Homebrew:
{
"mcpServers": {
"XcodeBazelMCP": {
"command": "xcodebazelmcp",
"args": ["mcp"],
"env": {
"BAZEL_IOS_WORKSPACE": "/path/to/your/ios-workspace"
}
}
}
}Or with workspace flag:
npx -y xcodebazelmcp mcp --workspace /path/to/your/ios-workspaceFrom source
git clone https://github.com/XcodeBazelMCP/XcodeBazelMCP.git
cd XcodeBazelMCP
npm install
npm run buildWorking with Workspaces
XcodeBazelMCP needs to know which Bazel workspace to operate on. There are several ways to set it, in order of precedence:
MCP tool at runtime —
bazel_ios_set_workspace(or CLIset-defaults --target //app:app)CLI flag —
xcodebazelmcp mcp --workspace /path/to/workspaceEnvironment variable —
BAZEL_IOS_WORKSPACE=/path/to/workspaceConfig file —
.xcodebazelmcp/config.yamlin the workspace root (supports profiles)Fallback —
process.cwd()
For multi-workspace setups, use profiles in config.yaml:
profiles:
app:
target: '//app:app'
platform: simulator
buildMode: debug
mac:
target: '//mac:mac'
platform: macosThen switch at runtime: xcodebazelmcp set-defaults --profile app
CLI Examples
# Health check
xcodebazelmcp doctor
# Discover & query
xcodebazelmcp discover --scope //Apps/... --kind apps
xcodebazelmcp query 'deps(//app:app)'
# Build & run (simulator)
xcodebazelmcp build //app:app --debug --simulator
xcodebazelmcp run //app:app --simulator-name "iPhone 16 Pro"
# Build & run (device)
xcodebazelmcp device-run //app:app --device-name "iPhone"
xcodebazelmcp device-screenshot output.png --device-name "iPhone"
xcodebazelmcp device-log-start --device-name "iPhone"
# Test
xcodebazelmcp test //tests:UnitTests --filter "SomeTest/testCase" --stream
# macOS
xcodebazelmcp macos-build //mac:mac --debug
xcodebazelmcp macos-run //mac:mac
# Swift Package Manager
xcodebazelmcp spm-build --path ./MyPackage
xcodebazelmcp spm-test --filter "MyTests/testExample"
# Scaffold
xcodebazelmcp new ios_app MyNewApp --bundle-id com.example.MyNewApp
# Config
xcodebazelmcp defaults
xcodebazelmcp set-defaults --target //app:app --simulator-name "iPhone 16 Pro"
xcodebazelmcp workflowsWorkflow Categories (112 tools)
Workflows control which tools are advertised to MCP clients. Smart defaults enable the most common workflows; use toggle-workflow to customize.
Category | Tools | Description |
build | 2 | Build iOS targets for simulator or device |
test | 2 | Run iOS tests with optional coverage |
simulator | 10 | Manage simulator lifecycle and settings |
app_lifecycle | 5 | Install, launch, stop apps on simulator |
capture | 5 | Screenshot, video recording, log capture (simulator) |
ui_automation | 9 | Tap, swipe, type, drag, accessibility snapshot |
deep_links | 2 | Open URLs and send push notifications |
device | 13 | Physical device build, deploy, test, screenshot, logs |
lldb | 10 | LLDB debugger: breakpoints, variables, stepping |
macos | 13 | macOS build, run, test, discover |
tvos | 4 | tvOS build, run, test, discover |
watchos | 4 | watchOS build, run, test, discover |
visionos | 4 | visionOS build, run, test, discover |
spm | 7 | Swift Package Manager operations |
project | 6 | Target discovery, query, deps, rdeps |
scaffold | 2 | Generate new Bazel projects |
session | 7 | Workspace, defaults, profiles, health |
daemon | 3 | Background daemon management |
update | 2 | Self-update and version check |
iOS 17+ Device Notes
Apple replaced lockdownd/usbmuxd with CoreDevice (remoted) starting in iOS 17 / macOS 15. This means:
xcrun devicectlis the only reliable CLI for device operations (list, install, launch, terminate).Screenshots require
pymobiledevice3withtunneldrunning — nodevicectlscreenshot subcommand exists.Logs use
pymobiledevice3 syslog live(automatic fallback toidevicesyslogfor older devices).Process termination uses a two-step PID lookup since
devicectldoesn't exposebundleIdentifierin process listings.
See docs/device-support.md for full details.
Development
git clone https://github.com/XcodeBazelMCP/XcodeBazelMCP.git
cd XcodeBazelMCP
npm install
npm run build # Build dist/
npm test # Run tests (vitest)
npm run lint # ESLintNotes
The server launches Bazel with spawn, not a shell. Extra flags are passed as argv entries so commands are reproducible and avoid shell interpolation.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/XcodeBazelMCP/XcodeBazelMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server