xcode-mcp-server

v1.0.3
@iflow-mcp/xcode-mcp-server Checked 3 days ago Published 1 year ago

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

ParameterTypeDescription
baseDir *stringPath 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.

ParameterTypeDescription
projectPath *stringPath to the .xcodeproj directory for the desired project. Supports ~ for home directory and environment variables.
openInXcodebooleanIf true, also open the project in Xcode (default: false)
setActiveDirectorybooleanIf true, also set the active directory to the project directory

get_active_project

Retrieves detailed information about the currently active Xcode project.

ParameterTypeDescription
detailedbooleanIf true, include additional detailed project information

find_projects

Finds Xcode projects in the specified directory.

ParameterTypeDescription
directorystringDirectory to search in. Defaults to projects base directory.
includeSPMbooleanIf true, include Swift Package Manager projects
includeWorkspacesbooleanIf true, include .xcworkspace files

change_directory

Changes the active directory for relative path operations.

ParameterTypeDescription
directoryPath *stringPath 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.

ParameterTypeDescription
directoryPath *stringPath 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.

ParameterTypeDescription
forceRedetectbooleanIf 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.

ParameterTypeDescription
filePath *stringPath to the file to add to the project
createGroupsbooleanWhether to create intermediate groups if they don't exist (default: true)
groupstringGroup path within the project to add the file to (e.g., 'MyApp/Models'). If not provided, will add to the root group.
targetNamestringName 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.

ParameterTypeDescription
name *stringName of the workspace to create
outputDirectory *stringDirectory where the workspace will be created
projectsarrayOptional array of project paths to add to the workspace
setAsActivebooleanWhether to set the new workspace as the active project (default: true)

add_project_to_workspace

Adds an existing project to the active workspace.

ParameterTypeDescription
projectPath *stringPath to the project to add to the workspace
workspacePathstringPath to the workspace. If not provided, uses the active workspace.

create_xcode_project

Creates a new Xcode project using a template.

ParameterTypeDescription
name *stringName of the project to create
outputDirectory *stringDirectory where the project will be created
template *stringTemplate to use for the project
includeTestsbooleanWhether to include unit tests (default: true)
includeUITestsbooleanWhether to include UI tests (default: false)
languagestringProgramming language to use (default: swift)
organizationIdentifierstringOrganization identifier (e.g., 'com.example') to use in the project
organizationNamestringOrganization name to use in the project
setAsActivebooleanWhether 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.

ParameterTypeDescription
filePath *stringPath to the file to read. Can be absolute, relative to active directory, or use ~ for home directory.
asBinarybooleanIf true, read the file as binary and return base64-encoded content. Useful for images and other binary files.
encodingstringEncoding 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.

ParameterTypeDescription
content *stringThe content to be written to the file.
path *stringPath to the file to update or create. Can be absolute, relative to active directory, or use ~ for home directory.
createIfMissingIf true, creates the file if it doesn't exist.
createPathbooleanIf true, creates the directory path if it doesn't exist.
encodingstringEncoding to use when writing the file (e.g., 'utf-8', 'latin1'). Default is 'utf-8'.
filePathstringAlias for 'path' parameter (deprecated)
fromBase64booleanIf 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.

ParameterTypeDescription
destination *stringDestination path. Can be absolute, relative to active directory, or use ~ for home directory.
source *stringSource path. Can be absolute, relative to active directory, or use ~ for home directory.
recursivebooleanIf true, copy directories recursively

move_file

Moves a file or directory to a new location within allowed directories.

ParameterTypeDescription
destination *stringDestination path. Can be absolute, relative to active directory, or use ~ for home directory.
source *stringSource path. Can be absolute, relative to active directory, or use ~ for home directory.

delete_file

Deletes a file or directory within allowed directories.

ParameterTypeDescription
path *stringPath to delete. Can be absolute, relative to active directory, or use ~ for home directory.
recursivebooleanIf true, delete directories recursively

create_directory

Creates a new directory within allowed directories.

ParameterTypeDescription
path *stringPath to create. Can be absolute, relative to active directory, or use ~ for home directory.

list_project_files

Lists all files within an Xcode project.

ParameterTypeDescription
projectPath *stringPath to the .xcodeproj directory of the project. Can be absolute, relative to active directory, or use ~ for home directory.
fileTypestringOptional file extension filter.

list_directory

Lists the contents of a directory, showing both files and subdirectories.

