architecture

A command-line and MCP server for building, testing, and controlling iOS projects with Bazel, a build tool, instead of Apple's xcodebuild command.

In plain words
What is it for?
Use it to run Bazel builds and tests, manage simulators and devices, debug with LLDB, work with Swift packages, automate user interfaces, and perform related macOS tasks.
Why use it?
It gives agents one Bazel-based interface for common iOS development and simulator or device tasks.

Agent for Codex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/debugswift/xcodebazelmcp/architecture
Clone the repo
git clone --depth 1 https://github.com/DebugSwift/XcodeBazelMCP

Made for: Codex.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 940 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00940
Opus 5 $0.00000 $0.00470
Sonnet 5 $0.00000 $0.00188
Haiku 4.5 $0.00000 $0.00094

Measured yesterday against content hash 4f48e8336189, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/agents/architecture.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Architecture

Overview

Bazel-first MCP server + CLI for iOS, modeled after getsentry/XcodeBuildMCP but swapping xcodebuild for bazel.

Entry Points

  • src/cli.ts — CLI + MCP via mcp subcommand (~400 lines, thin dispatcher)
  • src/doctor-cli.ts — standalone health check

Module Layout

Tools

  • src/tools/bazel-tools.ts — thin orchestrator (~33 lines), aggregates definitions from all handler modules and dispatches callBazelTool to the matching handler.
  • src/tools/helpers.ts — shared state (log captures, video recordings, device log captures) and utilities (applyDefaults, resolveSimulatorFromArgs, prependWarning, stringOrUndefined, numberOrUndefined).
  • src/tools/streaming.ts — streaming tool logic and post-build actions, separated from main dispatch.
  • src/tools/handlers/ — 10 domain-specific files, each exports definitions, canHandle(), and handle():
    • session.ts, build.ts, simulator.ts, device.ts, lldb.ts, macos.ts, multi-platform.ts, spm.ts, scaffold.ts, ui-automation.ts

CLI

  • src/cli/parsers.ts — 48 parse functions (~730 lines)
  • src/cli/commands.tsrunUpgrade, runDaemon, etc. (~240 lines)
  • src/cli/help.tsprintHelp (~160 lines)

Core

  • src/core/bazel.ts — arg builders, runBazel, label validation, query sanitization
  • src/core/simulators.ts — simctl wrappers
  • src/core/workspace.ts — workspace validation, BSP

Runtime & Config

  • src/runtime/config.ts — env vars BAZEL_IOS_WORKSPACE, BAZEL_PATH, BAZEL_IOS_MCP_MAX_OUTPUT, plus .xcodebazelmcp/config.yaml loading (workspace or ~/.xcodebazelmcp/).
  • Custom lightweight YAML parser: handles flat key-value and nested profiles: blocks without external deps. Cannot handle values containing : (splits on first occurrence).

Process Execution

  • src/utils/process.tsspawn (no shell) with timeout + output cap. All Bazel commands go through runBazel which tracks lastCommand.
  • runCommandStreaming is an AsyncGenerator<StreamChunk | CommandResult> — yields { stream: 'stdout'|'stderr', data } chunks, then the final CommandResult.

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 66 lines · 0 tokens per session scan A 4f48e8336189

Subscribe to this mod's changes

architecture is an agent published in the GitHub repository DebugSwift/XcodeBazelMCP (7 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 940 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories