Labsco
Dmitriusan logo

MCP JVM Diagnostics

โ˜… 1

from Dmitriusan

JVM diagnostics MCP server for thread dump and GC log analysis. Detects deadlocks, lock contention, and GC pressure. Runs via npx on Node.js โ€” no JVM or Docker required.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

MCP JVM Diagnostics

A Model Context Protocol (MCP) server that gives AI assistants the ability to analyze JVM thread dumps and GC logs. It detects deadlocks, identifies lock contention hotspots, analyzes garbage collection pressure, and recommends JVM tuning parameters.

Why This Tool?

JVM diagnostic MCP servers exist (TDA, jfr-mcp, Arthas) โ€” but they're all Java-based, requiring a JVM runtime just to diagnose JVM problems. This tool runs on Node.js via npx โ€” no JVM, no Docker, no SSH.

It analyzes offline artifacts (thread dumps, GC logs, heap histograms) rather than requiring a running JVM. Paste a thread dump or GC log and get instant analysis.

Features

  • 6 MCP tools for comprehensive JVM diagnostics
  • Thread dump analysis โ€” deadlock detection, contention hotspots, thread state breakdown
  • GC log analysis โ€” pause statistics, heap trends, memory leak detection
  • Heap histogram analysis โ€” memory leak candidates, classloader leaks, finalization issues
  • JFR summary โ€” Java Flight Recorder file analysis
  • Unified diagnosis โ€” cross-correlates thread and GC data
  • Supports G1, ZGC, Parallel, Serial, and Shenandoah GC formats
  • No external dependencies โ€” works on local text input, no API keys needed

Pro Tier

Generate exportable diagnostic reports (HTML + PDF) with a Pro license key.

  • Full JVM thread dump analysis report with actionable recommendations
  • PDF export for sharing with your team
  • Priority support

$9.00/month โ€” Get Pro License

Pro license key activates the generate_report MCP tool in mcp-jvm-diagnostics.

Quick Demo

Try these prompts in Claude (paste your JVM output):

  1. "Analyze this thread dump: [paste jstack output]" โ€” Detects deadlocks, contention hotspots, and thread state breakdown
  2. "Analyze this GC log: [paste GC log]" โ€” Shows pause statistics, heap trends, and tuning recommendations
  3. "Compare these heap histograms to find memory leaks: BEFORE: [paste] AFTER: [paste]" โ€” Identifies growing classes, classloader leaks, and finalizer issues

Tools

analyze_thread_dump

Parse a JVM thread dump and analyze thread states, detect deadlocks, and identify lock contention.

Parameters:

  • thread_dump โ€” The full thread dump text (from jstack <pid>, kill -3, or VisualVM)

Example prompt: "Analyze this thread dump and tell me if there are any deadlocks"

analyze_gc_log

Parse a GC log and analyze garbage collection patterns, pause times, and memory pressure.

Parameters:

  • gc_log โ€” The GC log text (from -Xlog:gc* or -verbose:gc)

Example prompt: "Analyze this GC log and tell me if there are any performance issues"

analyze_heap_histo

Parse jmap -histo output and detect memory leak candidates, object creation hotspots, and classloader leaks.

Parameters:

  • histo โ€” The jmap -histo output text (from jmap -histo <pid> or jmap -histo:live <pid>)

Example prompt: "Analyze this heap histogram and tell me if there are any memory leak candidates"

diagnose_jvm

Unified JVM diagnosis combining thread dump and GC log analysis for comprehensive root cause analysis.

Parameters:

  • thread_dump (optional) โ€” Thread dump text
  • gc_log (optional) โ€” GC log text

Example prompt: "I have both a thread dump and GC log from the same time โ€” diagnose what's wrong"

compare_heap_histos

Compare two jmap -histo snapshots taken at different times to detect memory growth patterns and leak candidates.

Parameters:

  • before โ€” The first (earlier) jmap -histo output
  • after โ€” The second (later) jmap -histo output

Example prompt: "Compare these two heap histograms and tell me what's growing"

Detects:

  • Classes with growing instance/byte counts (leak candidates)
  • New classes that appeared between snapshots
  • Classes that disappeared (GC'd or unloaded)
  • Overall heap growth rate
  • Classloader leaks and finalizer queue growth

Collecting JVM Diagnostics

Thread Dump

# Using jstack
jstack <pid> > thread-dump.txt

# Using kill signal (Linux/Mac)
kill -3 <pid>

# Using jcmd
jcmd <pid> Thread.print > thread-dump.txt

GC Log

Add these JVM flags to your application:

# Java 9+ (unified logging)
-Xlog:gc*:file=gc.log:time,level,tags

# Java 8
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log

Part of the MCP Java Backend Suite