MCP server/monitoring

MemoryLens MCP Server

On-demand .NET memory profiling with AI-actionable code fix suggestions

★ 10MarcelRoozekrans/memorylens-mcp ↗by MarcelRoozekransupdated
Manual setup required. We don't have a verified install command for this server. Follow the maintainer README and use the raw config below as a starting point.
1

Prepare the server locally

Run this once before adding it to Claude Code.

git clone https://github.com/MarcelRoozekrans/memorylens-mcp
cd memorylens-mcp

Then follow the repository README for any remaining dependency or build steps.

2

Add it to Claude Code

Paste the maintainer's config below, then edit any placeholder values.

~/.claude.json
{
  "servers": {
    "memorylens": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "MemoryLens.Mcp",
        "--yes"
      ]
    }
  }
}

See the memorylens-mcp README for full setup instructions.

3

Make your agent remember this setup

memorylens's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.

npx conare@latest

Free · one command · indexes the sessions already on disk. Set up in the browser instead →

What it does

  • Automated .NET memory profiling using JetBrains dotMemory
  • Heuristic-based rule engine for identifying memory leaks and performance issues
  • AI-actionable code fix suggestions for detected problems
  • Support for single snapshots and comparative snapshot analysis
  • Customizable rule behavior via .memorylens.json configuration

Tools 6

ensure_dotmemoryDownloads and verifies the JetBrains dotMemory CLI tool is available
list_processesLists running .NET processes available for profiling
snapshotCaptures a single memory snapshot of a target process
compare_snapshotsCaptures two snapshots with configurable delay and compares them
analyzeRuns the rule engine against a captured snapshot and returns findings
get_rulesLists all available analysis rules with their metadata

Try it

Take a snapshot of my running API (PID 12345) and analyze it for memory leaks.
Check if my app has a memory leak by comparing two snapshots taken before and after processing 1000 requests.
List all available memory analysis rules and their severity levels.
Identify why my .NET process is consuming excessive memory using the latest snapshot.
Original README from MarcelRoozekrans/memorylens-mcp
<h1 align="center">MemoryLens MCP</h1>

On-demand .NET memory profiling with concrete, AI-actionable code fix suggestions — wraps JetBrains dotMemory with a heuristic-based rule engine.

<a href="https://glama.ai/mcp/servers/MarcelRoozekrans/memorylens-mcp"> </a>

Quick Start

VS Code / Visual Studio (via dnx)

Add to your MCP settings (.vscode/mcp.json or VS settings):

{
  "servers": {
    "memorylens": {
      "type": "stdio",
      "command": "dnx",
      "args": ["MemoryLens.Mcp", "--yes"]
    }
  }
}

Claude Code Plugin

claude install gh:MarcelRoozekrans/memorylens-mcp

.NET Global Tool

dotnet tool install -g MemoryLens.Mcp

Prerequisites

Available MCP Tools

Tool Description
ensure_dotmemory Downloads and verifies the JetBrains dotMemory CLI tool is available
list_processes Lists running .NET processes available for profiling
snapshot Captures a single memory snapshot of a target process
compare_snapshots Captures two snapshots with configurable delay and compares them
analyze Runs the rule engine against a captured snapshot and returns findings
get_rules Lists all available analysis rules with their metadata

Built-in Rules

ID Severity Category Description
ML001 critical leak Event handler leak detected
ML002 critical leak Static collection growing unbounded
ML003 high leak Disposable object not disposed
ML004 high fragmentation Large Object Heap fragmentation
ML005 medium retention Object retained longer than expected
ML006 medium allocation Excessive allocations in hot path
ML007 medium retention Closure retaining unexpected references
ML008 low allocation Array/list resizing without capacity hint
ML009 low pattern Finalizer without Dispose pattern
ML010 low pattern String interning opportunity

Configuration

Create a .memorylens.json file in your project root to customize rule behavior:

{
  "rules": {
    "ML001": { "enabled": true, "severity": "critical" },
    "ML002": { "enabled": true, "severity": "critical" },
    "ML003": { "enabled": true, "severity": "high" },
    "ML004": { "enabled": true, "severity": "high" },
    "ML005": { "enabled": true, "severity": "medium" },
    "ML006": { "enabled": true, "severity": "medium" },
    "ML007": { "enabled": true, "severity": "medium" },
    "ML008": { "enabled": true, "severity": "low" },
    "ML009": { "enabled": true, "severity": "low" },
    "ML010": { "enabled": true, "severity": "low" }
  }
}

Usage Examples

Single Snapshot

Capture a memory snapshot of a running process to inspect current memory state:

> /memorylens
> Take a snapshot of my running API (PID 12345)

Claude will call ensure_dotmemory, then snapshot with the target PID, then analyze the result and present findings ordered by severity.

Before/After Comparison

Detect memory growth by comparing two snapshots taken with a delay:

> /memorylens
> Check if my app has a memory leak — compare before and after processing 1000 requests

Claude will call compare_snapshots with a configurable wait period, then analyze the diff to identify objects that grew between snapshots.

License

MIT

Frequently Asked Questions

What are the key features of MemoryLens?

Automated .NET memory profiling using JetBrains dotMemory. Heuristic-based rule engine for identifying memory leaks and performance issues. AI-actionable code fix suggestions for detected problems. Support for single snapshots and comparative snapshot analysis. Customizable rule behavior via .memorylens.json configuration.

What can I use MemoryLens for?

Detecting event handler leaks in long-running .NET services. Identifying unbounded growth in static collections. Troubleshooting Large Object Heap (LOH) fragmentation issues. Optimizing memory usage by finding excessive allocations in hot code paths.

How do I install MemoryLens?

Install MemoryLens by running: dnx MemoryLens.Mcp --yes

What MCP clients work with MemoryLens?

MemoryLens works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Conare · memory for coding agents

Turn this server into reusable context

Keep MemoryLens docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Set up free$npx conare@latest