ParameterTypeDescription
path *stringPath to the directory to list. Can be absolute, relative to active directory, or use ~ for home directory.
formatstringFormat of the output: simple (names only) or detailed (with file information)
showHiddenbooleanIf true, include hidden files (starting with .)

get_file_info

Gets detailed information about a file or directory.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
path *stringDirectory to search in. Can be absolute, relative to active directory, or use ~ for home directory.
pattern *stringGlob pattern to match files (e.g., '*.swift' or '**/*.json')
maxDepthnumberMaximum directory depth to search
showHiddenbooleanIf true, include hidden files in the search

resolve_path

Resolves a path, taking into account the active directory and current project.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
directory *stringDirectory to search in. Can be absolute, relative to active directory, or use ~ for home directory.
pattern *stringFile pattern to match (e.g., '*.swift', '*.{js,ts}')
searchText *stringText or regular expression to search for within the files
caseSensitivebooleanIf true, perform a case-sensitive search
includeHiddenbooleanIf true, include hidden files in the search
isRegexbooleanIf true, treat searchText as a regular expression
maxResultsnumberMaximum number of results to return

analyze_file

Analyzes a source file for potential issues using Xcode's static analyzer.

ParameterTypeDescription
filePath *stringPath to the source file to analyze. Can be absolute, relative to active directory, or use ~ for home directory.
schemestringOptional scheme to use. If not provided, will use the first available scheme.
sdkstringOptional 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.

ParameterTypeDescription
configuration *stringBuild configuration to use (e.g., 'Debug' or 'Release').
scheme *stringName of the build scheme to be built. Must be one of the schemes available in the project.
derivedDataPathstringPath where build products and derived data will be stored (optional).
destinationstringOptional destination specifier (e.g., 'platform=iOS Simulator,name=iPhone 15'). If not provided, a suitable destination will be selected automatically.
jobsnumberMaximum number of concurrent build operations (optional, default is determined by Xcode).
sdkstringOptional 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.

ParameterTypeDescription
destinationstringOptional destination specifier (e.g., 'platform=iOS Simulator,name=iPhone 15'). If not provided, a suitable simulator will be selected automatically.
enableCodeCoveragebooleanWhether to enable code coverage during testing (default: false).
onlyTestingarrayOptional list of tests to include, excluding all others. Format: 'TestTarget/TestClass/testMethod'.
resultBundlePathstringOptional path where test results bundle will be stored.
schemestringOptional scheme to use for testing. If not provided, will use the active project's scheme.
skipTestingarrayOptional list of tests to exclude. Format: 'TestTarget/TestClass/testMethod'.
testPlanstringOptional name of the test plan to run.

list_available_destinations

Lists available build destinations for the active Xcode project or workspace.

ParameterTypeDescription
schemestringOptional 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.

ParameterTypeDescription
configurationstringOptional build configuration to clean (e.g., 'Debug' or 'Release'). If not provided, cleans all configurations.
derivedDataPathstringOptional path to the derived data directory to clean. If not provided, uses Xcode's default location.
schemestringOptional scheme to clean. If not provided, will use the first available scheme.

archive_project

Archives the active Xcode project for distribution.

ParameterTypeDescription
archivePath *stringPath where the .xcarchive file will be saved.
configuration *stringBuild configuration to use (e.g., 'Debug' or 'Release').
scheme *stringThe scheme to archive. Must be one of the schemes available in the project.
destinationstringOptional destination specifier (e.g., 'generic/platform=iOS'). If not provided, uses the default destination for the scheme.
exportOptionsPliststringOptional 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.

ParameterTypeDescription
cleanInstallbooleanIgnore the contents of the project cache and force a full pod installation.
repoUpdatebooleanWhether to update the spec repositories before installation. Defaults to false.
verbosebooleanShow more debugging information during installation.

pod_update

Runs 'pod update' in the active project directory to update CocoaPods dependencies.

ParameterTypeDescription
cleanInstallbooleanIgnore the contents of the project cache and force a full pod installation.
excludePodsarrayOptional list of pods to exclude during update.
podsarrayOptional list of specific pods to update. If not provided, updates all pods.
repoUpdatebooleanWhether to update the spec repositories before updating pods. Defaults to true.
sourcesarrayOptional list of sources from which to update dependent pods.

pod_outdated

Shows outdated pods in the current project and their available updates.

