
Memorydetective
Brings iOS memory and performance debugging into chat by wrapping Xcode command-line tools like `leaks`, `heap`, and `xctrace`. Parse `.memgraph` files to hunt retain cycles, analyze `.trace` bundles for hangs and time profiles, or ingest MetricKit diagnostics from production builds. The MCP layer exposes over 40 tools covering cycle classification against SwiftUI and Combine patterns, diff comparisons between two memory snapshots, network activity timelines, and verification hooks that check whether a proposed fix actually clears the leak. Works on macOS against simulators and Mac apps. Physical iOS device captures still require Xcode's GUI, but once you have the artifact the analysis runs entirely through Claude or Cursor without opening Instruments. Ships with honest fault surfaces when Apple tooling breaks, like the macOS 26 `task_for_pid` regression.
- GitHub stars
- 11
- tools
- 27
- transport
- STDIO
- last updated
- May 18, 2026
Tools
27 toolsPublic tool metadata for what this MCP can expose to an agent.
analyzeMemgraphRun `leaks` against a `.memgraph` and return summary (totals, ROOT CYCLE blocks, plain-English diagnosis).
Run `leaks` against a `.memgraph` and return summary (totals, ROOT CYCLE blocks, plain-English diagnosis).
No parameter schema in public metadata yet.
findCyclesExtract just the ROOT CYCLE blocks as flattened chains, with optional `className` substring filter.
Extract just the ROOT CYCLE blocks as flattened chains, with optional `className` substring filter.
No parameter schema in public metadata yet.
findRetainers"Who is keeping `<class>` alive?". Returns retain chain paths from a top-level node down to the match.
"Who is keeping `<class>` alive?". Returns retain chain paths from a top-level node down to the match.
No parameter schema in public metadata yet.
countAliveCount instances by class. Provide `className` for one number, or omit for top-N most-leaked classes.
Count instances by class. Provide `className` for one number, or omit for top-N most-leaked classes.
No parameter schema in public metadata yet.
reachableFromCycleCycle-scoped reachability. "How many `<X>` instances are reachable from the cycle rooted at `<Y>`?". Distinguishes the actual culprit from its retained dependencies.
Cycle-scoped reachability. "How many `<X>` instances are reachable from the cycle rooted at `<Y>`?". Distinguishes the actual culprit from its retained dependencies.
No parameter schema in public metadata yet.
diffMemgraphsCompare two `.memgraph` snapshots: total deltas + class-count changes + cycles new/gone/persisted.
Compare two `.memgraph` snapshots: total deltas + class-count changes + cycles new/gone/persisted.
No parameter schema in public metadata yet.
analyzeAbandonedMemoryDiff two `.memgraph` snapshots on heap reference-tree class counts (not cycle list) and classify each grown class as `kvo-observer-orphaned`, `notificationcenter-observer-leaked`, `cache-too-aggressive`, `singleton-retains-payload`, or `unknown-growth`.
Diff two `.memgraph` snapshots on heap reference-tree class counts (not cycle list) and classify each grown class as `kvo-observer-orphaned`, `notificationcenter-observer-leaked`, `cache-too-aggressive`, `singleton-retains-payload`, or `unknown-growth`.
No parameter schema in public metadata yet.
verifyFixCycle-semantic diff: per-pattern PASS/PARTIAL/FAIL verdict + bytes freed. CI-gateable.
Cycle-semantic diff: per-pattern PASS/PARTIAL/FAIL verdict + bytes freed. CI-gateable.
No parameter schema in public metadata yet.
classifyCycleMatch each ROOT CYCLE against a built-in catalog of 36 named antipatterns with confidence + textual `fixHint` + `staticAnalysisHint` + `fixTemplate` (Swift before/after snippet).
Match each ROOT CYCLE against a built-in catalog of 36 named antipatterns with confidence + textual `fixHint` + `staticAnalysisHint` + `fixTemplate` (Swift before/after snippet).
No parameter schema in public metadata yet.
analyzeHangsParse `xctrace` `potential-hangs` schema; return Hang vs Microhang counts + top N longest.
Parse `xctrace` `potential-hangs` schema; return Hang vs Microhang counts + top N longest.
No parameter schema in public metadata yet.
analyzeAnimationHitchesParse `xctrace` `animation-hitches` schema; report by-type counts and how many hitches crossed Apple's user-perceptible 100ms threshold.
Parse `xctrace` `animation-hitches` schema; report by-type counts and how many hitches crossed Apple's user-perceptible 100ms threshold.
No parameter schema in public metadata yet.
analyzeTimeProfileParse `xctrace` `time-profile` schema; return top symbols by sample count.
Parse `xctrace` `time-profile` schema; return top symbols by sample count.
No parameter schema in public metadata yet.
analyzeAllocationsParse `xctrace` `allocations` schema; return per-category aggregates and top allocators.
Parse `xctrace` `allocations` schema; return per-category aggregates and top allocators.
No parameter schema in public metadata yet.
analyzeAppLaunchParse `xctrace` `app-launch` schema; return cold/warm launch type + per-phase breakdown.
Parse `xctrace` `app-launch` schema; return cold/warm launch type + per-phase breakdown.
No parameter schema in public metadata yet.
logShowOne-shot query of macOS unified logging via `log show --style compact` with predicate / process / subsystem filters.
One-shot query of macOS unified logging via `log show --style compact` with predicate / process / subsystem filters.
No parameter schema in public metadata yet.
recordTimeProfileWrap `xcrun xctrace record --template "Time Profiler"` and return `bundleStatus` after a run.
Wrap `xcrun xctrace record --template "Time Profiler"` and return `bundleStatus` after a run.
No parameter schema in public metadata yet.
recordViaInstrumentsAppmacOS 26.x escape hatch: opens Instruments.app, returns instructions, and polls for new `.trace` bundles.
macOS 26.x escape hatch: opens Instruments.app, returns instructions, and polls for new `.trace` bundles.
No parameter schema in public metadata yet.
captureMemgraphWrap `leaks --outputGraph <path> <pid>`, resolving appName to pid and returning a structured workaroundNotice on regressions.
Wrap `leaks --outputGraph <path> <pid>`, resolving appName to pid and returning a structured workaroundNotice on regressions.
No parameter schema in public metadata yet.
logStreamWrap `log stream --style compact` for a bounded duration (≤ 60 s) and return parsed entries.
Wrap `log stream --style compact` for a bounded duration (≤ 60 s) and return parsed entries.
No parameter schema in public metadata yet.
bootAndLaunchForLeakInvestigationSingle-call build + boot + install + launch with `MallocStackLogging=1` propagated via `SIMCTL_CHILD_*`.
Single-call build + boot + install + launch with `MallocStackLogging=1` propagated via `SIMCTL_CHILD_*`.
No parameter schema in public metadata yet.
replayScenarioDrive the iOS Simulator through tap / swipe / wait / type actions with a `repeat` count to amplify leaks.
Drive the iOS Simulator through tap / swipe / wait / type actions with a `repeat` count to amplify leaks.
No parameter schema in public metadata yet.
captureScenarioStateComposite snapshot for verify-fix: writes `.memgraph` + `.png` screenshot + `.ui.json` accessibility tree into `outputDir`.
Composite snapshot for verify-fix: writes `.memgraph` + `.png` screenshot + `.ui.json` accessibility tree into `outputDir`.
No parameter schema in public metadata yet.
listTraceDevicesParse `xcrun xctrace list devices` (devices + simulators + UDIDs).
Parse `xcrun xctrace list devices` (devices + simulators + UDIDs).
No parameter schema in public metadata yet.
listTraceTemplatesParse `xcrun xctrace list templates` (standard + custom).
Parse `xcrun xctrace list templates` (standard + custom).
No parameter schema in public metadata yet.
inspectTraceOrientation tool for `.trace` bundles. Returns schemas present + row counts + device/OS/template metadata + `suggestedNextCalls[]`.
Orientation tool for `.trace` bundles. Returns schemas present + row counts + device/OS/template metadata + `suggestedNextCalls[]`.
No parameter schema in public metadata yet.
summarizeTraceSingle call that chains `inspectTrace` + the 5 analyzers in parallel + cross-correlates findings and pre-renders a compact markdown summary card.
Single call that chains `inspectTrace` + the 5 analyzers in parallel + cross-correlates findings and pre-renders a compact markdown summary card.
No parameter schema in public metadata yet.
analyzeMetricKitPayloadIngest Apple MetricKit `.mxdiagnostic` JSON payloads from real-device builds and output crash clusters and hang hotspots.
Ingest Apple MetricKit `.mxdiagnostic` JSON payloads from real-device builds and output crash clusters and hang hotspots.
No parameter schema in public metadata yet.
Sponsors
Readme
memorydetective
English · Português brasileiro
Diagnose iOS retain cycles and performance regressions from your chat window. No Xcode required.
demo
Highlights
Details
- Repository
- github.com/carloshpdoc/memorydetective
- Categories
- Developer Tools, Monitoring & Observability, Mobile Development
- Package
memorydetective- Transport
- STDIO
- Registry
- MCP registry, active