mcp-jvm-diagnostics

mcp-jvm-diagnostics

Enables AI assistants to analyze JVM thread dumps and GC logs, detecting deadlocks, lock contention, and GC pressure, without requiring a JVM runtime.

Category
访问服务器

README

npm version License: MIT

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

<!-- TODO: replace placeholder Stripe Payment Link once STRIPE_SECRET_KEY is configured --> $9.00/monthGet Pro License

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

Installation

npx mcp-jvm-diagnostics

Or install globally:

npm install -g mcp-jvm-diagnostics

Configuration

Claude Desktop

Add to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "jvm-diagnostics": {
      "command": "npx",
      "args": ["-y", "mcp-jvm-diagnostics"]
    }
  }
}

No environment variables needed — this tool works on text input you provide.

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

Contributing

  1. Clone the repo
  2. npm install
  3. npm run build
  4. npm test

Limitations & Known Issues

  • Text input only: Thread dumps, GC logs, and heap histograms must be provided as text. The server cannot attach to a running JVM or capture data automatically.
  • Java 9+ GC logs: The GC log parser is optimized for unified logging format (-Xlog:gc*). Legacy -verbose:gc format (Java 8) has basic support but may miss some events.
  • Shenandoah GC: Limited support. G1, ZGC, Parallel, and Serial are fully supported.
  • Virtual threads (Java 21+): Thread dump parser handles virtual threads but analysis recommendations are tuned for platform threads.
  • Heap histo comparison: Requires standard jmap -histo or jcmd GC.class_histogram format. Custom formats or truncated output may not parse correctly.
  • Deadlock detection: Detects monitor-based deadlocks. ReentrantLock deadlocks may not be detected if lock addresses are not visible in the thread dump.
  • No historical analysis: Each analysis is a point-in-time snapshot. For trend analysis, compare multiple snapshots manually.
  • HotSpot/OpenJDK only: Parser targets HotSpot/OpenJDK thread dump format. GraalVM native-image or Eclipse OpenJ9 dumps may parse incompletely.
  • Classloader leak detection: Heap analysis flags growing ClassLoader instances but cannot definitively prove a leak without memory profiler data.

Part of the MCP Java Backend Suite

License

MIT


End-of-life: 2026-05-10.

This MCP server is no longer maintained or distributed. The Corporation has pivoted to Apify marketplace actors. See irrationalways on Apify and irrcorp/bzp-poland-tenders for current Corporation work.

The npm package has been unpublished. The repository is archived for historical reference only.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选