JVMind MAT MCP Server
A local Model Context Protocol server for analyzing Java heap dumps with Eclipse MAT. It can discover local Java processes, capture a live heap dump, and expose heap overview, histograms, dominator trees, threads, OQL, leak suspects, and OOM diagnosis to MCP clients such as Claude Desktop, Cursor, and VS Code.
Everything runs on your machine. Heap dumps never leave the host; the helper
service binds to 127.0.0.1 only.
Published
- PyPI: https://pypi.org/project/jvmind-mat-mcp/ (v0.2.0)
- Official MCP Registry:
io.github.kengrary/jvmind-mat - MCPRush: https://mcprush.com/kengrary/jvmind-mat-heap-dump-analyzer-mcp
- Install:
uvx jvmind-mat-mcp doctor
Directory listings (mcp.so, Glama, PulseMCP) are prepared but not live yet.
Smithery is skipped because its current web UI has no local MCPB flow; see
../marketplace/README.md.
Requirements
- Python 3.10+
- JDK 21+
- Eclipse MAT 1.17.x (the server installs its small query bundle into MAT on first use; MAT itself is not bundled)
Download MAT from https://eclipse.dev/mat/downloads.php and unpack it, for
example to /opt/mat.
Install
uvx jvmind-mat-mcp doctor
or with pip:
pip install jvmind-mat-mcp
jvmind-mat-mcp doctor
doctor validates MAT, JDK, permissions, and the state directory.
If MAT is not in a common location, set MAT_HOME:
export MAT_HOME=/opt/mat
Client configuration
Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json):
{
"mcpServers": {
"jvmind-mat": {
"command": "uvx",
"args": ["jvmind-mat-mcp"],
"env": {
"MAT_HOME": "/opt/mat",
"JVMIND_MAT_XMX": "8g"
}
}
}
}
VS Code (.vscode/mcp.json):
{
"servers": {
"jvmind-mat": {
"type": "stdio",
"command": "uvx",
"args": ["jvmind-mat-mcp"],
"env": {
"MAT_HOME": "/opt/mat",
"JVMIND_MAT_XMX": "8g"
}
}
}
}
Restart the client after changing the configuration.
Usage
Live JVM
list_java_processes()— discover local, attachable JVMs. The managed MAT helper is excluded and secrets in command lines are masked.dump_java_heap(pid)— first call withoutconfirm=truereturns a preview (target, output directory, estimated/free disk, timeout). Call again withconfirm=trueto capture.get_heapdump_status(report_id)— the dump runs in the background withstatus=DUMPING; MAT parsing starts automatically and the status becomesPARSING, thenDONE.- Analyze with the
mat_*tools.
A live dump uses jmap -dump:live, so it triggers a Full GC and may pause the
target JVM. The default output directory is the server's current working
directory; override it with output_dir or JVMIND_MCP_DUMP_DIR.
Existing heap dump
open_heapdump(path)— absolute path to a.hproffile. Indexing starts in the background and the call returns immediately with areport_idandstatus=PARSING. If MAT index files already exist next to the dump, the report is ready immediately.get_heapdump_status(report_id)— poll untilstatus=DONE. Large dumps can take several minutes.- Analyze:
mat_overview— always start heremat_histogram,mat_dominator,mat_top_consumersmat_threads,mat_threadlocals,mat_sql_in_threadsmat_object,mat_path2gc,mat_oqlmat_leak_suspects,mat_diagnose_oom,mat_connection_pools
close_heapdump(report_id)— release the handle. Passstop_service=trueto also stop the MAT helper process.
Tools accept an object id in decimal or 0x-prefixed hex. Values shown as
retained may be approximate (MAT's dominator-tree lower bound).
Tools
All analysis tools take the report_id returned by open_heapdump.
open_heapdump— open a local.hprof, start background indexing, return areport_idget_heapdump_status— poll parse status, progress, and phaselist_heapdumps— list heap dumps known to this MCP serverclose_heapdump— release a heap dump handle and optionally stop the MAT helperlist_java_processes— discover local attachable JVMs (pid, main class, command; MAT helper excluded)dump_java_heap— preview and capture a live heap dump, then start MAT parsing (confirm=true)mat_overview— heap overview: used/committed/live heap, object/class/classloader counts, JDK versionmat_histogram— class histogram sorted by shallow, retained, or object countmat_dominator— dominator tree of the largest retained objects, with parent drill-downmat_threads— list threads or drill into stack frames and frame localsmat_threadlocals— inspect ThreadLocal values grouped by value class or threadmat_object— inspect a single object's fields, statics, references, and GC rootmat_path2gc— shortest path from an object to a GC rootmat_oql— run an OQL query and return rows plus a reusable result set idmat_leak_suspects— run LeakHunter and return suspects with retained sizes and descriptionsmat_diagnose_oom— composite OOM diagnosis: leak suspects + SQL in threads + dominator analysismat_connection_pools— diagnose database connection pools and leaked connectionsmat_top_consumers— top memory consumers by retained heapmat_sql_in_threads— find SQL statements in thread stacks
Configuration
| Variable | Default | Purpose |
|---|---|---|
MAT_HOME |
auto-detect | Eclipse MAT install directory |
JVMIND_JAVA |
JAVA_HOME/bin/java or java |
JDK 21 binary |
JVMIND_JCMD |
sibling of JVMIND_JAVA |
jcmd used for process discovery and heap estimates |
JVMIND_JPS |
sibling of JVMIND_JAVA |
jps fallback for process discovery |
JVMIND_JMAP |
sibling of JVMIND_JAVA |
jmap used for live heap dumps |
JVMIND_MAT_XMX |
70% of RAM, min 4g | Heap for MAT parsing and queries |
JVMIND_MCP_DUMP_DIR |
current working directory | Default output directory for live dumps |
JVMIND_DUMP_TIMEOUT |
300 |
Live dump timeout (seconds) |
JVMIND_DUMP_MIN_FREE_GB |
2 |
Minimum free disk space before a dump |
MAT_QUERY_SERVICE_URL |
managed locally | Use an already-running query service |
MAT_QUERY_PORT |
8090 |
Preferred local port (falls back to a free port) |
MAT_QUERY_CACHE |
true |
Cache heavy query results on disk |
JVMIND_MCP_STATE_DIR |
platform state dir | State, logs, parsed report registry |
JVMIND_MCP_HTTP_TIMEOUT |
60 |
Per-request timeout (seconds) |
JVMIND_MCP_POLL_INTERVAL |
2 |
Async task poll interval (seconds) |
JVMIND_MCP_POLL_MAX_SECS |
900 |
Async task timeout (seconds) |
State and logs live in ~/.local/state/jvmind-mcp on Linux (see
jvmind-mat-mcp doctor for the exact path).
Privacy and security
- The MCP server and MAT helper communicate over loopback only.
- No telemetry, no uploads, no cloud calls.
- OQL can read arbitrary strings from the heap. Treat query output as sensitive.
list_java_processesreturns command lines; values that look like passwords, tokens, or credentials are masked, but review output before sharing it.- Heap dumps and MAT index files contain sensitive heap data. Use a private
output directory (the default is the server's current working directory).
The
.hprofis chmod 0600; MAT writes index files with its own permissions, so directory permissions matter. - The MAT query service has no authentication; it is bound to
127.0.0.1and must not be exposed to a network.
Troubleshooting
MAT not found — set MAT_HOME to the directory containing plugins/ and
configuration/. On macOS this is often
/Applications/mat.app/Contents/Eclipse.
Wrong MAT version — this release requires MAT 1.17.x. Upgrade MAT or install a matching release of this package.
Permission denied writing to MAT — the server must copy one small jar into
$MAT_HOME/plugins and update
configuration/org.eclipse.equinox.simpleconfigurator/bundles.info. Install MAT
in a user-writable directory or grant write access.
Parsing runs out of memory — increase JVMIND_MAT_XMX (for example 16g)
or analyze a smaller dump.
Port already in use — the server reuses a JVMind query service if it finds
one, otherwise picks a free port. Set MAT_QUERY_PORT to a preferred port.
No Java processes found — confirm the same user owns the MCP server and the
target JVM, that jcmd/jps come from the JDK 21 install, and that the target
is in the same PID namespace (containers only see their own processes).
Attach failed / socket file error — the target may run with
-XX:+DisableAttachMechanism or under another user. Start it without that flag
and run the MCP server as the same user. Java 8 targets are supported on a
best-effort basis.
Not enough disk space — set JVMIND_MCP_DUMP_DIR to a larger filesystem or
raise JVMIND_DUMP_MIN_FREE_GB. MAT also writes index files next to the dump.
Dump stays DUMPING — large heaps can take a long time. Increase
JVMIND_DUMP_TIMEOUT; the target JVM may be paused for a Full GC.
Inspect logs — see ~/.local/state/jvmind-mcp/logs/ (parse-<id>.log,
dump-<id>.log, and mat-service.log) or run jvmind-mat-mcp doctor.
Development
cd mcp-server
python -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest -q
.venv/bin/ruff check src tests
.venv/bin/ruff format --check src tests
The wheel ships src/jvmind_mat_mcp/vendor/com.jvmind.mat.query-<version>.jar.
After changing the Java query service, rebuild and vendor it:
mcp-server/scripts/vendor-bundle.sh
Integration test:
MAT_HOME=/opt/mat \
JVMIND_MCP_IT_HPROF=/path/to/app.hprof \
.venv/bin/pytest -q -m integration
Docker (directory/CI checks; MAT and JDK 21 are not included):
docker build -t jvmind-mat-mcp:0.2.0 .
docker run --rm -i \
-v /opt/mat:/opt/mat:ro \
-e MAT_HOME=/opt/mat \
jvmind-mat-mcp:0.2.0
Publishing
v0.2.0 is published to PyPI and the official MCP Registry. Release tags use
the mcp-v<version> form. The GitHub workflow builds the wheel, publishes to
PyPI with Trusted Publishing, then publishes server.json to the official MCP
Registry with GitHub OIDC.
Manual prerequisites:
- Configure a PyPI Trusted Publisher for the
pypienvironment. - Confirm the package name
jvmind-mat-mcpand registry nameio.github.kengrary/jvmind-mat. - Bump the version in
pyproject.toml,server.json, andsrc/jvmind_mat_mcp/__init__.pytogether.
Local checks:
python -m build
python -m twine check dist/*.whl dist/*.tar.gz
mcp-publisher validate
Marketplace packs (mcp.so/Glama/PulseMCP copy) live in
../marketplace/README.md. The Smithery MCPB is kept
for a future retry (its local publishing flow is currently unavailable); it runs
the Python package via uv and is pinned by uv.lock. Build both bundles with:
mcp-server/scripts/build-mcpb.sh
License
The MCP server is licensed under the MIT License; see LICENSE. Eclipse MAT is licensed under the Eclipse Public License 2.0 and is not redistributed by this package.
Metadata
Release files for jvmind-mat-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jvmind_mat_mcp-0.2.0.tar.gz | 192.0 kB | With provenance | Details for jvmind_mat_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jvmind_mat_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for jvmind_mat_mcp-0.2.0-py3-none-any.whl |
Total release size: 377.1 kB
Release files / jvmind_mat_mcp-0.2.0.tar.gz
| Download URL | jvmind_mat_mcp-0.2.0.tar.gz |
|---|---|
| Size | 192.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35bc213ad2bd3651ca906cb26cb5503f4f53a9b35c1d4ddbc7a5797a675d4f2c
|
|
BLAKE2b-256 checksum How to use checksums |
9be3a31a7e21750f6a9c19b1c55a45a0663c253b949fc88c52c411eddedaeda0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / jvmind_mat_mcp-0.2.0-py3-none-any.whl
| Download URL | jvmind_mat_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 185.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7037b82574e4a6e0552b5d11ec7fba9c2bc6c05cc41aa13c1fe5daca9755a995
|
|
BLAKE2b-256 checksum How to use checksums |
8abcaae22341e4b2cfc70e7652237a1c5b095fcaf74821246dc656813f0f999f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for jvmind-mat-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jvmind_mat_mcp-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.