
Memorylens Mcp
io.github.MarcelRoozekransPublished by GitHub account MarcelRoozekransv2.1.3Updated Oct 31, 2026
MCP server for .NET memory profiling — in-process heap snapshots via EventPipe with leak heuristics
Overview
Local MCP server that lets an assistant profile .NET process memory: list processes, take heap snapshots, compare them and run leak rules.
- What you can do
- List running .NET processes available for profiling
- Capture a heap snapshot of a target process by PID and compare two snapshots taken with a delay
- Run the built-in rule engine on a snapshot and return findings ordered by severity
- List the available analysis rules and their metadata
- When to use it
- Useful when debugging memory growth or suspected leaks in a running .NET application and you want the assistant to gather heap data and point at likely causes without installing a profiler.
- Requirements
- Runs as a local stdio process; the npm package is a launcher that installs the MemoryLens.Mcp .NET global tool, so the .NET 10 SDK (10.0.4xx feature band) must be on PATH. Also installable as a NuGet global tool or run via dnx. On Linux and in containers, attaching may need a matching UID or SYS_PTRACE. No accounts, keys or environment variables declared.
Installation
In SourceWeft
- Open Memorylens Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
MemoryLens MCP
[NuGet] [NuGet Downloads] [npm] [Build Status] [codecov] [License]
On-demand .NET memory profiling with concrete, AI-actionable code fix suggestions — no profiler to install.
[memorylens-mcp MCP server]Hosted deployment
A hosted deployment is available on Fronteir AI.
Quick Start
npx (any MCP client)
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.
VS Code / Visual Studio (via dnx)
Add to your MCP settings (.vscode/mcp.json or VS settings):
Claude Code Plugin
The plugin runs the NuGet tool through dnx, so it needs the .NET 10 SDK and nothing else.
.NET Global Tool
Docker
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.
-v /tmp:/tmp is what makes list_processes return anything — the runtime's
diagnostic sockets live in the temp directory — and it is also what keeps
snapshots alive after --rm, since they are written to
/tmp/memorylens-snapshots inside the container. -v "$PWD:/workspace" is only
so .memorylens.json is picked up; nothing is written there.
Prerequisites
- .NET 10 SDK, 10.0.4xx feature band (pinned in
global.json)
Running a filtered subset of the tests, e.g. dotnet test --filter <name>, will exit with code 9
and print error: 1, failed: 0. That's the test project's discovery-collapse guard
(--minimum-expected-tests) firing because the filter left fewer tests than expected — it is
not a test failure, and a full dotnet test run is unaffected.
How Collection Works
MemoryLens collects heap data in-process over EventPipe, the .NET runtime's built-in diagnostics channel. There is no profiler to install, no download on first use, and no external tool on PATH.
snapshot attaches to a running .NET process by pid, induces a collection, and aggregates the heap into per-type counts and sizes. Snapshots are written as small JSON files under your temp directory and referenced by a short id.
On Linux and in containers, attaching to another process's diagnostic endpoint may require matching UID or SYS_PTRACE — see docs/docker.md.
Available MCP Tools
Built-in Rules
Configuration
Create a .memorylens.json file in your project root to customize rule behavior:
Usage Examples
Single Snapshot
Capture a memory snapshot of a running process to inspect current memory state:
Claude will call snapshot with the target PID, then analyze the returned snapshot id and present findings ordered by severity.
Before/After Comparison
Detect memory growth by comparing two snapshots taken with a delay:
Claude will call compare_snapshots with a delaySeconds value (default 10 seconds) between the two captures, then analyze the diff to identify objects that grew between snapshots.
Family
MemoryLens MCP is part of a small family of .NET projects for AI work:
- AI.Sentinel: Security monitoring middleware for
IChatClient: prompt injection, hallucination and PII detection with an audit trail. - Minos.NET: Typed, source-generated decision questions with calibrated answers.
- Rag.NET: A modular retrieval-augmented generation pipeline on Microsoft.Extensions.AI.
- Roslyn CodeLens MCP: Semantic .NET code intelligence for AI agents over MCP.
Built on ZeroAlloc
MemoryLens MCP uses these ZeroAlloc libraries, which are source generators and analyzers with no reflection at runtime:
License
Source: README.md at commit 59babff
Tools
0Version history
2- v2.1.3LatestOct 31, 2026
- v2.1.2Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts