mcp-jvm-diagnostics 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/build/index.js +2 -2
- package/build/parsers/gc-log.js +16 -0
- package/build/parsers/jfr-summary.js +5 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A Model Context Protocol (MCP) server that gives AI assistants the ability to an
|
|
|
9
9
|
|
|
10
10
|
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.
|
|
11
11
|
|
|
12
|
-
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.
|
|
12
|
+
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.
|
|
13
13
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
@@ -160,6 +160,13 @@ Add these JVM flags to your application:
|
|
|
160
160
|
- **HotSpot/OpenJDK only**: Parser targets HotSpot/OpenJDK thread dump format. GraalVM native-image or Eclipse OpenJ9 dumps may parse incompletely.
|
|
161
161
|
- **Classloader leak detection**: Heap analysis flags growing ClassLoader instances but cannot definitively prove a leak without memory profiler data.
|
|
162
162
|
|
|
163
|
+
## Part of the MCP Java Backend Suite
|
|
164
|
+
|
|
165
|
+
- [mcp-db-analyzer](https://www.npmjs.com/package/mcp-db-analyzer) — PostgreSQL/MySQL/SQLite schema analysis
|
|
166
|
+
- [mcp-spring-boot-actuator](https://www.npmjs.com/package/mcp-spring-boot-actuator) — Spring Boot health, metrics, and bean analysis
|
|
167
|
+
- [mcp-redis-diagnostics](https://www.npmjs.com/package/mcp-redis-diagnostics) — Redis memory, slowlog, and client diagnostics
|
|
168
|
+
- [mcp-migration-advisor](https://www.npmjs.com/package/mcp-migration-advisor) — Flyway/Liquibase migration risk analysis
|
|
169
|
+
|
|
163
170
|
## License
|
|
164
171
|
|
|
165
172
|
MIT
|
package/build/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { compareHeapHistos } from "./analyzers/heap-diff.js";
|
|
|
12
12
|
import { parseJfrSummary } from "./parsers/jfr-summary.js";
|
|
13
13
|
// Handle --help
|
|
14
14
|
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
15
|
-
console.log(`mcp-jvm-diagnostics v0.1.
|
|
15
|
+
console.log(`mcp-jvm-diagnostics v0.1.4 — MCP server for JVM diagnostics
|
|
16
16
|
|
|
17
17
|
Usage:
|
|
18
18
|
mcp-jvm-diagnostics [options]
|
|
@@ -31,7 +31,7 @@ Tools provided:
|
|
|
31
31
|
}
|
|
32
32
|
const server = new McpServer({
|
|
33
33
|
name: "mcp-jvm-diagnostics",
|
|
34
|
-
version: "0.1.
|
|
34
|
+
version: "0.1.4",
|
|
35
35
|
});
|
|
36
36
|
// --- Tool: analyze_thread_dump ---
|
|
37
37
|
server.tool("analyze_thread_dump", "Parse a JVM thread dump (jstack output) and analyze thread states, detect deadlocks, identify lock contention hotspots, and find thread starvation patterns.", {
|
package/build/parsers/gc-log.js
CHANGED
|
@@ -14,6 +14,9 @@ const UNIFIED_CONCURRENT_RE = /\[(\d+[.,]\d+)s\].*?GC\(\d+\)\s+(Concurrent\s+\S+
|
|
|
14
14
|
const LEGACY_GC_RE = /\[(Full )?GC\s*\(([^)]+)\)\s+(\d+)K->(\d+)K\((\d+)K\),\s+(\d+[.,]\d+)\s+secs\]/;
|
|
15
15
|
// ZGC format: [0.123s][info][gc] GC(0) Garbage Collection (Warmup) 24M(1%)->8M(0%) 1.234ms
|
|
16
16
|
const ZGC_RE = /\[(\d+[.,]\d+)s\].*?GC\(\d+\)\s+Garbage Collection\s+\([^)]+\)\s+(\d+)M\(\d+%\)->(\d+)M\(\d+%\)\s+(\d+[.,]\d+)ms/;
|
|
17
|
+
// Shenandoah pause format: [0.521s][info][gc] GC(0) Pause Init Mark 2.606ms
|
|
18
|
+
// Pauses include: Pause Init Mark, Pause Final Mark, Pause Init Update Refs, Pause Final Update Refs, Pause Full
|
|
19
|
+
const SHENANDOAH_PAUSE_RE = /\[(\d+[.,]\d+)s\].*?GC\(\d+\)\s+(Pause\s+(?:Init|Final)\s+\S+(?:\s+\S+)?|Pause Full(?:\s+\([^)]*\))?)\s+(\d+[.,]\d+)ms/;
|
|
17
20
|
export function parseGcLog(text) {
|
|
18
21
|
const lines = text.replace(/\r\n/g, "\n").split("\n");
|
|
19
22
|
const events = [];
|
|
@@ -75,6 +78,19 @@ export function parseGcLog(text) {
|
|
|
75
78
|
});
|
|
76
79
|
continue;
|
|
77
80
|
}
|
|
81
|
+
// Try Shenandoah pause format (no heap sizes in pause events)
|
|
82
|
+
const shenandoahMatch = line.match(SHENANDOAH_PAUSE_RE);
|
|
83
|
+
if (shenandoahMatch) {
|
|
84
|
+
events.push({
|
|
85
|
+
timestamp: parseFloat(shenandoahMatch[1].replace(",", ".")),
|
|
86
|
+
type: shenandoahMatch[2].trim(),
|
|
87
|
+
pauseMs: parseFloat(shenandoahMatch[3].replace(",", ".")),
|
|
88
|
+
heapBeforeMb: 0,
|
|
89
|
+
heapAfterMb: 0,
|
|
90
|
+
heapTotalMb: 0,
|
|
91
|
+
});
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
78
94
|
// Try legacy format
|
|
79
95
|
const legacyMatch = line.match(LEGACY_GC_RE);
|
|
80
96
|
if (legacyMatch) {
|
|
@@ -110,6 +110,11 @@ function analyzeJfrEvents(events, totalEvents, totalSize) {
|
|
|
110
110
|
issues.push(`${monitorEnter.count.toLocaleString()} monitor enter events — significant lock contention.`);
|
|
111
111
|
recommendations.push("Use `analyze_thread_dump` to identify contention hotspots and consider lock-free alternatives.");
|
|
112
112
|
}
|
|
113
|
+
// Check for threads spending time in Object.wait() — indicates producer-consumer imbalance
|
|
114
|
+
if (monitorWait && monitorWait.count > 2000) {
|
|
115
|
+
issues.push(`${monitorWait.count.toLocaleString()} Object.wait() events — threads frequently waiting for notifications. Producers may be slower than consumers.`);
|
|
116
|
+
recommendations.push("Profile the producer side of producer-consumer queues. Consider bounded queues with backpressure or increasing producer thread count.");
|
|
117
|
+
}
|
|
113
118
|
// Check for thread starts (churn)
|
|
114
119
|
const threadStart = byName.get("jdk.ThreadStart");
|
|
115
120
|
if (threadStart && threadStart.count > 200) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-jvm-diagnostics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "MCP server for JVM diagnostics — analyze thread dumps, detect deadlocks, parse GC logs, and get JVM tuning recommendations",
|
|
5
|
+
"mcpName": "io.github.dmitriusan/mcp-jvm-diagnostics",
|
|
5
6
|
"author": "Dmytro Lisnichenko",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"main": "./build/index.js",
|