
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
MemoryLens.Mcp
Advanced tools
MCP server for .NET memory profiling — wraps JetBrains dotnet-dotmemory with heuristic-based analysis rules
On-demand .NET memory profiling with concrete, AI-actionable code fix suggestions — wraps JetBrains dotMemory with a heuristic-based rule engine.
A hosted deployment is available on Fronteir AI.
{
"mcpServers": {
"memorylens": {
"type": "stdio",
"command": "npx",
"args": ["-y", "memorylens-mcp"]
}
}
}
The npm package ships no server code — it is a launcher that installs the MemoryLens.Mcp .NET
global tool at a matching version and execs it, so the .NET 10 SDK must be on PATH.
Subsequent starts skip the install entirely and work offline.
Add to your MCP settings (.vscode/mcp.json or VS settings):
{
"servers": {
"memorylens": {
"type": "stdio",
"command": "dnx",
"args": ["MemoryLens.Mcp", "--yes"]
}
}
}
claude install gh:MarcelRoozekrans/memorylens-mcp
dotnet tool install -g MemoryLens.Mcp
docker build -t memorylens-mcp .
docker run -i --rm --pid=host --cap-add=SYS_PTRACE \
-v "$PWD:/workspace" -v memorylens-tools:/root/.memorylens memorylens-mcp
Profiling from a container needs ptrace and the host PID namespace, and on
Docker Desktop that namespace is the Linux VM rather than your desktop — see
docs/docker.md before choosing this route.
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.
| Platform | Architecture |
|---|---|
| Windows | x64, x86, ARM64 |
| Linux (glibc) | x64, ARM64, ARM |
| Linux (musl) | x64, ARM64 |
| macOS | x64 (Intel), ARM64 (Apple Silicon) |
Downloaded binaries are cached at ~/.memorylens/tools/dotmemory/{version}/. Old versions are not auto-removed — delete the directory manually to free disk space.
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:
~/.local/share/JetBrains/Toolbox/apps/rider/tools/profiler/dotMemory.sh%LOCALAPPDATA%\JetBrains\Toolbox\apps\rider\tools\profiler\dotMemory.exeIf auto-download is unavailable, MemoryLens MCP falls back through these discovery modes in order:
DOTMEMORY_PATH environment variable — explicit path to the CLI executabledotMemory.sh / dotMemory (Linux/macOS) or dotMemory.exe (Windows)dotnet tool install dotnet-dotmemory --localdotnet tool install -g dotnet-dotmemory (legacy fallback)| Error | Cause | Fix |
|---|---|---|
Platform '...' is not supported | Unsupported OS/arch | Set DOTMEMORY_PATH |
| Network/download failure | No internet / NuGet unreachable | Set DOTMEMORY_PATH or retry ensure_dotmemory |
chmod +x failed | Read-only filesystem | Set DOTMEMORY_PATH to a writable location |
dotMemory CLI not found | All discovery modes failed | Run ensure_dotmemory or set DOTMEMORY_PATH |
| Tool | Description |
|---|---|
ensure_dotmemory | Downloads and verifies the JetBrains dotMemory CLI tool is available |
list_processes | Lists running .NET processes available for profiling. Discovers them from their diagnostic IPC endpoints, so it works before ensure_dotmemory |
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 |
| 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 |
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" }
}
}
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.
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.
FAQs
MCP server for .NET memory profiling — wraps JetBrains dotnet-dotmemory with heuristic-based analysis rules
We found that MemoryLens.Mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.