Skip to main content

JVMind MAT MCP Server

A local Model Context Protocol server for analyzing Java heap dumps with Eclipse MAT. It wraps the JVMind MAT query service and exposes 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

Directory listings (Smithery, mcp.so, Glama, PulseMCP) are prepared but not live yet; 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

  1. open_heapdump(path) — absolute path to a .hprof file. Indexing starts in the background and the call returns immediately with a report_id and status=PARSING. If MAT index files already exist next to the dump, the report is ready immediately.
  2. get_heapdump_status(report_id) — poll until status=DONE. Large dumps can take several minutes.
  3. Analyze:
    • mat_overview — always start here
    • mat_histogram, mat_dominator, mat_top_consumers
    • mat_threads, mat_threadlocals, mat_sql_in_threads
    • mat_object, mat_path2gc, mat_oql
    • mat_leak_suspects, mat_diagnose_oom, mat_connection_pools
  4. close_heapdump(report_id) — release the handle. Pass stop_service=true to 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).

Configuration

Variable Default Purpose
MAT_HOME auto-detect Eclipse MAT install directory
JVMIND_JAVA JAVA_HOME/bin/java or java JDK 21 binary
JVMIND_MAT_XMX 70% of RAM, min 4g Heap for MAT parsing and queries
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.
  • The MAT query service has no authentication; it is bound to 127.0.0.1 and 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.

Inspect logs — see ~/.local/state/jvmind-mcp/logs/ (parse-<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.1.1 .
docker run --rm -i \
  -v /opt/mat:/opt/mat:ro \
  -e MAT_HOME=/opt/mat \
  jvmind-mat-mcp:0.1.1

Publishing

v0.1.1 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.

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:

  1. Configure a PyPI Trusted Publisher for the pypi environment.
  2. Confirm the package name jvmind-mat-mcp and registry name io.github.kengrary/jvmind-mat.
  3. Bump the version in pyproject.toml, server.json, and src/jvmind_mat_mcp/__init__.py together.

Local checks:

python -m build
python -m twine check dist/*.whl dist/*.tar.gz
mcp-publisher validate

Marketplace packs (Smithery MCPB, mcp.so/Glama/PulseMCP copy) live in ../marketplace/README.md. The Smithery bundle is a uv-runtime MCPB pinned by uv.lock; build it 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.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jvmind-mat-mcp 0.1.1
File Size Uploaded Provenance Actions
jvmind_mat_mcp-0.1.1.tar.gz 180.8 kB With provenance Details for jvmind_mat_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jvmind-mat-mcp 0.1.1
File Interpreter ABI Platform Actions
jvmind_mat_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for jvmind_mat_mcp-0.1.1-py3-none-any.whl

Total release size: 357.5 kB

Release files / jvmind_mat_mcp-0.1.1.tar.gz

Download URL jvmind_mat_mcp-0.1.1.tar.gz
Size 180.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3a36f6c388c63d72439f9bf1066846818d3d155119ed50cfdb69c922bef28b14
BLAKE2b-256 checksum
How to use checksums
41b85f50d2df48f9ba1a77664f274f2119b14bb685b2aeba37e95905d78f8b1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 19, 2026.

Transparency log

Release files / jvmind_mat_mcp-0.1.1-py3-none-any.whl

Download URL jvmind_mat_mcp-0.1.1-py3-none-any.whl
Size 176.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5faa6a0e24394b1f16624b36065515a0b04b212314ac135bf11bf8f4e34c52f6
BLAKE2b-256 checksum
How to use checksums
29e249084b4be0b183899cd307846974c9dfbedbefebec300b02c921773c3119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 19, 2026.

Transparency log

Security for jvmind-mat-mcp 0.1.1

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.

Select from 2 files

Attestation for jvmind_mat_mcp-0.1.1.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 19, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page