# shenghaiwang/xcodebuild architecture

> Architecture diagram of the GitHub repository shenghaiwang/xcodebuild, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shenghaiwang/xcodebuild
- Repository: https://github.com/shenghaiwang/xcodebuild

## Overview

##### Project type and purpose
- This is a thin, Python‑based MCP (Model Context Protocol) server that exposes two “tools” (build and test) for iOS Xcode workspaces/projects.
- It’s invoked either via Astral’s `uvx` CLI or directly with Python’s `-m mcpxcodebuild`.

##### File structure
- **pyproject.toml** – project metadata, dependencies (including MCP/uv libraries).
- **uv.lock** – locked dependencies for `uv`.
- **src/mcpxcodebuild/**
- `__main__.py` – entrypoint that boots the MCP server.
- `server.py` – core server implementation: registers “build” and “test” handlers; listens on stdio or TCP (the MCP transport).

##### README for additional insights
- Two exposed commands:
- `build(folder: string)` → runs `xcodebuild` CLI to compile the workspace/project.
- `test(folder: string)`  → runs `xcodebuild test`.
- Integration targets: VS Code extensions (Cline, Roo Code), Claude.app via JSON config.

##### Elements
- Request → Server
- Server → Subprocess
- Subprocess → File System (read/write)
- Subprocess → Server (stdout/stderr)
- Server → Client (response)
- Client (green), Server (blue), Subprocess (orange), File System (gray)
- **Annotations** for entrypoint (`__main__.py`) and key modules (`server.py`).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client"
        Client["Client<br/>(VS Code ext, Claude.app, uvx CLI)"]:::client
    end

    subgraph "MCP Server"
        init["__init__.py"]:::code
        mainFile["__main__.py<br/>(entrypoint)"]:::code
        serverFile["server.py<br/>(core implementation)"]:::server
    end

    subgraph "Subprocess"
        Xcode["xcodebuild CLI"]:::process
    end

    subgraph "File System"
        FS["iOS Xcode workspace/project"]:::fs
    end

    subgraph "Repository Files"
        pyproject["pyproject.toml"]:::code
        uvlock["uv.lock"]:::code
        readme["README.md"]:::code
    end

    Client -->|"build(folder) JSON‑RPC"| mainFile
    mainFile -->|"boot server"| serverFile
    serverFile -->|"spawn xcodebuild"| Xcode
    Xcode -->|"read/write project files"| FS
    FS -->|"project data"| Xcode
    Xcode -->|"stdout/stderr logs"| serverFile
    serverFile -->|"JSON‑RPC response"| Client

    click pyproject "https://github.com/shenghaiwang/xcodebuild/blob/main/pyproject.toml"
    click uvlock "https://github.com/shenghaiwang/xcodebuild/blob/main/uv.lock"
    click init "https://github.com/shenghaiwang/xcodebuild/blob/main/src/mcpxcodebuild/__init__.py"
    click mainFile "https://github.com/shenghaiwang/xcodebuild/blob/main/src/mcpxcodebuild/__main__.py"
    click serverFile "https://github.com/shenghaiwang/xcodebuild/blob/main/src/mcpxcodebuild/server.py"
    click readme "https://github.com/shenghaiwang/xcodebuild/blob/main/README.md"

    classDef client fill:#d4f1be,stroke:#333,stroke-width:1px
    classDef server fill:#bee3f8,stroke:#333,stroke-width:1px
    classDef process fill:#fdd9b5,stroke:#333,stroke-width:1px
    classDef fs fill:#e2e8f0,stroke:#333,stroke-width:1px
    classDef code fill:#f8f4b1,stroke:#333,stroke-width:1px
```
