XcodeBazelMCP

XcodeBazelMCP

A comprehensive MCP server and CLI for Bazel-based Apple platform development, providing 112 tools across 19 workflow categories for building, testing, debugging, and managing iOS, macOS, tvOS, watchOS, visionOS, and Swift Package Manager projects.

Category
访问服务器

README

<div align="center"> <img src="https://github.com/XcodeBazelMCP/XcodeBazelMCP/blob/HEAD/assets/LOGO.png?raw=true" alt="XcodeBazelMCP" width="200">

<h1>XcodeBazelMCP</h1>

<p> A Model Context Protocol (MCP) server and CLI for Bazel-based Apple platform development. Ships 112 tools across 19 workflow categories covering iOS, macOS, tvOS, watchOS, visionOS, and Swift Package Manager. </p>

CI npm package License MIT node >=18.x Xcode 16 platform macOS MCP Compatible codecov Socket Badge Ask DeepWiki </div>

<br>

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.

Requirements

  • macOS with Xcode installed
  • Node.js 18+
  • Bazel or Bazelisk on PATH
  • A Bazel workspace (set via BAZEL_IOS_WORKSPACE, config file, or set_workspace tool)

Optional (for device screenshots & logs on iOS 17+)

  • pymobiledevice3pip3 install pymobiledevice3
  • For screenshots: sudo pymobiledevice3 remote tunneld running in background
  • For logs: pymobiledevice3 is tried first automatically, falls back to idevicesyslog

Installation

npm

npm install -g xcodebazelmcp

Then use the installed CLI:

xcodebazelmcp mcp

Homebrew

brew install XcodeBazelMCP/tap/xcodebazelmcp

Then use the installed CLI:

xcodebazelmcp mcp

Or run directly via npx (no install needed):

npx -y xcodebazelmcp mcp

Quick start (interactive)

npx -y xcodebazelmcp setup

Install agent skills (Cursor / Codex)

npx -y xcodebazelmcp init

MCP 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-workspace

From source

git clone https://github.com/XcodeBazelMCP/XcodeBazelMCP.git
cd XcodeBazelMCP
npm install
npm run build

Working with Workspaces

XcodeBazelMCP needs to know which Bazel workspace to operate on. There are several ways to set it, in order of precedence:

  1. MCP tool at runtimebazel_ios_set_workspace (or CLI set-defaults --target //app:app)
  2. CLI flagxcodebazelmcp mcp --workspace /path/to/workspace
  3. Environment variableBAZEL_IOS_WORKSPACE=/path/to/workspace
  4. Config file.xcodebazelmcp/config.yaml in the workspace root (supports profiles)
  5. Fallbackprocess.cwd()

For multi-workspace setups, use profiles in config.yaml:

profiles:
  app:
    target: '//app:app'
    platform: simulator
    buildMode: debug
  mac:
    target: '//mac:mac'
    platform: macos

Then 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 workflows

Workflow 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 devicectl is the only reliable CLI for device operations (list, install, launch, terminate).
  • Screenshots require pymobiledevice3 with tunneld running — no devicectl screenshot subcommand exists.
  • Logs use pymobiledevice3 syslog live (automatic fallback to idevicesyslog for older devices).
  • Process termination uses a two-step PID lookup since devicectl doesn't expose bundleIdentifier in 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      # ESLint

Notes

The server launches Bazel with spawn, not a shell. Extra flags are passed as argv entries so commands are reproducible and avoid shell interpolation.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选