# XcodeMCP MCP server

> Controls Xcode via JavaScript for Automation to perform builds, tests, debugging, and detailed XCResult analysis.

- Repository: https://github.com/lapfelix/XcodeMCP
- Page: https://hostedmcp.org/servers/lapfelix/xcodemcp
- Transport: stdio
- Stars: 59
- License: Apache-2.0
- Latest version: 2.1.4

## Install

### Claude Code

```sh
claude mcp add xcodemcp -- npx -y xcodemcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "xcodemcp": {
      "command": "npx",
      "args": [
        "-y",
        "xcodemcp"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "xcodemcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "xcodemcp"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"xcodemcp","type":"stdio","command":"npx","args":["-y","xcodemcp"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "xcodemcp": {
      "command": "npx",
      "args": [
        "-y",
        "xcodemcp"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add xcodemcp -- npx -y xcodemcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.xcodemcp]
command = "npx"
args = ["-y", "xcodemcp"]
```

### Gemini CLI

```sh
gemini mcp add -s user xcodemcp npx -- -y xcodemcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "xcodemcp": {
      "command": "npx",
      "args": [
        "-y",
        "xcodemcp"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `LOG_LEVEL` | no | no |  |
| `XCODEMCP_CONSOLE_LOGGING` | no | no |  |
| `XCODEMCP_LOG_FILE` | no | no |  |
| `XCODE_MCP_PREFERRED_SCHEME` | no | no |  |
| `XCODE_MCP_PREFERRED_XCODEPROJ` | no | no |  |

## Tools (22)

- `xcode_open_project`
- `xcode_get_workspace_info`
- `xcode_get_projects`
- `xcode_open_file`
- `xcode_build`
- `xcode_clean`
- `xcode_test`
- `xcode_build_and_run`
- `xcode_debug`
- `xcode_stop`
- `xcode_get_schemes`
- `xcode_set_active_scheme`
- `xcode_get_run_destinations`
- `xcresult_browse`
- `xcresult_browser_get_console`
- `xcresult_summary`
- `xcresult_get_screenshot`
- `xcresult_get_ui_hierarchy`
- `xcresult_get_ui_element`
- `xcresult_list_attachments`
- `xcresult_export_attachment`
- `xcode_health_check`

## FAQ

### Can I use XcodeMCP alongside Apple's official Xcode MCP?

Yes, you can run XcodeMCP in sidekick mode to provide complementary tools like project management and XCResult analysis.

### Does XcodeMCP work with the xcodebuild CLI?

No, it controls Xcode directly through JavaScript for Automation (JXA) rather than using the xcodebuild CLI.
