Skip to main content
Glama

Xcode MCP Server

Apple エコシステム向け Model Context Protocol サーバー

OpenCode、Codex、Claude Code を Xcode に接続 — 1 つの index.js に 43 個のプロフェッショナルツール

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

🌐 言語: English | Español

インストールツールOpenCodeCodexClaude Codeドキュメント


これは何ですか?

Xcode MCP Server は、AI IDE(OpenCode / Codex / Claude Code)と Xcode + Apple Dev Tools を結ぶ、本格的で本番対応のブリッジです。

LLM はもはや Swift を書くだけではありません。ビルド、テスト、プロファイリング、シミュレータ・実機・署名の管理、さらには該当行で Xcode を開くことまで、HTTP サーバーなしで MCP stdio 経由で行います。

スタック: ES Modules · @modelcontextprotocol/sdk@1.30 · StdioServerTransport · promisify(exec) · Yarn 4 Berry · Make

  • 単一ファイルの index.js(2250 行) — ビルドステップやコンパイルは不要、1 つのファイルで監査可能。シバン #!/usr/bin/env node 付きで、nodeyarn startnpx のいずれでも実行できます。

  • 厳格な JSON Schema を備えた 43 個のツールadditionalProperties:false)+ グローバルな try/catch。各ツールは content: [{type:"text"}] を返し、失敗時には isError:true を返します — // TODO はありません。

  • Apple ツールを完全カバー: xcodebuildsimctl(9)、devicectl(2)、xctrace(5 テンプレート)、agvtoolsecurityosascript/xed

  • モダンな DX: 同梱の Yarn 4(.yarn/releases)、help 付きの自己文書化 Makefile、モジュール化された docs/、macOS CI + make test スモークテスト。

  • マルチクライアント: 同じ index.js が変更なしで OpenCodeCodexClaude Code で動作します。


Related MCP server: Xcode MCP Server

✨ 機能

カテゴリ

ツール数

説明

ビルド

6

xcode_buildxcode_clean(+ DerivedData のパージ)、xcode_list_schemesxcode_analyzexcode_archive_export.ipa)、swift_format_lint

テスト

2

xcode_run_testsonlyTesting フィルター)、xcode_test_coveragexccov --json

シミュレータ

9

simctl_listlifecycle(起動 / シャットダウン / 消去)、install_launchmedia_capturepush_notificationlocation_mockprivacy_controlui_appearanceopen_url

デバイス

2

devicectl_listdevicectl_logs(N 秒間のストリーミング)

プロファイリング

1

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

バージョン管理

2

agvtool_version_bumpxcode_certificates_check

エディタ

2

xcode_get_active_file(AppleScript)、xcode_open_at_linexedxcode://

ローカライゼーション

1

xcode_sync_strings.xcstrings → 欠落 / 保留 / 空)

アセット

6

asset_list_contentsasset_manage_color(ライト / ダーク)、asset_manage_image(1x / 2x / 3x / ベクター)、asset_read_infoasset_deleteasset_validate_actoolactool

アプリアイコン

1

asset_generate_appicon(全 Apple OS: iOS、macOS、watchOS、tvOS、visionOS + sips でのリサイズ)

パッケージ / SPM

11

package_resolvepackage_updatepackage_list_dependenciespackage_read_resolvedpackage_reset_cachepackage_compute_checksumspm_add_dependencyspm_remove_dependencycocoapods_managecarthage_managecocoapods_to_spm_migrate


📋 目次

  1. 必要条件

  2. ステップバイステップのインストール

  3. 検証

  4. OpenCode / Codex / Claude Code での使用

  5. ツール (43)

  6. Make コマンド

  7. ドキュメント

  8. アーキテクチャ

  9. コントリビューション


📦 必要条件

依存関係

バージョン

インストール

必須

macOS

13+(14+ 推奨)

xcodebuild / simctl に必要

Xcode

15+

App Store → xcode-select --install

Node.js

≥ 18

brew install nodenode --version

Yarn

4.x Berry

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

make

3.81+

xcode-select --install(make を含む)

swift-format

最新

brew install swift-format

◻️ 任意

swiftlint

最新

brew install swiftlint

◻️ 任意

Linux / Windows: 動作するのは make lint のみです(Xcode なし)。CI はそのために syntax-linux ジョブを実行します。


🚀 ステップバイステップのインストール

この順序どおりに実行してください。ブロックごとにコピー&ペーストしてください。

ステップ 0 — Xcode と 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

ステップ 1 — リポジトリのクローン

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

ステップ 2 — 依存関係のインストール

オプション A — Make を使用(推奨・モダン):

make install

