MobileBuildMCPdocs
Install

Environment Variables

Every env var MobileBuildMCP 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 .mobilebuildmcp/config.yaml, see Configuration.

Precedence#

session_set_defaults > .mobilebuildmcp/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
enabledWorkflowsMOBILEBUILDMCP_ENABLED_WORKFLOWS (comma-separated)
experimentalWorkflowDiscoveryMOBILEBUILDMCP_EXPERIMENTAL_WORKFLOW_DISCOVERY
Startup working directoryMOBILEBUILDMCP_CWD
disableSessionDefaultsMOBILEBUILDMCP_DISABLE_SESSION_DEFAULTS
disableXcodeAutoSyncMOBILEBUILDMCP_DISABLE_XCODE_AUTO_SYNC
incrementalBuildsEnabledINCREMENTAL_BUILDS_ENABLED
filePathRenderStyleMOBILEBUILDMCP_FILE_PATH_RENDER_STYLE (list or tree)
debugMOBILEBUILDMCP_DEBUG
showTestTimingMOBILEBUILDMCP_SHOW_TEST_TIMING
sentryDisabledMOBILEBUILDMCP_SENTRY_DISABLED
debuggerBackendMOBILEBUILDMCP_DEBUGGER_BACKEND
dapRequestTimeoutMsMOBILEBUILDMCP_DAP_REQUEST_TIMEOUT_MS
dapLogEventsMOBILEBUILDMCP_DAP_LOG_EVENTS
launchJsonWaitMsMOBILEBUILDMCP_LAUNCH_JSON_WAIT_MS
MCP idle timeoutMOBILEBUILDMCP_MCP_IDLE_TIMEOUT_MS
uiDebuggerGuardModeMOBILEBUILDMCP_UI_DEBUGGER_GUARD_MODE
axePathMOBILEBUILDMCP_AXE_PATH
iosTemplatePathMOBILEBUILDMCP_IOS_TEMPLATE_PATH
iosTemplateVersionMOBILEBUILD_MCP_IOS_TEMPLATE_VERSION
macosTemplatePathMOBILEBUILDMCP_MACOS_TEMPLATE_PATH
macosTemplateVersionMOBILEBUILD_MCP_MACOS_TEMPLATE_VERSION

Session default bootstrap#

Session defaultEnvironment variable
workspacePathMOBILEBUILDMCP_WORKSPACE_PATH
projectPathMOBILEBUILDMCP_PROJECT_PATH
schemeMOBILEBUILDMCP_SCHEME
configurationMOBILEBUILDMCP_CONFIGURATION
simulatorNameMOBILEBUILDMCP_SIMULATOR_NAME
simulatorIdMOBILEBUILDMCP_SIMULATOR_ID
simulatorPlatformMOBILEBUILDMCP_SIMULATOR_PLATFORM
deviceIdMOBILEBUILDMCP_DEVICE_ID
platformMOBILEBUILDMCP_PLATFORM
useLatestOSMOBILEBUILDMCP_USE_LATEST_OS
archMOBILEBUILDMCP_ARCH
suppressWarningsMOBILEBUILDMCP_SUPPRESS_WARNINGS
derivedDataPathMOBILEBUILDMCP_DERIVED_DATA_PATH
preferXcodebuildMOBILEBUILDMCP_PREFER_XCODEBUILD
bundleIdMOBILEBUILDMCP_BUNDLE_ID

MCP idle shutdown#

MOBILEBUILDMCP_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#

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

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

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

json
{
  "mcpServers": {
    "MobileBuildMCP": {
      "command": "npx",
      "args": ["-y", "mobilebuildmcp@latest", "mcp"],
      "env": {
        "MOBILEBUILDMCP_CWD": "~/Projects/MyApp"
      }
    }
  }
}

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

Example#

json
{
  "mcpServers": {
    "MobileBuildMCP": {
      "command": "npx",
      "args": ["-y", "mobilebuildmcp@latest", "mcp"],
      "env": {
        "MOBILEBUILDMCP_ENABLED_WORKFLOWS": "simulator,debugging,ui-automation",
        "MOBILEBUILDMCP_WORKSPACE_PATH": "/Users/me/MyApp/MyApp.xcworkspace",
        "MOBILEBUILDMCP_SCHEME": "MyApp",
        "MOBILEBUILDMCP_PLATFORM": "iOS Simulator",
        "MOBILEBUILDMCP_SIMULATOR_NAME": "iPhone 17 Pro"
      }
    }
  }
}

Exporting from setup#

mobilebuildmcp 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.