Skip to main content
Glama

Xcode MCP Server

Model Context Protocol Server for the Apple Ecosystem

Connect OpenCode, Codex and Claude Code to Xcode β€” 43 professional tools in a single index.js

CI Node >=18 Yarn 4 MCP License: MIT Version

🌐 Language: English | Español

Installation β€’ Tools β€’ OpenCode β€’ Codex β€’ Claude Code β€’ Docs


What is this?

Xcode MCP Server is a serious, production-ready bridge between your AI IDE (OpenCode / Codex / Claude Code) and Xcode + Apple Dev Tools.

An LLM no longer just writes Swift: it builds, tests, profiles, manages simulators, physical devices, signing and even opens Xcode on the exact line β€” all via MCP stdio with no HTTP server.

Stack: ES Modules Β· @modelcontextprotocol/sdk@1.30 Β· StdioServerTransport Β· promisify(exec) Β· Yarn 4 Berry Β· Make

  • βœ… Single-file index.js (2250 lines) β€” no build step, no compile, auditable in one file. Shebang #!/usr/bin/env node, ready for node, yarn start or npx.

  • βœ… 43 tools with strict JSON Schema (additionalProperties:false) + global try/catch. Each tool returns content: [{type:"text"}] and isError:true on failure β€” no // TODO.

  • βœ… Full Apple coverage: xcodebuild, simctl (9), devicectl (2), xctrace (5 templates), agvtool, security, osascript/xed.

  • βœ… Modern DX: Vendored Yarn 4 (.yarn/releases), self-documenting Makefile with help, modular docs/, macOS CI + make test smoke.

  • βœ… Multi-client: same index.js works with OpenCode, Codex and Claude Code without changes.


Related MCP server: Xcode MCP Server

✨ Features

Category

Tools

Description

Build

6

xcode_build, xcode_clean (+ purge DerivedData), xcode_list_schemes, xcode_analyze, xcode_archive_export (.ipa), swift_format_lint

Tests

2

xcode_run_tests (onlyTesting filter), xcode_test_coverage (xccov --json)

Simulators

9

simctl_list, lifecycle (boot/shutdown/erase), install_launch, media_capture, push_notification, location_mock, privacy_control, ui_appearance, open_url

Devices

2

devicectl_list, devicectl_logs (N-second streaming)

Profiling

1

xctrace_profile (Time Profiler, Allocations, Leaks, System Trace…)

Versions

2

agvtool_version_bump, xcode_certificates_check

Editor

2