ParameterTypeDescription
ignorePrereleasebooleanDon't consider prerelease versions to be updates. Defaults to true.
repoUpdatebooleanWhether 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.

ParameterTypeDescription
silentbooleanShow nothing during update.
verbosebooleanShow 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.

ParameterTypeDescription
includeOutdatedbooleanCheck 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.

ParameterTypeDescription
enableTestsbooleanEnable test targets (default: true)
namestringName for the package (defaults to directory name)
testingFrameworkstringTesting framework to use (xctest or swift-testing)
typestringType 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.

ParameterTypeDescription
url *stringThe URL of the Swift package to add
productNamestringSpecific product name to add from the package
skipUpdatebooleanSkip running 'package update' after adding the dependency
versionstringVersion 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.

ParameterTypeDescription
confirm *booleanConfirmation to remove the package. Must be set to true.
url *stringThe 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.

ParameterTypeDescription
content *stringThe new content for the Package.swift file
createBackupbooleanWhether to create a backup of the original file (default: true)
packagePathstringOptional 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.

ParameterTypeDescription
configurationstringBuild configuration to use (default: debug)
packagePathstringOptional path to the directory containing Package.swift. If not provided, uses the active project directory.
targetstringSpecific target to build. If not provided, builds all targets.
verbosebooleanWhether to show verbose output (default: false)

test_spm_package

Runs tests for a Swift Package Manager package directly using 'swift test' instead of Xcode.

ParameterTypeDescription
filterstringFilter to run a subset of tests. Format: 'TestTarget[.TestClass[.testMethod]]'.
packagePathstringOptional path to the directory containing Package.swift. If not provided, uses the active project directory.
parallelbooleanWhether to run tests in parallel (default: true)
verbosebooleanWhether to show verbose output (default: false)

get_package_info

Gets detailed information about a Swift Package Manager package.

ParameterTypeDescription
packagePathstringOptional 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.

ParameterTypeDescription
branchstringThe branch to resolve at (only applies when specificPackage is provided)
revisionstringThe revision to resolve at (only applies when specificPackage is provided)
specificPackagestringOnly update this specific package (leave empty to update all)
versionstringThe version to resolve at (only applies when specificPackage is provided)

swift_package_command

Executes Swift Package Manager commands in the active project directory.

ParameterTypeDescription
command *stringThe SPM command to execute (e.g., 'build', 'test', 'clean', 'resolve')
configurationstringBuild configuration ('debug' or 'release')
extraArgsstringAdditional arguments to pass to the command

build_swift_package

Builds a Swift Package using Swift Package Manager.

ParameterTypeDescription
buildTestsbooleanAlso build test targets
configurationstringBuild configuration (default: debug)
jobsnumberNumber of parallel build jobs
productstringBuild a specific product
showBinPathbooleanShow binary output path
targetstringBuild a specific target
verbosebooleanShow verbose output

test_swift_package

Tests a Swift Package using Swift Package Manager.

ParameterTypeDescription
codeCoveragebooleanEnable code coverage
configurationstringBuild configuration (default: debug)
filterstringRun tests matching regular expression (e.g., 'MyTests.MyTestCase/testExample')
listTestsbooleanList all available tests instead of running them
numWorkersnumberNumber of parallel test workers
outputPathstringPath for XUnit test results output
parallelbooleanRun tests in parallel
skipstringSkip tests matching regular expression

show_swift_dependencies

Shows the resolved dependencies of a Swift Package.

ParameterTypeDescription
formatstringOutput format (default: text)
outputPathstringPath to save output to a file
verbosebooleanShow verbose output

clean_swift_package

Cleans the build artifacts of a Swift Package.

ParameterTypeDescription
purgeCachebooleanAlso purge the global cache
resetbooleanReset 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.

ParameterTypeDescription
outputPath *stringDirectory where the generated documentation will be saved
hostingBasePathstringBase path for hosting the documentation (e.g., '/docs')
openInBrowserbooleanOpen the generated documentation in a browser after generation (default: false)
transformForStaticHostingbooleanTransform 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

ParameterTypeDescription
filterNamestringFilter simulators by name (case-insensitive substring match)
filterRuntimestringFilter simulators by runtime (e.g., 'iOS 16')
filterStatestringFilter simulators by state
formatstringOutput format (json for raw data, parsed for structured data). Defaults to parsed.

boot_simulator

Boot an iOS simulator by UDID or name

ParameterTypeDescription
namestringThe name of the simulator to boot (will use the most recent iOS version if multiple match)
runtimestringWhen using name, optionally specify the iOS runtime version (e.g., 'iOS 16')
udidstringThe UDID of the simulator to boot

shutdown_simulator

Shutdown a simulator by UDID, or shutdown all running simulators

ParameterTypeDescription
allbooleanShutdown all running simulators
udidstringThe UDID of the simulator to shutdown

install_app

Install an app on a simulator

ParameterTypeDescription
appPath *stringPath to the .app bundle to install
udid *stringThe UDID of the simulator

launch_app

Launch an installed app on a simulator

ParameterTypeDescription
bundleId *stringBundle identifier of the app to launch
udid *stringThe UDID of the simulator
argsarrayArguments to pass to the app on launch
waitForDebuggerbooleanWait for a debugger to attach before starting the app

terminate_app

Terminate a running app on a simulator

ParameterTypeDescription
bundleId *stringBundle identifier of the app to terminate
udid *stringThe UDID of the simulator

open_url

Open a URL in a simulator

ParameterTypeDescription
udid *stringThe UDID of the simulator
url *stringThe URL to open

take_screenshot

Take a screenshot of a simulator

ParameterTypeDescription
outputPath *stringPath where to save the screenshot (PNG format)
udid *stringThe UDID of the simulator

reset_simulator

Reset a simulator by erasing all content and settings

ParameterTypeDescription
confirm *booleanConfirmation to reset the simulator. Must be set to true.
udid *stringThe UDID of the simulator to reset

list_installed_apps

List all installed applications on a simulator

ParameterTypeDescription
udid *stringThe UDID of the simulator

run_xcrun

Executes a specified Xcode tool via xcrun

ParameterTypeDescription
tool *stringThe name of the Xcode tool to run
argsstringArguments to pass to the tool
workingDirstringWorking directory to execute the command in

compile_asset_catalog

Compiles an asset catalog (.xcassets) using actool

ParameterTypeDescription
catalogPath *stringPath to the asset catalog (.xcassets directory)
outputDir *stringDirectory where compiled assets should be placed
appIconstringName of the app icon set to include
minDeploymentTargetstringMinimum deployment target version (default: 14.0)
platformstringTarget platform (default: iphoneos)
targetDevicesarrayTarget devices (default: ['iphone', 'ipad'])

run_lldb

Launches the LLDB debugger with optional arguments

ParameterTypeDescription
argsstringArguments to pass to lldb
commandstringSingle LLDB command to execute

trace_app

Captures a performance trace of an application using xctrace

ParameterTypeDescription
appPath *stringPath to the application to trace
durationnumberDuration of the trace in seconds (default: 10)
outputPathstringPath where to save the trace file (default: app_trace.trace in active directory)
startSuspendedbooleanStart the application in a suspended state
templatestringTrace template to use (default: 'Time Profiler')

get_xcode_info

Get information about Xcode installations on the system

switch_xcode

Switch the active Xcode version

ParameterTypeDescription
versionstringVersion of Xcode to use (e.g., '14.3'). Will use the first matching version found.
xcodePathstringPath 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)

ParameterTypeDescription
archivePath *stringPath to the .xcarchive file to export
exportPath *stringDirectory where exported IPA and other files will be placed
method *stringDistribution method
compileBitcodebooleanWhether to compile Bitcode. Default is true for App Store, false otherwise.
provisioningProfilesobjectDictionary mapping bundle identifiers to provisioning profile names.
signingCertificatestringSigning certificate to use. If not provided, will try to use the default certificate for the selected method.
stripSwiftSymbolsbooleanWhether to strip Swift symbols. Default is true.
teamIdstringTeam 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

ParameterTypeDescription
ipaPath *stringPath to the .ipa file to validate
password *stringApp-specific password for the App Store Connect account
username *stringApp Store Connect username (usually an email)
apiIssuerstringAPI Key Issuer ID (required if using apiKey)
apiKeystringAPI Key ID (alternative to username/password)
apiKeyPathstringPath to the API Key .p8 file (required if using apiKey)

generate_icon_set

Generate an app icon set from a source image

ParameterTypeDescription
outputPath *stringPath where to create the AppIcon.appiconset directory
sourceImage *stringPath to the source image (should be at least 1024x1024)
platformstringTarget platform (default: ios)