apple-instruments-mcp

v1.2.1
apple-instruments-mcp Checked 2 days ago Published 4 months ago

MCP server for Apple platform profiling via xctrace/Instruments

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

doctor

One-shot health check: xctrace responsiveness/version/path, online and offline target counts, CoreSimulator access, and template/instrument availability. Useful before recording so a wedged or sandbox-restricted toolchain surfaces immediately instead of through a failed record.

profile_preset

Profile a target with a bundle of instruments in a single recording, then report each family that produced data. Presets: cpu / memory / network / full. `cpu` = Time Profiler. `memory` = Allocations + Leaks. `network` = Network Connections. `full` = all of the above. Faster than three separate runs when you want a broad picture.

ParameterTypeDescription
preset *stringPreset bundle of instruments to record in a single trace.
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
time_limit_secondsintegerRecording duration in seconds.

list_devices

List devices and runtimes visible to xctrace.

list_devices_structured

List devices and runtimes visible to xctrace as JSON.

list_templates

List all Instruments profiling templates installed on this Mac.

list_templates_structured

List Instruments profiling templates as JSON.

build_xctrace_command

Build the exact `xcrun xctrace record ...` command for the given target without executing it.

ParameterTypeDescription
template *stringInstruments template name, e.g. 'Time Profiler', 'App Launch'.
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
output_pathOptional absolute path for the .trace output. Defaults to a placeholder.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
time_limit_secondsintegerRecording duration in seconds.

profile_ios_app

Profile an iOS, iPadOS, tvOS, watchOS, or visionOS app by bundle ID on a simulator/device.

ParameterTypeDescription
bundle_id *stringApp bundle ID, e.g. com.mycompany.myapp.
device_id *stringSimulator UUID or physical device ID from list_devices.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
profile_typestringAnalysis type to run.
time_limit_secondsintegerRecording duration in seconds.

profile_mac_app

Profile a macOS app or executable by launching it.

ParameterTypeDescription
launch_path *stringmacOS .app or executable path to launch.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
profile_typestringAnalysis type to run.
time_limit_secondsintegerRecording duration in seconds.

profile_process

Profile a running process by process name or PID.

ParameterTypeDescription
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
profile_typestringAnalysis type to run.
time_limit_secondsintegerRecording duration in seconds.

profile_all_processes

Profile all processes on the host or selected device when the template supports it.

ParameterTypeDescription
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
profile_typestringAnalysis type to run.
time_limit_secondsintegerRecording duration in seconds.

analyze_launch

Record an App Launch trace and report methods that hurt startup time.

ParameterTypeDescription
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_critical_msnumberLaunch time at or above this value is reported as critical.
launch_good_msnumberLaunch time below this value is reported as good.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
offender_critical_msnumberLaunch offender self-time above this value is critical.
offender_warning_msnumberLaunch offender self-time above this value is a warning.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
time_limit_secondsintegerRecording duration in seconds.

analyze_launch_trace

Analyze an existing .trace bundle recorded with the App Launch template.

ParameterTypeDescription
trace_path *stringAbsolute path to the .trace bundle.
bundle_idstringTarget name used in the report.
launch_critical_msnumberLaunch time at or above this value is reported as critical.
launch_good_msnumberLaunch time below this value is reported as good.
offender_critical_msnumberLaunch offender self-time above this value is critical.
offender_warning_msnumberLaunch offender self-time above this value is a warning.

analyze_allocations

Record an Allocations trace and report live memory and top allocation categories.

ParameterTypeDescription
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
memory_cache_warning_mbnumberPeak memory above this value suggests cache release recommendations.
memory_critical_mbnumberPeak memory above this value is critical.
memory_warning_mbnumberPeak memory above this value is a warning.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
time_limit_secondsintegerRecording duration in seconds.

analyze_allocations_trace

Analyze an existing Allocations .trace bundle.

ParameterTypeDescription
trace_path *stringAbsolute path to the .trace bundle.
bundle_idstringTarget name used in the report.
memory_cache_warning_mbnumberPeak memory above this value suggests cache release recommendations.
memory_critical_mbnumberPeak memory above this value is critical.
memory_warning_mbnumberPeak memory above this value is a warning.

analyze_leaks

Record a Leaks trace and report leaks with retain cycle hints when xctrace exports leak details.

ParameterTypeDescription
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
leak_critical_countintegerLeak count above this value is critical.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
time_limit_secondsintegerRecording duration in seconds.

analyze_leaks_trace

Analyze an existing Leaks .trace bundle.

ParameterTypeDescription
trace_path *stringAbsolute path to the .trace bundle.
bundle_idstringTarget name used in the report.
leak_critical_countintegerLeak count above this value is critical.

analyze_time_profiler

Record a Time Profiler trace and report CPU hot methods.

