Xcode MCP Server Tools Overview

June 5, 2025 ยท View on GitHub

This document provides a comprehensive overview of the tools available in the Xcode MCP Server and explains how they interact with Xcode projects.

Server Architecture

The Xcode MCP Server is organized into the following modules:

  • Project Management: Tools for working with Xcode projects
  • File Operations: Tools for reading and writing files
  • Build & Testing: Tools for building and testing projects
  • CocoaPods Integration: Tools for managing CocoaPods dependencies
  • Swift Package Manager: Tools for managing Swift Package Manager functionality
  • Simulator Tools: Tools for interacting with iOS simulators
  • Xcode Utilities: Miscellaneous Xcode-specific tools
  • Path Management: System for secure file access and directory navigation

Project Management Tools

ToolDescription
set_projects_base_dirSets the base directory where Xcode projects are stored
set_project_pathSets the active Xcode project (xcodeproj, xcworkspace, or SPM); can optionally open the project in Xcode
get_active_projectRetrieves detailed information about the active project
find_projectsFinds Xcode projects in the specified directory
get_project_configurationRetrieves configuration details for the active project
detect_active_projectDetects the active Xcode project with option to respect existing project settings
change_directoryChanges the active directory for relative path operations
push_directoryPushes current directory to stack and changes to a new directory
pop_directoryReturns to previous directory from stack
get_current_directoryShows the current active directory

These tools help you navigate and manage Xcode projects. The server supports multiple project types including regular .xcodeproj files, workspaces (.xcworkspace), and Swift Package Manager projects (Package.swift).

Key Tool Parameters

set_project_path

  • projectPath: Path to the .xcodeproj, .xcworkspace, or directory with Package.swift
  • setActiveDirectory: If true (default), sets the active directory to the project directory
  • openInXcode: If true, opens the project in Xcode automatically, ensuring alignment between the server and Xcode

detect_active_project

  • forceRedetect: If true, forces rediscovery of open projects in Xcode, otherwise respects existing project settings (default: false)

File Operation Tools

ToolDescription
read_fileReads the contents of a file within allowed directories
write_fileWrites or updates file content within allowed directories
copy_fileCopies a file or directory to a new location
move_fileMoves a file or directory to a new location
delete_fileDeletes a file or directory
create_directoryCreates a new directory
list_project_filesLists all files within an Xcode project
list_directoryLists directory contents with options for format and hidden files
get_file_infoGets detailed information about a file or directory
find_filesSearches for files matching a pattern in a directory
resolve_pathShows how a path would be resolved
check_file_existsChecks if a file or directory exists

File operation tools allow you to interact with files securely. All operations use the path management system for validation and security.

Build & Testing Tools

ToolDescription
analyze_fileAnalyzes a source file for potential issues using Xcode's static analyzer
build_projectBuilds the active Xcode project with specified configuration and scheme
run_testsExecutes tests for the active Xcode project, optionally with a test plan

Build and testing tools interact with Xcode's build system to compile your projects and run tests. They use xcodebuild in the background.

CocoaPods Integration

ToolDescription
pod_installRuns 'pod install' in the active project directory
pod_updateRuns 'pod update' in the active project directory
pod_outdatedChecks for outdated dependencies in the project
pod_repo_updateUpdates the local CocoaPods spec repositories
pod_deintegrateRemoves CocoaPods from the project
pod_initInitializes a new Podfile in the project
check_cocoapodsChecks if the active project uses CocoaPods and returns setup information

CocoaPods tools allow you to manage CocoaPods dependencies in your iOS projects. These tools require CocoaPods to be installed on your system.

Swift Package Manager Tools

ToolDescription
init_swift_packageInitializes a new Swift Package Manager project with options for type and testing
add_swift_packageAdds a Swift Package dependency to the active project
update_swift_packageUpdates dependencies with options for specific packages and versions
swift_package_commandExecutes arbitrary Swift Package Manager commands
build_swift_packageBuilds a Swift Package with configuration options
test_swift_packageTests a Swift Package with filtering and parallel options
show_swift_dependenciesDisplays dependency graphs in various formats
clean_swift_packageCleans build artifacts with options for global cache
dump_swift_packageDumps the Package.swift manifest as JSON

Swift Package Manager tools provide comprehensive support for Swift packages and dependencies. They interact with the Swift Package Manager CLI and provide enhanced error reporting.

Simulator Tools

ToolDescription
list_simulatorsLists all available iOS simulators
boot_simulatorBoots an iOS simulator identified by its UDID
shutdown_simulatorShuts down an active iOS simulator
install_appInstalls an app on a simulator
uninstall_appRemoves an app from a simulator
launch_appLaunches an app on a simulator
terminate_appTerminates a running app on a simulator
take_screenshotCaptures a screenshot of a simulator
record_videoRecords video of simulator activity

Simulator tools allow you to interact with iOS simulators. They use the simctl command-line tool that is part of Xcode.

Xcode Utilities

ToolDescription
run_xcrunExecutes a specified Xcode tool via 'xcrun'

See docs/exec-safety-audit.md for a review of shell command usage.