make install が行うこと:

  1. yarn を検出し、なければ corepack 経由でインストール

  2. yarn install を実行(yarn.lock を読み、@modelcontextprotocol/sdk をインストール)

  3. chmod +x index.js を実行

想定される出力:

➤ YN0000: · Yarn 4.18.0
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 3s
✓ dependencies installed

オプション B — Yarn を直接使用:

yarn install
chmod +x index.js

npm から移行する場合:

rm -f package-lock.json
yarn install

ステップ 3 — 環境の確認

make doctor

次のように表示されるはずです:

Node: v20.x
Yarn: 4.18.0
Xcode: Xcode 15.x
xcrun: xcrun version 70
...
✓ doctor complete

xcodebuild: command not found と表示された場合:

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

ステップ 4 — MCP サーバーの検証

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

または手動で:

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

ステップ 5 — AI クライアントの設定

いずれか 1 つ(または 3 つすべて — 同じ index.js がどこでも動作します)を選択:

クライアント

設定ファイル

コマンド

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 または .mcp.json

コピー&ペースト用の JSON / TOML 付きの完全な手順:

ステップ 6 — 再起動してテスト

OpenCode / Codex / Claude Code を再起動して、次のように入力します:

list the xcode tools

43 個のツールが表示され、ログには次のように出力されるはずです:

✅ Xcode MCP Server started (stdio) — 43 tools registered

完了です!あとは次のように指示できます:

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

✅ 検証

# 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

🔧 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

またはプロジェクト単位で .mcp.json を使用:

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

各クライアントのプロンプト例 → docs/opencode.md · docs/codex.md · docs/claude-code.md · テンプレート: .mcp.json.example · .codex-config.toml.example


🛠️ ツール (43)

1. ビルド、診断、クリーン

ツール

xcrun / xcodebuild

主な引数

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-formatswiftlint

path, `mode: lint

format, tool: auto`

2. テストとカバレッジ

ツール

xcodebuild

主な引数

xcode_run_tests

xcodebuild test

scheme*, destination*, onlyTesting, enableCodeCoverage

xcode_test_coverage

xcrun xccov view --report --json

xcresultPath (DerivedData内を自動検索)

3. シミュレータ xcrun simctl (9)

simctl_list (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. 物理デバイス xcrun devicectl (2)

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

5. プロファイリング xcrun xctrace (1)

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

6. バージョンとセキュリティ (2)

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

7. Xcode GUIエディタ (2)

xcode_get_active_file (AppleScript osascript), xcode_open_at_line (filePath*, line*, columnxedxcode://)

8. ローカライズ (1)

xcode_sync_strings (.xcstringsmissing / pendingTranslation / emptyValues)

9. アセット Assets.xcassets + actool (6)

asset_list_contents (*.colorset/*.imagesetを一覧表示), asset_manage_color (#RRGGBBのLight + Dark), asset_manage_image (スケール/ベクター + preserves-vector-representation), asset_read_info (Contents.json), asset_delete (安全), asset_validate_actool (xcrun actool --compile)

10. AppIcon 全Apple OS (1)

asset_generate_appicon (iOS、macOS、watchOS、tvOS、visionOS — 42スロット、baseImagePathがある場合はsips -z)

11. パッケージ 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)

JSON Schema + コピー&ペースト例付きの完全リファレンス → docs/tools.md


📖 Makeコマンド

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

詳細 → docs/development.md


📚 ドキュメント

ドキュメント

対象読者

内容

installation.md

すべての人

Yarn Berry、Corepack、yarnPathのベンダリング、トラブルシューティング

tools.md

LLM / 開発者

全43ツール、JSON Schema、コピー&ペースト可能なJSON例

opencode.md

OpenCode

opencode.json グローバル/ローカル、プロンプト、DEVELOPER_DIR環境変数

codex.md

Codex

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

claude-code.md

Claude Code

claude mcp add / .mcp.json、権限、信頼設定

development.md

コントリビューター

構成、ツールの追加、CI、リリース

architecture.md

興味のある方

単一ファイルの理由、ヘルパー、ディスパッチャー、stdioフロー


🧪 手動スモークテスト

# 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

🏗️ アーキテクチャ

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)

単一ファイルの決定、OpenCode → stdin → handler → xcrun → stdoutフローについては、docs/architecture.mdを参照してください。


🤝 コントリビューション

# 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

イシュー: バグ報告 · 機能リクエスト · PRテンプレート

CIはmacos-14ubuntu-latestで実行されます — あなたのPRは自動的にテストされます。


📄 ライセンス

MIT © YanxRealLICENSEを参照してください。


🔗 リンク

Appleエコシステムのために❤️を込めて作成 · Yarn 4 + Make + CI + Docs

役に立ったら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