# @memlab/mcp-server [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/meta/memlab  
**GitHub Stars:** 5094  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/memlab-mcp-server

## Description
MCP server for MemLab heap snapshot analysis — gives AI coding assistants tools to explore JavaScript heap snapshots, find memory leaks, and identify optimization opportunities

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-server": {
    "command": "npx",
    "args": ["-y","-p","@memlab/mcp-server","memlab-mcp"],
    "env": {
      "NODE_OPTIONS": ""
    }
  }
}
```

**Requires environment variables:** `NODE_OPTIONS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What @memlab/mcp-server does

@memlab/mcp-server exposes MemLab's heap-analysis capabilities to AI coding assistants through the Model Context Protocol. Agents can work with JavaScript heap snapshots to determine what occupies memory, find objects that remain reachable unexpectedly, inspect retaining references, and investigate objects that grow during an interaction.

The server is intended for memory debugging rather than general application development. It is useful when an agent needs to reason about a `.heapsnapshot` file, diagnose a suspected browser leak, or turn an observed memory problem into a regression test. MemLab's surrounding tooling supports snapshots from Chromium-based browsers, Node.js, Electron, and Hermes.

## How it works

The MCP process is launched with the `memlab-mcp` executable from the `@memlab/mcp-server` package. An MCP-compatible coding agent starts that process and communicates with it over standard input and output. The agent can then ask MemLab to inspect heap data and guide an investigation conversationally.

A typical investigation begins with a heap snapshot. MemLab can examine the heap graph, identify objects associated with leaks or memory growth, and show a retainer trace: the chain of references that keeps an object reachable from a garbage-collection root. That trace helps locate the reference that should have been released. A particular heap object can also be investigated by its object identifier.

For web applications, MemLab can run an end-to-end scenario using Puppeteer, compare snapshots around an interaction, and report grouped leaks. The underlying MemLab framework also supports custom leak detectors, memory analyses, and Node.js memory assertions. Code that has readable function, property, and variable names produces more useful traces than heavily minified code.

## Setup and configuration

The package can be run without a global installation through npx:

```bash
npx -y -p @memlab/mcp-server memlab-mcp
```

Claude Code and Codex can add the server directly with their MCP commands. Their documented setup also sets `NODE_OPTIONS=--max-old-space-size=8192`, which gives the MemLab process an 8 GB Node.js heap limit for memory-intensive analysis:

```bash
claude mcp add memlab -e NODE_OPTIONS=--max-old-space-size=8192 -- npx -y -p @memlab/mcp-server memlab-mcp
codex mcp add memlab --env NODE_OPTIONS=--max-old-space-size=8192 -- npx -y -p @memlab/mcp-server memlab-mcp
```

Claude Code and Codex can instead install the MemLab plugin, which bundles this MCP server with four agent skills for heap analysis, web leak detection, snapshot capture, and memory-test creation. Cursor and other agents can add the same stdio command to their MCP configuration using the format required by the client.

## Tools and capabilities

- Load and inspect JavaScript heap snapshots.
- Investigate objects that consume or continue to accumulate memory.
- Find memory leaks and examine retainer traces.
- Analyze snapshots captured from Chromium, Hermes, Node.js, Electron, or MemLab.
- Support browser leak investigations based on Puppeteer interaction scenarios.
- Help coding agents create memory leak regression tests and explore optimization opportunities through the associated MemLab skills.

_Full upstream README: https://allmcps.com/mcp/memlab-mcp-server/readme_

