Skip to main content
Glama
grahammckee

Xcode MCP Broker

by grahammckee

Xcode MCP Broker

A small localhost broker that lets multiple MCP clients share one persistent xcrun mcpbridge connection to Xcode.

With the broker, Xcode authorization normally happens once per Xcode launch. After allowing the broker connection, agents can delegate work to subagents, custom tools, and external scripts that reuse it instead of starting another bridge and requesting access again.

OpenCode ------------\
Custom MCP clients ----> localhost broker --> mcpbridge --> Xcode
Automation scripts ---/

The broker exposes a Streamable HTTP endpoint, serializes calls to Xcode, forwards progress, cancels queued work before dispatch, caches tool discovery, and reconnects when Xcode restarts or its bridge stops responding. It binds to 127.0.0.1 by default.

Requirements

  • macOS with an Xcode version that provides xcrun mcpbridge

  • Node.js 20 or later for source installation and development

Related MCP server: apple-log-mcp

Xcode compatibility

The broker does not hardcode Xcode's tools. It reads tools/list from mcpbridge and refreshes the cache when the bridge reconnects or Xcode sends a tools/list_changed notification. New, removed, or changed tools should therefore be picked up automatically after an Xcode update without requiring a broker release. Connected MCP clients are notified when the cached tool list changes.

When Xcode is running, the broker uses the mcpbridge bundled with that application and pins the bridge to its process ID. This keeps beta or side-by-side Xcode installations aligned even when xcode-select points to another version. If no Xcode process is available, the broker waits without spawning a bridge. It monitors the pinned Xcode process and creates one replacement bridge when Xcode restarts.

This has been tested with the latest Xcode 27 beta available at the time of testing. Future Xcode versions should remain compatible as long as mcpbridge continues to implement the standard MCP lifecycle and tool APIs.

If XCODE_MCP_ALLOWED_TOOLS is set, newly added tools remain hidden until they are added to that allowlist. XCODE_MCP_BRIDGE_COMMAND can still override automatic bridge selection when needed.

Installation

macOS installer

Download the latest universal macOS installer and open it with Installer. The Developer ID signed and notarized package contains its own runtime, so Node.js is not required.

The package installs for the current user:

~/Library/Application Support/XcodeMCPBroker/xcode-mcp-broker
~/Library/LaunchAgents/com.gmicc.opencode-xcode-mcp-broker.plist

The LaunchAgent starts automatically at the next login. To start it immediately after installation:

launchctl bootout gui/$(id -u)/com.gmicc.opencode-xcode-mcp-broker 2>/dev/null || true
launchctl bootstrap gui/$(id -u) "$HOME/Library/LaunchAgents/com.gmicc.opencode-xcode-mcp-broker.plist"

Source installation

Clone the repository, install dependencies, and run the tests:

git clone https://github.com/grahammckee/XcodeMCPBroker.git
cd XcodeMCPBroker
npm install
npm test

Install the broker as a user LaunchAgent:

npm run service:install

The installer uses the current Node executable and repository path, starts the broker at login, and writes logs to ~/Library/Logs/xcode-mcp-broker.log.

Xcode does not need to be open when the service starts. The broker remains available and retries until Xcode launches. Xcode may show its normal Allow dialog when the connection is first established.

OpenCode

Point OpenCode at the broker in ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "xcode": {
      "type": "remote",
      "url": "http://127.0.0.1:7341/mcp",
      "oauth": false,
      "enabled": true
    }
  }
}

Restart OpenCode after changing its configuration.

Verification

curl --fail http://127.0.0.1:7341/healthz
npm run broker:smoke
launchctl print gui/$(id -u)/com.gmicc.opencode-xcode-mcp-broker

The smoke command waits up to 60 seconds for initial Xcode discovery, then lists the available tools and calls the read-only XcodeListWindows tool.

To run the broker in the foreground instead:

npm run broker:start

To remove the LaunchAgent:

npm run service:uninstall

To remove a package installation while retaining its logs:

"$HOME/Library/Application Support/XcodeMCPBroker/xcode-mcp-broker" uninstall

Configuration

Variable

Default

Purpose

XCODE_MCP_BROKER_HOST

127.0.0.1

HTTP bind address

XCODE_MCP_BROKER_PORT

7341

HTTP port

XCODE_MCP_BRIDGE_COMMAND

automatic

Override the bridge executable; otherwise wait for and use a running Xcode's bridge

XCODE_MCP_ALLOWED_TOOLS

all tools

Comma-separated tool allowlist

XCODE_MCP_DISCOVERY_TIMEOUT_MS

10000

Timeout for later Xcode tool-list refreshes; initial discovery waits up to the maximum request duration for authorization

XCODE_MCP_REQUEST_TIMEOUT_MS

45000

Downstream no-progress timeout; progress notifications reset it

XCODE_MCP_MAX_TOTAL_TIMEOUT_MS

1800000

Maximum total duration of a downstream request

XCODE_MCP_SESSION_IDLE_TIMEOUT_MS

300000

Idle upstream session timeout

XCODE_MCP_XCODE_STARTUP_GRACE_MS

5000

Delay before connecting to a newly launched Xcode process

These variables are read directly when running in the foreground. To persist an override in the LaunchAgent, provide it while installing:

XCODE_MCP_ALLOWED_TOOLS="XcodeListWindows,BuildProject" npm run service:install

The broker does not provide authentication. Keep it bound to the loopback interface unless you add an appropriate access-control layer.

Contributing

Issues and pull requests are welcome. Read CONTRIBUTING.md for development, testing, and release-label requirements. Participation is governed by the Code of Conduct.

Do not open public issues for suspected vulnerabilities. Follow the private reporting process in SECURITY.md.

Repository layout

Path

Purpose

src/

Broker runtime and standalone executable entrypoint

test/

Node test suites

scripts/

Development, installation, and release commands

scripts/lib/

Shared release-policy helpers

packaging/

macOS signing and installer metadata

.github/

CI, release automation, Dependabot, and contribution templates

License

Licensed under the MIT License.

A
license - permissive license
-
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
2dRelease cycle
7Releases (12mo)
Commit activity
Issues opened vs closed

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

  • A
    license
    A
    quality
    A
    maintenance
    mcp-broker is a local Model Context Protocol process broker for MCP clients. Think PgBouncer for MCP: one stable local endpoint in front of many upstream MCP servers. The broker owns upstream startup, reuse, cleanup, profile exposure, status, and safe tool routing. The core idea is simple: do not make every agent session load every upstream tool definition before the user asks a task.
    4
    4
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    MCP server for interacting with Xcode build tools, iOS Simulator, and Apple notarization services.
    15
    5
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay

  • Broker + MCP server for last-bidder-wins on-chain games on Solana via x402 micropayments.

  • MCP server for Appcircle mobile CI/CD platform.

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/grahammckee/XcodeMCPBroker'

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