Skip to main content
Glama
xctools-mcp-server

xctools-mcp-server

by nzrsky

XCTools MCP Server

A Model Context Protocol (MCP) server that provides structured access to Xcode development tools including xcrun, xcodebuild, and xctrace.

Installation

Method 1: Using uvx

  1. Prerequisites:

    • Python 3.13+

    • Xcode with Command Line Tools installed

    • uvx: curl -LsSf https://astral.sh/uv/install.sh | sh

  2. Run directly with uvx:

    uvx xctools-mcp-server

Method 2: Local Development Installation

  1. Prerequisites:

    • Python 3.13+

    • Xcode with Command Line Tools installed

  2. Clone and install:

    git clone https://github.com/nzrsky/xctools-mcp-server
    cd xctools-mcp-server
    pip install .
  3. Run the server:

    xctools-mcp-server

Method 3: Build from Source

  1. Build the wheel:

    python -m build --wheel
    pip install dist/xctools_mcp_server-0.1.0-py3-none-any.whl

Related MCP server: MCP Xcode

Configuration

For Claude Desktop

Add to your ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "xctools": {
      "command": "xctools-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

Or if using uvx:

{
  "mcpServers": {
    "xctools": {
      "command": "uvx",
      "args": ["xctools-mcp-server"],
      "env": {}
    }
  }
}

For VS Code with MCP Extension

  1. Install the MCP Extension from the VS Code marketplace

  2. Add server configuration to your VS Code settings (settings.json):

{
  "mcp.servers": {
    "xctools": {
      "command": "xctools-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

Or if using uvx:

{
  "mcp.servers": {
    "xctools": {
      "command": "uvx",
      "args": ["xctools-mcp-server"],
      "env": {}
    }
  }
}
  1. Restart VS Code to load the MCP server

  2. Use the Command Palette (Cmd+Shift+P) and search for "MCP" commands to interact with the Xcode development tools

For Other MCP Clients

The server runs on stdio, so you can invoke it directly:

With installed package:

xctools-mcp-server

With uvx:

uvx xctools-mcp-server

Features

  • Complete Xcode toolchain access through xcrun

  • Project building and testing with xcodebuild

  • Performance analysis using xctrace (Instruments)

  • SDK and destination management

  • Comprehensive error handling with detailed messages

  • Cross-platform compatibility (macOS with Xcode installed)

Available Tools

XCRUN Tools

  • xcrun_find_tool - Find the path to development tools (clang, swift, etc.)

  • xcrun_show_sdk_path - Show the path to SDKs

  • xcrun_show_sdk_version - Show SDK versions

  • xcrun_run_tool - Run any development tool via xcrun

XCODEBUILD Tools

  • xcodebuild_build - Build Xcode projects or workspaces

  • xcodebuild_test - Run tests for projects/workspaces

  • xcodebuild_archive - Archive projects for distribution

  • xcodebuild_list - List targets, schemes, and configurations

  • xcodebuild_show_sdks - List all available SDKs

  • xcodebuild_show_destinations - Show valid build destinations

XCTRACE Tools (Instruments)

  • xctrace_record - Record new Instruments traces

  • xctrace_import - Import supported files into trace format

  • xctrace_export - Export data from trace files

  • xctrace_list - List available devices, templates, or instruments

  • xctrace_symbolicate - Symbolicate traces with debug symbols

Usage Examples

Finding Development Tools

# Find the path to a specific tool
"Find the path to clang compiler"

# Show SDK path for iOS
"Show the path to the iOS SDK"

# Get SDK version information
"Show the version of the iOS SDK"

Building Projects

# Build an Xcode project
"Build the project MyApp.xcodeproj for iOS simulator"

# Run tests for a workspace
"Run tests for MyApp.xcworkspace on iPhone 15 Pro simulator"

# Archive for distribution
"Archive MyApp.xcworkspace for release"

# List project information
"List all schemes and targets in MyApp.xcodeproj"

Performance Analysis with Instruments

# Record a trace for Time Profiler
"Record a Time Profiler trace for MyApp on iPhone 15 Pro for 30 seconds"

# List available instruments
"List all available Instruments templates"

# Export trace data
"Export data from trace file to XML format"

# Import a file for analysis
"Import a .dtps file into Instruments trace format"

SDK and Destination Management

# List all available SDKs
"Show all available SDKs for building"

# Show build destinations
"List all available destinations for iOS builds"

# Run a tool via xcrun
"Run swift command with version flag via xcrun"

Error Handling

The server includes comprehensive error handling:

  • Command failures: Returns detailed error messages from xcrun, xcodebuild, and xctrace

  • Missing Xcode: Detects when Xcode Command Line Tools are not available

  • Invalid parameters: Validates tool arguments and provides helpful error messages

  • Tool availability: Checks for required tools before execution

Troubleshooting

Common Issues

  1. "xcrun: error: unable to find utility"

    • Ensure Xcode Command Line Tools are installed: xcode-select --install

    • Verify Xcode is properly configured: xcode-select -p

  2. "No developer directory found"

    • Install Xcode from the Mac App Store

    • Accept Xcode license: sudo xcodebuild -license accept

  3. Permission errors

    • Ensure the user has necessary permissions to access Xcode tools

    • Try running with proper macOS development permissions

  4. Tool not found errors

    • Verify the specific tool is available in your Xcode installation

    • Some tools may require specific Xcode versions or additional components

Requirements

  • macOS: Required (Xcode development tools are macOS-only)

  • Xcode: Xcode Command Line Tools or full Xcode installation

  • Python: 3.13 or higher

  • MCP Client: Claude Desktop, VS Code with MCP extension, or any MCP-compatible client

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

  • Invalid parameters: Validates input parameters before execution

  • File operations: Handles temporary files for push notifications safely

Security Considerations

  • The server only exposes read and simulator management operations

  • No access to host file system beyond specified app paths

  • Push notification payloads are validated for structure

  • Privacy permission changes are explicit and logged

Development Notes

  • Built specifically for iOS development workflows

  • Optimized for common simulator management tasks

  • Structured output parsing for JSON responses

  • Support for both individual and batch operations

  • Compatible with Xcode 15+ simulator features

Available Tools

15 tools
xcodebuild_archiveA

Archive an Xcode project or workspace.

Args: project: Path to .xcodeproj file workspace: Path to .xcworkspace file scheme: Scheme name to archive (required) archive_path: Path where to save the archive

Returns: Archive result

Inputs: project, workspace, scheme, archive_path. Returns: result

xcodebuild_buildB

Build an Xcode project or workspace.

Args: project: Path to .xcodeproj file workspace: Path to .xcworkspace file scheme: Scheme name to build target: Target name to build configuration: Build configuration (Debug, Release, etc.) sdk: SDK to build against destination: Destination to build for clean: Whether to clean before building

Returns: Build output

Inputs: project, workspace, scheme, target, +4 more. Returns: result

xcodebuild_listA

List targets and configurations in a project, or schemes in a workspace.

Args: project: Path to .xcodeproj file workspace: Path to .xcworkspace file

Returns: List of targets/schemes and configurations

Inputs: project, workspace. Returns: result

xcodebuild_show_destinationsB

List valid destinations for a project or workspace and scheme.

Args: project: Path to .xcodeproj file workspace: Path to .xcworkspace file scheme: Scheme name (required)

Returns: List of valid destinations

Inputs: project, workspace, scheme. Returns: result

xcodebuild_show_sdksB

List all available SDKs.

Returns: List of available SDKs

Inputs: no named parameters. Returns: result

xcodebuild_testA

Run tests for an Xcode project or workspace.

Args: project: Path to .xcodeproj file workspace: Path to .xcworkspace file
scheme: Scheme name to test (required) destination: Destination to test on test_plan: Name of test plan to use only_testing: List of test identifiers to run exclusively skip_testing: List of test identifiers to skip

Returns: Test results

Inputs: project, workspace, scheme, destination, +3 more. Returns: result

xcrun_find_toolA

Find the path to a development tool using xcrun.

Args: tool_name: Name of the tool to find (e.g., 'clang', 'swift', 'texturetool') sdk: SDK name to search in (e.g., 'iphoneos', 'macosx')

Returns: Absolute path to the tool

Inputs: tool_name (required), sdk. Returns: result

xcrun_run_toolC

Run a development tool via xcrun.

Args: tool_name: Name of the tool to run args: Arguments to pass to the tool sdk: SDK to use when running the tool verbose: Enable verbose output

Returns: Output from the tool

Inputs: tool_name (required), args (required), sdk, verbose. Returns: result

xcrun_show_sdk_pathA

Show the path to the SDK.

Args: sdk: SDK name (e.g., 'iphoneos', 'macosx'). Uses default if not specified.

Returns: Path to the SDK

Inputs: sdk. Returns: result

xcrun_show_sdk_versionA

Show the version of the SDK.

Args: sdk: SDK name (e.g., 'iphoneos', 'macosx'). Uses default if not specified.

Returns: Version of the SDK

Inputs: sdk. Returns: result

xctrace_exportB

Export data from an Instruments trace file.

Args: input_file: Path to the .trace file to export from output_path: Path to save the exported data toc: Export table of contents xpath: XPath expression to select specific data

Returns: Exported data or success message

Inputs: input_file (required), output_path, toc, xpath. Returns: result

xctrace_importC

Import a supported file format into an Instruments trace file.

Args: input_file: Path to the input file to import (e.g., .logarchive, .ktrace) template: Template name or path to use for import output_path: Path to save the imported trace file instrument: Name of instrument to add to import configuration package: Path to Instruments Package to install temporarily

Returns: Import result

Inputs: input_file (required), template (required), output_path, instrument, +1 more. Returns: result

xctrace_listA

List available devices, templates, or instruments.

Args: list_type: What to list ('devices', 'templates', 'instruments')

Returns: List of requested items

Inputs: list_type (required). Returns: result

xctrace_recordA

Record a new Instruments trace using the specified template.

Args: template: Template name or path to use for recording output_path: Path to save the trace file device: Device name or UDID to record on time_limit: Time limit for recording (e.g., '5s', '1m') all_processes: Record all processes on the system attach_process: Process name or PID to attach to launch_command: Command and arguments to launch and record

Returns: Recording result

Inputs: template (required), output_path, device, time_limit, +3 more. Returns: result

xctrace_symbolicateB

Symbolicate a trace file using debug symbols.

Args: input_file: Path to the .trace file to symbolicate output_path: Path to save the symbolicated trace dsym_path: Path to dSYM file or directory containing dSYMs

Returns: Symbolication result

Inputs: input_file (required), output_path, dsym_path. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 15 tools

    Disambiguation5/5

    Tools are clearly separated by domain prefixes (xcodebuild_, xcrun_, xctrace_) and within each group have distinct, non-overlapping purposes. For example, xcodebuild_archive builds a standalone archive while xcodebuild_build compiles the project, and xcrun_find_tool locates a tool versus xcrun_run_tool executes it.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with a category prefix and a descriptive verb (e.g., xcodebuild_archive, xcrun_find_tool, xctrace_record). Multi-word verbs are compound but still uniform. No mixing of conventions.

    Tool Count5/5

    With 15 tools, the set covers the primary Xcode development workflows (building, archiving, testing, running command-line tools, and profiling) without being excessive. Each tool has a defined purpose and the count feels appropriate for the server's domain.

    Completeness4/5

    The tool surface covers major Xcode operations: building, archiving, testing, SDK queries, xcrun utilities, and Instruments recording. Minor gaps exist, such as missing xcodebuild clean or analyze, and limited xcrun actions (e.g., no simctl), but the core workflows are complete and agents can work around these omissions.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides programmatic access to Xcode functionality, enabling AI assistants to create, build, test, and manage iOS/macOS projects directly.
      33
      7 npm
      5
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to build, test, run, and manage Apple platform projects (iOS, macOS, tvOS, watchOS, visionOS) directly through Xcode. Provides comprehensive control over Xcode projects, Swift packages, simulators, and development workflows without leaving your editor.
      5
      7 npm
      2
      MIT