Heap Analyzer MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Heap Analyzer MCP Serveranalyze the thread dump at /tmp/threads.txt"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Heap Analyzer MCP Server
This repository provides a Python-based MCP (Model Context Protocol) server that exposes tools for analyzing JVM thread dumps:
analyze_thread_dump: Parses a JVM thread dump text file and returns a summary of thread states and potential deadlocks.
compare_thread_dumps: Parses two JVM thread dump text files and returns a comparison of thread state counts and deadlocks.
Prerequisites
Python 3.9+
pip (Python package installer)
Related MCP server: heap-seance
Installation
Option 1: Clone and Build from Source (Recommended)
Clone the repository:
git clone https://github.com/rajendrag/jvm-heap-analyzer-mcp.git cd jvm-heap-analyzer-mcpCreate and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activateBuild the wheel:
pip install build python -m buildInstall the package:
pip install dist/heap_analyzer_mcp_server-0.1.0-py3-none-any.whl
Option 2: Development Installation
For development or if you want to modify the code:
git clone https://github.com/rajendrag/jvm-heap-analyzer-mcp.git
cd jvm-heap-analyzer-mcp
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .Usage with MCP Clients
After installation, the server can be used with any MCP-compatible client. The console script heap-analyzer-mcp-server will be available in your PATH.
Claude Desktop Configuration
Locate your Claude Desktop config directory:
macOS:
~/Library/Application Support/Claude/Windows:
%APPDATA%\Claude\
Create or edit the
claude_desktop_config.jsonfile:{ "mcpServers": { "heap-analyzer-mcp": { "command": "heap-analyzer-mcp-server", "args": [] } } }Restart Claude Desktop to load the new server configuration.
Generic MCP Client Configuration
For other MCP clients, use this configuration:
{
"name": "heap-analyzer-mcp",
"command": "heap-analyzer-mcp-server",
"args": [],
"env": {},
"timeout": 120000
}Alternative: Using Python Module Directly
If you prefer not to use the console script:
{
"name": "heap-analyzer-mcp",
"command": "python",
"args": ["-m", "heap_analyzer_mcp"],
"env": {}
}Testing the Server
You can test the server manually to ensure it's working:
# Test that the server starts without errors
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}' | heap-analyzer-mcp-server
# Test import functionality
python -c "from heap_analyzer_mcp.__main__ import main; print('✅ Server is working!')"Available Tools
1. analyze_thread_dump
Analyzes a single JVM thread dump file.
Parameters:
path(required): Path to the thread dump text filemax_threads(optional): Maximum number of threads to analyze (default: 5000)
Example usage in MCP client:
{
"path": "/path/to/thread_dump.txt",
"max_threads": 5000
}Example response:
{
"summary": "Analyzed 4 threads (limit 5000). States: RUNNABLE=2, WAITING=2",
"counts": {
"RUNNABLE": 2,
"WAITING": 2,
"BLOCKED": 0,
"TIMED_WAITING": 0,
"NEW": 0,
"TERMINATED": 0
},
"deadlocks": [
{
"threads": ["Thread-1", "Thread-2"],
"monitor": "java.lang.Object@12345"
}
]
}2. compare_thread_dumps
Compares two JVM thread dump files and shows the differences.
Parameters:
path_a(required): Path to the first thread dump filepath_b(required): Path to the second thread dump filemax_threads(optional): Maximum number of threads to analyze (default: 5000)diff_mode(optional): Level of detail in comparison (default: "full")"summary": Returns only summary and notes"states": Returns summary, counts, and deltas"full": Returns all fields including deadlock details
Example usage in MCP client:
{
"path_a": "/path/to/dump1.txt",
"path_b": "/path/to/dump2.txt",
"diff_mode": "full",
"max_threads": 5000
}Example response:
{
"summary": "State deltas: RUNNABLE=+1, WAITING=-1; Deadlocks present only in A",
"counts_a": {"RUNNABLE": 2, "WAITING": 2, "BLOCKED": 0, "TIMED_WAITING": 0, "NEW": 0, "TERMINATED": 0},
"counts_b": {"RUNNABLE": 3, "WAITING": 1, "BLOCKED": 0, "TIMED_WAITING": 0, "NEW": 0, "TERMINATED": 0},
"deltas": {"RUNNABLE": 1, "WAITING": -1, "BLOCKED": 0, "TIMED_WAITING": 0, "NEW": 0, "TERMINATED": 0},
"deadlocks_a": [{"threads": ["Thread-1", "Thread-2"], "monitor": "java.lang.Object@12345"}],
"deadlocks_b": [],
"notes": "Deadlocks present only in A"
}Sample Thread Dumps
The repository includes sample thread dumps in the tests/ directory that you can use for testing:
tests/sample_thread_dump.txttests/sample_thread_dump_2.txt
Development and Testing
Running Tests
Install test dependencies:
pip install -e .[test]Run tests:
pytest -q
Alternative Testing (without MCP dependencies)
If you can't install MCP dependencies in your environment:
PYTHONPATH=src python3 -m pytest -qThis uses the tools adapter to test functionality without requiring the full MCP runtime.
Project Structure
jvm-heap-analyzer-mcp/
├── src/heap_analyzer_mcp/
│ ├── __init__.py
│ ├── __main__.py # MCP server and tool implementations
│ ├── parser.py # Core thread dump parsing logic
│ └── tools_adapter.py # MCP tool behavior for testing
├── tests/ # Test files and sample thread dumps
├── pyproject.toml # Package configuration
└── README.md # This fileLimitations and Notes
File size limit: Thread dump files larger than 10MB are rejected for safety
File access: Files must be accessible by the server process (consider file permissions)
Thread limit: By default, analysis is limited to 5000 threads per dump
Communication: The server uses stdio for communication with MCP clients
Troubleshooting
Server Won't Start
Verify installation:
heap-analyzer-mcp-server --helpCheck Python environment:
which pythonandwhich heap-analyzer-mcp-serverTry running directly:
python -m heap_analyzer_mcp
Client Can't Connect
Ensure the server binary is in your PATH
Verify the client configuration file syntax
Check that the virtual environment is activated when starting the client
Look at client logs for specific error messages
Permission Issues
Ensure thread dump files are readable by the server process
On Windows, you may need to use full paths in the configuration
Import Errors
Verify all dependencies are installed:
pip list | grep mcpTry reinstalling:
pip uninstall heap-analyzer-mcp-server && pip install dist/heap_analyzer_mcp_server-0.1.0-py3-none-any.whl
Contributing
Fork the repository
Create a feature branch
Make your changes
Run tests:
pytestSubmit a pull request
License
This project is open source. Please check the repository for license details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables comprehensive analysis of Apache Spark event logs from S3, HTTP, or local sources, providing performance metrics, resource monitoring, shuffle analysis, and automated optimization recommendations with interactive HTML reports.MIT
- AlicenseCqualityCmaintenanceMCP server that provides 8 tools for Java memory leak investigation: \- Class histograms, GC pressure snapshots, JFR recordings, heap dumps, MAT leak suspects analysis, async-profiler allocation profiles \- Structured confidence-based verdicts (none/low/medium/high) requiring independent signal corroboration \- Designed for use inside Claude Code with two slash commands84Apache 2.0
- FlicenseBqualityDmaintenanceProvides tools to analyze test failures, cluster similar failures, and detect flaky tests from input or log files, helping QA teams debug and triage issues.3
- AlicenseNot gradedqualityDmaintenanceAnalyzes Gradle dependencies in Android projects, supporting Version Catalog, duplicate detection, module comparison, and dependency tree generation.MIT
Related MCP Connectors
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Compare two JSON files deeply, regardless of order. Get a detailed difference report highlighting…
Read your own DMARC aggregate and forensic reports: sources, alignment, alerts, CSV export.
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/rajendrag/jvm-heap-analyzer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server