ParameterTypeDescription
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
dsym_pathOptional path to a .dSYM bundle (or plain Mach-O) used to resolve raw-address frames (release builds with stripped symbols). When set, the report includes a Symbolication section with resolved/unresol…
hang_threshold_msintegerMain-thread inter-sample gap (ms) above which the gap is counted as a candidate stall. Default 250 mirrors typical hang-instrument settings.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
method_critical_msnumberHot method self-time above this value is critical.
method_warning_msnumberHot method self-time above this value is a warning.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
scope_end_msOptional inclusive upper bound (ms since trace start) for sample analysis. Omit or set to 0 to extend to the end of the trace.
scope_start_msOptional inclusive lower bound (ms since trace start) for sample analysis. Use with `scope_end_ms` to zoom into a specific window (e.g. a jank around second 12).
time_limit_secondsintegerRecording duration in seconds.
total_critical_msnumberAverage CPU load at or above this many CPU-active milliseconds per wall-clock second is critical.
total_good_msnumberAverage CPU load below this many CPU-active milliseconds per wall-clock second is good.
user_binariesstringComma-separated binary names that count as 'user code' for the user-methods view (e.g. `MyApp,MyAppKit`). Empty disables the user-methods section.

analyze_time_profiler_trace

Analyze an existing .trace bundle recorded with the Time Profiler template.

ParameterTypeDescription
trace_path *stringAbsolute path to the .trace bundle.
bundle_idstringTarget name used in the report.
dsym_pathOptional path to a .dSYM bundle (or plain Mach-O) used to resolve raw-address frames (release builds with stripped symbols). When set, the report includes a Symbolication section with resolved/unresol…
hang_threshold_msintegerMain-thread inter-sample gap (ms) above which the gap is counted as a candidate stall. Default 250 mirrors typical hang-instrument settings.
method_critical_msnumberHot method self-time above this value is critical.
method_warning_msnumberHot method self-time above this value is a warning.
scope_end_msOptional inclusive upper bound (ms since trace start) for sample analysis. Omit or set to 0 to extend to the end of the trace.
scope_start_msOptional inclusive lower bound (ms since trace start) for sample analysis. Use with `scope_end_ms` to zoom into a specific window (e.g. a jank around second 12).
total_critical_msnumberAverage CPU load at or above this many CPU-active milliseconds per wall-clock second is critical.
total_good_msnumberAverage CPU load below this many CPU-active milliseconds per wall-clock second is good.
user_binariesstringComma-separated binary names that count as 'user code' for the user-methods view (e.g. `MyApp,MyAppKit`). Empty disables the user-methods section.

analyze_network

Record a Network trace and report slow requests and transfer sizes.

ParameterTypeDescription
all_processesbooleanRecord all processes instead of launching or attaching to one target.
bundle_idApp bundle ID for simulator/device launch, e.g. com.mycompany.myapp.
device_idOptional simulator UUID or physical device ID. Omit for host macOS profiling.
dry_runbooleanReturn the xctrace command without recording.
keep_tracebooleanKeep generated trace and XML artifacts and include their paths in the report.
launch_argsOptional shell-style arguments passed after launch_path.
launch_pathExecutable or .app path to launch, useful for macOS apps and command-line tools.
output_dirOptional directory for generated artifacts. A run-specific subdirectory is created inside it.
pidAttach to a running process by PID.
process_nameAttach to a running process by name.
request_critical_msnumberRequest duration above this value is critical.
request_warning_msnumberRequest duration above this value is a warning.
slow_request_critical_countintegerSlow request count above this value is critical.
time_limit_secondsintegerRecording duration in seconds.
transfer_warning_mbnumberTransferred data above this value adds a transfer-size recommendation.

analyze_network_trace

Analyze an existing .trace bundle recorded with the Network template.

ParameterTypeDescription
trace_path *stringAbsolute path to the .trace bundle.
bundle_idstringTarget name used in the report.
request_critical_msnumberRequest duration above this value is critical.
request_warning_msnumberRequest duration above this value is a warning.
slow_request_critical_countintegerSlow request count above this value is critical.
transfer_warning_mbnumberTransferred data above this value adds a transfer-size recommendation.

compare_launch_traces

Compare two App Launch .trace bundles and report launch-time deltas.

ParameterTypeDescription
baseline_trace_path *stringAbsolute path to the baseline .trace bundle.
candidate_trace_path *stringAbsolute path to the candidate .trace bundle.
bundle_idstringTarget name used in the report.
launch_critical_msnumberLaunch time at or above this value is reported as critical.
launch_good_msnumberLaunch time below this value is reported as good.
offender_critical_msnumberLaunch offender self-time above this value is critical.
offender_warning_msnumberLaunch offender self-time above this value is a warning.

compare_memory_traces

Compare two Allocations .trace bundles and report memory deltas.

ParameterTypeDescription
baseline_trace_path *stringAbsolute path to the baseline .trace bundle.
candidate_trace_path *stringAbsolute path to the candidate .trace bundle.
bundle_idstringTarget name used in the report.
memory_cache_warning_mbnumberPeak memory above this value suggests cache release recommendations.
memory_critical_mbnumberPeak memory above this value is critical.
memory_warning_mbnumberPeak memory above this value is a warning.

compare_cpu_traces

Compare two Time Profiler .trace bundles and report CPU hot-method deltas.

ParameterTypeDescription
baseline_trace_path *stringAbsolute path to the baseline .trace bundle.
candidate_trace_path *stringAbsolute path to the candidate .trace bundle.
bundle_idstringTarget name used in the report.
method_critical_msnumberHot method self-time above this value is critical.
method_warning_msnumberHot method self-time above this value is a warning.
total_critical_msnumberAverage CPU load at or above this many CPU-active milliseconds per wall-clock second is critical.
total_good_msnumberAverage CPU load below this many CPU-active milliseconds per wall-clock second is good.