← Back to directory
M

MemoryLens MCP

Community
On-demand .NET memory profiling with AI-actionable code fix suggestions.
GitHub source repository ↗
★ 10 Stars Category · Dev Tools Popular Source revision 989fdfb95b11
51FMRS · D

MemoryLens MCP provides a useful MCP interface for .NET memory profiling, wrapping JetBrains dotMemory with a rule-based engine that offers AI-actionable insights. Its strengths are its on-demand nature, multiple deployment options, and the ability to generate actionable fixes. However, the dependency on .NET 10 and dotMemory CLI, plus the automatic download of external tools, are considerations for users regarding security and environment readiness.

Reliability
8/20
Security and permissions
8/20
Maintenance
10/20
Documentation
14/20
Setup experience
11/20
Read the FMRS scoring method →

MemoryLens MCP is an MCP server for on-demand memory profiling of .NET processes. It wraps JetBrains dotMemory and provides actionable, AI-executable code fix suggestions via a heuristic-based rule engine. Supports in-process heap snapshots via EventPipe with leak heuristics. The server requires .NET 10 SDK or later and is available via multiple deployment options: npm launcher, .NET global tool, or Docker. It includes a tool to automatically download and cache the dotMemory CLI.

Tools

ensure_dotmemory
Downloads and verifies the JetBrains dotMemory CLI is available.
list_processes
Lists running .NET processes available for profiling (discovered via diagnostic IPC endpoints).
snapshot
Captures a single memory snapshot of a target process.
analyze
Runs the rule engine against a captured snapshot and returns findings.
compare_snapshots
Captures two snapshots with configurable delay and compares them to detect memory growth.
get_rules
Lists all available analysis rules with their metadata.

Setup

For npx (requires .NET 10 SDK): add a stdio server config with command npx -y memorylens-mcp. Or use dnx: dnx MemoryLens.Mcp --yes. Also available as .NET global tool: dotnet tool install -g MemoryLens.Mcp.

claude_desktop_config.json
{
  "mcpServers": {
    "memorylens": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "memorylens-mcp"
      ]
    }
  }
}

Fit and risk

Best for

  • .NET developers seeking quick, on-demand memory profiling integrated with AI-assisted coding tools.
  • Debugging scenarios that require analyzing running .NET processes by their PID.
  • Teams that want to automate detection of common memory leak patterns like event handler leaks or static collections growing unbounded.

Not for

  • Non-.NET processes are not supported.
  • Users without .NET 10 SDK or on unsupported platforms (e.g., FreeBSD) will need manual dotMemory setup.
  • Not suitable for fully offline scenarios unless the dotMemory CLI is pre-installed and cached.

Required permissions

  • Executes arbitrary commands to launch profilers (e.g., dotMemory CLI).
  • May access the network to download tools and dependencies.
  • May require ptrace and host PID namespace if running in a container.

Risks and side effects

  • The tool downloads and executes external binaries (dotMemory CLI), introducing supply chain risk.
  • Memory profiling of a target process may impact its performance or stability.
  • Running with elevated privileges could pose security risks.

Troubleshooting

  1. Ensure .NET 10 SDK is on PATH.
  2. For unsupported platforms, set DOTMEMORY_PATH to an existing dotMemory CLI executable.
  3. If automatic download fails, check network connectivity and retry `ensure_dotmemory`.
  4. If no processes are listed, verify the target process is a .NET process and running.
  5. Refer to the error scenarios table: 'Platform not supported', 'Network/download failure', 'chmod +x failed', 'dotMemory CLI not found'.

Use cases

Take a memory snapshot of a running .NET process to inspect current memory state and identify leaks.
Compare two snapshots (before/after) to detect memory growth after load testing or user operations.
Get concrete, AI-actionable code fix suggestions for memory issues such as event handler leaks or static collections growing unbounded.

Supported clients

Claude DesktopFull support
VS CodePartial support
Visual StudioPartial support
Claude CodeFull support