Skip to content

[Bug]: Build tools inject hardcoded -configuration Debug, overriding the scheme's configuration #443

@hujunfeng

Description

@hujunfeng

Bug Description

When no configuration is provided (neither as a tool parameter nor a session default), every build/test/path tool injects -configuration Debug into the xcodebuild invocation. This overrides the configuration that the scheme's Run action would otherwise select.

xcodebuild, run on its own, picks the configuration from the scheme. By always passing -configuration Debug, XcodeBuildMCP forces resolution against Debug.xcconfig instead of the scheme's actual Run configuration. In a project where the scheme's Run action uses a custom configuration (e.g. Debug-dev), this produces the wrong build settings — including the wrong bundle identifier.

Concrete example from a real project:

  • Scheme's Run action configuration: Debug-dev -> Development.xcconfig -> com.example.app.dev (expected)
  • Forced -configuration Debug -> Debug.xcconfig -> com.example.app (what actually gets built)

Debug Output

⚙️ XcodeBuildMCP Doctor

   Generated: 2026-06-03T14:21:14.316Z
   Server Version: 2.6.2
   Output Mode: Redacted (default)

System Information
  platform: darwin
  release: 25.5.0
  arch: arm64
  cpus: 10 x Apple M1 Pro
  memory: 32 GB

Node.js Information
  version: v25.2.1
  platform: darwin
  arch: arm64

Xcode Information
  version: Xcode 26.5 - Build version 17F42
  path: /Applications/Xcode-26.5.0.app/Contents/Developer
  selectedXcode: /Applications/Xcode-26.5.0.app/Contents/Developer/usr/bin/xcodebuild
  xcrunVersion: xcrun version 72.

Dependencies
  axe: 1.7.1
  mise: 2026.5.18 macos-arm64 (2026-05-31)

Environment Variables
  XCODEBUILDMCP_RUNTIME: cli
  XCODEBUILDMCP_SILENCE_LOGS: true

UI Automation (axe)
  Available: Yes
  UI Automation Supported: Yes

Manifest Tool Inventory
  Total Unique Tools: 82
  Workflow Count: 15

Tool Availability Summary
  Build Tools: Available
  UI Automation Tools: Available
  Incremental Build Support: Not available

Sentry
  Sentry enabled: Yes

✅ Doctor diagnostics complete

Editor/Client

Claude Code

MCP Server Version

2.6.2

LLM

Claude Opus 4.8

MCP Configuration

"XcodeBuildMCP": {
    "args": [
      "-y",
      "xcodebuildmcp@latest",
      "mcp"
    ],
    "command": "npx",
    "env": {},
    "type": "stdio"
  }

Steps to Reproduce

  1. Use a project whose scheme's Run action is set to a non-Debug configuration (e.g. Debug-dev).
  2. Ask the agent to build for simulator/device without specifying a configuration, and without a configuration session default set.
  3. Inspect the generated xcodebuild command in the build log.

Expected Behavior

When neither an explicit configuration argument nor a session default is set, -configuration should be omitted so xcodebuild honors the scheme's configuration for the chosen action.

Actual Behavior

-configuration Debug is always passed, silently overriding the scheme and producing the wrong build settings/bundle id for projects whose scheme uses a non-Debug Run configuration.

Root cause:

// src/mcp/tools/simulator/build_sim.ts:103 (same pattern in device/macos/clean/path tools)
const configuration = params.configuration ?? 'Debug';
// src/utils/build-utils.ts:97 — pushed unconditionally
command.push('-configuration', params.configuration);

SharedBuildParams.configuration is typed as required string (src/types/common.ts:135), so no code path omits the flag. Session defaults allow configuration: string | null and only merge concrete non-null values, so an unset configuration always falls through to the hardcoded Debug.

Error Messages

(none — silent wrong-config build)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions