Xcode MCP 服务

XcodeMCPKit 是一个通过单一 MCP 服务器代理并运行 Xcode 原生 MCP 工具的本地开发服务,支持在无界面进程中基于已保存的工作区模型调用 Xcode 能力,适用于 Codex、Claude Code 等 MCP 客户端接入 Xcode 开发工作流。

  • by lynnswap
  • Swift
  • 混合部署
  • 29 星标
  • 更新于
在 GitHub 查看 lynnswap/XcodeMCPKit

使用说明

XcodeMCPKit

XcodeMCPKit runs Xcode's MCP tools through one server, using saved workspace models in an owned headless process.

Requirements

  • An Apple silicon Mac running macOS 15.4+
  • An Xcode installation with native MCP tools
  • Homebrew for installation

Quick start

Install

For a new installation:

brew install lynnswap/tap/xcode-mcpkit

[!NOTE] If you previously installed XcodeMCPKit with the shell installer or from source, run this command once to migrate to Homebrew, even if you have already run brew install:

curl -fsSL https://github.com/lynnswap/XcodeMCPKit/releases/latest/download/install.sh | sh

Restart the server and connected MCP clients afterward.

With Homebrew set up, no additional PATH setting is needed.

Start the server

xcode-mcp-proxy-server

Keep this terminal open while using MCP. You can leave Xcode closed.

To automatically allow other agents' MCP connections directly to the Xcode app, start the server with --auto-approve:

xcode-mcp-proxy-server --auto-approve

Grant macOS Accessibility access to the server's host process when prompted. Headless operations do not need this monitor.

Connect your MCP client

In another terminal, run the command for your client.

Codex

codex mcp add xcode --url http://localhost:8765/mcp

Claude Code

claude mcp add --transport http xcode http://localhost:8765/mcp

For other MCP clients, connect to http://localhost:8765/mcp using Streamable HTTP.

Replacing an existing MCP registration

If your client already has an xcode registration, remove it before running the connection command above:

codex mcp remove xcode
# Or, for Claude Code:
claude mcp remove xcode

Restart clients that are already running after changing their configuration.

Other installation options

Build from source

To build main locally, use a Swift 6.3+ toolchain and install it in a separate directory:

git clone https://github.com/lynnswap/XcodeMCPKit.git
cd XcodeMCPKit
swift run -c release xcode-mcp-proxy-install --bindir "$HOME/.local/opt/xcode-mcpkit-dev/bin"

Stop any running proxy server, then start this build by its full path:

"$HOME/.local/opt/xcode-mcpkit-dev/bin/xcode-mcp-proxy-server"

Connect your client using the HTTP commands in Quick start. No PATH change is needed. The two commands and XcodeMCPNativeHost.app are installed together; keep the helper app beside the commands.

Without --bindir, the source installer defaults to ~/.local/bin and replaces existing commands there, including links created by the Homebrew migration. Using a separate directory keeps development builds independent of that installation.

The installer also accepts --prefix directory to install into its bin subdirectory. Run swift run -c release xcode-mcp-proxy-install --help for details.

Migration from a custom installation directory

For an old custom location, use the same --prefix or --bindir; for example:

curl -fsSL https://github.com/lynnswap/XcodeMCPKit/releases/latest/download/install.sh | sh -s -- --bindir /path/to/bin

Only the specified old installation directory is migrated. If you keep copies in multiple locations, repeat the migration with each location's --bindir.

Update or uninstall a Homebrew installation

Stop the server before updating, then start it again:

brew update
brew upgrade lynnswap/tap/xcode-mcpkit
xcode-mcp-proxy-server

To uninstall, stop the server and run brew uninstall xcode-mcpkit.

Documentation

License

MIT