memorylens-mcp
Hosted deployment
A hosted deployment is available on Fronteir AI.
Related MCP server: ASPNET Core Debugging MCP Server
Quick Start
npx (any MCP client)
{
"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.
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.McpDocker
docker build -t memorylens-mcp .
docker run -i --rm --pid=host --cap-add=SYS_PTRACE \
-v /tmp:/tmp \
-v "$PWD:/workspace" memorylens-mcpProfiling 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
Tool | Description |
| Lists running .NET processes available for profiling, discovered from their diagnostic IPC endpoints |
| Captures a single memory snapshot of a target process |
| Captures two snapshots with configurable delay and compares them |
| Runs the rule engine against a captured snapshot and returns findings |
| Lists all available analysis rules with their metadata |
Built-in Rules
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 |
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 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:
> /memorylens
> Check if my app has a memory leak — compare before and after processing 1000 requestsClaude 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.
License
Available Tools
5 toolsanalyzeB
Analyzes a memory snapshot using built-in rules to detect leaks, fragmentation, excessive allocations, and anti-patterns. Returns findings with severity, description, and optional code suggestions.
| Name | Required | Description | Default |
|---|---|---|---|
| afterPath | No | Path to 'after' snapshot for comparison | |
| beforePath | No | Path to 'before' snapshot for comparison | |
| snapshotId | Yes | Snapshot ID or path to analyze | |
| snapshotPath | No | Path to snapshot file | |
| workingDirectory | No | Working directory for resolving relative paths |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided. Description implies read-only ('analyzes'), but does not explicitly state non-destructiveness, performance impact, or any side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, concise and front-loaded with the main action and outputs. No fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema, but description describes return fields (severity, description, suggestions). Missing details about how comparison works given afterPath/beforePath, especially compared to sibling compare_snapshots.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline 3. Description adds context about 'built-in rules' and return format, but does not explain the comparison parameters (afterPath, beforePath) beyond what schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states it 'Analyzes a memory snapshot' and lists specific detections (leaks, fragmentation, etc.). Distinguishes from sibling tools like list_processes, snapshot, compare_snapshots.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs siblings (e.g., compare_snapshots). Does not specify prerequisites or when not to use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compare_snapshotsA
Takes two memory snapshots of a .NET process with a delay between them for comparison. Useful for detecting memory leaks by comparing before/after state. Provide a pid. Returns the ids and paths of both snapshots.
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | Process ID to snapshot | |
| command | No | Not implemented; a process id is required | |
| processName | No | Process name, used only to apply the profiling exclusion list | |
| delaySeconds | No | Seconds to wait between before and after snapshots (default: 10) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden and it does disclose key behavior: two snapshots, delay, and return of IDs/paths. However, it does not discuss side effects, possible failures, blocking behavior, or whether the tool is purely read-only, leaving room for unanticipated runtime behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short, purposeful sentences. The action is front-loaded, the use case is given immediately after, and the required input plus return are stated clearly with no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers what the tool does, why to use it, an important input requirement, and what it returns. Since the schema already documents the remaining parameter details, this is sufficiently complete for a tool with these siblings, though it does not explain its relation to a single snapshot tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% for all 4 parameters, so the baseline is 3. The description adds value by clarifying that pid is effectively required despite being nullable/optional in the schema, and says 'with a delay between them' which aligns with delaySeconds and reinforces its role.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action: 'Takes two memory snapshots of a .NET process with a delay between them' and explicitly connects this to memory-leak detection. It is distinguishable from the sibling 'snapshot' tool by the two-snapshot nature, though it does not name alternatives directly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives clear context: detecting memory leaks by comparing before/after state, and it tells the agent that a pid must be provided. It does not explicitly mention when not to use this tool or name a sibling alternative, so exclusions are missing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_rulesA
Lists all active analysis rules with their ID, title, severity, and category. Rules can be configured via .memorylens.json in the project root.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It indicates read-only behavior and specifies the configuration file location, but lacks details on edge cases (e.g., empty list, error states).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description consists of two focused sentences, the first stating the tool's purpose and the second providing configuration context. Every sentence is essential and there is no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a parameterless list tool with no output schema, the description is comprehensive: it specifies the output fields and the source of rules. Minor improvement could be noting that the list reflects current active configuration.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Since there are zero parameters (baseline 4), the description adds value by explaining the output fields and the configuration file location, which is not evident from the empty input schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the verb 'Lists' and specifies the resource 'active analysis rules', clearly communicating the tool's function. It also mentions the output fields (ID, title, severity, category), making it distinct from sibling tools like list_processes or snapshot.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when one needs to see available analysis rules, but does not provide explicit guidance on when to use this tool versus alternatives or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_processesA
Lists running .NET processes suitable for memory profiling, discovered from their diagnostic IPC endpoints. Excludes IDE, tooling, and MCP server processes to prevent interference.
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Optional filter to match process name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden of behavioral disclosure. It discloses that the tool excludes certain process types and that discovery is via IPC endpoints, which is useful. However, it doesn't mention whether the operation is read-only, whether it requires elevated permissions, or what happens if no processes are found. The exclusions are a behavioral trait, but more context (e.g., performance implications, side effects) would be helpful.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no waste. The core purpose is front-loaded, and the exclusion detail is concise. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a list tool with one optional parameter and no output schema, the description is largely complete. It explains what is listed, how they are discovered, and what is excluded. The only minor gap is not describing the return format (e.g., whether it returns process names, IDs, or full details), but since there's no output schema, a brief note on return shape would improve completeness. Still, the description is adequate for an agent to call it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents the filter parameter. The description adds context about what the filter matches (process name) but doesn't add syntax or format details beyond the schema. Baseline 3 is appropriate since the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists running .NET processes suitable for memory profiling, discovered via diagnostic IPC endpoints. It also specifies exclusions (IDE, tooling, MCP server processes), which distinguishes it from generic process-listing tools and provides concrete scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use it (when you need to identify .NET processes for memory profiling) and what it excludes, but it does not explicitly mention alternatives or when not to use it. Sibling tools like snapshot, analyze, and compare_snapshots suggest a workflow, but the description doesn't route the agent to them or explain how list_processes fits into that workflow.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
snapshotA
Takes a memory snapshot of a running .NET process. Provide a pid. Returns a snapshot id to pass to analyze.
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | Process ID to snapshot | |
| command | No | Not implemented; a process id is required | |
| processName | No | Process name, used only to apply the profiling exclusion list | |
| durationSeconds | No | Seconds to wait before taking snapshot |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. It states what the tool does, that the target must be running, and what it returns, but it does not disclose side effects, required permissions, or behavior on invalid pids. This is adequate but not deeply transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short, focused sentences with no filler. The action, the required input, and the return value are each clearly stated and naturally ordered. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description says what the tool does, what input it truly requires, and what it returns next for usage. The non-pid parameters are already fully documented in the simple schema, and the usage is a running output is a next-step hint. It is enough for a simple snapshot/analyze workflow.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already gives 100% parameter coverage, so the baseline is 3. The description adds meaningful value by making clear that a pid must be provided, even though the pid schema field is marked nullable. This helps the agent avoid relying on the null default.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb action ('Takes a memory snapshot') and a specific subject ('a running .NET process'), and it explains that the result is 'a snapshot id to pass to analyze.' This clearly positions it against sibling tools like list_processes and compare_snapshots.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The usage context is clear: when a .NET process snapshot is needed, provide a pid and receive a snapshot id for later analysis. It doesn't explicitly name alternatives or exclusions, but the workflow and prerequisites are unambiguous enough for an agent to invoke correctly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v2.1.1- Changed
compare_snapshots2 fields changed- changed
Input schema / properties / command / descriptionPrevious value: -"Command to launch and snapshot"New value: +"Not implemented; a process id is required" - changed
Input schema / properties / processName / descriptionPrevious value: -"Process name to snapshot"New value: +"Process name, used only to apply the profiling exclusion list"
- Changed
snapshot2 fields changed- changed
Input schema / properties / command / descriptionPrevious value: -"Command to launch and snapshot"New value: +"Not implemented; a process id is required" - changed
Input schema / properties / processName / descriptionPrevious value: -"Process name to snapshot"New value: +"Process name, used only to apply the profiling exclusion list"
1 tool update
v2.0.0- Removed
ensure_dotmemory
6 tool updates
- First observed
analyze - First observed
compare_snapshots - First observed
ensure_dotmemory - First observed
get_rules - First observed
list_processes - First observed
snapshot
TDQS
Each tool targets a distinct phase of the profiling workflow (discovery, snapshot, comparison, analysis, rule listing), and descriptions are clear enough to avoid serious misselection. However, snapshot and compare_snapshots both involve taking snapshots; while not ambiguous in intent, they are closely related.
Most names follow a verb_snake_case pattern (list_processes, get_rules, compare_snapshots), but 'snapshot' and 'analyze' are single-word verbs rather than the verb_noun form. The naming is readable but not perfectly uniform across the set.
Five tools is well-scoped for a memory profiling MCP server. Each tool serves a necessary part of the primary workflow, and there is no bloat or redundancy.
The tool set covers the core workflow: find process, take snapshot, compare snapshots, analyze against rules, and list rules. Minor gaps like managing rules directly or inspecting snapshot raw details are missing, but the main user journeys are supported.
Maintenance
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
A MCP server built for developers enabling Git based project management with project and personal…
MCP server for Qwen Image 3 AI image generation
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that enables AI agents to debug .NET applications using netcoredbg. It supports core debugging tasks like setting breakpoints, stepping through code, and inspecting variables or stack traces.1MIT
- AlicenseAqualityBmaintenanceMCP server that lets AI agents (Claude, Cursor) debug your .NET / ASP.NET Core app2714MIT
- AlicenseAqualityDmaintenanceMCP server for profiling Java applications via JDK utilities (jcmd, jfr, jps). Enables AI assistants to diagnose performance, analyze threads, and inspect JFR recordings without manual CLI usage.266410MIT
- AlicenseAqualityCmaintenanceLive .NET runtime diagnostics for AI assistants. Ask Claude to diagnose memory leaks, GC pressure, LOH fragmentation, and thread starvation in any running .NET process — no code changes required.72MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/MarcelRoozekrans/memorylens-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server