MCP server that wraps Xcode Instruments. Record traces, automate the simulator, parse results — find out what's slow without opening Instruments.
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.
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.1ms
35 tools across profiling, UI automation, simulator control, and trace analysis. Full tool list →
- One-shot —
profile_cpu,profile_swiftui,profile_memory,profile_hitches,profile_launch,profile_energy,profile_leaks,profile_network - Scripted scenarios —
profile_scenariorecords a trace while executing UI steps (tap, scroll, type, launch) - Interactive —
start_profiling/stop_profilingfor manual interaction - Health check —
performance_auditruns 5 templates and combines the results - Any template —
profile_rawhandles templates without a dedicated parser
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).
Launch/terminate apps, open deep links, push notifications, take screenshots, set location, toggle dark mode.
Re-analyze saved traces, drill into specific functions, track regressions with baselines, generate Markdown reports.
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.
- Xcode Instruments (xctrace) 15.x through 26.x
- Handles xctrace 26 Deferred recording mode automatically
- Device identifiers (
booted, device name, UDID) resolved automatically
Architecture
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 helpers
Build from source
git 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.
MIT
