xcode-mcp-server
v1.0.3An MCP server for Xcode integration, enabling AI assistants to interact with Xcode projects
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
set_projects_base_dir
Sets the base directory where your Xcode projects are stored.
| Parameter | Type | Description |
|---|---|---|
baseDir * | string | Path to the directory containing your Xcode projects. Supports ~ for home directory and environment variables. |
set_project_path
Sets the active Xcode project by specifying the path to its .xcodeproj directory.
| Parameter | Type | Description |
|---|---|---|
projectPath * | string | Path to the .xcodeproj directory for the desired project. Supports ~ for home directory and environment variables. |
openInXcode | boolean | If true, also open the project in Xcode (default: false) |
setActiveDirectory | boolean | If true, also set the active directory to the project directory |
get_active_project
Retrieves detailed information about the currently active Xcode project.
| Parameter | Type | Description |
|---|---|---|
detailed | boolean | If true, include additional detailed project information |
find_projects
Finds Xcode projects in the specified directory.
| Parameter | Type | Description |
|---|---|---|
directory | string | Directory to search in. Defaults to projects base directory. |
includeSPM | boolean | If true, include Swift Package Manager projects |
includeWorkspaces | boolean | If true, include .xcworkspace files |
change_directory
Changes the active directory for relative path operations.
| Parameter | Type | Description |
|---|---|---|
directoryPath * | string | Path to the directory to set as active. Supports absolute paths, paths relative to the current active directory, and ~ for home directory. |
push_directory
Pushes the current directory onto a stack and changes to a new directory.
| Parameter | Type | Description |
|---|---|---|
directoryPath * | string | Path to the directory to set as active. Supports absolute paths, paths relative to the current active directory, and ~ for home directory. |
pop_directory
Pops a directory from the stack and changes to it.
get_current_directory
Returns the current active directory.
get_project_configuration
Retrieves configuration details for the active project, including schemes and targets.
detect_active_project
Attempts to automatically detect the active Xcode project.
| Parameter | Type | Description |
|---|---|---|
forceRedetect | boolean | If true, always try to detect the project even if one is already set (default: false) |
add_file_to_project
Adds a file to the active Xcode project.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | Path to the file to add to the project |
createGroups | boolean | Whether to create intermediate groups if they don't exist (default: true) |
group | string | Group path within the project to add the file to (e.g., 'MyApp/Models'). If not provided, will add to the root group. |
targetName | string | Name of the target to add the file to. If not provided, will try to add to the first target. |
create_workspace
Creates a new Xcode workspace and optionally adds existing projects to it.
| Parameter | Type | Description |
|---|---|---|
name * | string | Name of the workspace to create |
outputDirectory * | string | Directory where the workspace will be created |
projects | array | Optional array of project paths to add to the workspace |
setAsActive | boolean | Whether to set the new workspace as the active project (default: true) |
add_project_to_workspace
Adds an existing project to the active workspace.
| Parameter | Type | Description |
|---|---|---|
projectPath * | string | Path to the project to add to the workspace |
workspacePath | string | Path to the workspace. If not provided, uses the active workspace. |
create_xcode_project
Creates a new Xcode project using a template.
| Parameter | Type | Description |
|---|---|---|
name * | string | Name of the project to create |
outputDirectory * | string | Directory where the project will be created |
template * | string | Template to use for the project |
includeTests | boolean | Whether to include unit tests (default: true) |
includeUITests | boolean | Whether to include UI tests (default: false) |
language | string | Programming language to use (default: swift) |
organizationIdentifier | string | Organization identifier (e.g., 'com.example') to use in the project |
organizationName | string | Organization name to use in the project |
setAsActive | boolean | Whether to set the new project as the active project (default: true) |
read_file
Reads the contents of a file within the active project or allowed directories.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | Path to the file to read. Can be absolute, relative to active directory, or use ~ for home directory. |
asBinary | boolean | If true, read the file as binary and return base64-encoded content. Useful for images and other binary files. |
encoding | string | Encoding to use when reading the file (e.g., 'utf-8', 'latin1'). Default is 'utf-8'. |
write_file
Writes or updates the content of a file within the active project or allowed directories.
| Parameter | Type | Description |
|---|---|---|
content * | string | The content to be written to the file. |
path * | string | Path to the file to update or create. Can be absolute, relative to active directory, or use ~ for home directory. |
createIfMissing | If true, creates the file if it doesn't exist. | |
createPath | boolean | If true, creates the directory path if it doesn't exist. |
encoding | string | Encoding to use when writing the file (e.g., 'utf-8', 'latin1'). Default is 'utf-8'. |
filePath | string | Alias for 'path' parameter (deprecated) |
fromBase64 | boolean | If true, decode the content from base64 before writing. Useful for binary files. |
copy_file
Copies a file or directory to a new location within allowed directories.
| Parameter | Type | Description |
|---|---|---|
destination * | string | Destination path. Can be absolute, relative to active directory, or use ~ for home directory. |
source * | string | Source path. Can be absolute, relative to active directory, or use ~ for home directory. |
recursive | boolean | If true, copy directories recursively |
move_file
Moves a file or directory to a new location within allowed directories.
| Parameter | Type | Description |
|---|---|---|
destination * | string | Destination path. Can be absolute, relative to active directory, or use ~ for home directory. |
source * | string | Source path. Can be absolute, relative to active directory, or use ~ for home directory. |
delete_file
Deletes a file or directory within allowed directories.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to delete. Can be absolute, relative to active directory, or use ~ for home directory. |
recursive | boolean | If true, delete directories recursively |
create_directory
Creates a new directory within allowed directories.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to create. Can be absolute, relative to active directory, or use ~ for home directory. |
list_project_files
Lists all files within an Xcode project.
| Parameter | Type | Description |
|---|---|---|
projectPath * | string | Path to the .xcodeproj directory of the project. Can be absolute, relative to active directory, or use ~ for home directory. |
fileType | string | Optional file extension filter. |
list_directory
Lists the contents of a directory, showing both files and subdirectories.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the directory to list. Can be absolute, relative to active directory, or use ~ for home directory. |
format | string | Format of the output: simple (names only) or detailed (with file information) |
showHidden | boolean | If true, include hidden files (starting with .) |
get_file_info
Gets detailed information about a file or directory.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the file or directory. Can be absolute, relative to active directory, or use ~ for home directory. |
find_files
Searches for files matching a pattern in a directory.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory to search in. Can be absolute, relative to active directory, or use ~ for home directory. |
pattern * | string | Glob pattern to match files (e.g., '*.swift' or '**/*.json') |
maxDepth | number | Maximum directory depth to search |
showHidden | boolean | If true, include hidden files in the search |
resolve_path
Resolves a path, taking into account the active directory and current project.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to resolve. Can be absolute, relative to active directory, or use ~ for home directory. |
check_file_exists
Checks if a file or directory exists at the specified path.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to check. Can be absolute, relative to active directory, or use ~ for home directory. |
search_in_files
Searches for text content within files in a directory.
| Parameter | Type | Description |
|---|---|---|
directory * | string | Directory to search in. Can be absolute, relative to active directory, or use ~ for home directory. |
pattern * | string | File pattern to match (e.g., '*.swift', '*.{js,ts}') |
searchText * | string | Text or regular expression to search for within the files |
caseSensitive | boolean | If true, perform a case-sensitive search |
includeHidden | boolean | If true, include hidden files in the search |
isRegex | boolean | If true, treat searchText as a regular expression |
maxResults | number | Maximum number of results to return |
analyze_file
Analyzes a source file for potential issues using Xcode's static analyzer.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | Path to the source file to analyze. Can be absolute, relative to active directory, or use ~ for home directory. |
scheme | string | Optional scheme to use. If not provided, will use the first available scheme. |
sdk | string | Optional SDK to use for analysis (e.g., 'iphoneos', 'iphonesimulator'). Defaults to automatic selection based on available devices. |
build_project
Builds the active Xcode project using the specified configuration and scheme.
| Parameter | Type | Description |
|---|---|---|
configuration * | string | Build configuration to use (e.g., 'Debug' or 'Release'). |
scheme * | string | Name of the build scheme to be built. Must be one of the schemes available in the project. |
derivedDataPath | string | Path where build products and derived data will be stored (optional). |
destination | string | Optional destination specifier (e.g., 'platform=iOS Simulator,name=iPhone 15'). If not provided, a suitable destination will be selected automatically. |
jobs | number | Maximum number of concurrent build operations (optional, default is determined by Xcode). |
sdk | string | Optional SDK to use (e.g., 'iphoneos', 'iphonesimulator'). If not provided, will use the default SDK for the project type. |
run_tests
Executes tests for the active Xcode project.
| Parameter | Type | Description |
|---|---|---|
destination | string | Optional destination specifier (e.g., 'platform=iOS Simulator,name=iPhone 15'). If not provided, a suitable simulator will be selected automatically. |
enableCodeCoverage | boolean | Whether to enable code coverage during testing (default: false). |
onlyTesting | array | Optional list of tests to include, excluding all others. Format: 'TestTarget/TestClass/testMethod'. |
resultBundlePath | string | Optional path where test results bundle will be stored. |
scheme | string | Optional scheme to use for testing. If not provided, will use the active project's scheme. |
skipTesting | array | Optional list of tests to exclude. Format: 'TestTarget/TestClass/testMethod'. |
testPlan | string | Optional name of the test plan to run. |
list_available_destinations
Lists available build destinations for the active Xcode project or workspace.
| Parameter | Type | Description |
|---|---|---|
scheme | string | Optional scheme to show destinations for. If not provided, uses the active scheme. |
list_available_schemes
Lists all available schemes in the active Xcode project or workspace.
clean_project
Cleans the build directory for the active Xcode project.
| Parameter | Type | Description |
|---|---|---|
configuration | string | Optional build configuration to clean (e.g., 'Debug' or 'Release'). If not provided, cleans all configurations. |
derivedDataPath | string | Optional path to the derived data directory to clean. If not provided, uses Xcode's default location. |
scheme | string | Optional scheme to clean. If not provided, will use the first available scheme. |
archive_project
Archives the active Xcode project for distribution.
| Parameter | Type | Description |
|---|---|---|
archivePath * | string | Path where the .xcarchive file will be saved. |
configuration * | string | Build configuration to use (e.g., 'Debug' or 'Release'). |
scheme * | string | The scheme to archive. Must be one of the schemes available in the project. |
destination | string | Optional destination specifier (e.g., 'generic/platform=iOS'). If not provided, uses the default destination for the scheme. |
exportOptionsPlist | string | Optional path to an export options property list file for subsequent export operations. |
pod_install
Runs 'pod install' in the active project directory to install CocoaPods dependencies.
| Parameter | Type | Description |
|---|---|---|
cleanInstall | boolean | Ignore the contents of the project cache and force a full pod installation. |
repoUpdate | boolean | Whether to update the spec repositories before installation. Defaults to false. |
verbose | boolean | Show more debugging information during installation. |
pod_update
Runs 'pod update' in the active project directory to update CocoaPods dependencies.
| Parameter | Type | Description |
|---|---|---|
cleanInstall | boolean | Ignore the contents of the project cache and force a full pod installation. |
excludePods | array | Optional list of pods to exclude during update. |
pods | array | Optional list of specific pods to update. If not provided, updates all pods. |
repoUpdate | boolean | Whether to update the spec repositories before updating pods. Defaults to true. |
sources | array | Optional list of sources from which to update dependent pods. |
pod_outdated
Shows outdated pods in the current project and their available updates.
| Parameter | Type | Description |
|---|---|---|
ignorePrerelease | boolean | Don't consider prerelease versions to be updates. Defaults to true. |
repoUpdate | boolean | Whether to update the spec repositories before checking for outdated pods. Defaults to false. |
pod_repo_update
Updates the local clone of the CocoaPods spec repositories.
| Parameter | Type | Description |
|---|---|---|
silent | boolean | Show nothing during update. |
verbose | boolean | Show more detailed output. |
pod_deintegrate
Deintegrate CocoaPods from the active project, removing all traces of CocoaPods.
check_cocoapods
Checks if the active project uses CocoaPods and returns setup information.
| Parameter | Type | Description |
|---|---|---|
includeOutdated | boolean | Check for outdated pods and include update information. Default: false |
pod_init
Generate a Podfile for the current project directory.
init_swift_package
Initializes a new Swift Package Manager project in the current directory. Use this tool first if your project doesn't have a Package.swift file yet and you want to start using Swift packages.
| Parameter | Type | Description |
|---|---|---|
enableTests | boolean | Enable test targets (default: true) |
name | string | Name for the package (defaults to directory name) |
testingFramework | string | Testing framework to use (xctest or swift-testing) |
type | string | Type of package to create (library, executable, tool, build-tool-plugin, command-plugin, macro, or empty) |
add_swift_package
Adds a Swift Package dependency to the active project. Note: Your project must already be set up for Swift Package Manager (must have a Package.swift file). If you haven't initialized SPM yet, use the init_swift_package tool first.
| Parameter | Type | Description |
|---|---|---|
url * | string | The URL of the Swift package to add |
productName | string | Specific product name to add from the package |
skipUpdate | boolean | Skip running 'package update' after adding the dependency |
version | string | Version requirement (e.g., 'exact: 1.0.0', 'from: 1.0.0', 'branch: main') |
remove_swift_package
Removes a Swift Package dependency from the active project.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Confirmation to remove the package. Must be set to true. |
url * | string | The URL of the Swift package to remove |
edit_package_swift
Directly edit the Package.swift file of the active SPM project. This is useful for making changes that aren't supported by the other SPM tools.
| Parameter | Type | Description |
|---|---|---|
content * | string | The new content for the Package.swift file |
createBackup | boolean | Whether to create a backup of the original file (default: true) |
packagePath | string | Optional path to the Package.swift file. If not provided, uses the active project's Package.swift. |
build_spm_package
Builds a Swift Package Manager package directly using 'swift build' instead of Xcode.
| Parameter | Type | Description |
|---|---|---|
configuration | string | Build configuration to use (default: debug) |
packagePath | string | Optional path to the directory containing Package.swift. If not provided, uses the active project directory. |
target | string | Specific target to build. If not provided, builds all targets. |
verbose | boolean | Whether to show verbose output (default: false) |
test_spm_package
Runs tests for a Swift Package Manager package directly using 'swift test' instead of Xcode.
| Parameter | Type | Description |
|---|---|---|
filter | string | Filter to run a subset of tests. Format: 'TestTarget[.TestClass[.testMethod]]'. |
packagePath | string | Optional path to the directory containing Package.swift. If not provided, uses the active project directory. |
parallel | boolean | Whether to run tests in parallel (default: true) |
verbose | boolean | Whether to show verbose output (default: false) |
get_package_info
Gets detailed information about a Swift Package Manager package.
| Parameter | Type | Description |
|---|---|---|
packagePath | string | Optional path to the directory containing Package.swift. If not provided, uses the active project directory. |
update_swift_package
Updates the dependencies of your Swift project using Swift Package Manager.
| Parameter | Type | Description |
|---|---|---|
branch | string | The branch to resolve at (only applies when specificPackage is provided) |
revision | string | The revision to resolve at (only applies when specificPackage is provided) |
specificPackage | string | Only update this specific package (leave empty to update all) |
version | string | The version to resolve at (only applies when specificPackage is provided) |
swift_package_command
Executes Swift Package Manager commands in the active project directory.
| Parameter | Type | Description |
|---|---|---|
command * | string | The SPM command to execute (e.g., 'build', 'test', 'clean', 'resolve') |
configuration | string | Build configuration ('debug' or 'release') |
extraArgs | string | Additional arguments to pass to the command |
build_swift_package
Builds a Swift Package using Swift Package Manager.
| Parameter | Type | Description |
|---|---|---|
buildTests | boolean | Also build test targets |
configuration | string | Build configuration (default: debug) |
jobs | number | Number of parallel build jobs |
product | string | Build a specific product |
showBinPath | boolean | Show binary output path |
target | string | Build a specific target |
verbose | boolean | Show verbose output |
test_swift_package
Tests a Swift Package using Swift Package Manager.
| Parameter | Type | Description |
|---|---|---|
codeCoverage | boolean | Enable code coverage |
configuration | string | Build configuration (default: debug) |
filter | string | Run tests matching regular expression (e.g., 'MyTests.MyTestCase/testExample') |
listTests | boolean | List all available tests instead of running them |
numWorkers | number | Number of parallel test workers |
outputPath | string | Path for XUnit test results output |
parallel | boolean | Run tests in parallel |
skip | string | Skip tests matching regular expression |
show_swift_dependencies
Shows the resolved dependencies of a Swift Package.
| Parameter | Type | Description |
|---|---|---|
format | string | Output format (default: text) |
outputPath | string | Path to save output to a file |
verbose | boolean | Show verbose output |
clean_swift_package
Cleans the build artifacts of a Swift Package.
| Parameter | Type | Description |
|---|---|---|
purgeCache | boolean | Also purge the global cache |
reset | boolean | Reset the complete build directory |
dump_swift_package
Dumps the Package.swift manifest as JSON.
generate_swift_docs
Generates documentation for a Swift Package using DocC.
| Parameter | Type | Description |
|---|---|---|
outputPath * | string | Directory where the generated documentation will be saved |
hostingBasePath | string | Base path for hosting the documentation (e.g., '/docs') |
openInBrowser | boolean | Open the generated documentation in a browser after generation (default: false) |
transformForStaticHosting | boolean | Transform the documentation for static hosting (default: true) |
list_booted_simulators
List all currently booted iOS simulators
list_simulators
List all available iOS simulators with filtering options
| Parameter | Type | Description |
|---|---|---|
filterName | string | Filter simulators by name (case-insensitive substring match) |
filterRuntime | string | Filter simulators by runtime (e.g., 'iOS 16') |
filterState | string | Filter simulators by state |
format | string | Output format (json for raw data, parsed for structured data). Defaults to parsed. |
boot_simulator
Boot an iOS simulator by UDID or name
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the simulator to boot (will use the most recent iOS version if multiple match) |
runtime | string | When using name, optionally specify the iOS runtime version (e.g., 'iOS 16') |
udid | string | The UDID of the simulator to boot |
shutdown_simulator
Shutdown a simulator by UDID, or shutdown all running simulators
| Parameter | Type | Description |
|---|---|---|
all | boolean | Shutdown all running simulators |
udid | string | The UDID of the simulator to shutdown |
install_app
Install an app on a simulator
| Parameter | Type | Description |
|---|---|---|
appPath * | string | Path to the .app bundle to install |
udid * | string | The UDID of the simulator |
launch_app
Launch an installed app on a simulator
| Parameter | Type | Description |
|---|---|---|
bundleId * | string | Bundle identifier of the app to launch |
udid * | string | The UDID of the simulator |
args | array | Arguments to pass to the app on launch |
waitForDebugger | boolean | Wait for a debugger to attach before starting the app |
terminate_app
Terminate a running app on a simulator
| Parameter | Type | Description |
|---|---|---|
bundleId * | string | Bundle identifier of the app to terminate |
udid * | string | The UDID of the simulator |
open_url
Open a URL in a simulator
| Parameter | Type | Description |
|---|---|---|
udid * | string | The UDID of the simulator |
url * | string | The URL to open |
take_screenshot
Take a screenshot of a simulator
| Parameter | Type | Description |
|---|---|---|
outputPath * | string | Path where to save the screenshot (PNG format) |
udid * | string | The UDID of the simulator |
reset_simulator
Reset a simulator by erasing all content and settings
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Confirmation to reset the simulator. Must be set to true. |
udid * | string | The UDID of the simulator to reset |
list_installed_apps
List all installed applications on a simulator
| Parameter | Type | Description |
|---|---|---|
udid * | string | The UDID of the simulator |
run_xcrun
Executes a specified Xcode tool via xcrun
| Parameter | Type | Description |
|---|---|---|
tool * | string | The name of the Xcode tool to run |
args | string | Arguments to pass to the tool |
workingDir | string | Working directory to execute the command in |
compile_asset_catalog
Compiles an asset catalog (.xcassets) using actool
| Parameter | Type | Description |
|---|---|---|
catalogPath * | string | Path to the asset catalog (.xcassets directory) |
outputDir * | string | Directory where compiled assets should be placed |
appIcon | string | Name of the app icon set to include |
minDeploymentTarget | string | Minimum deployment target version (default: 14.0) |
platform | string | Target platform (default: iphoneos) |
targetDevices | array | Target devices (default: ['iphone', 'ipad']) |
run_lldb
Launches the LLDB debugger with optional arguments
| Parameter | Type | Description |
|---|---|---|
args | string | Arguments to pass to lldb |
command | string | Single LLDB command to execute |
trace_app
Captures a performance trace of an application using xctrace
| Parameter | Type | Description |
|---|---|---|
appPath * | string | Path to the application to trace |
duration | number | Duration of the trace in seconds (default: 10) |
outputPath | string | Path where to save the trace file (default: app_trace.trace in active directory) |
startSuspended | boolean | Start the application in a suspended state |
template | string | Trace template to use (default: 'Time Profiler') |
get_xcode_info
Get information about Xcode installations on the system
switch_xcode
Switch the active Xcode version
| Parameter | Type | Description |
|---|---|---|
version | string | Version of Xcode to use (e.g., '14.3'). Will use the first matching version found. |
xcodePath | string | Path to the Xcode.app to use. If not provided, available Xcode installations will be listed. |
export_archive
Export an Xcode archive for distribution (App Store, Ad Hoc, Enterprise, Development)
| Parameter | Type | Description |
|---|---|---|
archivePath * | string | Path to the .xcarchive file to export |
exportPath * | string | Directory where exported IPA and other files will be placed |
method * | string | Distribution method |
compileBitcode | boolean | Whether to compile Bitcode. Default is true for App Store, false otherwise. |
provisioningProfiles | object | Dictionary mapping bundle identifiers to provisioning profile names. |
signingCertificate | string | Signing certificate to use. If not provided, will try to use the default certificate for the selected method. |
stripSwiftSymbols | boolean | Whether to strip Swift symbols. Default is true. |
teamId | string | Team ID for code signing. If not provided, will try to use the default team. |
validate_app
Validate an app for App Store submission using altool
| Parameter | Type | Description |
|---|---|---|
ipaPath * | string | Path to the .ipa file to validate |
password * | string | App-specific password for the App Store Connect account |
username * | string | App Store Connect username (usually an email) |
apiIssuer | string | API Key Issuer ID (required if using apiKey) |
apiKey | string | API Key ID (alternative to username/password) |
apiKeyPath | string | Path to the API Key .p8 file (required if using apiKey) |
generate_icon_set
Generate an app icon set from a source image
| Parameter | Type | Description |
|---|---|---|
outputPath * | string | Path where to create the AppIcon.appiconset directory |
sourceImage * | string | Path to the source image (should be at least 1024x1024) |
platform | string | Target platform (default: ios) |