xcode_get_active_file (AppleScript), xcode_open_at_line (xed β†’ xcode://)

Localization

1

xcode_sync_strings (.xcstrings β†’ missing/pending/empty)

Assets

6

asset_list_contents, asset_manage_color (Light/Dark), asset_manage_image (1x/2x/3x/vector), asset_read_info, asset_delete, asset_validate_actool (actool)

AppIcon

1

asset_generate_appicon (ALL Apple OS: iOS, macOS, watchOS, tvOS, visionOS + sips resize)

Package / SPM

11

package_resolve, package_update, package_list_dependencies, package_read_resolved, package_reset_cache, package_compute_checksum, spm_add_dependency, spm_remove_dependency, cocoapods_manage, carthage_manage, cocoapods_to_spm_migrate


πŸ“‹ Table of Contents

  1. Requirements

  2. Step-by-step Installation

  3. Verification

  4. Usage with OpenCode / Codex / Claude Code

  5. Tools (43)

  6. Make Commands

  7. Documentation

  8. Architecture

  9. Contributing


πŸ“¦ Requirements

Dependency

Version

Install

Required

macOS

13+ (14+ recommended)

β€”

βœ… for xcodebuild/simctl

Xcode

15+

App Store β†’ xcode-select --install

βœ…

Node.js

β‰₯ 18

brew install node β†’ node --version

βœ…

Yarn

4.x Berry

corepack enable && corepack prepare yarn@stable --activate

βœ…

make

3.81+

xcode-select --install (includes make)

βœ…

swift-format

latest

brew install swift-format

◻️ optional

swiftlint

latest

brew install swiftlint

◻️ optional

Linux/Windows: only make lint works (no Xcode). CI runs a syntax-linux job for that.


πŸš€ Step-by-step Installation

Follow exactly in this order. Copy and paste block by block.

Step 0 β€” Verify Xcode and Node

xcodebuild -version
# Xcode 15.4  Build version 15F31d

node --version
# v20.11.0 (or newer)

yarn --version
# 4.18.0 β€” if "command not found", run:
corepack enable
corepack prepare yarn@stable --activate
yarn --version

Step 1 β€” Clone the repository

git clone https://github.com/YanxReal/Xcode-MPC.git
cd Xcode-MPC

Step 2 β€” Install dependencies

Option A β€” with Make (recommended, modern):

make install

What make install does:

  1. Detects yarn, installs via corepack if missing

  2. Runs yarn install (reads yarn.lock, installs @modelcontextprotocol/sdk)

  3. Runs chmod +x index.js

Expected output:

➀ YN0000: · Yarn 4.18.0
➀ YN0000: β”Œ Resolution step
➀ YN0000: β”” Completed
➀ YN0000: · Done with warnings in 3s
βœ“ dependencies installed

Option B β€” with Yarn directly:

yarn install
chmod +x index.js

If you come from npm:

rm -f package-lock.json
yarn install

Step 3 β€” Verify the environment

make doctor

Should show:

Node: v20.x
Yarn: 4.18.0
Xcode: Xcode 15.x
xcrun: xcrun version 70
...
βœ“ doctor complete

If you see xcodebuild: command not found:

sudo xcode-select -s /Applications/Xcode.app

Step 4 β€” Validate the MCP server

make lint
# ➜ node --check index.js
# βœ“ lint ok

make test
# ➜ smoke test MCP...
# βœ“ tools/list: 43 tools
# βœ“ xcode_sync_strings OK
# βœ“ xcode_certificates_check OK
# βœ“ smoke test PASSED

Or manually:

python3 scripts/smoke_test.py
# or
node scripts/smoke_test.mjs

Step 5 β€” Configure your AI client

Pick one (or all three β€” same index.js works everywhere):

Client

Config file

Command

OpenCode

~/.config/opencode/opencode.json

node /.../Xcode-MPC/index.js

Codex

~/.codex/config.toml

[mcp_servers.xcode] command="node"

Claude Code

claude mcp add xcode -- node ...

CLI or .mcp.json

Full step-by-step with copy-paste JSON/TOML:

Step 6 β€” Restart and test

Restart OpenCode / Codex / Claude Code and type:

list the xcode tools

You should see 43 tools and in the log:

βœ… Xcode MCP Server started (stdio) β€” 43 tools registered

Done! Now you can say:

Build MyApp with xcode_build scheme MyApp destination "platform=iOS Simulator,name=iPhone 15"

βœ… Verification

# 1. Syntax
make lint

# 2. Smoke MCP (no Xcode needed, just Node)
make test

# 3. Apple environment
make doctor
# Checks: node, yarn, xcodebuild, xcrun, simctl, swiftlint, security, osascript

# 4. Visual inspector (optional)
make inspect
# or
yarn inspect
# Open http://localhost:6274 β†’ tools/list β†’ tools/call

πŸ”§ Usage with OpenCode / Codex / Claude Code

OpenCode

~/.config/opencode/opencode.json:

{
  "mcpServers": {
    "xcode": {
      "command": "node",
      "args": ["/Users/YanxReal/Dev/Tools/Xcode-MPC/index.js"],
      "env": {}
    }
  }
}

Codex (OpenAI)

~/.codex/config.toml:

[mcp_servers.xcode]
command = "node"
args = ["/Users/YanxReal/Dev/Tools/Xcode-MPC/index.js"]

Claude Code (Anthropic)

claude mcp add xcode -- node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js
# verify
claude mcp list
# xcode: connected β€” 43 tools

Or per-project with .mcp.json:

{
  "mcpServers": {
    "xcode": {
      "command": "node",
      "args": ["/Users/YanxReal/Dev/Tools/Xcode-MPC/index.js"]
    }
  }
}

Prompt examples for each client β†’ docs/opencode.md Β· docs/codex.md Β· docs/claude-code.md Β· Templates: .mcp.json.example Β· .codex-config.toml.example


πŸ› οΈ Tools (43)

1. Build, Diagnostics & Clean

Tool

xcrun / xcodebuild

Key args

xcode_build

xcodebuild build

scheme*, workspace, project, destination, configuration

xcode_clean

xcodebuild clean + rm -rf DerivedData

purgeDerivedData:boolean

xcode_list_schemes

xcodebuild -list -json

workspace, project, directory

xcode_analyze

xcodebuild analyze

scheme, workspace, project

xcode_archive_export

archive + -exportArchive

scheme*, exportOptionsPlist*, archivePath, exportPath

swift_format_lint

swift-format β†’ swiftlint

path, `mode: lint

2. Tests & Coverage

Tool

xcodebuild

Key args

xcode_run_tests

xcodebuild test

scheme*, destination*, onlyTesting, enableCodeCoverage

xcode_test_coverage

xcrun xccov view --report --json

xcresultPath (auto-finds in DerivedData)

3. Simulators xcrun simctl (9)

simctl_list (filter booted), simctl_lifecycle (boot|shutdown|erase), simctl_install_launch, simctl_media_capture (screenshot|record), simctl_push_notification, simctl_location_mock, simctl_privacy_control, simctl_ui_appearance (light|dark), simctl_open_url

4. Physical Devices xcrun devicectl (2)

devicectl_list (--json), devicectl_logs (deviceUdid*, durationSeconds)

5. Profiling xcrun xctrace (1)

xctrace_profile (template: Time Profiler|Allocations|Leaks|System Trace, timeLimitSeconds, outputFilePath*)

6. Versions & Security (2)

agvtool_version_bump (bump_build|set_version|set_build), xcode_certificates_check (security find-identity)

7. Xcode GUI Editor (2)

xcode_get_active_file (AppleScript osascript), xcode_open_at_line (filePath*, line*, column β€” xed β†’ xcode://)

8. Localization (1)

xcode_sync_strings (.xcstrings β†’ missing / pendingTranslation / emptyValues)

9. Assets Assets.xcassets + actool (6)

asset_list_contents (list *.colorset/*.imageset), asset_manage_color (#RRGGBB Light + Dark), asset_manage_image (scales/vector + preserves-vector-representation), asset_read_info (Contents.json), asset_delete (safe), asset_validate_actool (xcrun actool --compile)

10. AppIcon ALL Apple OS (1)

asset_generate_appicon (iOS, macOS, watchOS, tvOS, visionOS β€” 42 slots, sips -z if baseImagePath)

11. Package SPM / CocoaPods / Carthage (11)

package_resolve/update/list/read_resolved/reset_cache/compute_checksum, spm_add/remove_dependency, cocoapods_manage, carthage_manage, cocoapods_to_spm_migrate (Podfile→Package.swift)

Full reference with JSON Schema + copy-paste examples β†’ docs/tools.md


πŸ“– Make Commands

make help          # Show this pretty help (colors)
make install       # yarn install + chmod +x
make reinstall     # clean + install (from scratch)
make lint          # node --check index.js
make doctor        # Check Node/Yarn/Xcode/simctl/swiftlint/osascript
make test          # Smoke test MCP (43 tools + 2 calls)
make start         # yarn start (stdio)
make dev           # yarn dev (--watch)
make inspect       # MCP Inspector at http://localhost:6274
make clean         # Remove node_modules/.yarn/cache/build
make fmt           # prettier if available
make release VERSION=1.0.1  # bump + tag + push

Details β†’ docs/development.md


πŸ“š Documentation

Doc

Audience

Covers

installation.md

Everyone

Yarn Berry, Corepack, yarnPath vendored, troubleshooting

tools.md

LLM / Dev

All 43 tools, JSON Schema, copy-paste JSON examples

opencode.md

OpenCode

opencode.json global/local, prompts, DEVELOPER_DIR env

codex.md

Codex

config.toml (mcp_servers.xcode), codex mcp list

claude-code.md

Claude Code

claude mcp add / .mcp.json, permissions, trust

development.md

Contributors

Structure, adding a tool, CI, release

architecture.md

Curious

Why single-file, helpers, dispatcher, stdio flow


πŸ§ͺ Manual Smoke Test

# Without Make:
python3 scripts/smoke_test.py
# STDERR: βœ… Xcode MCP Server started β€” 43 tools
# βœ“ tools/list: 43 tools
# βœ“ xcode_sync_strings OK
# βœ“ smoke test PASSED

# With Make:
make test

πŸ—οΈ Architecture

index.js (2250 lines, 1 file)
β”œβ”€β”€ Shebang + Imports (MCP SDK, promisify(exec), fs, path, os)
β”œβ”€β”€ Helpers: shellEscape, expandTilde, runCommand (try/catch + 10MB buffer), formatResult
β”œβ”€β”€ TOOLS[43]: Strict JSON Schema (additionalProperties:false)
β”œβ”€β”€ Handlers[43]: async handle_* with validation + fallbacks (xedβ†’xcode://, swift-formatβ†’swiftlint)
β”œβ”€β”€ Dispatcher: HANDLERS map + ListTools/CallTool (try/catch β†’ isError:true)
└── Server: StdioServerTransport (stdin JSON-RPC, stdout JSON-RPC, stderr logs)

See docs/architecture.md for single-file decision, OpenCode β†’ stdin β†’ handler β†’ xcrun β†’ stdout flow.


🀝 Contributing

# 1. Fork and branch
git checkout -b feat/my-tool

# 2. Develop: add to TOOLS + Handler + HANDLERS in index.js
make install && make lint && make test

# 3. Document in docs/tools.md + README.md

# 4. PR

Issues: Bug Report Β· Feature Request Β· PR Template

CI runs on macos-14 and ubuntu-latest β€” your PR is tested automatically.


πŸ“„ License

MIT Β© YanxReal β€” see LICENSE.


Made with ❀️ for the Apple ecosystem · Yarn 4 + Make + CI + Docs

If it helps you, leave a ⭐ on GitHub

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A server that acts as a bridge between Claude and local Xcode projects, enabling AI-powered code assistance, project management, and automated development tasks without exposing your code to the internet.
  • A
    license
    B
    quality
    C
    maintenance
    Provides programmatic access to Xcode functionality, enabling AI assistants to create, build, test, and manage iOS/macOS projects directly.
    33
    8
    5
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enable Claude Code, Cursor, or your favorite LLM to interact with Xcode, building your projects the same way you do, and seeing the same errors. Greatly increases productivity when working on iOS, iPadOS, macOS, visionOS, tvOS projects & Swift packages - or any time you might use Xcode.
    29
    5
    MIT

View all related MCP servers

Related MCP Connectors

  • Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.

  • Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.

  • Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.

View all MCP Connectors

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/YanxReal/Xcode-MPC'

If you have feedback or need assistance with the MCP directory API, please join our Discord server