MCP Hub
Back to servers

memorylens-mcp

MCP server for .NET memory profiling with AI-actionable code fix suggestions, powered by JetBrains dotMemory

glama
Forks
1
Updated
Mar 10, 2026

MemoryLens MCP

MemoryLens MCP

NuGet NuGet Downloads Build Status License

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

memorylens-mcp MCP server

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

ToolDescription
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

Built-in Rules

IDSeverityCategoryDescription
ML001criticalleakEvent handler leak detected
ML002criticalleakStatic collection growing unbounded
ML003highleakDisposable object not disposed
ML004highfragmentationLarge Object Heap fragmentation
ML005mediumretentionObject retained longer than expected
ML006mediumallocationExcessive allocations in hot path
ML007mediumretentionClosure retaining unexpected references
ML008lowallocationArray/list resizing without capacity hint
ML009lowpatternFinalizer without Dispose pattern
ML010lowpatternString 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

Reviews

No reviews yet

Sign in to write a review