memorydetective — Claude Code MCP server: setup
An MCP server for finding iOS retain cycles and performance issues. It analyzes .memgraph, .trace, and MetricKit payloads from an agent chat.
claude mcp add memorydetective -- npx -y memorydetectiveWhat memorydetective 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.
What it helps with
- find retain cycles in
.memgraphcaptures - inspect iOS
.tracebundles after profiling - match leaks to SwiftUI and Combine patterns
- group crashes from MetricKit diagnostics
- check iOS memory and performance regressions
Example prompts for the agent
- Find retain cycles in
App.memgraphand explain the likely causes. - Inspect
Profile.trace, focus on memory problems, and suggest the next investigation step. - Analyze
diagnostic.mxdiagnosticand group crashes by exception type.
How to install memorydetective
Platform CLI
claude mcp add memorydetective -- npx -y memorydetectivePlatform CLI
codex mcp add memorydetective -- npx -y memorydetectiveConfig file
{
"mcpServers": {
"memorydetective": {
"command": "npx",
"args": [
"-y",
"memorydetective"
]
}
}
}Config file
{
"servers": {
"memorydetective": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"memorydetective"
]
}
}
}Platform CLI
gemini mcp add memorydetective npx -y memorydetectiveStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about memorydetective
How do I install memorydetective in Claude Code?
Run claude mcp add memorydetective -- npx -y memorydetective.
What does memorydetective do?
It lets an agent investigate iOS retain cycles, trace data, performance issues, and MetricKit diagnostics through MCP tools. The investigation can start from a chat instead of a manual Instruments workflow.
What does memorydetective require?
You need Node.js 20 or newer. Physical iOS device analysis requires Xcode, while Memory Graph capture also works with Mac apps and iOS simulators.