convez.ai
MCP ServerDevOps & InfraestruturaAvançado
MarcelRoozekrans

MemoryLens MCP

MarcelRoozekrans/memorylens-mcp

Análise de memória .NET com sugestões de fix acionáveis por IA

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP para análise de memória em aplicações .NET com sugestões de correção de código acionáveis por IA. Integra-se com JetBrains dotMemory e fornece um mecanismo de regras heurísticas para identificar e resolver vazamentos de memória e ineficiências.

Instalação

$npx convez-ai MarcelRoozekrans/memorylens-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
11
Forks
3
Acompanhando
0
Saúde
42%
Último commit
há 1 dia
Versão
v2.2.1
Issues abertas
4
Contribuidores
6

Casos de uso

  • Identificar vazamentos de memória em aplicações .NET
  • Otimizar consumo de memória em produção
  • Gerar recomendações de refatoração baseadas em profiling

Veredito

Ferramenta especializada e madura para profiling de memória em .NET, com integração sólida ao ecossistema JetBrains. Ideal para equipes que precisam de diagnóstico profundo e automação de análise de performance em pipelines CI/CD.

README

A tradução para o português deste README ainda está na fila.

GitHub Sponsors


Hosted deployment

A hosted deployment is available on Fronteir AI.

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

  • .NET 10 SDK or later
  • JetBrains dotMemory CLI (see below for installation options)

dotMemory CLI Installation

MemoryLens MCP automatically downloads and caches the JetBrains dotMemory CLI on first use via the ensure_dotmemory tool — no manual installation required on supported platforms.

Supported Platforms (auto-download)

PlatformArchitecture
Windowsx64, x86, ARM64
Linux (glibc)x64, ARM64, ARM
Linux (musl)x64, ARM64
macOSx64 (Intel), ARM64 (Apple Silicon)

Cache Location

Downloaded binaries are cached at ~/.memorylens/tools/dotmemory/{version}/. Old versions are not auto-removed — delete the directory manually to free disk space.

Unsupported Platforms

Platforms not listed above (e.g. FreeBSD, Linux x86) cannot use auto-download. Set DOTMEMORY_PATH to point to an existing dotMemory CLI executable:

export DOTMEMORY_PATH="/path/to/dotMemory.sh"   # Linux/macOS
set DOTMEMORY_PATH=C:\path\to\dotMemory.exe      # Windows

Find dotMemory CLI in JetBrains Toolbox:

  • Linux: ~/.local/share/JetBrains/Toolbox/apps/rider/tools/profiler/dotMemory.sh
  • Windows: %LOCALAPPDATA%\JetBrains\Toolbox\apps\rider\tools\profiler\dotMemory.exe

Manual Fallback Discovery

If auto-download is unavailable, MemoryLens MCP falls back through these discovery modes in order:

  1. DOTMEMORY_PATH environment variable — explicit path to the CLI executable
  2. System PATH — searches for dotMemory.sh / dotMemory (Linux/macOS) or dotMemory.exe (Windows)
  3. Local .NET tool manifest — dotnet tool install dotnet-dotmemory --local
  4. Global .NET tool — dotnet tool install -g dotnet-dotmemory (legacy fallback)

Error Scenarios

ErrorCauseFix
Platform '...' is not supportedUnsupported OS/archSet DOTMEMORY_PATH
Network/download failureNo internet / NuGet unreachableSet DOTMEMORY_PATH or retry ensure_dotmemory
chmod +x failedRead-only filesystemSet DOTMEMORY_PATH to a writable location
dotMemory CLI not foundAll discovery modes failedRun ensure_dotmemory or set DOTMEMORY_PATH

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

Ver o original no GitHub

Bom para

Relacionados