XcodeBuildMCPdocs
Install

Environment Variables

Every env var XcodeBuildMCP reads on startup. Use these to bootstrap MCP clients that can't supply workspace context directly.

Set env vars in the env field of your MCP client config (for example mcp_config.json for Windsurf, .vscode/mcp.json for VS Code, or claude_desktop_config.json for Claude Desktop). For repo-scoped structured settings, prefer .xcodebuildmcp/config.yaml, see Configuration.

Precedence#

session_set_defaults > .xcodebuildmcp/config.yaml > env vars. Each layer serves a different context:

  • Config file is the canonical home for structured, repo-scoped, version-controlled settings.
  • Env vars are best for flat startup defaults in MCP clients with limited workspace support.
  • Tool calls are for agent-driven runtime adjustments.

General settings#

Config optionEnvironment variable
enabledWorkflowsXCODEBUILDMCP_ENABLED_WORKFLOWS (comma-separated)
experimentalWorkflowDiscoveryXCODEBUILDMCP_EXPERIMENTAL_WORKFLOW_DISCOVERY
Startup working directoryXCODEBUILDMCP_CWD
disableSessionDefaultsXCODEBUILDMCP_DISABLE_SESSION_DEFAULTS
disableXcodeAutoSyncXCODEBUILDMCP_DISABLE_XCODE_AUTO_SYNC
incrementalBuildsEnabledINCREMENTAL_BUILDS_ENABLED
filePathRenderStyleXCODEBUILDMCP_FILE_PATH_RENDER_STYLE (list or tree)
debugXCODEBUILDMCP_DEBUG
showTestTimingXCODEBUILDMCP_SHOW_TEST_TIMING
sentryDisabledXCODEBUILDMCP_SENTRY_DISABLED
debuggerBackendXCODEBUILDMCP_DEBUGGER_BACKEND
dapRequestTimeoutMsXCODEBUILDMCP_DAP_REQUEST_TIMEOUT_MS
dapLogEventsXCODEBUILDMCP_DAP_LOG_EVENTS
launchJsonWaitMsXBMCP_LAUNCH_JSON_WAIT_MS
MCP idle timeoutXCODEBUILDMCP_MCP_IDLE_TIMEOUT_MS
uiDebuggerGuardModeXCODEBUILDMCP_UI_DEBUGGER_GUARD_MODE
axePathXCODEBUILDMCP_AXE_PATH
iosTemplatePathXCODEBUILDMCP_IOS_TEMPLATE_PATH
iosTemplateVersionXCODEBUILD_MCP_IOS_TEMPLATE_VERSION
macosTemplatePathXCODEBUILDMCP_MACOS_TEMPLATE_PATH
macosTemplateVersionXCODEBUILD_MCP_MACOS_TEMPLATE_VERSION

Session default bootstrap#

Session defaultEnvironment variable
workspacePathXCODEBUILDMCP_WORKSPACE_PATH
projectPathXCODEBUILDMCP_PROJECT_PATH
schemeXCODEBUILDMCP_SCHEME
configurationXCODEBUILDMCP_CONFIGURATION
simulatorNameXCODEBUILDMCP_SIMULATOR_NAME
simulatorIdXCODEBUILDMCP_SIMULATOR_ID
simulatorPlatformXCODEBUILDMCP_SIMULATOR_PLATFORM
deviceIdXCODEBUILDMCP_DEVICE_ID
platformXCODEBUILDMCP_PLATFORM
useLatestOSXCODEBUILDMCP_USE_LATEST_OS
archXCODEBUILDMCP_ARCH
suppressWarningsXCODEBUILDMCP_SUPPRESS_WARNINGS
derivedDataPathXCODEBUILDMCP_DERIVED_DATA_PATH
preferXcodebuildXCODEBUILDMCP_PREFER_XCODEBUILD
bundleIdXCODEBUILDMCP_BUNDLE_ID

MCP idle shutdown#

XCODEBUILDMCP_MCP_IDLE_TIMEOUT_MS is disabled by default (0). Set it to a positive number of milliseconds when you want an unused MCP server process to shut down gracefully after that idle period.

The server only exits when the timeout has elapsed, no MCP request is in flight, and no registered runtime operation is active.

Working directory override#

XCODEBUILDMCP_CWD overrides the directory XcodeBuildMCP uses to discover .xcodebuildmcp/config.yaml and resolve relative paths. Set this when the host that launches XcodeBuildMCP can configure environment variables but not the spawn directory (the most common case is MCP Inspector).

VariableBehavior
XCODEBUILDMCP_CWDAbsolute path; supports a leading ~/. Falls back to the original cwd with a warning if the directory cannot be entered.

Example: launch XcodeBuildMCP from anywhere and have it read ~/Projects/MyApp/.xcodebuildmcp/config.yaml:

json
{
  "mcpServers": {
    "XcodeBuildMCP": {
      "command": "npx",
      "args": ["-y", "xcodebuildmcp@latest", "mcp"],
      "env": {
        "XCODEBUILDMCP_CWD": "~/Projects/MyApp"
      }
    }
  }
}

If you have not set XCODEBUILDMCP_CWD, the working directory is whatever the host process spawned XcodeBuildMCP in.

Example#

json
{
  "mcpServers": {
    "XcodeBuildMCP": {
      "command": "npx",
      "args": ["-y", "xcodebuildmcp@latest", "mcp"],
      "env": {
        "XCODEBUILDMCP_ENABLED_WORKFLOWS": "simulator,debugging,ui-automation",
        "XCODEBUILDMCP_WORKSPACE_PATH": "/Users/me/MyApp/MyApp.xcworkspace",
        "XCODEBUILDMCP_SCHEME": "MyApp",
        "XCODEBUILDMCP_PLATFORM": "iOS Simulator",
        "XCODEBUILDMCP_SIMULATOR_NAME": "iPhone 17 Pro"
      }
    }
  }
}

Exporting from setup#

xcodebuildmcp setup --format mcp-json prints an env-based bootstrap block for your MCP client, based on the choices made in the interactive wizard. This is intended for MCP client bootstrap only, it does not replace config.yaml as the canonical project configuration.