# memorydetective

An MCP server for finding iOS retain cycles and performance issues. It analyzes .memgraph, .trace, and MetricKit payloads from an agent chat.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 14
- Author: carloshpdoc
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/carloshpdoc/memorydetective
- Updated: 2026-05-25
- HTML: https://affpapa.org/en/nevibecode/mcp/memorydetective

## What it does

memorydetective gives an agent access to iOS diagnostics. It reads `.memgraph` captures, locates ROOT CYCLE entries, matches them to common SwiftUI and Combine patterns, and returns a short direction for the fix. Trace support includes `inspectTrace`, `summarizeTrace`, memory and energy analysis, plus network activity checks.

The server can ingest Apple MetricKit `.mxdiagnostic` files from TestFlight and App Store builds, then group crashes, identify hang hotspots, and surface CPU or disk exceptions. `recordViaInstrumentsApp` opens Instruments.app, guides the recording flow, and passes the saved `.trace` to inspection. Node.js `20` or newer is required. On macOS 26.x, simulator recording through `xctrace` is broken, so use Instruments.app or a physical device instead. A physical iOS device still requires Xcode.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add memorydetective -- npx -y memorydetective
```

### Codex

**Platform CLI**
```bash
codex mcp add memorydetective -- npx -y memorydetective
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "memorydetective": {
            "command": "npx",
            "args": [
                "-y",
                "memorydetective"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "memorydetective": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "memorydetective"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add memorydetective npx -y memorydetective
```

## When to use it
- find retain cycles in `.memgraph` captures
- inspect iOS `.trace` bundles after profiling
- match leaks to SwiftUI and Combine patterns
- group crashes from MetricKit diagnostics
- check iOS memory and performance regressions

## Example prompts
- Find retain cycles in `App.memgraph` and explain the likely causes.
- Inspect `Profile.trace`, focus on memory problems, and suggest the next investigation step.
- Analyze `diagnostic.mxdiagnostic` and group crashes by exception type.

## Similar
- [swiftui-performance](https://affpapa.org/en/nevibecode/skills/swiftui-performance.md) — skill · 4600 installs
- [swiftui-performance-audit](https://affpapa.org/en/nevibecode/skills/swiftui-performance-audit.md) — skill · 109 installs
- [android-profiler](https://affpapa.org/en/nevibecode/skills/android-profiler.md) — skill · 1000 installs
- [ios-memgraph-analysis](https://affpapa.org/en/nevibecode/skills/ios-memgraph-analysis.md) — skill · 1200 installs
- [ios-memgraph-leaks](https://affpapa.org/en/nevibecode/skills/ios-memgraph-leaks.md) — skill · 1054 installs
- [optimize-memory-usage](https://affpapa.org/en/nevibecode/commands/optimize-memory-usage.md) — command · 476 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
