InstrumentsMCP
Enables UI automation for iOS apps, including taps, swipes, gestures, typing, snapshots, and deep links. Also provides simulator control like setting location, pushing notifications, and toggling dark mode.
Provides tools for profiling iOS/macOS applications using Xcode Instruments, including CPU, memory, SwiftUI, energy, leaks, and more. Also allows launching/terminating apps and managing the simulator.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@InstrumentsMCP Profile the CPU of MyApp for 5 seconds"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP server that wraps Xcode Instruments. Record traces, automate the simulator, and return structured profiling data your coding agent can act on.
Quick Start
Requirements: macOS, Xcode, Node.js >= 20
Add to your project's .mcp.json:
{
"mcpServers": {
"instruments": {
"command": "npx",
"args": ["-y", "instrumentsmcp@latest"]
}
}
}Or run directly: npx instrumentsmcp@latest
Works with Claude Code, Cursor, Windsurf, and any MCP client.
Related MCP server: iPhone MCP
What It Does
Ask your agent to profile. It records a trace, drives the simulator, and returns structured results:
=== Time Profiler === severity: [WARNING] samples: 1587
Hotspots:
UpdateStack::update() (AttributeGraph) 42.3ms self ━━━━━━╌╌╌╌╌╌╌╌╌ 12.1%
FeedViewModel.loadItems() (MyApp) 28.1ms self ━━━━╌╌╌╌╌╌╌╌╌╌╌ 8.0%
Main thread blockers:
[WARNING] FeedViewModel.loadItems() 28.1ms35 tools across profiling, UI automation, simulator control, and trace analysis. Full tool list →
Profiling
One-shot —
profile_cpu,profile_swiftui,profile_memory,profile_hitches,profile_launch,profile_energy,profile_leaks,profile_networkScripted scenarios —
profile_scenariorecords a trace while executing UI steps (tap, scroll, type, launch)Interactive —
start_profiling/stop_profilingfor manual interactionHealth check —
performance_auditruns 5 templates and combines the resultsAny template —
profile_rawhandles templates without a dedicated parser
UI Automation
Drive the simulator programmatically: ui_tap, ui_type, ui_swipe, ui_gesture, ui_snapshot, ui_long_press. Powered by AXe CLI (brew tap cameroncooke/axe && brew install axe).
Simulator Control
Launch/terminate apps, open deep links, push notifications, take screenshots, set location, toggle dark mode.
Analysis
Re-analyze saved traces, drill into specific functions, track regressions with baselines, generate Markdown reports.
CLI Mode
Record traces from the terminal without an MCP client:
npx instrumentsmcp record --process MyApp
npx instrumentsmcp record --process MyApp --template AllocationsCtrl+C to stop. Feed the trace to your agent for analysis.
Compatibility
Xcode Instruments (xctrace) 15.x through 26.x
Handles xctrace 26 Deferred recording mode automatically
Device identifiers (
booted, device name, UDID) resolved automatically
Docs
src/
├── index.ts # MCP server entry + CLI router
├── cli.ts # CLI mode (instrumentsmcp record)
├── tools/
│ ├── profile.ts # One-shot profiling tools
│ ├── simulator.ts # Simulator control + start/stop + scenarios
│ ├── analyze.ts # Trace analysis + symbolication + audit
│ ├── baseline.ts # Baseline comparison + report generation
│ ├── investigate.ts # Drill-down + trace listing
│ ├── ui.ts # UI automation (snapshot, tap, type, swipe)
│ └── list.ts # Discovery tools (status, templates, devices)
├── parsers/ # Template-specific XML→JSON parsers
└── utils/ # xctrace, simctl, AXe wrappers + shared helpersgit clone https://github.com/nemanjavlahovic/instruments-mcp-server.git
cd instruments-mcp-server
npm install && npm run buildPoint your MCP client to dist/index.js.
License
MIT
Available Tools
37 toolsanalyze_traceA
Export and analyze a specific table from an existing .trace file. Use after profile_raw to drill into specific data tables. First call with toc=true to see available tables, then call with xpath to get data.
Inputs: trace_path (required), xpath, toc, summarize.
drill_downA
Navigate deeper into profiling data from a previous profile result. Use the traceId returned by any profile_* tool to investigate further.
CPU traces: Pass a function name to see its callers (who calls it), callees (what it calls), and the heaviest execution path. Use "hottest" to auto-select the most expensive function.
Other templates: Pass a search term (category, domain, view name, leak type) to see full detail for matching rows that were truncated in the initial summary.
Examples: drill_down(trace_id: "t_abc123", target: "CoreData.executeFetchRequest") drill_down(trace_id: "t_abc123", target: "hottest") drill_down(trace_id: "t_abc123", target: "api.example.com")
Inputs: trace_id (required), target (required).
instruments_list_devicesA
List all available devices and simulators that can be profiled
Inputs: no named parameters.
instruments_list_instrumentsA
List all available individual instruments that can be combined into custom recordings
Inputs: no named parameters.
instruments_list_templatesA
List all available Instruments profiling templates (Time Profiler, SwiftUI, Allocations, etc.)
Inputs: no named parameters.
instruments_statusA
Check if Instruments (xctrace) is available on this system and return version info
Inputs: no named parameters.
list_tracesA
List profiling traces available for investigation with drill_down. Shows trace IDs, templates, and timestamps from this session's profile_* calls.
Inputs: no named parameters.
performance_auditA
Run a comprehensive performance audit by recording multiple profiles in sequence. Records: Time Profiler + Animation Hitches + Leaks + Energy Log + Network for a full health check. Returns a combined report with actionable findings and an overall severity. Total recording time = 5x duration.
Inputs: process (required), device, duration.
performance_baselineA
Save, compare, list, or delete performance baselines to track regressions over time.
save: Store profile results as a named baseline (pass the JSON output from any profile tool)
compare: Diff current results against a saved baseline — shows deltas and regression/improvement status
list: Show all saved baselines
delete: Remove a saved baseline
Inputs: action (required), name, metrics.
performance_reportA
Generate a shareable Markdown performance report from profile results. Pass the JSON output from one or more profile tools. Returns formatted Markdown suitable for PRs, Slack, documentation, or stakeholder updates.
Inputs: results (required), app_name, baseline_name.
profile_cpuB
Record and analyze CPU performance using Time Profiler. Returns: Top CPU hotspots with severity classification and actionable summary. Pass trace_path to re-analyze an existing trace without re-recording.
Inputs: process, launch_path, device, duration, +1 more.
profile_energyA
Record and analyze energy usage using Energy Log. Returns: Energy impact scores (0–20 scale), per-component breakdown (CPU, GPU, network, display), thermal state. Best results on physical devices. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
profile_hitchesA
Record and analyze animation hitches and main thread hangs. Returns: Hang events by severity, worst hangs with backtraces. Best used during scrolling or animations. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
profile_launchA
Record and analyze app launch performance. Returns: Total launch time, launch type (cold/warm/resume), phase breakdown, severity against Apple's guidelines. IMPORTANT: Use launch_path to launch the app — attaching to a running process won't capture the launch. Pass trace_path to re-analyze an existing trace.
Inputs: launch_path, device, duration, trace_path.
profile_leaksA
Record and detect memory leaks using the Leaks template. Returns: Leaked object types, sizes, responsible libraries, and backtraces. The Leaks instrument takes periodic heap snapshots — longer recordings improve detection. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
profile_memoryA
Record and analyze memory allocations. Returns: Allocation counts by category, total memory, largest allocators. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
profile_networkB
Record and analyze HTTP network traffic using the Network template. Returns: Request counts, response times, error rates, per-domain breakdown, slowest requests. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
profile_rawA
Record a trace with any Instruments template and return the raw table of contents. Use this for templates without a dedicated parser (System Trace, File Activity, etc.). You can then use analyze_trace to export specific tables.
Inputs: template (required), process, launch_path, device, +1 more.
profile_scenarioA
Record an Instruments trace WHILE executing a scenario on a simulator. This is the primary tool for profiling real user flows — it launches your app, runs interaction steps, and records performance data throughout.
Steps execute sequentially after xctrace starts recording. Supports both simctl steps (deep links, push, appearance, location) and UI automation steps (tap, type_text, swipe, gesture, long_press, snapshot_ui) powered by AXe CLI. UI steps require AXe: brew tap cameroncooke/axe && brew install axe
Returns: Parsed profile results + screenshots taken + scenario execution log.
Inputs: bundle_id (required), scenario (required), device, template, +2 more.
profile_swiftuiA
Record and analyze SwiftUI view performance. Returns: View body evaluation counts, excessive re-renders, and duration per view. Best used while navigating through the app. Pass trace_path to re-analyze an existing trace.
Inputs: process, launch_path, device, duration, +1 more.
sim_launch_appA
Launch an app by bundle ID on a booted simulator. Returns the process ID (PID) of the launched app.
Inputs: bundle_id (required), device, terminate_existing.
sim_list_bootedA
List all booted iOS simulators and their installed user apps. Returns: Device names, UDIDs, runtime versions, and installed app bundle IDs. Use this to discover what's running before profiling.
Inputs: include_apps.
sim_open_urlA
Open a URL or deep link on a simulator. Use this for app navigation — simctl does not support direct tap/swipe. The app must register the URL scheme in its Info.plist.
Inputs: url (required), device.
sim_push_notificationA
Send a simulated push notification to an app on a simulator. Constructs an APS payload from title/body, or accepts a full custom payload.
Inputs: bundle_id (required), device, title, body, +1 more.
sim_screenshotB
Take a screenshot of a simulator's screen. Saves as PNG. Returns the file path to the saved screenshot.
Inputs: device, label.
sim_set_appearanceA
Toggle the simulator between light and dark mode. Useful for testing appearance-sensitive performance (e.g., dark mode rendering).
Inputs: mode (required), device.
sim_set_locationB
Set simulated GPS coordinates on a simulator. Useful for profiling location-dependent features.
Inputs: latitude (required), longitude (required), device.
sim_terminate_appC
Terminate a running app on a simulator.
Inputs: bundle_id (required), device.
start_profilingA
Start recording an Instruments trace and return immediately. The user interacts with the app manually while recording runs in the background. Call stop_profiling when done to end the recording and get parsed results.
This is the recommended workflow for profiling real user interactions:
start_profiling → agent starts recording
User scrolls, taps, navigates in the app
stop_profiling → agent stops recording, parses trace, returns performance data
Max recording time is 5 minutes (safety limit). Recording stops automatically if not stopped manually.
Inputs: process, launch_path, device, template, +1 more.
stop_profilingA
Stop an active recording started by start_profiling. Sends SIGINT to xctrace, waits for the trace to be saved, then parses and returns structured results. Returns the same parsed performance data as the profile_* tools.
Inputs: no named parameters.
symbolicate_traceA
Add debug symbols to a trace file so function names are readable instead of memory addresses. Run this if profile results show hex addresses instead of function names.
Inputs: trace_path (required), dsym_path.
ui_gestureA
Perform a preset gesture on the simulator. Available presets: scroll-up, scroll-down, scroll-left, scroll-right, swipe-from-left-edge, swipe-from-right-edge, swipe-from-top-edge, swipe-from-bottom-edge.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: preset (required), device.
ui_long_pressB
Long press (touch-and-hold) at coordinates on the simulator. Use ui_snapshot to find the target element's frame coordinates.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: x (required), y (required), device, duration_ms.
ui_snapshotA
Get the accessibility hierarchy of a simulator screen. This is the key tool for understanding what's on screen — returns element roles, labels, identifiers, values, and frame coordinates. Use it to find elements before tapping or swiping.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: device.
ui_swipeA
Swipe between two points on the simulator screen. Use ui_snapshot to get coordinates, then swipe between them. For common gestures like scrolling, prefer ui_gesture instead.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: start_x (required), start_y (required), end_x (required), end_y (required), +2 more.
ui_tapA
Tap a UI element on the simulator by accessibility id (most reliable), label, or x/y coordinates. At least one targeting method must be provided. Prefer accessibility id when available — use ui_snapshot to discover them.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: device, id, label, x, +1 more.
ui_typeA
Type text into the currently focused field on the simulator. Tap a text field first with ui_tap to focus it, then use this to type.
Requires AXe CLI: brew tap cameroncooke/axe && brew install axe
Inputs: text (required), device.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 37 tools
Each tool has a clearly distinct purpose, with categories for profiling, simulation, UI automation, and analysis. Descriptions are detailed and specify when to use each tool, minimizing confusion.
Tool names follow a consistent prefix pattern (profile_, sim_, ui_, instruments_, performance_) with descriptive nouns, making the set predictable and easy to navigate.
37 tools cover a broad domain including profiling, simulator control, UI automation, and analysis. While slightly high, each tool earns its place with a clear role, avoiding redundancy.
The tool surface is comprehensive, covering major profiling types, simulator operations, UI interactions, and analysis. Minor gaps exist (e.g., no dedicated real device profiling), but the core workflow is well-supported.
Maintenance
Related MCP Connectors
Cloud iPhones and Macs with Xcode for AI agents: build, run and test iOS apps, use the screen.
Cloud iPhone Simulators for AI agents: build the Xcode project, read the screen, tap by label, test.
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
Build, run, and inspect iOS apps in disposable hosted Simulators from cloud coding agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to record, analyze, and compare Xcode Instruments traces, detect performance bottlenecks and regressions, and provide optimization recommendations.44MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control real iPhones and simulators on macOS, allowing for UI interaction, testing, and automation.51 npm98MIT
- FlicenseAqualityDmaintenanceEnables natural language profiling of iOS apps using xctrace (Instruments) for performance analysis like launch time, memory leaks, CPU usage, and network requests.12-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control iOS Simulators for UI/UX debugging, app management, and accessibility auditing via simctl, IDB, and ClaudeDebugKit.MIT