
MemLab MCP Server (Meta): Setup for Claude, Cursor and Other Apps
Lets Claude, Cursor and other assistants analyze JavaScript heap snapshots to find memory leaks and show what holds memory.
This is the MCP server that ships with Meta's MemLab project. It runs on your computer and reads heap snapshot files from Chrome or Node.js. The assistant can then explain what the heap is made of, who keeps an object alive, and whether memory grows over a series of snapshots. Nothing is sent to a service, and no account is needed.
It is big: about 150 tools, most of which only read a snapshot. Some run JavaScript the assistant writes, and one can delete snapshot files. Read the safety notes before you connect it to anything you care about. For a first try, start with the tool named memlab_app_heap.
Good for
- Web and Node developers chasing a memory leak with a heap snapshot
- Performance engineers who compare snapshots taken while an action repeats
- Teams who want a fix checked: did the growth rate really drop
Works in
12 should work
Tap an app to see how to set it up and any known problems.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Client does not support this transport.
Client does not support this transport.
Install memlab MCP
Claude Code
- 1
Copy this prompt.
Add the memlab MCP server to Claude Code. Run this command: claude mcp add memlab -e NODE_OPTIONS=--max-old-space-size=8192 -- npx -y -p @memlab/mcp-server memlab-mcp Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
Read-only mode: There is no read-only mode. Add MEMLAB_DISABLE_CODE_TOOLS=1 to turn off the tools that run JavaScript. The capture, prune and report-writing tools stay on unless you pick tool groups with MEMLAB_TOOLSETS.
Use the npx form from the README: -p names the package and memlab-mcp is the program to run, because the package has two programs. NODE_OPTIONS is optional: the server starts without it, but the README advises --max-old-space-size=8192 or higher because large heap snapshots can run out of memory on Node's default limit. Use a larger number for big snapshots. Node.js 18 or later is needed. To turn off every tool that runs caller-supplied JavaScript, add MEMLAB_DISABLE_CODE_TOOLS=1 to the same env settings. Claude Code and Codex users can also install the memlab plugin, which adds the server together with skills.
Built from the package data we hold. Not yet tested by us.
Tools
Measures how much heap is JavaScript source text.
Counts the JavaScript source text kept in the heap and flags a bundle that is held in memory more than once, which is often the largest single item in a browser heap.
Files ·
memlab_script_censusLists every property name used in the heap.
Builds an index of all distinct property names, how many objects carry each one and which classes they belong to, so you can discover what an app stores before searching for a specific field.
Files ·
memlab_property_namesCounts the async work still waiting to run.
Reports pending React scheduler tasks (split into live and cancelled), timer callbacks and unsettled Promises with the shapes that own them, to spot timers or tasks piling up.
Files ·
memlab_async_censusRanks unsettled Promises by how many callbacks wait on them.
Lists Promises that never settled, ordered by the length of their callback chain, with retained size and owner path, because one stuck Promise can hold a long chain of callbacks alive.
Files ·
memlab_pending_promisesShows how much of the heap is the application itself.
Subtracts bundle and code memory, dev-build leftovers and measurement-tool content from the total, so you see what the app really uses. A good first call on an unfamiliar app.
Try: “What is this heap made of, app data or bundle code?”
Files ·
memlab_app_heapSplits the whole heap into non-overlapping rows.
Answers "what is using the memory?" with one table where every byte lands in exactly one row, grouping React, collections, event records and modules, and it works on minified code.
Files ·
memlab_memory_partitionShows where memory sits as a tree.
Draws the shortest-retainer-path tree from the GC roots with the bytes under each branch, expanding only large branches, so the sums add up and shared caches show their true size.
Files ·
memlab_path_treeMeasures what one loaded record costs per model type.
For Backbone-style collections, reports how many records are loaded and what one record costs, including its property store and the arrays it holds, even in minified code.
Files ·
memlab_model_censusGroups pending timers by the function they will run.
Finds scheduled tasks and timers, unwraps error-guard wrappers to the real callback, and shows what each group of callbacks keeps alive.
Files ·
memlab_timersSizes the common framework buffers in one call.
Probes for recurring buffers such as in-memory log arrays, module timing records, the scheduler queue, module tables and objects with thousands of properties, and reports their size.
Files ·
memlab_framework_buffersTakes fresh heap snapshots of a running page and its workers.
Connects to Chrome over the DevTools Protocol, without a script, and saves heap snapshots of a live page and its dedicated workers, which a page snapshot alone would never include.
Try: “Take snapshots of the page open in Chrome.”
Write ·
memlab_captureSplits one snapshot by JavaScript realm.
Lists each realm (the page, iframes, extension worlds, detached windows) with the bytes it owns alone, the bytes shared between realms and the bytes no realm reaches.
Files ·
memlab_native_contextsCompares the heaps of several realms side by side.
Puts a page and its workers captured at the same moment into one table showing app memory, bundle text, loaded code, dev-only bytes, WebAssembly modules and shared buffers, counting shared memory once.
Files ·
memlab_realm_summaryFinds collections that hold the same objects.
Groups Maps, Sets and WeakMaps whose keys or values overlap and shows how many bytes a fix would free by cutting one holder versus all of them.
Files ·
memlab_co_holdersFinds modules loaded twice across realms.
Takes a page snapshot and its worker snapshots and lists each module present in more than one realm, with its memory in each and the bytes saved if only the largest copy stayed.
Files ·
memlab_realm_duplicationGives a first overview of a loaded snapshot in one call.
Returns the snapshot summary, the largest objects, a class histogram and duplicated strings together, saving several round trips. Run it right after loading a snapshot.
Files ·
memlab_quick_diagnosisSummarizes the loaded heap snapshot.
Reports total nodes, edges and size with a count and self size for each node type, giving retained size as a cheap range by default so large snapshots do not stall the server.
Files ·
memlab_snapshot_summaryCounts instances and size for each class.
Lists each constructor or class with its instance count and total self size, sorted by size, in a single fast pass. Retained size is optional and slow on big snapshots.
Files ·
memlab_class_histogramLists the objects with the largest retained size.
Returns the top objects by retained size with a content preview, filtered by node type, and collapses several views of the same subtree into one row.
Try: “Which objects retain the most memory?”
Files ·
memlab_largest_objectsGroups objects by their set of property names.
Counts objects that share the same property structure and shows how much memory each shape uses, which helps when most objects are plain generic Objects.
Files ·
memlab_shape_histogramWorks out what a minified structure is.
Matches a node or a property shape against known fingerprints, so a class named only "t" or "e" can be identified as, for example, a listener record or an editor history entry.
Files ·
memlab_identifyBreaks down the per-instance memory cost of a class.
Reports header overhead, number storage, property backing store and collection overhead per instance, and compares it with storing numeric properties in typed arrays.
Files ·
memlab_object_cost_breakdownEstimates how many bytes freeing a set of objects returns.
Reports the retained size of a population with nothing counted twice and nothing counted that is also reachable another way, the number a fix decision needs.
Files ·
memlab_what_ifTraces retainer paths for a whole population.
Traces every object in a population back to its roots and clusters the paths, so a small group holding much of the bytes is not missed by sampling.
Files ·
memlab_trace_allChecks whether growth followed the same retention path.
Compares a population across two snapshots to tell whether an existing owner grew or a new owner appeared, which count diffs cannot tell apart.
Files ·
memlab_retainer_diffChecks whether two snapshots hold the same objects.
Matches a population across two snapshots by content instead of node id, useful across reloads or sessions, to separate objects that persist from ones that are replaced.
Files ·
memlab_identity_diffSays what the loaded snapshots can prove and what to capture next.
Reviews the snapshots in memory and tells you which conclusions they can support and which extra capture would change that, such as a missing rung or a light load.
Files ·
memlab_next_measurementReads the feature flags and config the app was running with.
Pulls feature flags and config values out of the snapshot itself, so you can tell whether a fix was actually enabled in the capture instead of guessing.
Files ·
memlab_app_configGuesses which experiment arm a capture belongs to.
Compares the loaded capture with one from the other arm to decide its experiment group when the flag is decided on the server and never appears in the heap.
Files ·
memlab_gate_fingerprintSaves a named measurement so it can be compared later.
Records a number under a name and keeps it across sessions in a small file, so a value measured today can be compared with one from next week. This tool writes a state file.
Write ·
memlab_metricMeasures the memory cost of one instance.
Reports retained bytes per instance for a class or shape and, given two snapshots, separates the average cost from the marginal cost of adding one more.
Files ·
memlab_unit_costPlans which snapshots of a ladder fit in memory.
Estimates what each snapshot costs to load and recommends which to hold in memory and which to probe one at a time.
Files ·
memlab_snapshot_budget_plannerLists every reference that keeps an island alive.
Finds all production-reachable references into a detached subtree or other island, not just the shortest one, because fixing only one holder reclaims nothing while others remain.
Files ·
memlab_island_doorsChecks the snapshot came from the build you think it did.
Scans the heap for marker strings from the new and the old revision, so you know the change was in the build before trusting any before/after number.
Files ·
memlab_build_provenanceShows what an open DevTools console keeps alive.
Reports objects held by the console from console.log calls, which act as GC roots in a capture, and whether a given object depends on them.
Files ·
memlab_console_retentionCounts one population several ways and flags disagreement.
Counts the same set of objects with several independent methods, because a method that cannot reach them returns 0, which looks the same as them not being there.
Files ·
memlab_count_populationFollows retained size down to the object holding it.
Starting from one node, walks down through wrappers such as closure contexts to the object that actually carries the weight, in a single call.
Files ·
memlab_drill_to_heavy_leafChecks whether classes retain the same bytes.
Reports pairwise overlap in retained size between classes plus the combined total with no double counting, to use before quoting the value of a fix that removes several.
Files ·
memlab_overlap_matrixMeasures a custom count across a series of snapshots.
Runs one numeric probe you write over an ordered ladder of snapshots and reports the series, the rate per cycle and a straight-line fit. It runs JavaScript supplied by the assistant.
Runs code ·
memlab_ladder_probeTests whether a population grows without bound.
Fits a line, a saturating curve and a step followed by a line to the rungs and reports which fits, the likely plateau and how many cycles an item stays retained.
Files ·
memlab_rate_modelCompares several rounds of a sweep side by side.
Compares N rounds and surfaces patterns no single round shows, such as a per-cycle growth rate that lands on a whole number and so points to one specific mechanism.
Files ·
memlab_compare_roundsEstimates what freeing one property would return.
Answers how many bytes come back if a fix sets a named property to null, and whether that property is the only reference keeping the data alive.
Files ·
memlab_field_release_impactRuns a round's full set of analyses in one call.
Runs the standard analysis set over one loaded graph, writes every tool's output to disk and returns only a short digest. It writes report files and runs JavaScript from its inputs.
Runs code ·
memlab_analysis_batteryLists the timeouts and expiry times the app uses.
Finds the app's retention windows (timeouts, TTLs, cleanup intervals, eviction ages) so you do not call growth unbounded when the test was shorter than those windows.
Files ·
memlab_retention_windowsFrees disk by compressing or deleting a round's snapshots.
Compresses a round's snapshot files by default to reclaim disk, or deletes them if you ask. The default only reports what it would do, so approve any delete call yourself.
Try: “Show what would be freed by compressing this round's snapshots.”
Delete ·
memlab_prune_runReports on an analysis battery running in the background.
Shows the progress of a battery started with the async option and returns its full report when done. With no battery id it lists the batteries the server knows.
Files ·
memlab_battery_statusStarts any memlab tool as a background job.
Runs another tool in the background and returns a job id at once, for slow ladder tools that would outlast the client timeout. Results are collected with the job status tool.
Runs code ·
memlab_start_jobChecks that the measurement can see known growth.
Measures the round's positive controls, known accumulators that should grow. A pass means flat results elsewhere are trustworthy, and a fail means a probe or the test drive is blind.
Files ·
memlab_positive_controlsJudges a leak-hunt round against stated invariants.
Checks plain-language claims such as "no growth" or "returns to baseline" using probe code you supply, and reports which invariants hold. It runs JavaScript from the assistant.
Runs code ·
memlab_judgesProves the invariant judges can fail when they should.
Runs every judge on rounds where named fixes are switched off and checks each judge turns red with its fix off and stays green with it on.
Runs code ·
memlab_switch_matrixChecks judges against rounds known to leak.
Runs judges on rounds known to carry the leaks they guard and records which judges stayed green and so are blind, in a ledger file. It runs JavaScript from the assistant.
Runs code ·
memlab_calibrate_judgesLists module-level caches ranked by what they hold.
Inventories Maps, Sets, WeakMaps and Arrays held by module scopes or by exported functions and classes, with owner, entry count and the memory their entries retain.
Files ·
memlab_cache_inventoryReads one module's served source out of the snapshot.
Returns the source code of a module as it was loaded in the page, so you can check whether a fix is actually served or whether the code is a dev-build artifact.
Files ·
memlab_module_sourceFinds which module's code a node belongs to.
Resolves a closure or other node to the module that created it, going from which object to which file without a separate code search.
Files ·
memlab_source_for_nodeFinds React refs that still point at removed page elements.
Lists refs whose current value is a detached DOM node, grouped by component and by how many component instances exist, since more stale refs than instances suggests a leak.
Files ·
memlab_stale_refsShows growth with development-only objects removed.
Computes per-class growth between two snapshots after removing objects only a dev build holds, such as console handles, Fast Refresh registries and React debug fields.
Files ·
memlab_dev_subtracted_deltaReports on a background job and returns its result.
Shows the state of a job started with the start job tool and returns the full result when finished. With no job id it lists every known job.
Files ·
memlab_job_statusTracks growth by object shape across snapshots.
Groups objects by their property set at every snapshot in a ladder and reports each shape's counts, rate per cycle and fit, for when a class report only blames plain Object.
Files ·
memlab_shape_census_diffCompares detached-DOM and listener counts at two snapshots.
Takes the detached DOM and event listener census at a start and end snapshot and compares them class by class, because equal totals can still hide a change in what is held.
Files ·
memlab_census_diffGives a one-call leak summary across a series of snapshots.
Runs the growth trend and then gathers evidence from the last snapshot, returning one table with counts per snapshot, growth per cycle, the main retainer and a verdict hint.
Try: “Compare these four snapshots and tell me what is growing.”
Files ·
memlab_leak_reportLooks at the newest objects of a growing population.
Groups the most recently created instances of a class by who holds them, their shapes and their paths from the roots, since the newest objects are the ones that grew.
Files ·
memlab_growth_cohortChecks an ordered series of snapshots for unbounded growth.
Loads each snapshot in turn, builds class histograms and reports each class's value at every step with a growth verdict such as growing at every step.
Files ·
memlab_sequence_analysisTracks named collections across a series of snapshots.
Reports entry counts for named collections at each snapshot with growth per cycle, to tell a real leak from a cache that has simply filled.
Files ·
memlab_collection_trendCompares what a population is made of between two snapshots.
Breaks a population into buckets and compares them across two snapshots, because equal totals can hide one set of objects being freed while another is stranded.
Files ·
memlab_population_diffReports leftover records in React update queues.
Finds React state updates that bailed out early and left records on a queue that never drains, and reports how many queues hold pending updates.
Files ·
memlab_react_update_queuesSeparates retained memory from work still in flight.
Compares a busy snapshot with one taken after the app was idle and garbage-collected, to tell lasting retention from a temporary backlog of promises, queues and buffers.
Files ·
memlab_settle_checkGuesses which collections grow without bound from one snapshot.
Flags Maps and Sets keyed by timestamps or counters and large arrays that look like append-only logs, using a single snapshot with no baseline.
Files ·
memlab_growth_signalsCompares two snapshots for classes that grew or shrank.
Lists classes that grew, shrank, appeared or disappeared between a before and an after snapshot, and matches objects by V8 id when both come from the same session.
Files ·
memlab_diff_snapshotsTests one theory against every snapshot in a series.
Takes a JavaScript test over heap nodes and returns its match count, total size and trend at each snapshot. It runs JavaScript supplied by the assistant.
Runs code ·
memlab_hypothesisDecides whether a fix reduced growth.
Compares the per-cycle growth rate of one metric between a series of snapshots from before the fix and a series from after it.
Try: “Did my fix reduce the growth rate?”
Files ·
memlab_verify_fixNames a series of snapshots so other tools can reuse it.
Saves a snapshot series under a name, with details such as the app, interaction and build, so trend tools can refer to it as ladder:name. It writes a small state file.
Write ·
memlab_ladderNames the React component behind plain objects.
Finds which component owns a population of generic Objects such as fibers, hooks and update records, which class-name based tools cannot trace in production code.
Files ·
memlab_react_ownersTells a standing cost from an accumulating leak.
Counts a population and its owners and reports the ratio, to separate roughly one record per live owner from owners collecting more and more records.
Files ·
memlab_population_vs_ownersWalks a linked structure and reports how deep it goes.
Follows repeated links such as closure chains, React update queues, LRU lists and interval trees from a start node and reports the depth and what the chain holds.
Files ·
memlab_chain_walkAssigns heap bytes to the module that owns them.
Walks the dominator tree up to the nearest module export or module scope, so the memory in a bundled app can be tied to the module that holds it.
Files ·
memlab_module_attributionCounts named populations at every snapshot of a series.
Counts several named populations, such as detached nodes or listener records, at each snapshot in one pass and reports the rate of change per cycle.
Files ·
memlab_censusJudges an A/B round with the fix off and on.
Runs the same probes on both arms, fits each against its own cycles and prints a table with rates, the ratio and a verdict per metric. It runs JavaScript from its inputs.
Runs code ·
memlab_ab_compareFinds blob URLs that were never released.
Counts blob: object URLs that were created and not revoked, which keep their Blob alive outside the V8 heap and so do not show in heap size.
Files ·
memlab_object_urlsRanks surfaces by growth per cycle for one metric.
Builds a table of per-cycle growth rates for one metric across several rounds, so the ranking shows which surface to fix first.
Files ·
memlab_rate_tableExplains the memory held by external strings.
Attributes the ExternalStringData class, often the largest in a web-app heap, to the objects and scripts that own it.
Files ·
memlab_external_stringsExplains where a heap grew by owner.
Attributes growth between two snapshots to the object that owns the new bytes, not the class of the new bytes, so the answer names what to fix.
Files ·
memlab_explain_deltaWalks up from a node to the root through its owners.
Lists the chain of objects that each exclusively dominate the target, so the nearest application-owned entry is the single owner to fix.
Files ·
memlab_dominator_chainMeasures how much of a population each candidate owner holds.
Given several candidate retainers, counts how much of a population each one dominates, so you see which would really free memory when released.
Files ·
memlab_dominator_attributionShows which code allocated live objects.
Groups live objects by the JavaScript stack that allocated them, from a capture recorded with allocation tracking, ranked by bytes or count.
Files ·
memlab_allocation_sitesShows memory kept alive only by certain retainer types.
Reports bytes retained only through closure contexts, detached DOM, the DevTools console or event handlers, meaning what removing every such retainer would free.
Files ·
memlab_retained_byFinds captured variables no live code can read.
Checks every closure context slot against the scope tree in the snapshot and lists variables kept alive only because a sibling closure still exists.
Files ·
memlab_dead_context_variablesSaves named probes for an app to reuse.
Stores probe code under a name in a file on disk so the ladder tools can run it automatically later. It writes a state file and the stored probes run JavaScript.
Write ·
memlab_probesCounts retained React elements and fibers by component.
Counts fibers as mounted, alternate or detached and elements by what holds them, per component type, to show which components leave objects behind.
Files ·
memlab_element_censusShows where retained Error objects were created.
Groups retained Errors by the top stack frames V8 recorded on them, with count, distinct messages and retained size.
Files ·
memlab_error_callsitesFinds model copies that share an identity.
Finds instances sharing the same identity value, such as a message id, which should be one record each, and reports the extra copies, their size and who holds them.
Files ·
memlab_model_duplicatesFinds closure scopes that pin earlier calls' scopes.
Finds chains of contexts that share one scope, where each call of a function keeps the previous call's scope alive, and reports the longest chain and linking variables.
Files ·
memlab_scope_chainsShows the shortest path from a GC root to a node.
Walks the retainer path to a heap node to show why it is still in memory.
Try: “Why is this object still in memory?”
Files ·
memlab_retainer_traceGroups retainer paths for many instances of a class.
Traces a sample of instances of a class, or chosen node ids, and shows how many share each retainer path, to confirm a single root cause.
Files ·
memlab_retainer_summaryGroups the things that reference a node.
Counts all incoming references to a node by edge name and source class, to see whether one edge name dominates, as in listener build-up.
Files ·
memlab_referrer_summaryFinds small objects that hold very large subtrees.
Ranks objects by retained size relative to their own size, limited to user-code objects, to point at the single cache, map or closure whose removal frees the most.
Files ·
memlab_pinch_pointsLists the objects a node exclusively holds.
Shows the direct children of a node in the dominator tree, the objects that would be freed if that node were garbage collected.
Files ·
memlab_dominator_subtreeChecks whether an object stays alive if one reference is cut.
Lists the independent references that retain a node, so you can tell whether cutting one edge would actually release it.
Files ·
memlab_retainer_layersFollows the largest child down the ownership tree.
Starting from a node, repeatedly follows the largest dominated child until it reaches data or a depth limit, replacing many manual lookups with one call.
Files ·
memlab_trace_dominatorsGives one number for heap that is not the application.
Combines the app heap split with dev artifacts and measurement leftovers, and with a baseline shows how much growth came from the app rather than the tooling.
Files ·
memlab_artifact_budgetChecks that a measured effect repeats across runs.
Takes the same probe and snapshot series from several independent runs and refuses to call the effect real until they agree. It runs JavaScript supplied by the assistant.
Runs code ·
memlab_replicateTracks growing native browser objects across snapshots.
Counts native Blink classes and timeline entries across a series and splits them by whether a JavaScript holder or the browser itself keeps them, which tells you if app code can release them.
Files ·
memlab_blink_native_censusSeparates production memory from dev-tool memory.
Flags large retainers held only through dev or extension globals, accessibility caches and similar, so they are not mistaken for production leaks.
Files ·
memlab_dev_artifactsRuns all the quick health checks at once.
Runs the heuristic checks in one call and returns a prioritized list of findings. A good first step after loading a snapshot.
Files ·
memlab_check_healthBudgets the attached DOM and ranks what to virtualize.
Counts live page elements by surface to show which areas have too many elements. This is for optimization, not leak finding.
Files ·
memlab_dom_auditFinds page elements removed from the document but still held.
Lists detached DOM elements kept alive by JavaScript references, with counts or ids only for big results and grouping by owner, tag or retainer pattern.
Try: “Are there detached DOM nodes holding memory?”
Files ·
memlab_detached_domDetects event listeners piling up on emitters.
Scans for event-emitter style listener lists and for accumulations of callback and context objects used by custom event systems.
Files ·
memlab_event_listener_leaksReports listener counts in per-model event tables.
Finds objects that map event names to lists of listeners, reports the top event names and listeners per host, and says whether the pattern looks structural or like a leak.
Files ·
memlab_event_registryFinds which collections grew without being told their names.
Counts entries in every Map, Set, WeakMap, WeakSet and Array at each snapshot, keys them by owner and property, and diffs them to find the ones that grew.
Files ·
memlab_collection_diffCounts WeakRefs and whether they are still live.
Counts every WeakRef split into live and empty, grouped by the object holding it, to find records that outlive the thing they pointed to.
Files ·
memlab_weakref_censusFinds large caches that look like they never evict.
Reports big Maps, Sets and Arrays with entry count, retained size, owner and whether entries use WeakRef, to spot caches missing eviction logic.
Files ·
memlab_cache_analysisDetects shared immutable data structures and their versions.
Finds Immutable.js collections, Immer drafts and RxJS-style subscriptions and reports how many versions stay retained and how many bytes they hold.
Files ·
memlab_persistent_structuresFinds arrays and objects that are mostly empty slots.
Finds integer-keyed storage that is mostly holes, memory V8 allocated and the app never uses, which a class histogram cannot show.
Files ·
memlab_sparse_elementsFinds tables that share one sparse id range.
Groups separate integer-indexed tables that all use ids from one counter, each sized for the whole range and mostly empty.
Files ·
memlab_id_space_auditFinds collections that hold stale references.
Checks Maps, Sets and Arrays for detached DOM or unmounted fibers, entries stuck in a terminal state such as FAILED, and entries nothing outside the collection refers to.
Files ·
memlab_stale_collectionsLists the entries of one Map or Set.
Enumerates the keys and values of a single Map or Set you name by node id, since the keys often explain an unbounded cache.
Files ·
memlab_map_entriesLists the entries of one WeakMap.
Enumerates the key and value pairs of a single WeakMap you name by node id, to see which objects are associated and what metadata is stored.
Files ·
memlab_weakmap_entriesGroups array or Map items by one property.
Reads a named property from each element of an array, Map or Set and counts the items by value, replacing a common hand-written script.
Files ·
memlab_array_group_byShows the most common values of one property.
Reports how many distinct values a property has and the most frequent ones with counts, to diagnose fields whose unbounded values blow up memory.
Files ·
memlab_property_distributionCounts strings by prefix across snapshots.
Counts strings that start with a given prefix, such as blob: or data:image/, at each snapshot with distinct values and bytes, without walking the whole graph.
Files ·
memlab_string_prefix_censusFinds duplicated strings that could be shared.
Groups duplicated strings by the property and object shape holding them and shows the saving from adding a string interning pool for each.
Files ·
memlab_intern_opportunitiesFinds identical strings stored many times.
Lists strings that appear multiple times, ranked by total retained size, as a source of wasted memory. It scans the whole heap, so it is slow on very large snapshots.
Try: “Which strings are duplicated the most?”
Files ·
memlab_duplicated_stringsGroups strings that share a common prefix.
Collapses families of related strings into one row with a count and total size, instead of many separate histogram entries.
Files ·
memlab_string_patternsFinds string slices that keep a large parent string alive.
Finds V8 sliced and concatenated strings and the parent strings they reference, since a small slice can keep a multi-megabyte parent in memory.
Files ·
memlab_sliced_stringsFinds objects with identical content repeated many times.
Groups objects by a shallow content signature to find structurally identical copies, which class and shape histograms group differently and cannot see.
Files ·
memlab_duplicate_objectsSearches the text inside string values.
Searches the actual content of strings for things like error messages, event names, config keys and URLs, and traces matches back to their owners.
Files ·
memlab_search_stringsReads the full text of a string node.
Resolves any V8 string node, including concatenated and sliced strings, to its complete text, and can show the internal string tree.
Files ·
memlab_get_stringFinds heap objects with several filters at once.
Filters objects in one call by class or name pattern, node type, property name, detached state, realm and what retains them, instead of chaining several searches.
Files ·
memlab_query_objectsFinds heap nodes by class name.
Finds nodes by exact constructor name or by a case-insensitive pattern, with the biggest by retained size first by default.
Files ·
memlab_find_nodes_by_classSearches heap nodes by name, type and size.
Combines a name pattern, node type, minimum size and detached status, sorted by retained size. It scans the whole heap, so it is slow on huge snapshots.
Files ·
memlab_search_nodesFinds objects that have a given property.
Finds every object with a named property, useful for React internals or framework markers, and can look up the objects whose property points at a given node.
Files ·
memlab_find_by_propertyFinds objects that have all of several properties.
Finds objects that carry every property name you list, to locate instances of a specific record type.
Files ·
memlab_find_by_shapeChecks whether a class appears in the heap at all.
Answers whether the code you plan to instrument is actually running on this page, a cheap check to make before building a test round.
Files ·
memlab_module_presentFinds the same object in another loaded snapshot.
Matches an object from the current snapshot to its counterpart in another one, since node ids differ between captures.
Files ·
memlab_match_objectLooks up one heap node by its id.
Returns the node's size, type, detached state, distance from the root, dominator, location and string value where one exists.
Files ·
memlab_get_nodeShows the properties of one or more objects.
Lists each object's named properties with target node types and sizes, hiding internal edges, and can compare several objects side by side.
Files ·
memlab_object_shapeLists what a node points to.
Returns the outgoing references of a node, its properties, elements and closure captures, sorted by size and filterable by edge name.
Files ·
memlab_get_referencesLists what points to a node.
Returns the incoming references to a node, sorted by size and filterable by edge name, with paging for widely referenced singletons.
Files ·
memlab_get_referrersReads one named property of a node.
Returns the target of a single named property, such as __proto__ or memoizedState, so you can walk the object graph step by step.
Files ·
memlab_get_propertyDecodes a stored number.
Reads the numeric value of a V8 small integer or heap number node and shows which objects refer to it and by which property.
Files ·
memlab_get_valueShows the variables a closure or paused async function holds.
Walks the full scope chain of a closure, or the live state of a suspended generator or async frame, and lists the captured variables at each depth.
Files ·
memlab_closure_inspectionLists application globals sorted by retained size.
Finds non-built-in globals on the window or global object, which may point to memory problems. It scans the whole heap, so it is slow on huge snapshots.
Files ·
memlab_global_variablesGroups heap nodes and totals their size.
Groups nodes by type, name or name prefix and reports count, self size and retained size without counting shared memory twice.
Files ·
memlab_aggregateRuns a filter, map and reduce over every heap node.
Lets the assistant supply JavaScript to select nodes, transform them and combine the results. It runs JavaScript supplied by the assistant.
Runs code ·
memlab_for_eachRuns JavaScript against the loaded snapshot.
Executes code supplied by the assistant with access to the snapshot and helper functions and returns the value assigned to result. It has the server process's privileges.
Try: “Count the objects whose class name starts with Cache.”
Runs code ·
memlab_evalRuns one eval program over several snapshots.
Runs the same JavaScript against several snapshots, loaded or from files, and returns the results side by side. It runs JavaScript supplied by the assistant.
Runs code ·
memlab_eval_acrossRuns a full automatic leak investigation.
Finds the top retained objects, traces each to the GC root, spots pinch points and unbounded caches, and returns a report with likely causes and suggested fixes.
Try: “Investigate this snapshot for me.”
Files ·
memlab_auto_investigateLists every memlab tool by the question it answers.
Prints an index of the tools grouped by purpose, with filtering and input schemas, to use when you are unsure which tool fits.
Files ·
memlab_toolsRewrites a snapshot so it can be shared.
Replaces string contents and identifier-like or credential-like names, while keeping class and function names so analysis still works. It writes a new file.
Write ·
memlab_anonymize_snapshotGives a short verdict table for a finished round.
Reads the files a leak-hunt round left on disk and returns only the verdicts, instead of tens of kilobytes of prose.
Files ·
memlab_round_digestGives one row per round for a whole sweep.
Summarizes each round from its files, including heap, cycles, audit verdict and leak candidates, and flags candidates no earlier round reported.
Files ·
memlab_sweep_digestChecks whether a round can support any conclusion.
Reads a leak hunt's run file and checks rung count, ladder continuity, whether each step landed and similar, before anyone reads its numbers.
Files ·
memlab_round_auditLoads a heap snapshot file for analysis.
Parses a .heapsnapshot, builds indexes, computes the dominator tree and retained sizes, and returns a quick diagnosis. It accepts a local path or URL.
Try: “Load /tmp/before.heapsnapshot.”
Files ·
memlab_load_snapshotManages the snapshots held in memory.
Lists loaded snapshots, switches the active one or unloads one to free memory, and toggles output settings that trim repeated text.
Files ·
memlab_snapshotsRuns several tools against one snapshot load.
Runs a list of memlab tools in order on one loaded snapshot and returns all outputs together, since loading is the expensive step.
Runs code ·
memlab_batchReads a snapshot file's header without loading it.
Returns node and edge counts, capture time and file size without a full load, so it cannot overload the server, and says whether the file fits the load limit.
Try: “Will this snapshot file fit in memory?”
Files ·
memlab_snapshot_headerChecks that the server is alive and shows its state.
Returns the server version, memory use, uptime and loaded snapshots instantly, plus load times and the slowest tools this session.
Files ·
memlab_server_statusChecks a leak finding against ones seen before.
Fingerprints a finding by its retainer path and compares it with earlier rounds so a hunt does not rediscover a known leak. It keeps a small index file.
Write ·
memlab_finding_indexRuns curated memory reports.
Lists or runs prebuilt analysis reports similar to Chrome DevTools Memory views, including a full analysis that runs them all.
Files ·
memlab_reportsRenders a leak hunt's results into a report.
Turns a hunt's run file into the standard report with configuration, the snapshot ladder and per-cycle rates, caveats and the stop reason.
Files ·
memlab_hunt_reportRuns the whole analysis for a leak-hunt run.
Runs the trend, owner attribution, detached-DOM comparison, dev-artifact classification and per-grower judgement for one run file in a single call.
Files ·
memlab_analyze_run
Read from the source code
Permissions
high risk · 5 things to watch
High risk
Most tools only read snapshot files, but some run JavaScript the assistant writes and one can delete files. Keep manual approval on, and switch off the code-running tools if you do not need them.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
Some tools run code the assistant writes
About a dozen tools run JavaScript from the assistant with the full privileges of the server process, and the README says node:vm is not a security sandbox. Set MEMLAB_DISABLE_CODE_TOOLS=1 unless you need them, and keep manual approval on. github.com
One tool can delete snapshot files
The prune tool can compress a round's snapshots in place or delete them. Its default only reports what it would do, but approve any delete mode call yourself. github.com
Some tools write files outside the heap
Capture writes snapshots, and the battery, finding and metric tools write reports and small state files. Check the folders they write to. github.com
Snapshots can contain private data
Heap snapshots hold page data such as tokens and personal text, and the assistant reads them. Use the anonymize tool before sharing a capture. github.com
Large snapshots can crash the server
It loads whole snapshots in memory and refuses ones that will not fit. Raise the memory limit in NODE_OPTIONS for big files. github.com
Security advisories
No published security advisories as of Nov 1, 2026.
Technical details
| Turning on read-only | No read-only mode. MEMLAB_DISABLE_CODE_TOOLS=1 turns off every tool that runs caller-supplied JavaScript, and MEMLAB_TOOLSETS limits the tool groups. |
|---|---|
| Talks to | A Chrome you start with remote debugging, on your own computer, when the capture tool is used |
| Sign-in and keys | No account or key is needed. |
Questions
Is the MemLab MCP server official?
Yes. It ships inside Meta's MemLab repository as the @memlab/mcp-server package.
What do I need to analyze?
A heap snapshot file from Chrome DevTools or Node.js. For finding leaks, take several snapshots while the same action repeats. The server loads them from disk and can also capture from a running Chrome.
Does it send my data anywhere?
Not to a MemLab service. It runs on your computer and reads local files. Your AI app still receives what the tools return, so anonymize a snapshot before sharing sensitive ones.
Can I stop it from running code?
Yes. Set MEMLAB_DISABLE_CODE_TOOLS=1 in the server's env settings. That turns off every tool that runs JavaScript supplied by the assistant.
Why does it crash on a big snapshot?
It keeps the whole snapshot in memory, several times its file size. Raise the limit with --max-old-space-size in NODE_OPTIONS. The server also refuses files it knows will not fit.
Why so many tools?
The README groups them by question: what the heap is made of, whether anything grows, who owns the growth, and whether a result is real. MEMLAB_TOOLSETS can expose only some groups, such as the core everyday tools.
Is it free?
Yes. It is open source under the MIT license.
Information
updated Nov 2, 2026
- Publisher
- Official
- Package
@memlab/mcp-server- Registry
- npm
- Transport
- stdio
- Auth
- None
- Version
- 2.313.0
- License
- MIT
- Last commit
- Oct 30, 2026
- Open issues
- 12
Sources
Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.
Show all 2Hide
- github.com · github.com
- registry.npmjs.org · registry.npmjs.org